- Joined
- May 11, 2010
- Messages
- 7
So I want to move units when they click on abilities (e.g. "Move East), for a chess/checkers like feel. The unit would be centered on a "random unit within range of the offset point". There are circles of power all over the checker/chessboard 12x18 map which the units attach themselves to. This basically, makes the ending position of the units more uniformed.
I made sure that it would only work if they were facing the right way, for example, needing to face 0 degrees to go east. And that they could not go into impassable terrain. It was working out finely until I came to needing to detect allied/enemy units in spaces.
Essentially, the problem is that units move into spaces that already contain other units. As a quick fix, I tried to create a dummy unit in the space, which would then block a units movement into an occupied space. But it doesn't work.
Thanks in advance!
I made sure that it would only work if they were facing the right way, for example, needing to face 0 degrees to go east. And that they could not go into impassable terrain. It was working out finely until I came to needing to detect allied/enemy units in spaces.
Essentially, the problem is that units move into spaces that already contain other units. As a quick fix, I tried to create a dummy unit in the space, which would then block a units movement into an occupied space. But it doesn't work.
Thanks in advance!
-
Move East
-
Events
- Unit - A unit Finishes casting an ability
-
Conditions
- (Ability being cast) Equal to Move East
-
Actions
- Set tempPt = (Position of (Triggering unit))
- Set temPt2 = (tempPt offset by 275.00 towards 0.00 degrees)
- Set tempGp1 = (Units within 25.00 of temPt2)
- Set tempPt3 = (Position of (Random unit from tempGp1))
- Set tempR1 = (Facing of (Triggering unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in (Units within 50.00 of temPt2)) Greater than 1
-
Then - Actions
- Unit - Create 1 dummy for (Owner of (Triggering unit)) at temPt2 facing Default building facing degrees
- Set tempUni1 = (Last created unit)
-
Else - Actions
- Do nothing
-
If - Conditions
- Set tempGp2 = (Units within 25.00 of temPt2)
- If (((Terrain pathing at temPt2 of type Walkability is off) Equal to True) or (((tempUni1 is in tempGp2) Equal to True) or (tempR1 Not equal to 0.00))) then do (Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 1.00)) else do (Unit - Move (Triggering unit) instantly to tempPt3)
- Custom script: call RemoveLocation(udg_tempPt)
- Custom script: call RemoveLocation(udg_temPt2)
- Custom script: call RemoveLocation(udg_tempPt3)
- Custom script: call DestroyGroup(udg_tempGp1)
- Custom script: call DestroyGroup(udg_tempGp2)
- Custom script: call DestroyGroup(udg_tempGp3)
- Custom script: call DestroyGroup(udg_tempGp4)
- Custom script: call DestroyGroup(udg_tempGp5)
-
Events