# [Trigger]Right formula for dummy missile movement?

Status
Not open for further replies.

#### Azeroc

Level 10
Right, I need formula which would set height of my dummy missile depending on cliff level, to create straight shot. Like now it does like this...

It doesn't go straight. I need formula for height changing so it would go straightly (like a bullet), like this example.

TRIGGERS

• MISSILES Arrow Launch
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• (Ability being cast) Equal to Shoot!
• Actions
• For each (Integer A) from 1 to 1, do (Actions)
• Loop - Actions
• Set Temp_Unit[0] = (Triggering unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Target point of ability being cast)
• -------- ------------------------------------------------------------------------------ --------
• Unit - Create 1 Dummy - Arrow for (Owner of Temp_Unit[0]) at Temp_Loc[0] facing ((Angle from Temp_Loc[0] to Temp_Loc[1]) + (Random real number between -3.00 and 3.00)) degrees
• -------- ------------------------------------------------------------------------------ --------
• -------- Setting Variables for Dummy --------
• -------- ------------------------------------------------------------------------------ --------
• Set MISSILES_ArrowSource = (Triggering unit)
• Set MISSILES_ArrowStartLoc = (Position of MISSILES_ArrowSource)
• Set MISSILES_ArrowEndLoc = (Target point of ability being cast)
• Set MISSILES_ArrowRange = (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc)
• Set MISSILES_ArrowHeight = 70.00
• Set MISSILES_ArrowMiddleReach = (MISSILES_ArrowRange / 2.00)
• Set MISSILES_ArrowSpeed = (MISSILES_ArrowRange / (25.00 + (Random real number between -5.00 and 5.00)))
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving them --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowRange as (Key arrow_range) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowHeight as (Key arrow_height) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowSpeed as (Key arrow_speed) of (Key (Last created unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• -------- Adding to Missile Movement Group (Arrow Type Group) --------
• Unit Group - Add (Last created unit) to MISSILES_ArrowGroup
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Animation - Change (Picked unit) flying height to MISSILES_ArrowHeight at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to 10.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowHeight - 2.00) as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])

#### Titanhex

Level 14
Correct me if I'm wrong but wouldn't that be a straight line equation that one does in order to figure out the fastest route from point A to point B?

If you create a triangle and do a squared times b squared minus c squared or something like that. cosign and tangent and whatnot, lol. Sorry I'm afraid I've forgotten this algebraic equation but it can be found in most pre-highschool text books, but for 3D models it will become more complex.

Anyways, that aside the big problem is that the unit adjusts itself to cliffs. After all, it is still a unit. It needs to take into account when that happens and adjust itself accordingly, otherwise it will always have that swoosh pattern in it's movement.

Someone who knows more will come along to help you, but this could be enough for you to attempt it in the meanwhile.

Last edited:

#### Diehard@Azeroth

Level 10
Altho Tithanhex did suggest the logical solution for this problem, sometimes when shooting the bullet shouldnt be able to go where it goes due to a collision (for realistic movement), i found this formula for the height (thanks to diablo.dk for telling me this was the one used in Elimination tournament, im also using this in a shooter im developing)
JASS:
`` z = Sin(Atan2(Z,maxDist))*DistanceTraveled``
The Distance traveled is the distance traveled (2d distance, meaning no heights are involved) The Z is the height of the location of the shooter (and + some height so it can calculate it as if it was shot from the gun, so maybe 25-50 if the shooter was a rifleman, its based on model), and the maxDist is the 2D Distance between the shooter and the place where the bullet is being shot, notice not 3d.

Hope i helped bro, iv been looking for the solution for ages The Math doesnt make much sense, i mean the logical conclusion would be (as Titanhex stated) is to use Prothagrean's theorem (rofl forgot how to write the name )

Good luck

#### Azeroc

Level 10
So... The dummy is that picked unit in my movement trigger. So... Where I put that script, or I do like
JASS:
``set real udg_z = Sin(Atan2(Z,maxDist))*DistanceTraveled``
and then set it's height with Z variable?

Whats "Sin" and "Atan" btw?

Last edited:

#### Diehard@Azeroth

Level 10
well the Z depends on the distance traveled, so it can be that line you wrote down, multiplied by the current distance traveled (thats what DistanceTraveled is, you can make it udg_DistanceTraveled so you just create a real variable to set it in GUI format)

so then the udg_z would be the new height,

Sin means Sine, and Atan2 i think is probably Tan -1.

;P

#### Azeroc

Level 10
• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Set MISSILES_maxDistance = (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc)
• Set MISSILES_DistanceTraveled = (Distance between Temp_Loc[0] and MISSILES_ArrowStartLoc)
• Custom script: set udg_Z = Sin(Atan2(udg_Z, udg_MISSILES_maxDistance)) * udg_MISSILES_DistanceTraveled
• Animation - Change (Picked unit) flying height to (MISSILES_ArrowHeight x Z) at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to 10.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowHeight - 2.00) as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])

I guess I misplaced something, because when I use just blank Z in height changing it's like equal to 0. What did I do wrong D:?

#### YourNameHere

Level 11
You have to set Z to GetLocationZ(Position of Caster) + 50 or something in order to make it work.

#### Azeroc

Level 10
But.... What about z = Sin(Atan2(Z,maxDist))*DistanceTraveled , My mind gonnnaaa blow up! x_x

#### The Reborn Devil

Level 22
You need to use GetLocationZ(which_location) to get the height of the ground and compensate for it by decreasing/increasing the height of the dummy.

Here's an example:

I don't have time to give you triggers now, but I hope the drawing will help.
If it isn't solved when I come back I will give you the triggers.

#### Attachments

• epic drawing.PNG
11.2 KB · Views: 385

#### Azeroc

Level 10
Ah, So I use Z instead of height? Anyway I shall try this.

EDIT: Sorry If I am annoying, but I guess I misplaced something again x_x.

• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Custom script: set udg_Z = GetLocationZ(udg_MISSILES_ArrowStartLoc)
• Animation - Change (Picked unit) flying height to (Z + MISSILES_ArrowHeight) at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to 10.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowHeight - 2.00) as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])

Last edited:

Level 30
If i understood correctly, you want to imitate the given warcraft 3 projectile movement.

Edit:

I used the following possibility.

Some simplifying variables:

a = Current angle from the projectile to the target
b = (Speed + current distance between target and projectile)/overall distance
c = initial flying height
d = Sin(3.14159*b) * curvation * overall distance (curvation = 0-1)
z = c + d + (current flying height of target - c) * (1-b)
z = z - terrain height at current projectile loc - 2*initial height of the target + current height of the target

The outcoming z is the flying height per interval. I i am sure there is a better possibility, but this one works flawless.

#### The Reborn Devil

Level 22
You could do this:

1. Store the flying height of the dummy + the height of the ground at the starting position in a variable.
2. At each interval you decrease that value with the new height of the terrain and set the flying height to that and then add that value back to the variable.

Ex.
If the missile is going to have a flying height of 50 at the beginning and the height of the ground is 200 then you must store the sum of those in a variable. When the missile has moved again and the height of the ground is 0 then you must set the missile's height to 250 (sum of flying height and the height of the ground at the beginning) - the height of the ground which is 0. Then when the missile goes over terrain with the height of 200 again the new height will be 250 - 200 which is 50, just like it was when it started. I hope you understand

#### Azeroc

Level 10
I tried this, but I did wrong again, I guess.

• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Set curvation = 1.00
• Set a = (Angle from Temp_Loc[0] to MISSILES_ArrowEndLoc)
• Set b = ((MISSILES_ArrowSpeed + (Distance between Temp_Loc[0] and MISSILES_ArrowEndLoc)) / (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc))
• Set c = 50.00
• Set d = ((Sin((3.14 x b))) x (curvation x (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc)))
• Custom script: set udg_Z = (udg_c + udg_d) + (0 - udg_c) * ( 1 - udg_b)
• Custom script: set udg_Z = (udg_Z - GetLocationZ(udg_Temp_Loc[0])) - (2 * 0) + 0
• Animation - Change (Picked unit) flying height to Z at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• Set MISSILES_ArrowHeight = (Current flying height of (Picked unit))
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to -1.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowHeight - 10.00) as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])
Also Initial and Current height of target is 0, cause target is ground, not unit.

@Reborn Trying that now.

EDIT: @Reborn, I kinda have problem that when arrow is between Cliff level 2 and zero, it kinda goes up... Like in this replay. http://www.hiveworkshop.com/forums/pastebin.php?id=vaflp6

• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowZHeight = (Load (Key arrow_zheight) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Custom script: set udg_Z = GetLocationZ(udg_Temp_Loc[0])
• Animation - Change (Picked unit) flying height to (MISSILES_ArrowZHeight - Z) at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• Set MISSILES_ArrowHeight = (Current flying height of (Picked unit))
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to 10.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowZHeight - 2.00) as (Key arrow_zheight) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowHeight as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])

Last edited:

#### Azeroc

Level 10
Right, now arrow goes like +200 height from every cliff level...

Also, same problem as In replay which I gave, arrow goes like /\ when between cliff level 2 and level 0.

• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowZHeight = (Load (Key arrow_zheight) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Set curvation = 0.00
• Set a = (Angle from Temp_Loc[0] to MISSILES_ArrowEndLoc)
• Set b = ((MISSILES_ArrowSpeed + (Distance between Temp_Loc[0] and MISSILES_ArrowEndLoc)) / (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc))
• Set c = 50.00
• Set d = ((Sin((3.14 x b))) x (curvation x (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc)))
• Set Z = ((c + d) + ((0.00 - c) + (1.00 - b)))
• Custom script: set udg_Z = (udg_Z - GetLocationZ(udg_Temp_Loc[0])) - (2 * 0) + 0
• Animation - Change (Picked unit) flying height to (MISSILES_ArrowZHeight - Z) at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• Set MISSILES_ArrowHeight = (Current flying height of (Picked unit))
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to 10.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowHeight - 1.00) as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])

#### The Reborn Devil

Level 22
EDIT: @Reborn, I kinda have problem that when arrow is between Cliff level 2 and zero, it kinda goes up... Like in this replay. http://www.hiveworkshop.com/forums/pastebin.php?id=vaflp6

• MISSILES Missile Movement 0x05
• Events
• Time - Every 0.05 seconds of game time
• Conditions
• Actions
• Unit Group - Pick every unit in MISSILES_ArrowGroup and do (Actions)
• Loop - Actions
• Set MISSILES_ArrowSource = (Load (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowStartLoc = (Load (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowEndLoc = (Load (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove)
• Set MISSILES_ArrowHeight = (Load (Key arrow_height) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowZHeight = (Load (Key arrow_zheight) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowMiddleReach = (Load (Key arrow_midreach) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowRange = (Load (Key arrow_range) of (Key (Picked unit)) from Table_MissileMove)
• Set MISSILES_ArrowSpeed = (Load (Key arrow_speed) of (Key (Picked unit)) from Table_MissileMove)
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_Unit[0] = (Picked unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• -------- ------------------------------------------------------------------------------ --------
• -------- Height Changing and Moving --------
• -------- ------------------------------------------------------------------------------ --------
• Custom script: set udg_Z = GetLocationZ(udg_Temp_Loc[0])
• Animation - Change (Picked unit) flying height to (MISSILES_ArrowZHeight - Z) at 1000.00
• Unit - Move (Picked unit) instantly to Temp_Loc[1]
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• -------- ------------------------------------------------------------------------------ --------
• -------- Hitting --------
• -------- ------------------------------------------------------------------------------ --------
• Set Temp_UGroup[0] = (Units within 500.00 of Temp_Loc[0])
• Set MISSILE_ArrowDummyHandle = (Picked unit)
• Unit Group - Pick every unit in Temp_UGroup[0] and do (Actions)
• Loop - Actions
• Set Temp_Loc[1] = (Position of (Picked unit))
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Current flying height of Temp_Unit[0]) Less than or equal to (Real((Point-value of (Picked unit))))
• ((Region centered at Temp_Loc[1] with size ((Mana of (Picked unit)), (Mana of (Picked unit)))) contains Temp_Unit[0]) Equal to True
• ((Owner of (Picked unit)) is an enemy of (Owner of Temp_Unit[0])) Equal to True
• ((Picked unit) is dead) Equal to False
• Then - Actions
• Set Temp_Loc[1] = (Temp_Loc[0] offset by MISSILES_ArrowSpeed towards (Facing of (Picked unit)) degrees)
• Unit - Cause Temp_Unit[0] to damage (Picked unit), dealing 50.00 damage of attack type Pierce and damage type Normal
• Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
• Unit - Kill Temp_Unit[0]
• -------- Removing/Cleaning --------
• Hashtable - Clear all child hashtables of child (Key MISSILE_ArrowDummyHandle) in Table_MissileMove
• Unit Group - Remove Temp_Unit[0] from MISSILES_ArrowGroup
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Else - Actions
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
• Custom script: call DestroyGroup(udg_Temp_UGroup[0])
• -------- ------------------------------------------------------------------------------ --------
• -------- If hit in ground. --------
• Set MISSILES_ArrowHeight = (Current flying height of (Picked unit))
• -------- ------------------------------------------------------------------------------ --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• MISSILES_ArrowHeight Less than or equal to 10.00
• Then - Actions
• Unit - Kill (Picked unit)
• Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Table_MissileMove
• Unit Group - Remove (Picked unit) from MISSILES_ArrowGroup
• Else - Actions
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving Everything for next loop. --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowZHeight - 2.00) as (Key arrow_zheight) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save (MISSILES_ArrowRange - MISSILES_ArrowSpeed) as (Key arrow_range) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowHeight as (Key arrow_height) of (Key (Picked unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMidPart as (Key arrow_midpart) of (Key (Picked unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])
Where do you initialize this:
• (Load (Key arrow_zheight) of (Key (Picked unit)) from Table_MissileMove)
?

Edit: Also, use udg_Temp_Loc[1] here:
• Custom script: set udg_Z = GetLocationZ(udg_Temp_Loc[0])

#### Azeroc

Level 10
• MISSILES Arrow Launch
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• (Ability being cast) Equal to Shoot!
• Actions
• For each (Integer A) from 1 to 1, do (Actions)
• Loop - Actions
• Set Temp_Unit[0] = (Triggering unit)
• Set Temp_Loc[0] = (Position of Temp_Unit[0])
• Set Temp_Loc[1] = (Target point of ability being cast)
• -------- ------------------------------------------------------------------------------ --------
• Unit - Create 1 Dummy - Arrow for (Owner of Temp_Unit[0]) at Temp_Loc[0] facing ((Angle from Temp_Loc[0] to Temp_Loc[1]) + (Random real number between -3.00 and 3.00)) degrees
• -------- ------------------------------------------------------------------------------ --------
• -------- Setting Variables for Dummy --------
• -------- ------------------------------------------------------------------------------ --------
• Set MISSILES_ArrowSource = (Triggering unit)
• Set MISSILES_ArrowStartLoc = (Position of MISSILES_ArrowSource)
• Set MISSILES_ArrowEndLoc = (Target point of ability being cast)
• Set MISSILES_ArrowRange = (Distance between MISSILES_ArrowStartLoc and MISSILES_ArrowEndLoc)
• Set MISSILES_ArrowHeight = 50.00
• Custom script: set udg_MISSILES_ArrowZHeight = (udg_MISSILES_ArrowHeight + GetLocationZ(udg_Temp_Loc[0]))
• Set MISSILES_ArrowMiddleReach = (MISSILES_ArrowRange / 2.00)
• Set MISSILES_ArrowSpeed = (MISSILES_ArrowRange / 20.00)
• -------- ------------------------------------------------------------------------------ --------
• -------- Saving them --------
• -------- ------------------------------------------------------------------------------ --------
• Hashtable - Save Handle OfMISSILES_ArrowSource as (Key arrow_source) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowStartLoc as (Key arrow_startloc) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save Handle OfMISSILES_ArrowEndLoc as (Key arrow_endloc) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowZHeight as (Key arrow_zheight) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowRange as (Key arrow_range) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowMiddleReach as (Key arrow_midreach) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowHeight as (Key arrow_height) of (Key (Last created unit)) in Table_MissileMove
• Hashtable - Save MISSILES_ArrowSpeed as (Key arrow_speed) of (Key (Last created unit)) in Table_MissileMove
• -------- ------------------------------------------------------------------------------ --------
• -------- Adding to Missile Movement Group (Arrow Type Group) --------
• Unit Group - Add (Last created unit) to MISSILES_ArrowGroup
• -------- ------------------------------------------------------------------------------ --------
• Custom script: call RemoveLocation(udg_Temp_Loc[0])
• Custom script: call RemoveLocation(udg_Temp_Loc[1])
EDIT: Nope, I tried Temp_Loc[1], still same problem as in replay.

Last edited:

#### hell gate

Level 14
may someone can help me with my missile sys?

• MS Globals
• Ereignisse
• Map initialization
• Bedingungen
• Aktionen
• Hashtabelle - Create a hashtable
• Set MS_Hash = (Last created hashtable)
• -------- Creating the hashtable --------
• -------- ================================ --------
• Set MS_MaxHeight = 2500.00
• -------- if a missile gets higher then this vaue it will killed --------
• Set MS_PlayableMapArena = (Playable map area)
• -------- if the missile will leave the rect it will also killed --------
• -------- ================================ --------
• Set MS_DummyUnit = MissleSystem (dummy)
• -------- the missile dummy unit --------
• -------- ================================ --------
• Custom script: set udg_MS_Missles = CreateGroup()
• -------- createing the missile group --------
• MS Init example1 and Read Me Kopieren
• Ereignisse
• Einheit - A unit Wird angegriffen
• Bedingungen
• (Unit-type of (Attacking unit)) Gleich Fighter
• Aktionen
• Set MSI_Caster = (Attacking unit)
• -------- the caster and the damage dealer --------
• Set MS_TempUnit[0] = (Attacked unit)
• -------- the temp unit (for the angle) --------
• -------- ================================ --------
• Set MSI_Distance = 2000.00
• -------- the max distance the missile can travel --------
• Set MSI_Speed = (2750.00 x 0.03)
• -------- the missile speed (converted) --------
• Set MSI_Damage = 20.00
• -------- how much damage the missile deal --------
• -------- the collisions radius --------
• -------- the radius of the damage --------
• Set MSI_SpeedIncraise = 0.00
• -------- how much the speed will incraised / 0.03 --------
• -------- ================================ --------
• Set MS_LeakPoint[0] = (Position of MSI_Caster)
• Set MS_LeakPoint[1] = (Position of MS_TempUnit[0])
• Set MSI_Angle = (Angle from MS_LeakPoint[0] to MS_LeakPoint[1])
• -------- ================================ --------
• Set MS_TempReal[5] = 5.00
• -------- ================================ --------
• Custom script: if GetUnitType(udg_MS_TempUnit[0]) == 2 then
• Custom script: set udg_MS_TempReal[6] = GetUnitHeightCylinder(udg_MS_TempUnit[0])/2
• Custom script: else
• Custom script: set udg_MS_TempReal[6] = 0.
• Custom script: endif
• -------- ================================ --------
• Set MS_TempReal[0] = (((Current flying height of MS_TempUnit[0]) + MS_TempReal[6]) - ((Current flying height of MSI_Caster) + MS_TempReal[5]))
• Set MS_TempReal[1] = (Distance between MS_LeakPoint[0] and MS_LeakPoint[1])
• Set MSI_ZAngle = (Atan2(MS_TempReal[0], MS_TempReal[1]))
• -------- ================================ --------
• Set MSI_MissleModel = Abilities\Weapons\WardenMissile\WardenMissile.mdl
• -------- ================================ --------
• Set MS_TempReal[2] = 0.60
• Custom script: set udg_MS_TempReal[3]=GetLocationZ(udg_MS_LeakPoint[0])
• Set MS_TempReal[4] = (Current flying height of MSI_Caster)
• -------- ================================ --------
• Set MSI_Angle = (MSI_Angle + (Random real number between -3.00 and 3.00))
• Set MSI_ZAngle = (MSI_ZAngle + (Random real number between -3.00 and 3.00))
• -------- ================================ --------
• Auslöser - Run MS Run <gen> (ignoring conditions)
• -------- ================================ --------
• Custom script: call RemoveLocation (udg_MS_LeakPoint[0])
• Custom script: call RemoveLocation (udg_MS_LeakPoint[1])
• MS Run
• Ereignisse
• Bedingungen
• Aktionen
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (MS Loop <gen> is on) Gleich False
• 'THEN'-Aktionen
• Auslöser - Turn on MS Loop <gen>
• 'ELSE'-Aktionen
• -------- turn the loop on --------
• Einheit - Create 1 MS_DummyUnit for (Owner of MSI_Caster) at MS_LeakPoint[0] facing MSI_Angle degrees
• -------- create the dummy unit --------
• Animation - Change (Last created unit)'s size to ((MS_TempReal[2] x 100.00)%, (MS_TempReal[2] x 100.00)%, (MS_TempReal[2] x 100.00)%) of its original size
• -------- changing the size of the missile --------
• Einheitengruppe - Add (Last created unit) to MS_Missles
• -------- adds the missile to the missile group --------
• -------- ------------------- --------
• Einheit - Add Krähengestalt to (Last created unit)
• Animation - Change (Last created unit) flying height to (MS_TempReal[4] + MS_TempReal[5]) at 0.00
• Einheit - Remove Krähengestalt from (Last created unit)
• -------- change the height of the missile --------
• Spezialeffekt - Create a special effect attached to the origin of (Last created unit) using MSI_MissleModel
• -------- create the missile effect --------
• -------- ================================ --------
• -------- ================================ --------
• Hashtabelle - Save Handle OfMSI_Caster as (Key Caster) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_Distance as (Key Distance) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_Speed as (Key Speed) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_Damage as (Key Damage) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_ZAngle as (Key ZAngle) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_MissleDeadModel as (Key DeadSFX) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_CollisionRadius as (Key CollisionsRad) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_Angle as (Key Angle) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save Handle Of(Last created special effect) as (Key UnitSFX) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_DamageRad as (Key DamageRad) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MSI_SpeedIncraise as (Key SpeedIncraise) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save (MS_TempReal[4] + MS_TempReal[5]) as (Key NormalHeight) of (Key (Last created unit)) in MS_Hash
• Hashtabelle - Save MS_TempReal[3] as (Key StartZ) of (Key (Last created unit)) in MS_Hash
• -------- ================================ --------
• -------- saves all things in the missile hash --------
• MS Loop
• Ereignisse
• Zeit - Every 0.03 seconds of game time
• Bedingungen
• Aktionen
• Einheitengruppe - Pick every unit in MS_Missles and do (Actions)
• Schleifen - Aktionen
• Set MS_TempUnit[0] = (Picked unit)
• Set MS_TempUnit[1] = (Load (Key Caster) of (Key (Picked unit)) in MS_Hash)
• -------- ================================ --------
• Einheit - Turn collision for MS_TempUnit[0] Aus
• -------- ================================ --------
• Set MS_TempReal[0] = (Load (Key Damage) of (Key (Picked unit)) from MS_Hash)
• Set MS_TempReal[1] = (Load (Key CollisionsRad) of (Key (Picked unit)) from MS_Hash)
• Set MS_TempReal[2] = ((Load (Key ZAngle) of (Key (Picked unit)) from MS_Hash) + 90.00)
• Set MS_TempReal[3] = ((Cos((Load (Key ZAngle) of (Key (Picked unit)) from MS_Hash))) x (Load (Key Speed) of (Key (Picked unit)) from MS_Hash))
• Set MS_TempReal[7] = (Load (Key DamageRad) of (Key (Picked unit)) from MS_Hash)
• -------- ================================ --------
• Set MS_LeakPoint[0] = (Position of (Picked unit))
• Set MS_LeakPoint[1] = (MS_LeakPoint[0] offset by MS_TempReal[3] towards (Load (Key Angle) of (Key (Picked unit)) from MS_Hash) degrees)
• -------- ================================ --------
• Custom script: call SetUnitX(udg_MS_TempUnit[0],GetLocationX(udg_MS_LeakPoint[1]))
• Custom script: call SetUnitY(udg_MS_TempUnit[0],GetLocationY(udg_MS_LeakPoint[1]))
• Einheit - Make (Picked unit) face (Load (Key Angle) of (Key (Picked unit)) from MS_Hash) over 0.00 seconds
• -------- ================================ --------
• -------- ================================ --------
• Set MS_TempReal[6] = ((Load (Key NormalHeight) of (Key (Picked unit)) from MS_Hash) + ((Sin((Load (Key ZAngle) of (Key (Picked unit)) from MS_Hash))) x (Load (Key Speed) of (Key (Picked unit)) from MS_Hash)))
• Hashtabelle - Save MS_TempReal[6] as (Key NormalHeight) of (Key (Picked unit)) in MS_Hash
• Custom script: set udg_MS_TempReal[8]=GetLocationZ(udg_MS_LeakPoint[1])
• Set MS_TempReal[9] = (MS_TempReal[6] + ((Load (Key StartZ) of (Key (Picked unit)) from MS_Hash) - MS_TempReal[8]))
• Hashtabelle - Save MS_TempReal[8] as (Key StartZ) of (Key (Picked unit)) in MS_Hash
• -------- ================================ --------
• Animation - Change MS_TempUnit[0] flying height to MS_TempReal[9] at 0.00
• -------- ================================ --------
• -------- ================================ --------
• Custom script: call SetUnitAnimationByIndex(udg_MS_TempUnit[0], R2I(udg_MS_TempReal[2]))
• -------- ================================ --------
• Hashtabelle - Save ((Load (Key Distance) of (Key (Picked unit)) from MS_Hash) - (Load (Key Speed) of (Key (Picked unit)) from MS_Hash)) as (Key Distance) of (Key (Picked unit)) in MS_Hash
• Hashtabelle - Save ((Load (Key Speed) of (Key (Picked unit)) from MS_Hash) + (Load (Key SpeedIncraise) of (Key (Picked unit)) from MS_Hash)) as (Key Speed) of (Key (Picked unit)) in MS_Hash
• -------- ================================ --------
• Custom script: set udg_MS_KillMissle= CheckForCollision(GetLocationX(udg_MS_LeakPoint[1]),GetLocationY(udg_MS_LeakPoint[1]),GetUnitFlyHeight(udg_MS_TempUnit[0]),udg_MS_TempReal[1], GetOwningPlayer(udg_MS_TempUnit[0]))
• -------- =========================================================================== --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• Or - Any (Conditions) are true
• Bedingungen
• MS_KillMissle Gleich True
• (MS_PlayableMapArena contains MS_TempUnit[0]) Gleich False
• (Current flying height of MS_TempUnit[0]) Größer gleich MS_MaxHeight
• (Current flying height of MS_TempUnit[0]) Kleiner gleich 1.00
• (Load (Key Distance) of (Key (Picked unit)) from MS_Hash) Kleiner gleich 0.00
• 'THEN'-Aktionen
• Custom script: call DamageUnitInRange(GetLocationX(udg_MS_LeakPoint[1]),GetLocationY(udg_MS_LeakPoint[1]),GetUnitFlyHeight(udg_MS_TempUnit[0]),udg_MS_TempReal[0],udg_MS_TempReal[7],udg_MS_TempUnit[1])
• Set MS_KillMissle = False
• Einheitengruppe - Remove MS_TempUnit[0] from MS_Missles
• Spezialeffekt - Destroy (Load (Key UnitSFX) of (Key (Picked unit)) in MS_Hash)
• Custom script: call SetUnitAnimationByIndex(udg_MS_TempUnit[0], 90)
• Spezialeffekt - Create a special effect attached to the origin of MS_TempUnit[0] using (Load (Key DeadSFX) of (Key (Picked unit)) from MS_Hash)
• Spezialeffekt - Destroy (Last created special effect)
• Hashtabelle - Clear all child hashtables of child (Key (Picked unit)) in MS_Hash
• Einheit - Add a 2.00 second Standard expiration timer to MS_TempUnit[0]
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'-Bedingungen
• (Number of units in MS_Missles) Gleich 0
• 'THEN'-Aktionen
• Auslöser - Turn off (This trigger)
• 'ELSE'-Aktionen
• 'ELSE'-Aktionen
• -------- ================================ --------
• Custom script: call RemoveLocation (udg_MS_LeakPoint[0])
• Custom script: call RemoveLocation (udg_MS_LeakPoint[1])

#### Azeroc

Level 10

Anyway, Reborn, It goes pretty good, there is only ONE problem. When arrow is between Cliff Level 2 and Cliff Level 0, arrow goes up and down, like /\ spike. Excepting this problem, missile moves pretty fine.

#### Azeroc

Level 10
And what use would be posting in this thread?

#### hell gate

Level 14
hmmmm. don't know ^^
may somebody look at my trigger too (i need it as fast as possibe)

Level 10
bump

#### D4RK_G4ND4LF

Level 19
too advanced for me ... sorry

don't spam

edit:
I used a modified version of a simple knockback system as a basis
however you won't be able to shoot through terrain but I just got an idea how to do that

edit2:
new version - now you can shoot threw massive walls!

edit3:
just to be sure you know:
the flying height of flying units on cliff edges is bugged
the flying height of units with storm crow form ont he edge of cliffs works perfectly

#### Attachments

• Bullet.w3x
20.9 KB · Views: 44
• Bullet2.w3x
23.2 KB · Views: 38
Last edited:

#### Azeroc

Level 10
Well... Shoot through stuff was just... example, in fact I need missile thingy like in ET (elim tournament). Anyway, gonna test this out.

EDIT1: Hmm, yes bullets go pretty straight, gonna try to copy formula. Thanks.

#### hell gate

Level 14
i'll update my missile system today. may you want to use it
(it includes unit collision and i'll add a instead missile sys and i also will add a dest collision sys)

Level 12

#### hell gate

Level 14

if you mean me
it's in the spell selection but i have to fix it because i have done some mistakes in the (vJass) unit collision sys

Status
Not open for further replies.

Replies
6
Views
875
Replies
2
Views
438
Replies
4
Views
2K
Replies
11
Views
815
Replies
4
Views
766