- Joined
- Feb 18, 2007
- Messages
- 216
I have a missile launcher weapon in my map, which fires a homing missile on the target enemy. The missile will collide with walls and other enemies on the way.
Here's the missile movement trigger. I know it leaks, but that's not my first priority atm.
But when enemy is within degrees 180-360 from you (southside), this is what happens:
The problem is within the first action of the trigger, I'm just not able to figure it out. I guess I'm not good enough with math.. So if anyone could explain me where the problem is and how to fix it I'd be very grateful.
Here's the missile movement trigger. I know it leaks, but that's not my first priority atm.
-
Missile Movement
-
Events
- Time - Every 0.02 seconds of game time
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (missile is alive) Equal to True
-
Then - Actions
- Unit - Move missile instantly to ((Position of missile) offset by missile_speed towards ((Facing of missile) + (((Angle from (Position of missile) to (Position of missile_target)) - (Facing of missile)) / 2.00)) degrees), facing ((Facing of missile) + (((Angle from (Position of missile) to (Position of missile_target)) - (Facing of missile)) / 2.00)) degrees
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in (Units within 40.00 of (Position of missile) matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Not equal to Player 1 (Red)) and (((Owner of (Matching unit)) Not equal to Player 2 (Blue)) and ((Owner of ( Greater than 0
-
Then - Actions
- Unit - Kill missile
- Else - Actions
-
If - Conditions
-
For each (Integer A) from 0 to 4, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Terrain pathing at ((Position of missile) offset by ((Real((Integer A))) x 10.00) towards (Facing of missile) degrees) of type Walkability is off) Equal to True
-
Then - Actions
- Unit - Kill missile
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
But when enemy is within degrees 180-360 from you (southside), this is what happens:
The problem is within the first action of the trigger, I'm just not able to figure it out. I guess I'm not good enough with math.. So if anyone could explain me where the problem is and how to fix it I'd be very grateful.