Attaching Map marker to another actor

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Attaching Map marker to another actor

Postby neoworm » Sat Nov 14, 2020 7:38 am

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?
User avatar
neoworm
 
Joined: 23 Sep 2005
Location: Czech Republic

Re: Attaching Map marker to another actor

Postby Gez » Sat Nov 14, 2020 9:33 am

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.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Attaching Map marker to another actor

Postby neoworm » Sat Nov 14, 2020 11:34 am

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.
User avatar
neoworm
 
Joined: 23 Sep 2005
Location: Czech Republic

Re: Attaching Map marker to another actor

Postby neoworm » Mon Nov 16, 2020 12:17 pm

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.
User avatar
neoworm
 
Joined: 23 Sep 2005
Location: Czech Republic

Re: Attaching Map marker to another actor

Postby Gez » Mon Nov 16, 2020 3:09 pm

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.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Attaching Map marker to another actor

Postby neoworm » Mon Nov 16, 2020 3:52 pm

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.
User avatar
neoworm
 
Joined: 23 Sep 2005
Location: Czech Republic


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests