HenKonen Posted October 10, 2017 Hi yall, I've come back to modding after a 5 year break and have found that I've lost most of what I learned way back. Anyhoo I'm trying to make this script sequence where endless amounts of lost souls are being continuosly spawned in a big outdoor map until the player kills a set amount of them. The problem is that the souls keep killing each other and ending the sequence on their own. There must be a way to work around this? Id like the counter to only tick down when the player (or another set tID) activates the script, i.e. kills the lost souls. The script in question: int lostsoulstokill = 30 script 67 (void) // script that spawns endless lost souls { spawn("lostsoul",(65536*random(-2368,4096)),(65536*random(-4544,2496)),(65536*random(24,300)),80); SetThingSpecial(80,80,68); // spawned souls activate script 68 on death delay(5); restart; } script 68 (void) // kill a lost soul { if (lostsoulstokill==0) { ACS_Terminate(67,0); Thing_Damage(80,1000); hudmessage (s:" ";HUDMSG_plain,10,CR_tan,0.5,0.23,0); } delay(1); lostsoulstokill--; SetFont("bigfont"); hudmessage (i:lostsoulstokill;HUDMSG_plain,10,CR_tan,0.5,0.23,0); } 0 Quote Share this post Link to post
scifista42 Posted October 10, 2017 if(PlayerNumber()!=-1) { // Activator is a player } else { // Activator is not a player } https://zdoom.org/wiki/PlayerNumber 0 Quote Share this post Link to post
HenKonen Posted October 10, 2017 (edited) Cheers mate! That did the trick. Usually the problems I come up with seem to be fairly simple if you know what you're doing but I don't know what to search for in ZDoom Wiki. Edited October 10, 2017 by Herska 0 Quote Share this post Link to post
HenKonen Posted October 10, 2017 On a sort of related subject: is there a way to check whether a thing was succesfully spawned OR count the number of things with a specific tID on a map? Earlier I tried to make a similar serial spawner script where things would spawn at a specific point at the map but as the spawn point would be occupied all the required monsters couldn't spawn. I was trying to make a script where exactly 10 cacodemons would spawn (and would need to be killed for a script to trigger). I'd need to make the script "try again" if the spawn would be unsuccesful or loop until 10 things with the set tID would come to existence. 0 Quote Share this post Link to post
Graf Zahl Posted October 10, 2017 The ACS Spawn... functions return the number of spawned actors, so if this is 0, nothing got spawned. Of course you can count most of what you need with the ThingCount... family of functions. 0 Quote Share this post Link to post
therektafire Posted October 10, 2017 It would be cool if you could work with actor pointers directly in more ACS functions instead of simply working at the TID level, like if spawn() returned both the number of spawned actors and an actor */thing * or array of actor * for each thing spawned, or make a "getActorsInTID" function that returns a list of pointers for all things with a particular TID Yeah it wouldn't really be useful for a lot of people but as someone who likes lower level programming (but isn't particularly great at it yet lol) it would be cool to have that option imo. Just a thought i had the other day and I figured now would be the perfect time to bring it up :) 0 Quote Share this post Link to post
Graf Zahl Posted October 11, 2017 Since you can call down to ZScript from ACS I don't really see much of a point to implement such a thing now. 0 Quote Share this post Link to post
therektafire Posted October 11, 2017 What is the difference between Zscript and acs? Do you have any good Zscript tutorials? 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.