- Joined
- Jul 11, 2007
- Messages
- 642
My goal in this system was to make it so bullets can realistically fly and not be affected by terrain. What is wrong with this current system? Explained in triggers:
-
Create
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Shoot Gun
-
Actions
- Set TP = (Position of (Triggering unit))
- -------- To make it more inacurate for longer range --------
- Set P = (Target point of ability being cast)
- Set FP = (P offset by ((Distance between TP and P) / 50.00) towards (Random angle) degrees)
- Custom script: call RemoveLocation(udg_P)
- Unit - Create 1 Bullet for (Owner of (Triggering unit)) at TP facing (Angle from TP to FP) degrees
- -------- To make it able to change heights --------
- Unit - Add Crow Form to (Last created unit)
- Unit - Remove Crow Form from (Last created unit)
- -------- To make it start the right height --------
- Animation - Change (Last created unit) flying height to 60.00 at 0.00
- -------- To calculate angle changed per 1/20th of a second --------
- Custom script: set udg_Real1 = GetLocationZ(udg_FP)
- Custom script: set udg_Real2 = GetLocationZ(udg_TP)
- Set Real3 = ((((Real1 + 60.00) - Real2) / ((Distance between TP and FP) / 1400.00)) / 20.00)
- -------- The +60 is to have a height offset, the 1400 is the movement per second, and the 20 is that there are 20 moves in a second. --------
- Unit - Set the custom value of (Last created unit) to (Integer(Real3))
- Custom script: call RemoveLocation(udg_TP)
- Custom script: call RemoveLocation(udg_FP)
-
Events
-
Move
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to Bullet
-
Then - Actions
- Set TP = ((Position of (Picked unit)) offset by 70.00 towards (Facing of (Picked unit)) degrees)
- Unit - Move (Picked unit) instantly to TP
- -------- To make the angle adjust --------
- Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) + (Real((Point-value of (Picked unit))))) at 0.03
- Set FP = ((Position of (Picked unit)) offset by 10.00 towards (Facing of (Picked unit)) degrees)
- -------- To adjust bullet so terrain doesn't affect --------
- Custom script: set udg_Real1 = GetLocationZ(udg_FP)
- Custom script: set udg_Real2 = GetLocationZ(udg_TP)
- Set Real3 = (Real1 - Real2)
- Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) + Real3) at 0.02
- Custom script: call RemoveLocation(udg_TP)
- Custom script: call RemoveLocation(udg_FP)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Events
-
Collision
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
- -------- To make it collide with the ground or make it dissappear when it goes too heigh --------
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Equal to Bullet
- (Current flying height of (Picked unit)) Less than or equal to 3.00
- (Current flying height of (Picked unit)) Greater than or equal to 450.00
-
Then - Actions
- Unit - Remove (Picked unit) from the game
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Events