- Joined
- Aug 1, 2008
- Messages
- 453
I've been working on a TD, and was about to stop because i couldn't find a way to fix some of the bugs in my trigger (The unique part of the game). But before i quit it i decided to ask the fellow members of the hive for some help .
The 3 bugs I've found.
1. the unit does not move back to the middle of the tower all the time.
2. the unit will chase units down, when they come within the radius and leave, but he'll return when they die.
3. If the unit can keep attacking units nonstop he will keep moving forward, even if they leave the area of the tower.
Here's the triggers that have to do with this part of the system.
And just to let you know I'm trying to make a unit tower that attacks all units within X AoE of the base tower. And when its done attacking it returns back to the middle of the base tower.
The 3 bugs I've found.
1. the unit does not move back to the middle of the tower all the time.
2. the unit will chase units down, when they come within the radius and leave, but he'll return when they die.
3. If the unit can keep attacking units nonstop he will keep moving forward, even if they leave the area of the tower.
Here's the triggers that have to do with this part of the system.
-
Create
-
Events
- Unit - A unit Finishes construction
-
Conditions
- (Unit-type of (Constructed structure)) Equal to |cff000000a |cffBB9910Lv. 1 Soldier (Building)
-
Actions
- Unit - Turn collision for (Constructed structure) Off
- Unit - Set level of Soldier Information (Dummy) for (Constructed structure) to (Point-value of (Constructed structure))
- Set Int_Towers[(Player number of (Owner of (Constructed structure)))] = (Int_Towers[(Player number of (Owner of (Constructed structure)))] + 1)
- Set Temp_Pos[1] = (Position of (Constructed structure))
- Set Customvalue[1] = (Customvalue[1] + 2)
- Set Positionoftower[(Customvalue[1] - 1)] = (Position of (Constructed structure))
- Unit - Create 1 |cffBB9910Lv. 1 Soldier (Unit) for (Owner of (Constructed structure)) at Temp_Pos[1] facing Default building facing degrees
- Unit - Set the custom value of (Last created unit) to Int_Towers[Customvalue[1]]
- Unit - Set the custom value of (Constructed structure) to Int_Towers[Customvalue[1]]
- Custom script: call RemoveLocation( udg_Temp_Pos[1] )
-
Events
-
Tower Limits
-
Events
- Time - Every 0.10 seconds of game time
- Conditions
-
Actions
- -------- Level 1 Towers --------
- -------- Level 1 Towers --------
- -------- Level 1 Towers --------
- Set Temp_Group[1] = (Units of type |cff000000a |cffBB9910Lv. 1 Soldier (Building))
-
Unit Group - Pick every unit in Temp_Group[1] and do (Actions)
-
Loop - Actions
- Set Temp_Unit[1] = (Picked unit)
- Set Temp_Pos[1] = (Position of (Picked unit))
- Set Temp_Group[2] = (Units within 600.00 of Temp_Pos[1])
- Set Temp_Interger = ((Custom value of (Picked unit)) - 1)
-
Unit Group - Pick every unit in Temp_Group[2] and do (Actions)
-
Loop - Actions
- Set Temp_Pos[2] = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Custom value of (Picked unit)) Equal to (Custom value of Temp_Unit[1])
- (Distance between Temp_Pos[1] and Temp_Pos[2]) Greater than or equal to 300.00
-
Then - Actions
- Unit - Order (Picked unit) to Move To Positionoftower[Customvalue[Temp_Interger]]
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup( udg_Temp_Group[2] )
- Custom script: call RemoveLocation( udg_Temp_Pos[1] )
-
Loop - Actions
- Custom script: call DestroyGroup( udg_Temp_Group[1] )
- -------- Level 2 Towers --------
- -------- Level 2 Towers --------
- -------- Level 2 Towers --------
- Set Temp_Group[1] = (Units of type |cff000000a |cffBB9910Lv. 2 Soldier (Building))
-
Unit Group - Pick every unit in Temp_Group[1] and do (Actions)
-
Loop - Actions
- Set Temp_Unit[1] = (Picked unit)
- Set Temp_Pos[1] = (Position of (Picked unit))
- Set Temp_Group[2] = (Units within 600.00 of Temp_Pos[1])
- Set Temp_Interger = ((Custom value of (Picked unit)) - 1)
-
Unit Group - Pick every unit in Temp_Group[2] and do (Actions)
-
Loop - Actions
- Set Temp_Pos[2] = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Custom value of (Picked unit)) Equal to (Custom value of Temp_Unit[1])
- (Distance between Temp_Pos[1] and Temp_Pos[2]) Greater than or equal to 300.00
-
Then - Actions
- Unit - Order (Picked unit) to Move To Positionoftower[Customvalue[Temp_Interger]]
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup( udg_Temp_Group[2] )
- Custom script: call RemoveLocation( udg_Temp_Pos[1] )
-
Loop - Actions
- Custom script: call DestroyGroup( udg_Temp_Group[1] )
-
Events
-
Lv 1 Soldier Upgrade
-
Events
- Unit - A unit Finishes an upgrade
-
Conditions
- (Unit-type of (Triggering unit)) Equal to |cff000000a |cffBB9910Lv. 2 Soldier (Building)
-
Actions
- -------- Unit lvl 1 --------
- Set Temp_Group[1] = (Units of type |cffBB9910Lv. 1 Soldier (Unit))
-
Unit Group - Pick every unit in Temp_Group[1] and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Custom value of (Picked unit)) Equal to (Custom value of (Triggering unit))
-
Then - Actions
- -------- Unit lvl 2 --------
- Unit - Replace (Picked unit) with a |cffBB9910Lv. 2 Soldier (Unit) using The new unit's max life and mana
- Unit - Set the custom value of (Last replaced unit) to (Custom value of (Triggering unit))
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Custom script: call DestroyGroup( udg_Temp_Group[1] )
-
Events
And just to let you know I'm trying to make a unit tower that attacks all units within X AoE of the base tower. And when its done attacking it returns back to the middle of the base tower.