- Joined
- Jan 24, 2011
- Messages
- 26
Ok so lets state what happens first.
I have a ORPG map with a friend of mine, and since the very start we had a VERY basic script to re-spawn the creeps.
it basicly does this:
Map init:
Create a custom number for every unit (for later use) on the WHOLE map.
Saving there unit type in a variable array, and there position of creation (We do not want creeps re-spawning where they die right?)
If creepy dies:
Wait 60seconds (just example time)
Unit - Create 1 UnitType_Mob[(Custom value of (Triggering unit))] for (Triggering player) at Position_Mob[(Custom value of (Triggering unit))] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
This works perfectly! BUT If one was to remove the units corpse. The ''triggering unit'' (or dieing unit for that matter, shouldn't matter at all.) Gets removed after the ''wait'' command, and the game forgets what mob and for what player it should be created.
So i tried to work AROUND that problem.. by saving the owning player and the triggering unit into 2 array's then wait 60 seconds, and then recalling the correct array number (meaning i would be limited to a certain amount of dead units at the same time before this goes wrong. But it should work at the least)
However. once again, if the units CORPSE gets removed before the waiting time the unit TYPE and the owning player are saved to the variable array. but after the 60second wait, the game once more forgets what is in those variables (though the same system i scripted without removing the corpse works just fine, so the variable saving works!)
Ill post the text version here, and hope you get what i am doing wrong (or the game is):
MAP INI:
(saving unit type might be a bit overkill but i was testing around)
WHEN UNIT DIES:
Variables i used:
DeathMemoryPlayer[array] (saves owning player)
DeathMemoryUnit[Array] (Saves unit.)
DeathMemoryNumber (Saves the number were on, to make each time the code runs direct to one of the IF THEN ELSE parts in attempt to make it not confusd with the wait time)
If someone gets that When a unit is killed and the corpse STAYS this program works. And if the unit dies and there is NO corpse (turned skeleton or exploded units for example) This fails and the DeathMemoryUnit simply goes BLANK after the waiting period. Id be VERY happy.
Keep in mind:
All variables were created, and not used in ANY other part of my codes.
While testing the script i made sure NEVER to kill more then 2 or 3 mobs (to avoid the overwriting of number 1 when a 5th unit is dead at the same time.)
I might write something confusing, if you got questions ask, ill be monitoring this thread.
I have a ORPG map with a friend of mine, and since the very start we had a VERY basic script to re-spawn the creeps.
it basicly does this:
Map init:
Create a custom number for every unit (for later use) on the WHOLE map.
Saving there unit type in a variable array, and there position of creation (We do not want creeps re-spawning where they die right?)
If creepy dies:
Wait 60seconds (just example time)
Unit - Create 1 UnitType_Mob[(Custom value of (Triggering unit))] for (Triggering player) at Position_Mob[(Custom value of (Triggering unit))] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
This works perfectly! BUT If one was to remove the units corpse. The ''triggering unit'' (or dieing unit for that matter, shouldn't matter at all.) Gets removed after the ''wait'' command, and the game forgets what mob and for what player it should be created.
So i tried to work AROUND that problem.. by saving the owning player and the triggering unit into 2 array's then wait 60 seconds, and then recalling the correct array number (meaning i would be limited to a certain amount of dead units at the same time before this goes wrong. But it should work at the least)
However. once again, if the units CORPSE gets removed before the waiting time the unit TYPE and the owning player are saved to the variable array. but after the 60second wait, the game once more forgets what is in those variables (though the same system i scripted without removing the corpse works just fine, so the variable saving works!)
Ill post the text version here, and hope you get what i am doing wrong (or the game is):
MAP INI:
Code:
Mob Position
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
Loop - Actions
Set RespawnInteger = (RespawnInteger + 1)
Unit - Set the custom value of (Picked unit) to RespawnInteger
Set Point_Mob[RespawnInteger] = (Position of (Picked unit))
Set UnitType_Mob[RespawnInteger] = (Unit-type of (Picked unit))
WHEN UNIT DIES:
Code:
Mob Respawn Copy
Events
Unit - A unit owned by Player 4 (Purple) Dies
Unit - A unit owned by Player 8 (Pink) Dies
Unit - A unit owned by Neutral Hostile Dies
Conditions
((Triggering unit) is Summoned) Equal to False
(Unit-type of (Triggering unit)) Not equal to Town Hall
Actions
Set DeathMemoryNumber = (DeathMemoryNumber + 1)
Game - Display to (All players) the text: (String(DeathMemoryNumber))
If (DeathMemoryNumber Equal to 4) then do (Set DeathMemoryNumber = 0) else do (Do nothing)
Set DeathMemoryPlayer[DeathMemoryNumber] = (Owner of (Triggering unit))
Set DeathMemoryUnit[DeathMemoryNumber] = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DeathMemoryNumber Equal to 0
Then - Actions
Wait 30.00 seconds
Unit - Create 1 UnitType_Mob[(Custom value of DeathMemoryUnit[0])] for DeathMemoryPlayer[0] at Point_Mob[(Custom value of DeathMemoryUnit[0])] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Custom value of DeathMemoryUnit[0])
Unit - Set (Last created unit) acquisition range to 200.00
Set DeathMemoryPlayer[0] = Emptyplayer
Set DeathMemoryUnit[0] = EmptyUnit
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DeathMemoryNumber Equal to 1
Then - Actions
Wait 30.00 seconds
Unit - Create 1 UnitType_Mob[(Custom value of DeathMemoryUnit[1])] for DeathMemoryPlayer[1] at Point_Mob[(Custom value of DeathMemoryUnit[1])] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Custom value of DeathMemoryUnit[1])
Unit - Set (Last created unit) acquisition range to 200.00
Set DeathMemoryPlayer[1] = Emptyplayer
Set DeathMemoryUnit[1] = EmptyUnit
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DeathMemoryNumber Equal to 2
Then - Actions
Wait 30.00 seconds
Unit - Create 1 UnitType_Mob[(Custom value of DeathMemoryUnit[2])] for DeathMemoryPlayer[2] at Point_Mob[(Custom value of DeathMemoryUnit[2])] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Custom value of DeathMemoryUnit[2])
Unit - Set (Last created unit) acquisition range to 200.00
Set DeathMemoryPlayer[2] = Emptyplayer
Set DeathMemoryUnit[2] = EmptyUnit
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DeathMemoryNumber Equal to 3
Then - Actions
Wait 30.00 seconds
Unit - Create 1 UnitType_Mob[(Custom value of DeathMemoryUnit[3])] for DeathMemoryPlayer[3] at Point_Mob[(Custom value of DeathMemoryUnit[3])] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Custom value of DeathMemoryUnit[3])
Unit - Set (Last created unit) acquisition range to 200.00
Set DeathMemoryPlayer[3] = Emptyplayer
Set DeathMemoryUnit[3] = EmptyUnit
Else - Actions
Do nothing
Variables i used:
DeathMemoryPlayer[array] (saves owning player)
DeathMemoryUnit[Array] (Saves unit.)
DeathMemoryNumber (Saves the number were on, to make each time the code runs direct to one of the IF THEN ELSE parts in attempt to make it not confusd with the wait time)
If someone gets that When a unit is killed and the corpse STAYS this program works. And if the unit dies and there is NO corpse (turned skeleton or exploded units for example) This fails and the DeathMemoryUnit simply goes BLANK after the waiting period. Id be VERY happy.
Keep in mind:
All variables were created, and not used in ANY other part of my codes.
While testing the script i made sure NEVER to kill more then 2 or 3 mobs (to avoid the overwriting of number 1 when a 5th unit is dead at the same time.)
I might write something confusing, if you got questions ask, ill be monitoring this thread.