Thing activates script

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
Scarekrowe
Posts: 30
Joined: Fri Mar 19, 2004 2:02 pm
Location: Kansas/Oklahoma
Contact:

Thing activates script

Post by Scarekrowe »

Is there any way to make it so when a spawned thing dies, it activates a script?
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Yes. When you spawn it, give it a TID. As the next line of your script, use Thing_SetSpecial to assign a special to the object with that TID.

Like so:

Code: Select all

Thing_Spawn(100, T_CYBERDEMON, 190, 666); // Mapspot TID, Thing Type, Angle, New TID
Thing_SetSpecial(666, ACS_Execute, 60, 0, 4); // TID, Special, Arg1 (Script#), Arg2 (Map#), Arg3(Arg1)
When this snippet of code is executed, it will spawn a Cyberdemon at the mapspot with a TID of 100, and gives that Cyberdemon a TID of 666. The next line uses that TID to assign it a special action. After it dies, it will execute script 60 of the current map, passing along 4 as the first argument to that script.
User avatar
Scarekrowe
Posts: 30
Joined: Fri Mar 19, 2004 2:02 pm
Location: Kansas/Oklahoma
Contact:

Post by Scarekrowe »

Thanks.
Locked

Return to “Editing (Archive)”