HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

bug - related to respawning creeps

03-28-2004, 02:25 PM#1
johnfn
First let me mention that i have to write this with my right hand only because i broke a finger on my other hand and am currently carrying around a bag of warm water on that hand, for some reason, so dont yell at me for grammer mistakes (because i can only type w/ one hand...).

Please dont let the long trigger scare you away :\ ...

Anyway as i mentioned above i have a bug in my trigger that respawns units. What it is supposed to do is respawn a dead unit every 30 seconds. However it doest always work. Sometimes it spawns before the 30 secs are up. sometimes it works perfectly. sometimes it never spawns. I can't see the bug un the trigger... can someone else help?

Here's the triggers (there's 2)

set up monster respawning system
Events
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: testing. 1 2 3
Wait 2.00 seconds
Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
Loop - Actions
Set for_every_unit = (for_every_unit + 1)
Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: (String(for_every_unit))
Set loc_of_creeps[for_every_unit] = (Position of (Picked unit))
Set corresponding_type_of_monster[for_every_unit] = (Picked unit)


second trigger


Respawn Monster
Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Actions
Game - Display to Player 1 (Red), at offset (0.00, 0.00) for 15.00 seconds the text: death
For each (Integer A) from 1 to (Number of units in (Units owned by Neutral Hostile)), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
corresponding_type_of_monster[(Integer A)] Equal to (Dying unit)
Then - Actions
Wait 30.00 seconds
Unit - Create 1 (Unit-type of corresponding_type_of_monster[(Integer A)]) for Neutral Hostile at loc_of_creeps[(Integer A)] facing Default building facing degrees
Set corresponding_type_of_monster[(Integer A)] = (Last created unit)
Else - Actions




Thanks again for your help.
03-28-2004, 02:34 PM#2
Vexorian
(Integer A) is a global variable and can be used by another trigger, killing your waits, have a special global variable for that trigger like SpawnInt and use the For each integer variable do (actions)
03-28-2004, 02:49 PM#3
johnfn
well i guess that cant be attributed to bad triggering -- i had no idea. Thanks a lot, i would never have guessed.