Hello guys!
I am in dire need of assistance here. I have a respawn system that respawns a random easy difficulty creep is a weak creep dies, medium for a medium creep and so on.
The code is working fine but the creeps only respawn twice, not thrice or more. Also it doesnt work for some units. Can you find errors/room for efficieny?
P.S. Lets not go into timers. Waits would do.
I am in dire need of assistance here. I have a respawn system that respawns a random easy difficulty creep is a weak creep dies, medium for a medium creep and so on.
The code is working fine but the creeps only respawn twice, not thrice or more. Also it doesnt work for some units. Can you find errors/room for efficieny?
P.S. Lets not go into timers. Waits would do.
-
Init
-
Events
- Map initialization
- Conditions
-
Actions
- Set TempInt[0] = 5
- -------- --------
- -------- Easy Creeps --------
- Set CreepsType[1] = Mur'gul Cliffrunner
- Set CreepsType[2] = Mur'gul Blood-Gill
- Set CreepsType[3] = Mur'gul Tidewarrior
- Set CreepsType[4] = Spider Crab Shorecrawler
- Set CreepsType[5] = Spider Crab Limbripper
- Set CreepsType[6] = Stormreaver Hermit
- Set CreepsType[7] = Skeletal Orc
- -------- Medium Creeps --------
- Set CreepsType[8] = Sea Elemental
- Set CreepsType[9] = Sea Giant
- Set CreepsType[10] = Makrura Deepseer
- Set CreepsType[11] = Skeletal Orc Grunt
- Set CreepsType[12] = Mur'gul Marauder
- Set CreepsType[13] = Giant Sea Turtle
- Set CreepsType[14] = Mur'gul Snarecaster
- -------- Hard Creeps --------
- Set CreepsType[15] = Revenant of the Depths
- Set CreepsType[16] = Sea Giant Hunter
- Set CreepsType[17] = Gargantuan Sea Turtle
- Set CreepsType[18] = Stormreaver Warlock
- Set CreepsType[19] = Enraged Jungle Stalker
- Set CreepsType[20] = Mur'gul Marauder
- -------- Boss --------
- Set CreepsType[21] = Deeplord Revenant
- Set CreepsType[22] = Sea Giant Behemoth
- Set CreepsType[23] = Ancient Hydra
- Set CreepsType[24] = Skeletal Orc Champion
- Set CreepsType[25] = Dragon Turtle
- -------- --------
- Set CreepsStartValue[1] = 1
- Set CreepsStartValue[2] = 8
- Set CreepsStartValue[3] = 15
- Set CreepsStartValue[4] = 21
-
For each (Integer A) from 1 to 4, do (Actions)
-
Loop - Actions
- Set CreepsEndValue[(Integer A)] = (CreepsStartValue[(Integer A)] - 1)
- Set TempPoint[0] = (Random point in Corpses Area <gen>)
- Unit - Create a CreepsType[(Random integer number between 1 and 20)] corpse for Neutral Hostile at TempPoint[0]
-
Loop - Actions
-
For each (Integer A) from 1 to 7, do (Actions)
-
Loop - Actions
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units owned by Neutral Hostile matching ((Unit-type of (Matching unit)) Equal to CreepsType[(Integer A)])) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to CreepsTypeGroup[1]
- Set TempInt[0] = (TempInt[0] + 1)
- Unit - Set the custom value of (Picked unit) to TempInt[0]
- Set CreepsPointLoc[(Custom value of (Picked unit))] = (Position of (Picked unit))
-
Loop - Actions
-
Loop - Actions
-
For each (Integer A) from 8 to 14, do (Actions)
-
Loop - Actions
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units owned by Neutral Hostile matching ((Unit-type of (Matching unit)) Equal to CreepsType[(Integer A)])) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to CreepsTypeGroup[2]
- Set TempInt[0] = (TempInt[0] + 1)
- Unit - Set the custom value of (Picked unit) to TempInt[0]
- Set CreepsPointLoc[(Custom value of (Picked unit))] = (Position of (Picked unit))
-
Loop - Actions
-
Loop - Actions
-
For each (Integer A) from 15 to 20, do (Actions)
-
Loop - Actions
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units owned by Neutral Hostile matching ((Unit-type of (Matching unit)) Equal to CreepsType[(Integer A)])) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to CreepsTypeGroup[3]
- Set TempInt[0] = (TempInt[0] + 1)
- Unit - Set the custom value of (Picked unit) to TempInt[0]
- Set CreepsPointLoc[(Custom value of (Picked unit))] = (Position of (Picked unit))
-
Loop - Actions
-
Loop - Actions
-
For each (Integer A) from 21 to 25, do (Actions)
-
Loop - Actions
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units owned by Neutral Hostile matching ((Unit-type of (Matching unit)) Equal to CreepsType[(Integer A)])) and do (Actions)
-
Loop - Actions
- Unit Group - Add (Picked unit) to CreepsTypeGroup[4]
- Set TempInt[0] = (TempInt[0] + 1)
- Unit - Set the custom value of (Picked unit) to TempInt[0]
- Set CreepsPointLoc[(Custom value of (Picked unit))] = (Position of (Picked unit))
-
Loop - Actions
-
Loop - Actions
- Custom script: call RemoveLocation(udg_TempPoint[0])
-
Events
-
Spawn System
-
Events
- Unit - A unit Dies
-
Conditions
- (Triggering player) Equal to Neutral Hostile
-
Actions
- Game - Display to (All players) the text: debug
-
For each (Integer A) from 1 to 4, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Triggering unit) is in CreepsTypeGroup[(Integer A)]) Equal to True
-
Then - Actions
- Unit Group - Remove (Triggering unit) from CreepsTypeGroup[(Integer A)]
- Set CreepsCVPass = (Custom value of (Triggering unit))
- Set CreepsFacingUnit[CreepsCVPass] = (Facing of (Triggering unit))
- Set CreepsRespawnInterval[CreepsCVPass] = (6.00 x (Real((Integer A))))
- Set CreepsStartValue[CreepsCVPass] = CreepsStartValue[(Integer A)]
- Set CreepsEndValue[CreepsCVPass] = CreepsEndValue[(Integer A)]
- Wait CreepsRespawnInterval[CreepsCVPass] seconds
- Unit - Create 1 CreepsType[(Random integer number between CreepsStartValue[CreepsCVPass] and CreepsEndValue[CreepsCVPass])] for Neutral Hostile at CreepsPointLoc[CreepsCVPass] facing CreepsFacingUnit[CreepsCVPass] degrees
- Unit Group - Add (Last created unit) to CreepsTypeGroup[(Integer A)]
- Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
- Special Effect - Destroy (Last created special effect)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Events