Monster Events problem I have. Help?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
TheSoldiersShadow
Posts: 35
Joined: Wed Apr 06, 2016 4:29 pm
Location: Canada

Monster Events problem I have. Help?

Post by TheSoldiersShadow »

So i'm making a wad right now, and I would like to know how I can make a script execute for killing 6 cyberdemons. Now, this question has already been answered many times already. IDTag Cyberdemons, do some ACS and so on. But here's the problem: The cyberdemons only spawn when I pick up a megasphere, so how im I suppose to Tag them if they're not even spawned in?

Image
Image

If any of you would know an ACS code for this, please let me know what to put. I'm not very good with ACS. Thank you all!

P.S. This is the ACS I have for the wad, just in case it would help solve this in any way. (Tags 8 and 9 are used for something else)

Code: Select all

#include "zcommon.acs"

script 1 (void)
{
    Thing_SpawnFacing(4, 114, 0, 999);
    
    Thing_SpawnFacing(5, 114, 0, 999);
    
    Thing_SpawnFacing(6, 114, 0, 999);
    
    Thing_SpawnFacing(7, 114, 0, 999);
    
    Thing_SpawnFacing(10, 114, 0, 999);
    
    Thing_SpawnFacing(11, 114, 0, 999);
}
User avatar
Chl
Posts: 219
Joined: Sat Dec 05, 2015 2:18 pm

Re: Monster Events problem I have. Help?

Post by Chl »

Use [wiki]Spawn[/wiki] instead. That lets you assign a tid.
User avatar
TheSoldiersShadow
Posts: 35
Joined: Wed Apr 06, 2016 4:29 pm
Location: Canada

Re: Monster Events problem I have. Help?

Post by TheSoldiersShadow »

Chl wrote:Use [wiki]Spawn[/wiki] instead. That lets you assign a tid.
So do I have to replace my whole ACS? If so, what do I do?

I'm sorry, but I am NOT intelligent when it comes to ACS.
User avatar
KeksDose
 
 
Posts: 596
Joined: Thu Jul 05, 2007 6:13 pm
Location: my laboratory
Contact:

Re: Monster Events problem I have. Help?

Post by KeksDose »

They have tid 999 as soon as they are spawned. Before that, you should not try to count them. Thing_SpawnFacing works just as you thought it would, no need to replace anything.

Just start the counting when they are spawned instead of using an open-script. You can keep your script 1 the way it is and just append this:

Code: Select all

while(ThingCount(T_CYBERDEMON, 999) > 0)
     Delay(const:30);

// Now do something when the cyberdemons are dead.   
User avatar
TheSoldiersShadow
Posts: 35
Joined: Wed Apr 06, 2016 4:29 pm
Location: Canada

Re: Monster Events problem I have. Help?

Post by TheSoldiersShadow »

KeksDose wrote:They have tid 999 as soon as they are spawned. Before that, you should not try to count them. Thing_SpawnFacing works just as you thought it would, no need to replace anything.

Just start the counting when they are spawned instead of using an open-script. You can keep your script 1 the way it is and just append this:

Code: Select all

while(ThingCount(T_CYBERDEMON, 999) > 0)
     Delay(const:30);

// Now do something when the cyberdemons are dead.     
So if I wanted to make Doomguy teleport to a MapSpot, would I use TeleportDest, or something else? What would be the code for it? The wiki pages are quite hard to understand for me.

Thank you for replying, btw. I really do appreciate it.
User avatar
KeksDose
 
 
Posts: 596
Joined: Thu Jul 05, 2007 6:13 pm
Location: my laboratory
Contact:

Re: Monster Events problem I have. Help?

Post by KeksDose »

You should use a TeleportDest. While MapSpot seems to work with teleport specials, it is actually unintended behaviour and has broken old maps before. Not sure about the details here, but using TeleportDest is the absolute safest bet!

You want to teleport when the Cyberdemons are killed, right? Picking up the Mega Sphere should make the player the activator. Then you can append the counting-loop and finally use [wiki=Teleport]Teleport[/wiki]. Like so:

Code: Select all

script 1 (void)
{
    // Here goes the stuff you had before already.
    ...
    // Then the counting:

    while(ThingCount(T_CYBERDEMON, 999) > 0)
        Delay(const:30);
    Teleport(50, 0, 0);
} 
The script will teleport you to a destination of tid 50.
User avatar
TheSoldiersShadow
Posts: 35
Joined: Wed Apr 06, 2016 4:29 pm
Location: Canada

Re: Monster Events problem I have. Help?

Post by TheSoldiersShadow »

KeksDose wrote:You should use a TeleportDest. While MapSpot seems to work with teleport specials, it is actually unintended behaviour and has broken old maps before. Not sure about the details here, but using TeleportDest is the absolute safest bet!

You want to teleport when the Cyberdemons are killed, right? Picking up the Mega Sphere should make the player the activator. Then you can append the counting-loop and finally use [wiki=Teleport]Teleport[/wiki]. Like so:

Code: Select all

script 1 (void)
{
    // Here goes the stuff you had before already.
    ...
    // Then the counting:

    while(ThingCount(T_CYBERDEMON, 999) > 0)
        Delay(const:30);
    Teleport(50, 0, 0);
}
The script will teleport you to a destination of tid 50.
Everything works! :D Thank you for the help! I really do appreciate it!
Locked

Return to “Editing (Archive)”