Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Phendrena

Spawn Key When Killing Actor

Recommended Posts

Hello!!

I'm sure I've read somewhere how to do this, however poking around here and there hasn't helped me find it.... anyway....

When I kill an actor, TID 27 in this case, I would like to spawn a yellow key card. Is anyone able to help me as I can't work out how to do it. Source port is ZDoom (D-in-H format).

Thanks,

Dave

Share this post


Link to post

Place a mapspot where you want to spawn the yellow key card. Give it a TID, eg: 100

Then attach this script to the actor. The script will be executed when the actor is killed.

script 100 (void)
{
delay (15);
// Thing_Spawn (mapspottid, type, angle, new tid)
Thing_Spawn ( 100, T_YELLOWKEYCARD, 0, 0);
}

Example

Share this post


Link to post
Kappes Buur said:

Place a mapspot where you want to spawn the yellow key card. Give it a TID, eg: 100

Then attach this script to the actor. The script will be executed when the actor is killed.

script 100 (void)
{
delay (15);
// Thing_Spawn (mapspottid, type, angle, new tid)
Thing_Spawn ( 100, T_YELLOWKEYCARD, 0, 0);
}

Example


You can do the same thing without a script as well: click the monster, select Action and set it to action 135(Thing Spawn). Then set the Thing ID of the Map Spot and what thing you want to spawn.

Share this post


Link to post

I was hoping to have the key 'dropped' by the actor. Am I best to create a custom actor that spawns the key upon death??

Share this post


Link to post

You can do that or you can use the Spawn ACS function.

Give the monster that you want to drop the key on death a tid (in your case, that would be 27), "Attach" special #80 (ACS_Execute) to it. Set the script number and the first argument. The first argument should be the same as the tid you give to the monster, which, again, in your case is 27.

Here is the script to execute:

Script 1 (int tid)
{
  Spawn("YellowCard", GetActorX(tid), GetActorY(tid), GetActorZ(tid));
}

Share this post


Link to post

As Obsidian pointed out, you don't need to make it a script. You can use a Thing_Spawn special instead.

Share this post


Link to post

To elaborate on what Gez said, even to have it spawn where the monster falls, you can give the monster a ThingID (say 100) and then attach ThingSpawn to it with a MapSpot Tag equal to the monster's ThingID (in this case 100 again).

Admittedly the delay looks a lot better, because with this method the key teleports in (fog and all) before the monster has even hit the ground.

Share this post


Link to post

Thanks for the replies.
I've done it, as suggested, without using ACS and assigning the actor with Thing Spawn (Silent). This works very nicely.

Thank you all,

Dave

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×