| 03-04-2005, 12:04 AM | #1 |
Ok, i got a pretty complex trigger here, and it seems that ive reached WEs limitations or something, i got trigger errors like i would if i used jass... but with GUI triggers, the trigger is for a td, and it works fine, i was just having to modify it a little so it can b sold. The tower shoots a glaive out at 0°, then it returns like a boomerang, the entire tower rotates, and it contionues like this. But, when u sell the tower, it doesnt sell the blade with it, so i was gonna use a unit group array to store the pairs of towers and units, however... thats when i got the errors, it says FUNCTION NAME REQUIRED, and points to the add and remove unit lines from the unit group action. anyways, heres my trigger (theres 1 more b4 it that im not posting). Code:
Boomerang Attack
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units of type Boomerang) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((String((Custom value of (Picked unit)))), 1, 1)) Equal to -
Then - Actions
Set TempStringX = 1
Else - Actions
Set TempStringX = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 1), (TempStringX + 1))))) Equal to 1
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (((Real((Custom value of (Picked unit)))) / (Abs((Real((Custom value of (Picked unit))))))) x ConstentBladeSpeed) towards (Facing of (Picked unit)) degrees), facing 0.00 degrees
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + (((Custom value of (Picked unit)) / (Abs((Custom value of (Picked unit))))) x 1))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to ((Integer((Default acquisition range of (Random unit from (Units of type Boomerang Blades))))) / (Integer(ConstentBladeSpeed)))
(Custom value of (Picked unit)) Greater than 0
Then - Actions
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) x -1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to 0
Then - Actions
Unit - Move (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))) instantly to (Position of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))), facing ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) + 90.00) degrees
Animation - Play (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))'s attack animation
Unit - Create 1 Boomerang for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) degrees
Unit Group - Add (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 0.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 360.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 90.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 200) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 180.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 300) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 270.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 400) else do (Do nothing)
Unit Group - Remove (Picked unit) from BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
Unit - Remove (Picked unit) from the game
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 1), (TempStringX + 1))))) Equal to 2
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (((Real((Custom value of (Picked unit)))) / (Abs((Real((Custom value of (Picked unit))))))) x ConstentBladeSpeed) towards (Facing of (Picked unit)) degrees), facing 90.00 degrees
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + (((Custom value of (Picked unit)) / (Abs((Custom value of (Picked unit))))) x 1))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to ((Integer((Default acquisition range of (Random unit from (Units of type Boomerang Blades))))) / (Integer(ConstentBladeSpeed)))
(Custom value of (Picked unit)) Greater than 0
Then - Actions
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) x -1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to 0
Then - Actions
Unit - Move (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))) instantly to (Position of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))), facing ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) + 90.00) degrees
Animation - Play (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))'s attack animation
Unit - Create 1 Boomerang for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) degrees
Unit Group - Add (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 0.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 360.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 90.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 200) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 180.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 300) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 270.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 400) else do (Do nothing)
Unit Group - Remove (Picked unit) from BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
Unit - Remove (Picked unit) from the game
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 1), (TempStringX + 1))))) Equal to 3
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (((Real((Custom value of (Picked unit)))) / (Abs((Real((Custom value of (Picked unit))))))) x ConstentBladeSpeed) towards (Facing of (Picked unit)) degrees), facing 180.00 degrees
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + (((Custom value of (Picked unit)) / (Abs((Custom value of (Picked unit))))) x 1))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to ((Integer((Default acquisition range of (Random unit from (Units of type Boomerang Blades))))) / (Integer(ConstentBladeSpeed)))
(Custom value of (Picked unit)) Greater than 0
Then - Actions
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) x -1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to 0
Then - Actions
Unit - Move (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))) instantly to (Position of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))), facing ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) + 90.00) degrees
Animation - Play (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))'s attack animation
Unit - Create 1 Boomerang for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) degrees
Unit Group - Add (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 0.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 360.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 90.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 200) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 180.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 300) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 270.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 400) else do (Do nothing)
Unit Group - Remove (Picked unit) from BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
Unit - Remove (Picked unit) from the game
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 1), (TempStringX + 1))))) Equal to 4
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (((Real((Custom value of (Picked unit)))) / (Abs((Real((Custom value of (Picked unit))))))) x ConstentBladeSpeed) towards (Facing of (Picked unit)) degrees), facing 270.00 degrees
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + (((Custom value of (Picked unit)) / (Abs((Custom value of (Picked unit))))) x 1))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to ((Integer((Default acquisition range of (Random unit from (Units of type Boomerang Blades))))) / (Integer(ConstentBladeSpeed)))
(Custom value of (Picked unit)) Greater than 0
Then - Actions
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) x -1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to 0
Then - Actions
Unit - Move (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))) instantly to (Position of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))), facing ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) + 90.00) degrees
Animation - Play (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))'s attack animation
Unit - Create 1 Boomerang for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) degrees
Unit Group - Add (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 0.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 360.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 90.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 200) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 180.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 300) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 270.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 400) else do (Do nothing)
Unit Group - Remove (Picked unit) from BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
Unit - Remove (Picked unit) from the game
Else - Actions
Else - Actions |
| 03-04-2005, 02:14 AM | #2 |
ok, well i got it working :). i just had 2 do a check 2 c if a glaive is stuck still and there is no tower around, so now it works and sells :). |
| 03-04-2005, 03:30 AM | #3 |
Thank god. No one would want to go though all that triggers. |
| 03-04-2005, 04:58 AM | #4 | |
Quote:
i went through it :p and i would like to note that comments REALLY REALLY help for readabilitiy and understandability also, random unit from unit group generally tends to start messing up once multiple-instances get involved... i mean the conditions and such are a bitch to read through so i didn't read through them, but yeah i hope u took care of that and uh, thats gonna cause so many memory leaks, its kinda scary and your four directional conditions (1/2/3/4) could really be combined into 1 action list since the only thing that appears to change is (0/90/180/270) equivalent to ( (custom value - 1) * 90 ) Code:
Boomerang Attack
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units of type Boomerang) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((String((Custom value of (Picked unit)))), 1, 1)) Equal to -
Then - Actions
Set TempStringX = 1
Else - Actions
Set TempStringX = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 1), (TempStringX + 1))))) Less than 5
Then - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (((Real((Custom value of (Picked unit)))) / (Abs((Real((Custom value of (Picked unit))))))) x ConstentBladeSpeed) towards (Facing of (Picked unit)) degrees), facing Real((Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 1), (TempStringX + 1))))) - 1 * 90) degrees
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + (((Custom value of (Picked unit)) / (Abs((Custom value of (Picked unit))))) x 1))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to ((Integer((Default acquisition range of (Random unit from (Units of type Boomerang Blades))))) / (Integer(ConstentBladeSpeed)))
(Custom value of (Picked unit)) Greater than 0
Then - Actions
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) x -1)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((String((Custom value of (Picked unit)))), (TempStringX + 2), (TempStringX + (Length of (String((Custom value of (Picked unit)))))))))) Equal to 0
Then - Actions
Unit - Move (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))) instantly to (Position of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))), facing ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) + 90.00) degrees
Animation - Play (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))'s attack animation
Unit - Create 1 Boomerang for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) degrees
Unit Group - Add (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 0.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 360.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 100) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 90.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 200) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 180.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 300) else do (Do nothing)
If ((Facing of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades)))) Equal to 270.00) then do (Unit - Set the custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Boomerang) and ((Matching unit) Not equal to (Picked unit))))) to 400) else do (Do nothing)
Unit Group - Remove (Picked unit) from BladePairs[(Custom value of (Random unit from (Units within ConstentBladeDetection of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Boomerang Blades))))]
Unit - Remove (Picked unit) from the game
Else - Actions
Else - Actions |
| 03-04-2005, 09:30 PM | #5 |
well, not exactally... the first number is a 1/2/3/4 determing dirrection, the other numbers r how far its gone, and to reverse the dirrection it multiplys the custom value by -1. so -248 means its gone in dirrection 2, and its moved 48 times, and since the constent speed is 10, 48 * 10 = 480, just shy of its aquistion range (500) this is how it knows when 2 reverse around. |
| 03-04-2005, 11:00 PM | #6 |
IT is not complex, it is just wrong, you should be already using a hash table instead of overusing custom value like that |
| 03-05-2005, 01:00 PM | #7 |
a hash table...? and y not use the custom values, its the simplest way to make this work properly. If i were 2 use arrays, then whenever a new unit is created, id have 2 run a bunch of checks to c which array slots r aviliable, and id have 2 make it so when u sell the tower, it allows for that array slot to be aviliable for another tower. |
| 03-05-2005, 01:13 PM | #8 |
The simplest way is a hash table since you won't need to decode/encode stuff like that. A hash table is a game cache that you don't use to save things in the hard drive so it is multiplayer compatible, of course you can combine a hash table with the return bug and you can do really nice stuff |
| 03-07-2005, 02:49 AM | #9 |
i cant say ive ever heard of something like this... whats the action called, or how do u do it? |
| 03-07-2005, 03:21 AM | #10 |
I as well would appreciate it if you could elaborate on the usage of a hash table. how is one initialized and what makes it so useful? I can see the potential of using it in conjunction with the return bug but why can't he just use custom values? |
| 03-07-2005, 06:28 AM | #11 |
he can use custom values... just setting up -- well, personally i don't call it a hash table, i'm only in 2nd year, but -- setting up the gamecache does make things a lot simpler and readable -- especially since he went hardcore with the substringing which is just godawful ugly |
| 03-07-2005, 02:04 PM | #12 |
Guest | Lord Vexorian, a little more details would really be appreciated |
