Hi,
So I've hit a bit of an issue in a map.... There's loads of regions that enemies can spawn in but I want them to spawn close to the player(s). My logic is to get the players point (TempPoint) and then get a random point from a spawn (TempPoint3), then if the distance between these is higher than how close I want them to spawn then run through all the spawn points and basically do the same thing. However it's working for the most part but sometimes no spawn point is getting picked and therefore the unit isn't being spawned at all (BIG ISSUES!)
The "Spawn Zombie" trigger is run from a different trigger and the "Get Spawn Point" trigger is run from "Spawn Zombie". Anyone got an idea what I'm doing wrong? (Sorry I can't seem to get the triggers posted properly with the new site!)
So I've hit a bit of an issue in a map.... There's loads of regions that enemies can spawn in but I want them to spawn close to the player(s). My logic is to get the players point (TempPoint) and then get a random point from a spawn (TempPoint3), then if the distance between these is higher than how close I want them to spawn then run through all the spawn points and basically do the same thing. However it's working for the most part but sometimes no spawn point is getting picked and therefore the unit isn't being spawned at all (BIG ISSUES!)
The "Spawn Zombie" trigger is run from a different trigger and the "Get Spawn Point" trigger is run from "Spawn Zombie". Anyone got an idea what I'm doing wrong? (Sorry I can't seem to get the triggers posted properly with the new site!)
-
Spawn Zombie
-
Events
-
Conditions
-
Actions
-
Trigger - Run Get Spawn Point <gen> (checking conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Random integer number between 1 and 100) Less than or equal to RoundNumber
-
RoundNumber Greater than or equal to 25
-
-
Then - Actions
-
Unit - Create 1 Zombie (6) for Player 12 (Brown) at TempPoint3 facing Default building facing degrees
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Random integer number between 1 and 80) Less than or equal to RoundNumber
-
RoundNumber Greater than or equal to 20
-
-
Then - Actions
-
Unit - Create 1 Zombie (5) for Player 12 (Brown) at TempPoint3 facing Default building facing degrees
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Random integer number between 1 and 60) Less than or equal to RoundNumber
-
RoundNumber Greater than or equal to 15
-
-
Then - Actions
-
Unit - Create 1 Zombie (4) for Player 12 (Brown) at TempPoint3 facing Default building facing degrees
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Random integer number between 1 and 40) Less than or equal to RoundNumber
-
RoundNumber Greater than or equal to 10
-
-
Then - Actions
-
Unit - Create 1 Zombie (3) for Player 12 (Brown) at TempPoint3 facing Default building facing degrees
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Random integer number between 1 and 20) Less than or equal to RoundNumber
-
RoundNumber Greater than or equal to 5
-
-
Then - Actions
-
Unit - Create 1 Zombie (2) for Player 12 (Brown) at TempPoint3 facing Default building facing degrees
-
-
Else - Actions
-
Unit - Create 1 Zombie (1) for Player 12 (Brown) at TempPoint3 facing Default building facing degrees
-
-
-
-
-
-
-
-
-
-
-
Custom script: call RemoveLocation(udg_TempPoint3)
-
Unit Group - Add (Last created unit) to ZombieGroup
-
Unit - Set the custom value of (Last created unit) to (Player number of (Owner of (Random unit from SurvivorGroup)))
-
-------- Hp Buffs --------
-
For each (Integer HpGainLoop) from 1 to HpBonus_10000, do (Actions)
-
Loop - Actions
-
Unit - Add Life Bonus (+10000) to (Last created unit)
-
Unit - Set level of Life Bonus (+10000) for (Last created unit) to 2
-
Unit - Remove Life Bonus (+10000) from (Last created unit)
-
-
-
For each (Integer HpGainLoop) from 1 to HpBonus_1000, do (Actions)
-
Loop - Actions
-
Unit - Add Life Bonus (+1000) to (Last created unit)
-
Unit - Set level of Life Bonus (+1000) for (Last created unit) to 2
-
Unit - Remove Life Bonus (+1000) from (Last created unit)
-
-
-
For each (Integer HpGainLoop) from 1 to HpBonus_100, do (Actions)
-
Loop - Actions
-
Unit - Add Life Bonus (+100) to (Last created unit)
-
Unit - Set level of Life Bonus (+100) for (Last created unit) to 2
-
Unit - Remove Life Bonus (+100) from (Last created unit)
-
-
-
For each (Integer HpGainLoop) from 1 to HpBonus_10, do (Actions)
-
Loop - Actions
-
Unit - Add Life Bonus (+10) to (Last created unit)
-
Unit - Set level of Life Bonus (+10) for (Last created unit) to 2
-
Unit - Remove Life Bonus (+10) from (Last created unit)
-
-
-
For each (Integer HpGainLoop) from 1 to HpBonus_1, do (Actions)
-
Loop - Actions
-
Unit - Add Life Bonus (+1) to (Last created unit)
-
Unit - Set level of Life Bonus (+1) for (Last created unit) to 2
-
Unit - Remove Life Bonus (+1) from (Last created unit)
-
-
-
-
-
Get Spawn Point
-
Events
-
Conditions
-
Actions
-
Set TempPoint = (Position of (Random unit from SurvivorGroup))
-
Set TempPoint3 = (Center of SpawnZone[(Random integer number between 1 and SpawnZoneMax)])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Distance between TempPoint and TempPoint3) Greater than 5000.00
-
-
Then - Actions
-
For each (Integer SpawnPointLoop) from 1 to SpawnZoneMax, do (Actions)
-
Loop - Actions
-
Set TempPoint2 = (Center of SpawnZone[SpawnPointLoop])
-
Set TempReal = (Distance between TempPoint and TempPoint2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempReal Less than or equal to 5000.00
-
-
Then - Actions
-
Custom script: call RemoveLocation(udg_TempPoint3)
-
Set TempPoint3 = TempPoint2
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_TempPoint2)
-
-
-
-
Else - Actions
-
-
Game - Display to (All players) the text: (String((Distance between TempPoint and TempPoint3)))
-
Custom script: call RemoveLocation(udg_TempPoint)
-
-
Last edited by a moderator: