Jump to content

How can I track the specific monster that activated a script?


Rorix

Recommended Posts

I am making a map which involves floating platforms, and a cloud of cacodemons, all of which must be killed in order to progress.        

              

The issue that I am having is that the cacos sometimes bunch up under the platforms, making it very tedious to kill them.        

         

My solution was to have the cacos teleport elsewhere if they go underneath a platform. However, I realized that I have no way to tell the game to teleport only the caco that activated the script. I'm sure that there must be some way to do this, but I haven't been able to find out how.

Share this post


Link to post

if the issue is that cacodemons are bunching up UNDERNEATH a platform, then simply using a "Cacodemon-only" teleport line will have the unintended effect of teleporting them even if they're ABOVE the platform.

 

My suggestion, if it's feasible - have your script check the actor's Z-value when determining whether to trigger the teleport or not. For example, I made a script to keep track of where the player was in a map and have it displayed in the automap (like how Doom 3 keeps track of where you are in a level). The problem I was running into was in a level with multi-story buildings built with 3D floors; the regular line trigger would activate regardless of which floor the player was on, and I couldn't substitute in "actor touches floor" thing triggers since those don't work with 3D floors. My solution was to implement a check via "GetActorZ" to look at the player's height when crossing the line - if their height was above the 3D floor's floor height, then it would give their location as the upper room, and if not, then it would give it as the lower room.

 

Spoiler

image.png

 

patting my past self on the back rn for bothering to write these code comments

 

I hope this helps!

Edited by SMG_Man

Share this post


Link to post
48 minutes ago, SMG_Man said:

I couldn't substitute in "actor touches floor" thing triggers since those don't work with 3D floors

They do work, you just have to put the sector action thing in the control sector of the 3D floor.

Share this post


Link to post
26 minutes ago, Aurelius said:

They do work, you just have to put the sector action thing in the control sector of the 3D floor.

 

I distinctly remember having trouble with this, but in trying again you're 100% correct and it's working perfectly. What the fuck was I doing in the past???

Share this post


Link to post

The issue that I'm having is when I use thing_move to teleport whichever cacodemon activated the script, I have no way of identifying the specific monster that activated it. The cacos all have the same TID.

Share this post


Link to post

 

14 minutes ago, jaeden said:

Activator of script is usually accessed by using TID 0.

 

Gave it a try. Unfortunately, it doesn't work. The script is below, if anyone can see any problems.

 

script 14 (void)

{
    if(getactorz(0) > -256 & getactorz(0) < -128)
    {
        thing_move(0, 2, 1);
    }
}

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...