• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

mountains interfering with unit flying height

Status
Not open for further replies.
Level 9
Joined
Apr 7, 2010
Messages
480
hi. ive been trying to create a jet game.
i have a problem on making terrain (mountains) able to pass through by units.

to make it clear.
i added a trigger that allows players to increase/decrease the height of their unit. but when a unit is going to mountains. the game makes the unit increase the height automatically. so if any have ideas please tell me how.
 
Go to your unit in the Object Editor and scroll to:
160036-albums4747-picture50573.png


Set both values to 0.00.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Make a looping trigger (or a timer) and set actions:
  • Set Loc = Position of YourUnit
  • Custom script: set udg_Height = GetLocationZ(udg_Loc)
  • Unit - Set unit fly height(YourUnit,Constant height - Height,0.00)
(You need point variable Loc and real variable Height, also you'll most likely loop through a unit group (jets) so YourUnit will be PickedUnit)
Go to your unit in the Object Editor and scroll to:
160036-albums4747-picture50573.png


Set both values to 0.00.
This is also useful to make the fly smooth since it makes unit's pitch unaffectable by terrain Z change.
 
Level 9
Joined
Apr 7, 2010
Messages
480
sorry, i'm not yet that advanced to understand what your saying.
so basically. i just have to copy these 3 actions. and make a looping/timer event? like every 1 sec of game time?
 
Garfield, Unit - Change fly height doesn't exist ^^ there is such function in Animation section tho :p freshhand :D

@Klann, unfortunately you have to loop with periodic event ;/
  • init
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • <Garfield>
And it's even better to declare point 'Loc' at map initialization and use: MoveLocation() funcion instead of setting point each time.
  • Custom script: call MoveLocation(udg_Loc, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()))
 
Level 9
Joined
Apr 7, 2010
Messages
480
i cant find this on action. "Unit - Set unit fly height(YourUnit,Constant height - Height,0.00)"

and while saving. im having a pop up problem of this custom script "Custom script: set udg_Height = GetLocationZ(udg_Loc)"

whats the difference between the one posted by garfield and "Custom script: call MoveLocation(udg_Loc, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()))" by spinnaker?
 
KLANN!!!!! Read carefully! Set unit fly height is in Anitation section:
  • Animation - Set unit fly height to X at 0.00
About custom script, you probably haven't declared any variable at all :X
MoveLocation is more effective and improves performance - after all it's just one point (and the only one you will need for trigger all game long), instead of creating/destroying locations repeatedly.
 
Level 9
Joined
Apr 7, 2010
Messages
480
ohh sorry. i thought it was on Unit.
  • Set Loc = Position of YourUnit
  • Custom script: set udg_Height = GetLocationZ(udg_Loc)
  • Unit - Set unit fly height(YourUnit,Constant height - Height,0.00)

i didn't notice this one because i skipped to @Klann,
Garfield, Unit - Change fly height doesn't exist ^^ there is such function in Animation section tho :p freshhand :D

just added the triggers
...the unit pass through the mountain by changing the units height(not solved). instead it gets lower than the deep water(added one problem).
 
Last edited:
Level 9
Joined
Apr 7, 2010
Messages
480
ok. to explain it further.

when a unit goes to a mountain the unit height changes automatically right?
in reality when a jet hits a mountain, of course the jet will explode : ) that is what i want to achieve. but i wont if the unit always automatically changes its height whenever it gets close to a mountain.
 
Level 9
Joined
Apr 7, 2010
Messages
480
my unit already has a certain height.
but when i put the triggers you posted, the unit height goes below water (i think its 0).
and when it goes to mountains, it still changes height.
.....
also. if height is 0.00 it means that my jet is not flying ^^
 
Status
Not open for further replies.
Top