(Unresolved/WIP) ACS Monster Teleporting system

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Psychojack88
Posts: 53
Joined: Sat May 07, 2022 10:12 pm
Graphics Processor: nVidia (Modern GZDoom)

(Unresolved/WIP) ACS Monster Teleporting system

Post by Psychojack88 »

I'm currently working on a teleporting system for a companion mod that I am working on. So far I was able to get the companion to teleport occasionally but it's inconsistent, where sometimes the companion teleports when too close or when way too far. Its progress but clearly needs tweaking.

It also seems to work also during combat, which I would like to avoid since they teleport to me in the middle of combat, sometimes hitting me with a friendly fire lol. Right now this is my current code for ACS.

Thing_ChangeTID(0, 1);
//Thing_ChangeTID(compSpawn, 1)

// Companion has TID 1 — you must set this in the DECORATE/ZScript definition or with Thing_ChangeTID
int companionTID = 1; // Give it a usable TID


//script 538 OPEN // put inside a script block

while (TRUE)
{
int playerX = GetActorX(0);
int playerY = GetActorY(0);
int playerZ = GetActorZ(0);

int compX = GetActorX(1);
int compY = GetActorY(1);

int deltaX = compX - playerX;
int deltaY = compY - playerY;

int distance = sqrt(deltaX * deltaX + deltaY * deltaY);

if (distance > 1000)

{SetActorPosition(1, playerX, playerY + 15, GetActorFloorZ(0), FALSE);
SetActorAngle(1, GetActorAngle(0));
}
delay(200); //NOTE this is 57 seconds. Too long and doesn't trigger properly when lowered. Especially during combat.
}
}

Any help would be very much appreciated.
Last edited by Psychojack88 on Fri Oct 24, 2025 11:04 am, edited 1 time in total.
lucillegross2
Posts: 1
Joined: Wed Oct 22, 2025 10:25 pm
Operating System Version (Optional): Window
Graphics Processor: nVidia (Modern GZDoom)
Location: Alaska

Re: (Resolved) ACS Monster Teleporting system

Post by lucillegross2 »

This teleport system sounds awesome, even if it’s a bit buggy right now. The random teleports and friendly fire made me laugh classic mod chaos. Once you fix the combat issue and timing, it’s gonna feel way smoother.
Psychojack88
Posts: 53
Joined: Sat May 07, 2022 10:12 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: (Resolved) ACS Monster Teleporting system

Post by Psychojack88 »

Yeah lol, since this post, I actually tried a different method to make the teleport system using NienerWiener's template via ZScript. I still have the ACS in case if I better understand it later down the line.

I can always repurpose it to use it to script enemy teleport events maybe on specific levels or sectors. It does the trick well enough for surprise enemies, just watch your back, there's always a back attack incoming 😆.

Return to “Scripting”