Jump to content
  • 0

Map spot spawned monster triggers another mapspot spawned monster


Cacodoomonic

Question

I'm having a bit of trouble with this... I have a map spot marked TID 60. I also have another map spot marked TID 61. I have an ACS script that is triggered in the map causing the map spot 60 to spawn in a zombieman also set to be tagged as 60. I need to make it so that killing this monster (now tagged 60 in place of the map spot it started out as) triggers ANOTHER script that turns map spot 61 into a zombieman also tagged 61. I have all the scripts written up but I'm not entirely sure how to get it to work, since killing the zombieman tagged 60 does not seem to activate the other script, even when tagged to do so. The reason is because I can assign a script action to the MAPSPOT tagged 60, but when it becomes the zombieman the script is removed as it is technically not the same "thing". Help?

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 0

You do not "turn the map spot into" a thing. The map spot always stays. So after spawning a thing at that spot you'll have to use SetThingSpecial on the newly spawned thing.

Share this post


Link to post
  • 0

Yes, that's an odd misconception.

 

The wiki examples for spawning things at map spots even show repeated use:

https://zdoom.org/wiki/SpawnSpot

 

That should make it clear that spots aren't getting transmogrified.

 

 

Share this post


Link to post
  • 0
Posted (edited)

In addition to what others have said, I suspect that if you're running scripts using a tag as a parameter, you don't want your map spots and zombiemen to share the same tags - not if you want the script to be doing different things with the spot and the parameter. Give them different, unique tags.

Edited by Stabbey

Share this post


Link to post
  • 0
Posted (edited)
8 hours ago, boris said:

You do not "turn the map spot into" a thing. The map spot always stays. So after spawning a thing at that spot you'll have to use SetThingSpecial on the newly spawned thing.

I actually never realized this. I always initially just believed that the "map spot" was transformed into that which the script tells it too. I'm going to look into the SetThingSpecial method then.

 

Can someone explain how I would do this though? I mean when reading this Wiki Page it doesn't show me exactly what I would need to do to make this work.

 

So for example:

 //monster to kill to trigger other monster spawn
Script 1 (void)
{
 SpawnSpotFacingForced ("Zombieman", 10, 10);
}

then

//monster spawned from killing previous monster
Script 2 (void)
{
 SpawnSpotFacingForced ("Zombieman", 11, 11);
}

What do I need to do to change for Script 1 to make this work? If I add: 

Script 1 
{
  SpawnSpotFacingForced ("Zombieman", 10, 10);
  SetThingSpecial (????????)
}

What do I do from here? The wiki does not explain exactly what I should do here, I'm not even sure if I'm using this technique correctly.

Edited by Cacodoomonic

Share this post


Link to post
  • 0
Posted (edited)

https://zdoom.org/wiki/SpawnSpotFacingForced

The third argument is the id that the newly spawned monster will have.  Just change that number to an id that is not used like 11.  Then you'd have SetThingSpecial use 11 as the tid.  You can use the UDB editor to look at the thing specials and get the number that way if you want, in this case the special you want is probably 139 (https://zdoom.org/w/index.php?title=Thing_SpawnFacing).

 

Edited by necros

Share this post


Link to post
  • 0
Posted (edited)
22 hours ago, necros said:

https://zdoom.org/wiki/SpawnSpotFacingForced

The third argument is the id that the newly spawned monster will have.  Just change that number to an id that is not used like 11.  Then you'd have SetThingSpecial use 11 as the tid.  You can use the UDB editor to look at the thing specials and get the number that way if you want, in this case the special you want is probably 139 (https://zdoom.org/w/index.php?title=Thing_SpawnFacing).

 

I might be just stupid I'm still not sure I understand this. My issue is, once the MapSpot spawns the monster, I need killing that monster to activate another script. How do I make the newly spawned monster have that script tied to it since I cannot assign that script to the monster in UDB because it spawns due to an in game script. How do I make the monster I have spawned via a script have a script assigned to it in its action settings? When a new monster is spawned it has no special actions assigned to it. I need it to have a script assigned to it so that when it is killed it activates the next script. 

 

I have the newly spawned monster now set to TID 11, but how do I tell thing 11 to now have SetLineSpecial (activate next script upon death)?  After I SetLineSpecial, it says I can assign Arguments 1, 2, 3 and 4 but that doesn't help me. I need it to activate a specific script I have written up.

 

The wiki page give an example of how to use this but it's not explained and doesn't clarify anything. It simply says "This script will give all with the tid of 1 the special ACS_ExecuteAlways to tally a score when killed."

 

Then shows an example that is not explained in anyway. How can I make killing my newly spawned monster (spawned via ACS script to a MAPSPOT) activate ANOTHER script upon being killed? Like something like this:

 

SetThingSpecial (11, Script_Execute, 22)

for example. Something like that. So it knows to excecute "script 22" upon TID 11's death. But of course this doesn't work, its just a made up example. I need something like this that works.

 

THIS is what I have so far and it doesn't work whatsoever. It doesn't even boot up.

 

//Spawn a zombieman that upon death spawns the zombieman with the blue key.
Script 35 (void)
{
	SpawnSpotFacingForced ("Zombieman", 60, 61);
	delay (1);
	SetThingSpecial (61, 139[,55]);
}

//Zombieman spawns in with the blue key.
Script 31 (void)
{
	SpawnSpotFacingForced("Zombieman", 55, 55);
}

//Zombieman drops blue key on death
Script 32 (void)
{
    DropItem (55, "BlueCard");
}

Can someone please just point out what the error is here. Why won't it work? How do I make it work?

 

EDIT:

 

Okay I got thsi working for the most part like this:

 

SetThingSpecial (61, ACS_ExecuteAlways, 31);

But now I have a different issue in the same series of events. The zombieman that spawns WILL NOT drop the blue key. Why not? What is wrong with this?

Edited by Cacodoomonic

Share this post


Link to post
  • 0
Posted (edited)
4 hours ago, Cacodoomonic said:

I have the newly spawned monster now set to TID 11, but how do I tell thing 11 to now have SetLineSpecial (activate next script upon death)? 

 

You don't, because SetLineSpecial sets specials on a Line. It's right there in the name. Spawned enemies are Things. You want to use SetThingSpecial.

 

To have a monster execute a script when it's killed, give it a tag, the action 80: Execute Script with the script number as the parameter, and the script will execute once the monster is killed. If you want it to only execute after all enemies with that tag are killed, I think you have to check for the ThingCount of that tag so it executes once that's zero. I don't remember that syntax offhand. EDIT: This should help:

 

script 12 (void) {
    if(ThingCount(T_NONE,34)==0) { // 34 is the tag you assign to the enemies.
        //Code to do your script action goes here
    }
}

 

Edited by Stabbey
added example

Share this post


Link to post
  • 0

Here, this should work. I played around and tested things, and looked up things until I got it to work.

script 4 (void) {
	SpawnSpotFacingForced("ZombieMan", 55, 56); // Give different T_ID's so that the map spot doesn't spawn another key
	SetThingSpecial(56,80,5); // On thing with TID 56, run the action 80: Script Execute on Script 5 
} // end script 4

script 5 (void) {
	Delay(15); // delay so it doesn't try to spawn inside a solid monster object
	Thing_SpawnNoFog(56, T_BLUEKEYCARD, 0, 0); // Spawn at location of TID 56, the blue key, with angle of 0 and assign a TID of 0 (N/A) to the spawned thing 
}

 

Share this post


Link to post
  • 0
2 hours ago, Stabbey said:

Here, this should work. I played around and tested things, and looked up things until I got it to work.


script 4 (void) {
	SpawnSpotFacingForced("ZombieMan", 55, 56); // Give different T_ID's so that the map spot doesn't spawn another key
	SetThingSpecial(56,80,5); // On thing with TID 56, run the action 80: Script Execute on Script 5 
} // end script 4

script 5 (void) {
	Delay(15); // delay so it doesn't try to spawn inside a solid monster object
	Thing_SpawnNoFog(56, T_BLUEKEYCARD, 0, 0); // Spawn at location of TID 56, the blue key, with angle of 0 and assign a TID of 0 (N/A) to the spawned thing 
}

 

You deserve to be credited for all your help, seriously. I'll add a special thanks in my game files credits to you and everyone else who has helped me on this site for all of this. Thank you so much. 

 

This entire script works beautiful, except only one detail. The keys still do not spawn once thing 56 is killed. I can only assume this is something to do with my custom blue key. I have labelled my custom blue key in my file as this:

 

ACTOR SpecialBlueKey : Key 1414
{
//$Category Keys
//$Title Special Blue Key
//$Sprite KEYSA0
  Inventory.PickupMessage "$GOTABLKEY"
  Inventory.Icon "INKEYS0"
  Scale 0.3
  Radius 8
  Height 8
    +wallsprite
  States
  {
  Spawn:
    SBKY AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_SetAngle(angle+3.0,SPF_INTERPOLATE)
    SBKY B 3 Bright A_SetAngle(angle+3.0,SPF_INTERPOLATE)
	SBKY A 3 A_SetAngle(angle+3.0,SPF_INTERPOLATE)
	SBKY B 3 Bright A_SetAngle(angle+3.0,SPF_INTERPOLATE)
    Loop
  }
}

In the games script it's written up like this:

//Zombieman spawns in with the Blue Key
Script 31 (void)
{
	SpawnSpotFacingForced("Zombieman", 55, 56);
	SetThingSpecial(56,80,32);
}

//Zombieman with key drops key.
Script 32 (void)
{
	delay(15);
	Thing_SpawnNoFog(56,"SpecialBlueKey",0,0);
}

 

I am assuming something is wrong with this which is why it isn't working. Everything else now works perfectly. I think the custom blue key is the issue here.

Share this post


Link to post
  • 0

T_BLUEKEYCARD is the official doom one, so that label isn't going to work for the custom one. You could try using "1414" instead and see if that works. I looked up this thread which may be of some small help.

Share this post


Link to post
  • 0
Posted (edited)
14 minutes ago, Stabbey said:

T_BLUEKEYCARD is the official doom one, so that label isn't going to work for the custom one. You could try using "1414" instead and see if that works. I looked up this thread which may be of some small help.

I just tried the 1414 method but for some reason still nothing. As a test, to see if the key was the issue, I added a line to the script to make the custom key spawn all over the map where mapspots marked 36 are. And it worked. So, as a last resort I added this:

 

Script 32 (void)
{
	delay(15);
	//Thing_SpawnNoFog(56,"SpecialBlueKey",0,0);
	SpawnSpotFacingForced("SpecialBlueKey", 56,0);
}

I didn't expect this to work, as the corpse of the zombieman isn't a "mapspot"... but it works. Should this be okay? Is this efficient would you say or will it cause later issues? It seems to do the trick so far.

Edited by Cacodoomonic

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
Answer this question...

×   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...