Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Sign in to follow this  
zzzornbringer

how to get thingcountname to work?

Question

this should be very easy but it just doesn't work. it always returns 0 no matter what.

 

here's the script:

 

script 89 (void) //intro - pickup shotgun
{
SpawnSpot ("TeleportFog", 89);
delay(10);
spawnspotfacingforced("DoomImp",89,90);
plat_downwaitupstaylip(17,32,-1,16);



while(thingcountname("DoomImp",90) > 0)
{
delay(30);
//print(d:thingcountname("DoomImp",90));
plat_downwaitupstaylip(20,32,-1,0);
}
}

this script spawns imps on mapspot 89. the imps get a newtid 90. the while loop is supposed to count these imps. when they're all killed, when they're 0, a plat (tag 20) should lower. what am i doing wrong?

 

edit: i have isolated the problem. it's smooth doom. i don't know exactly what is causing this, but if i launch the map with smooth doom, the doomimp identifier does not work. i have tested with revenants which work fine. running the map without smooth doom will count the imps no problem.

Edited by zzzornbringer

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 0
4 hours ago, zzzornbringer said:

this should be very easy but it just doesn't work. it always returns 0 no matter what.

 

what am i doing wrong?

 

edit: i have isolated the problem. it's smooth doom.

 

Because SmoothDoom is doing this:

  • ACTOR SmoothDoomImp : DoomImp Replaces DoomImp

 

https://zdoom.org/wiki/DECORATE tells all.  :-)

Share this post


Link to post
  • 0
4 hours ago, zzzornbringer said:

edit: i have isolated the problem. it's smooth doom.

 

Welcome to the wonderful world of pairing GZDoom scripts with mods! It's amazing how quickly compatibility breaks.

 

My hunch would be Smooth Doom has replaced DoomImp with a differently named actor. If you load SmoothDoom, point at an Imp, bring down the console and type "Info" it will tell you what the new monster is.

 

Edit: Damn, ninjad by Kappes while I was trying to remember the "Info" command!

Share this post


Link to post
  • 0
2 hours ago, Kappes Buur said:

 

Because SmoothDoom is doing this:

  • ACTOR SmoothDoomImp : DoomImp Replaces DoomImp

 

https://zdoom.org/wiki/DECORATE tells all.  :-)

 

little bit off-topic but is this even necessary? couldn't you just use the regular actor "doomimp" if your new actor replaces it anyways? i mean, the actor will inherit the original values anyways?!

Share this post


Link to post
  • 0

Sorry to refresh that topic, but I've got a similar problem like zzzornbringer which fits in here. 

 

Scenario: 

You walk over a linedef that triggers 10 lost souls to spawn around you. Quite easy so far, just use the famous "135" linedef action for the easy way.

Now I want them to be killed (condition) to lower a barrier so you could reach the exit. I tried a different way and don't know why the new thing ID seems not to be working in a script. I wanted to combine the linedef action with a plain 80-execute script and that's probably the trouble. Those lost souls should get a new thing ID (172) after they arrived at their teleport destination (171). The third script already includes the new thing ID 172 and I thought it should do the trick then, because all lost souls are physically there with that damn number. I even named them in the script specifically, but no.....nothing happens.

 

What is the conflict here?? (Using GZDB BF3045 / UDMF by the way)

 

damn.png.86c5710ec3b8c667a2b74afc95493f36.png

Share this post


Link to post
  • 0

how do you execute script 3? i don't see where you trigger it. 

 

i'd do it like this: instead of the spawn thing action, use action 80 to execute your script. add the spawn function to that script. i use personally use spawnspotforcedfacing. however if you use this function, you need to spawn the teleporter fog separately. or just use spawn_thing. it's basically the same.

 

i also recommend using thingcountname. it's easier for me, because i don't have to remember the exact name definitions. you can use the names that are used in the editor. for example: "doomimp" instead of T_IMP. easier to remember imho. but that's just a suggestion. both functions work identical.

 

i'd also add a print function: print (d:thingcount(T_LOSTSOUL, 172));

 

so you can see that it actually counts correctly. that's just for testing obviously.

Share this post


Link to post
  • 0
1 hour ago, zzzornbringer said:

how do you execute script 3? i don't see where you trigger it. 

 

Yeah, that's exactly the weird part. Usually, it's simple. You give an enemy the action trigger 80 and the corresponding script number. When it dies, sth. happens. The script itself wasn't compiled with errors and also works when I place lost souls directly with teir tags. It apparently doesn't work with a teleport destination that spawns lost souls with a TID that isn't on the map (yet). I didn't know how to set a trigger on something that doesn't exist yet. I desperately gave the teleport destination the trigger function but that was foolish either. I guess I have to do it your way then and script the whole thing like you did above or try something else. 

 

Edit:

 

Yep, it works... finally. I "stole" your script and adjusted it a little bit. It all could be so easy if you knew it. 

Scripting might kill me one day, LoL

 

 

damnscript.png.19847ed2475a591759591030f137cca6.png

 

 Thanks !!!!

 

 

Edited by 4everDoomed

Share this post


Link to post
  • 0

You don't need to set a trigger on them at all. Use a script to spawn the monsters at a given mapspot, and then in that same script, enter a loop that checks for when those monsters are all dead. Once dead, do something. One script does it all.

 

Script 3 (void)

{

  Thing_SpawnFacing(666, T_LOSTSOUL, FALSE, 172);  // Spawn lost souls with TID 172 at each mapspot with TID 666.

  While (Thing_Count(T_LOSTSOUL, 172)) Delay(1);  // If the number of lost souls with TID 172 is non-zero, delay for a tic.

  Plat_DownWaitUpStay(300, 3, 0); // Do the plat thing.

}

 

Also, you should use mapspots, not teleport destinations, and using the "Facing" version of a special/function will allow your lost souls to spawn facing the directions of your mapspots (in case you want them to surround the player, facing inwards).

Edited by EarthQuake

Share this post


Link to post
  • 0
1 hour ago, 4everDoomed said:

 

I didn't know how to set a trigger on something that doesn't exist yet.

 

 

 

i think this may come in handy:

https://zdoom.org/wiki/Thing_SetSpecial

 

but the way you did it already also does the job and is actually easier imho. but if you often use scripts to spawn things, this function may be useful to you.

Share this post


Link to post
  • 0

Thanks again ! 

I tried it on a test.wad that I created for my "experimental needs" :-)))

Just a slight mistake though, it has to be written "ThingCount" instead of Thing_Count but that could also depend on different Doombuilders or whatever...

Nevertheless, it works and I'll switch over to mapspots in the future like you recommended. 

 

2 hours ago, EarthQuake said:

You don't need to set a trigger on them at all. Use a script to spawn the monsters at a given mapspot, and then in that same script, enter a loop that checks for when those monsters are all dead. Once dead, do something. One script does it all.

 


Script 3 (void)

{

  Thing_SpawnFacing(666, T_LOSTSOUL, FALSE, 172);  // Spawn lost souls with TID 172 at each mapspot with TID 666.

  While (Thing_Count(T_LOSTSOUL, 172)) Delay(1);  // If the number of lost souls with TID 172 is non-zero, delay for a tic.

  Plat_DownWaitUpStay(300, 3, 0); // Do the plat thing.

}

 

Also, you should use mapspots, not teleport destinations, and using the "Facing" version of a special/function will allow your lost souls to spawn facing the directions of your mapspots (in case you want them to surround the player, facing inwards).

_______

 

2 hours ago, zzzornbringer said:

 

i think this may come in handy:

https://zdoom.org/wiki/Thing_SetSpecial

 

but the way you did it already also does the job and is actually easier imho. but if you often use scripts to spawn things, this function may be useful to you.

 

 

I'll try that one out, too.

Thanks for all your suggestions, it helped a lot and was better than what I tried. 

 

Share this post


Link to post
  • 0
19 minutes ago, 4everDoomed said:

Just a slight mistake though, it has to be written "ThingCount" instead of Thing_Count but that could also depend on different Doombuilders or whatever...

 

Ahh, sorry, my mistake. Too many function and special names that all look like each other. :)

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
Sign in to follow this  
×