cyber-menace Posted July 18, 2003 I was wondering if by using Zdoom is there any way to have a script activate after the player kills 50 enemies, 100, etc? Or would I have to do something like tag every monster with say 1 and tell the script to wait until all those are killed. If anyone knows how please either post an example script or make an example wad. I don't have much of a clue how I would do this so I need an example of some kind. 0 Share this post Link to post
XDelusion Posted July 18, 2003 I am only familiar with Fraggle Script for Legacy, and only partially for that matter, but I am pretty sure you should be able to write a script that waits for the last IMP or what ever to be killed to perform a certain action. 0 Share this post Link to post
Graf Zahl Posted July 18, 2003 Or would I have to do something like tag every monster with say 1 and tell the script to wait until all those are killed. If anyone knows how please either post an example script or make an example wad. I don't have much of a clue how I would do this so I need an example of some kind. Not necessarily. You can use the thingcount() function to count all the live monsters of the types that are present in your map. Unless there are no Arch-Viles and Pain Elementals which create new monsters this is probably the easiest way. Otherwise you have to be a little more careful. Here's a small example: // wait for all imps to die while (thingcount(T_IMP,0)>0) { delay(10); } // do your stuff here Remember, you have to check all monster types you are interested in! 0 Share this post Link to post
cyber-menace Posted July 18, 2003 So if I were to use multiple thingcounts in the same script it would wait until all of them are finished to activate the last bit correct? 0 Share this post Link to post
Ichor Posted July 18, 2003 You could either give every monster a tid number and do it that way, or if you're spawning enemies, you could give them a tid number as they spawn (not exactly sure how to do that in ZDoom). 0 Share this post Link to post
NiGHTMARE Posted July 18, 2003 If you can do it in Hexen, then it should be same in ZDoom. 0 Share this post Link to post
Ichor Posted July 18, 2003 Actually, you can't spawn enemies with tids in Hexen (they always spawn with no tid), but you can with ZDoom. I don't know the exact command though. 0 Share this post Link to post
cyber-menace Posted July 18, 2003 The Thingcount script doesn't work. I have two imps. I tried both < and > but one did the script right off the bat and the other didn't do anything. is the 0 beside the T_IMP supposed to refer to the number < is comparing the other 0 to? I need to figure this out in order to proceed in my level. 0 Share this post Link to post
Epyo Posted July 18, 2003 Ichor said:Actually, you can't spawn enemies with tids in Hexen (they always spawn with no tid), but you can with ZDoom. I don't know the exact command though. THING_SPAWN(mapspot's tid, what, direction, with a tid of); Heh, I hope I don't have "direction" and "with a tid of" switched up :) cyber-menace said:I was wondering if by using Zdoom is there any way to have a script activate after the player kills 50 enemies, 100, etc? Or would I have to do something like tag every monster with say 1 and tell the script to wait until all those are killed. If anyone knows how please either post an example script or make an example wad. I don't have much of a clue how I would do this so I need an example of some kind. Alright well how about thisscript 1 OPEN { int whee; whee = Thingcount(0, 222); // all monsters should have tid of 222 ACS_EXECUTE(2, 0, 0, 0, 0); } script 2 (void) { int woo; woo = thingcount(0, 222); whee - woo = kills; if (kills => 50)// if there's 50 kills then do the following: { //put your stuff here; terminate; } delay(1); restart; } 0 Share this post Link to post
Cyb Posted July 18, 2003 I don't believe there's a function that returns the number of monsters killed (though there might be, there's one to return almost everything else) but what you can do is something like this: #define TOTAL 200 //200 monsters total script 100 (void) { int x = thingcount(T_IMP, 0) + thingcount(T_CACODEMON, 0) + thingcount(T_BARON, 0) + thingcount(T_DEMON, 0); while(x) { if(x < TOTAL / 8) //25 left acs_execute(1, 0); else if(x < TOTAL / 4) //50 left acs_execute(2, 0); else if(x < TOTAL / 2) //100 left acs_execute(3, 0); delay(1); restart; } that's sort of similar to what I did in helm's deep with the waves of monsters, only instead of counting the entire population of monsters (btw you'll need a thingcount for every specific monster on the map) it counted populations of monsters with a certain tid and preformed an action after a certain amount was dead. this is a bit more involving, but not quite as complex. the #define TOTAL by the way is the total number of monsters on the map which I put that was so you don't have to change a million constants in the script every time you add or remove a monster. oh and epyo you can make script 2 into:script 2 (void) { if (whee - thingcount(0, 222) => 50)// if there's 50 kills then do the following: { //put your stuff here; terminate; } delay(1); restart; } and also wee - whoo = kills is incorrect, it needs to be kills = wee - whoo, since wee - whoo = kills is assigning the value kills to the variable wee - whoo which isn't a variable but a statement... unless acs allows that but I don't think it does keeping with the editing heh, spawnspot and spawn work in the hexen game mode of zdoom (not vanilla hexen of course) 0 Share this post Link to post
cyber-menace Posted July 18, 2003 Ok NOW I'm REALLY getting annoyed! Here's what I have so far: script 9 OPEN { imps = Thingcount (T_IMP, 600); ACS_Execute (10, 0, 0, 0); } script 10 (void) { dimps = Thingcount (T_IMP, 600); kills = imps - dimps; if (kills => 2); { ChangeCamera (3, 1, 0); Delay (1*35); Door_Open (3, 20); print (s:"Objective Complete!"); Delay (2*35); ChangeCamera (0, 1, 0); print (s:"Proceed to Security Room for info."); terminate; } } But whenever I try to compile it it gets as far as if (kills => 2); and then it says either "=> invalid statement" or "=> missing )" If I add the } I get the Invalied statement! WHAT IS GOING ON HERE?! I NEED TO KNOW SOON PLEASE?! 0 Share this post Link to post
Graf Zahl Posted July 18, 2003 cyber-menace said:Ok NOW I'm REALLY getting annoyed! Here's what I have so far: script 9 OPEN { imps = Thingcount (T_IMP, 600); ACS_Execute (10, 0, 0, 0); } script 10 (void) { dimps = Thingcount (T_IMP, 600); kills = imps - dimps; if (kills => 2); { ChangeCamera (3, 1, 0); Delay (1*35); Door_Open (3, 20); print (s:"Objective Complete!"); Delay (2*35); ChangeCamera (0, 1, 0); print (s:"Proceed to Security Room for info."); terminate; } } But whenever I try to compile it it gets as far as if (kills => 2); and then it says either "=> invalid statement" or "=> missing )" If I add the } I get the Invalied statement! WHAT IS GOING ON HERE?! I NEED TO KNOW SOON PLEASE?! I don't know how strict the syntax check of ACC is but you should at least remove the semicolon behind the 'if' statement. Even if the compiler takes it this will produce incorrect code. 0 Share this post Link to post
cyber-menace Posted July 18, 2003 Bah I've tried nearly everything I can think of on that id statement! And ACC still won't except the = symbol. I can't think of anything to do with the script I put above. How can I fix this? 0 Share this post Link to post
Epyo Posted July 18, 2003 Cyb said:and also wee - whoo = kills is incorrect, it needs to be kills = wee - whoo Oops I had it backwords then heh. Cyber-menace said:scripts and stuff Yeah, what Graf Zahl said, and have you tried (kills > 1)? Also I think maybe you forgot to put } delay(1); restart; } at the bottom there? instead of just } } But that won't make a difference in the error checker thing. Just your level. Fix! 0 Share this post Link to post
cyber-menace Posted July 18, 2003 I did all that but it still doesn't work. If I change < to > it works, but it happens before anything else. Wouldn't imps - dimps always equal zero. I mean if there are two imp it would be 2 - 2 = 0 and 1 - 1 = 0 and 0 - 0 = 0 right? There must be something wrong with the kills varible kills = imps - dimps is what I have. Wait a minute... is my Thingcount (T_IMP, 600); even correct? Maybe I need the Imp number or 0 or something can anyone find out what's wrong. 0 Share this post Link to post
cyber-menace Posted July 18, 2003 YES! I AM INVINCIBLE! Ahem........... I got it working!script 9 OPEN { imps = Thingcount (5, 600); ACS_Execute (10, 0, 0, 0); } script 10 (void) { dimps = Thingcount (5, 600); kills = imps - dimps; if (kills>1) { Delay (2*35); ChangeCamera (3, 1, 0); Delay (1*35); Door_Open (3, 20); print (s:"Objective Complete!"); Delay (2*35); ChangeCamera (0, 1, 0); print (s:"Proceed to Security Room for info."); terminate; } delay (1); restart; } I need to put dimps in script 10 so when script 10 restarted it would read the number of imps again! I then understood how kills could be greater than 1 because imps "2" would stay the same while dimps "?" would change as the script restarted after an imp was killed. THAT was quite difficult and after nearly a whole day's worth of trial and error I got it working! Thank you very much for your help. Using a lot of Epyo's script and his last suggestion and a little bit from Cyb I got it working. That was a tough one. Later! 0 Share this post Link to post
Graf Zahl Posted July 19, 2003 Just a few programming tips for the future. ACS uses a very C-like syntax. This means the following: An equality comparison is not '=' but '=='. '=' is only an assignment. '=>' is not a valid operator. It has to be '>='! It seems this was the cause of most of your problems. 0 Share this post Link to post
cyber-menace Posted July 19, 2003 Maybe I should have asked my friend Cody about that one... he knows a few things about programming and he might have known what was wrong. I guess being a programmer really pays off when it comes to DOOM scripting eh? 0 Share this post Link to post