Ouchface
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > ANOTHER scripting question
 
Author
All times are GMT. The time now is 16:34. Post New Thread    Post A Reply
DooMBoy
Heh
(but Stupidity still cannot be concealed)


Posts: 8509
Registered: 12-00


I have another question. I'm doing my version of E2M8, and when all the enemies are dead, I want a CyberDemon to appear. How would I do this? Thanks.

__________________
Heh

Old Post 12-31-02 19:06 #
DooMBoy is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Ichor
The Mysterious Red Square


Posts: 6937
Registered: 07-02


Let's see if this works:

Let's say you're going to have Cacodemons, Lost Souls, Demons, Spectres, and a Baron of Hell or two on this map. Then you might do something like this:

code:
script 8 open { if((thingcount(3, 0) == 0) && (thingcount(8, 0)== 0) && (thingcount(9, 0) == 0) && (thingcount(19, 0) == 0) && (thingcount(110, 0) ==)) { Thing_Spawn(114, 53, 128); } else { delay(1); restart; } }

__________________
0.666 - The number of the Millibeast

Old Post 12-31-02 19:18 #
Ichor is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Enjay
ASK ME ABOUT FOOTBALL / STEAM / DEAD CELEBRITIES / THE BLAIR WITCH PROJECT


Posts: 6382
Registered: 12-00


Ichor, I think by looking at your script you are counting all the different enemies by type seperately. thingcount can be used to count items with specified tids intead of counting items by type. So, if you give every enemy on the level the same tid, you could just use one instance of thingcount, and specify the tid to be counted as the second arg

thingcount(0, tid)

__________________
Meek

Old Post 12-31-02 19:58 #
Enjay is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Epyo
Dude


Posts: 2959
Registered: 06-02


Let's see if I can simplify that...Epyo style!
code:
script 3 OPEN { int hello; hello = thingcount(0, 222); if(hello == 0) { Thing_Spawn (/*mapspot's tid/*, T_CYBERDEMON, /*angle/*, /*cyberdemon's tid/*); Terminate; } Delay(35); restart; }

Should work...Replace the words commented with whatever they should be. Leave T_CYBERDEMON there I guess. Make all the monsters in the level have a tid of 222.

__________________
Pacman Doom 2 Play with latest version of ZDoom!

Old Post 12-31-02 20:02 #
Epyo is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Ichor
The Mysterious Red Square


Posts: 6937
Registered: 07-02


That works too, but I usually use it that way in case I want to have different enemies have different TIDs (for use by other scripts). Also, if this was Doom 2, Lost Souls spawned by Pain Elementals and resurrected enemies (at least I don't think so) would not be counted.

__________________
0.666 - The number of the Millibeast

Old Post 12-31-02 21:00 #
Ichor is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3629
Registered: 05-00


Well, couldn't you just use thingcount(0, 0)? :)

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 01-01-03 00:06 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
rf`
Dr. Nosign


Posts: 8217
Registered: 11-01



Tarin said:
Well, couldn't you just use thingcount(0, 0)? :)

Uh, that would count EVERY thing, not just enemies. You try killing a torch. :P

__________________
Released wads and other doom crap

Old Post 01-01-03 00:14 #
rf` is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3629
Registered: 05-00



ravage said:

Uh, that would count EVERY thing, not just enemies. You try killing a torch. :P


Hehe, yeah. I just tried it out. Even projectiles are counted then :P

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 01-01-03 00:22 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3629
Registered: 05-00


Ok, this script should work fine:

code:
#include "zcommon.acs" int enemies[17] = { T_CHAINGUY, T_BARON, T_ZOMBIE, T_IMP, T_ARACHNOTRON, T_SPIDERMASTERMIND, T_DEMON, T_SPECTRE, T_CACODEMON, T_REVENANT, T_LOSTSOUL, T_VILE, T_MANCUBUS, T_HELLKNIGHT, T_CYBERDEMON, T_PAINELEMENTAL,T_WOLFSS }; script 1 open { int i, count; do { count=0; for(i=0; i < 17; i++) { count += thingcount(enemies[i], 0); print(s:"monsters: ", d:count); } delay(1); } while(count > 0); print(s:"All monsters dead!!!111"); }

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 01-01-03 00:31 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 16:34. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > ANOTHER scripting question

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.