Page 1 of 1

Attaching Map marker to another actor

PostPosted: Sat Nov 14, 2020 7:38 am
by neoworm
Losing track of unopened locked chests can be tedious (as I experienced in Faithless mapset) so I would like to add a Map markers to locked chests. Since I want the chests to be pushable I would like the map marker to follow the chest, appear only after you see the chest (see the sector the chest is in) and dissapear when the chest is unlocked and opened.

I tried A_SpawnItemEx to spawn the Marker with a children/master relationship, use A_warp to teleport at the chest location once per second and remove children call to remove it when chest is opened. Problem is that the Marker is visible from the begining, it doesn't follow the chest at all and doesn't dissapear after the chest is opened. My guess is that I can't set the pointers right or A_warp doesn't work on Map Markers.

Would there be anybody capable of helping me?

Re: Attaching Map marker to another actor

PostPosted: Sat Nov 14, 2020 9:33 am
by Gez
From the wiki, it seems you don't need to bother with A_Warp:
If the first argument is non-zero, the map marker will follow the thing with the same TID as specified.


To get the marker to not be shown at firsts, use the second argument:
If the second argument is 1, then the map marker will not show up until the player has seen the sector it resides in.

Then when the chest is opened, it should Activate its associated marker to hide it back.

Re: Attaching Map marker to another actor

PostPosted: Sat Nov 14, 2020 11:34 am
by neoworm
I would like to be able to just drop in the chest actor into map without need to setting up another actor and TIDs. That's why I tried to do it with A_Warp.

Re: Attaching Map marker to another actor

PostPosted: Mon Nov 16, 2020 12:17 pm
by neoworm
I made Zscript that will assign new tid to the chest and spawn appropriate map marker with correctly set arguments and It seems to work. But now I can't use any scripts that would need a tid set on the chest. Even if I made the script check if there is already tid set for the chest and use that instead of new unique one, there is chance that multiple items can have the same tid, can't they?
I would be glad if there was a way to just pick a MapMarker sprite for any actor as an innate actor property.

Re: Attaching Map marker to another actor

PostPosted: Mon Nov 16, 2020 3:09 pm
by Gez
You could use ActorIterator to count if there are other actors that use the same TID.


The actual drawing logic is in void DAutomap::drawAuthorMarkers () in am_map.cpp, it's fully hardcoded and cannot be overridden by ZScript.

Re: Attaching Map marker to another actor

PostPosted: Mon Nov 16, 2020 3:52 pm
by neoworm
Could that be a feature request for further version?
I still have some problem that the map marker doesn't show the proper sprite I want it to.