• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Flying hieght

Status
Not open for further replies.
Level 15
Joined
Aug 18, 2007
Messages
1,390
Hello all
Im making on a map named Aircraft (https://www.hiveworkshop.com/forums/showthread.php?t=43148)
But i need a trigger i cant do myself. This is what it should:
Every 0.01 sec it should pick all units owned by players and set their flying hieght to thier flyinghieght - the ground hieght. If theyre flying hight is lower than 1, the flying hieght would be set to 1. If the flying hieght is 1 the picked unit will die.
If you have troubles understand it maybe this could help:
  • Event:
    • Every 0.01 seconds of gametime
  • Actions:
    • Unit Group - Pick all units in units in playable map area and do actions:
    • If/then/else
      • If Condition:
        • Player - Owner of picked unit is a player equal to true
      • Then Actions:
        • Unit - Set Picked units flying hieght to Flying hieght of picked unit - ground hieght of ground at posision of picked unit
hmm something like that i think :)
Hope i could get some help ^^
 
Last edited by a moderator:
  • Unknown
    • 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
              • (Current flying height of (Picked unit)) Less than or equal to 1.00
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
      • -------- I would never understand how to remove groups so no leaks :( --------
 
Here's your trigger without leaks, GhostWolf:

  • ]Unknown
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • 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
              • (Current flying height of (Picked unit)) Less than or equal to 1.00
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
 
Erm, what's the difference between Cliff Height and Ground Height?
As GhostWolf said:
You can change the ground's height without cliffs
(why did i post that??)

[offtopic] custom scripts pwn ^^
Agree ^^

When i start the game, it says that your Custom script set udg_ZHeight = GetLocationZ(udg_TempPoint)
got errors, and the trigger will be disabled....
Should TempPoint be a Variable whit Point type?
 
Last edited:
Thanks to the custom script you can do it like this

  • Unknown
    • Events
      • Events
    • Conditions
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
      • Custom script: set udg_ZHeight = GetLocationZ(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Set Real = ((Current flying height of (Triggering unit)) - ZHeight)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Real Equal to 0.00
        • Then - Actions
          • Unit - Explode (Triggering unit)
        • Else - Actions
 
Hmm it still dont work, trigger disables. This is the Bug Report:

function Trig_Test_Func001Func005C takes nothing returns boolean
if ( not ( udg_Real <= 1.00 ) ) then
return false
endif
return true
endfunction

function Trig_Test_Func001A takes nothing returns nothing
set udg_TempLoc = GetUnitLoc(GetEnumUnit())
set udg_ZHeight = GetLocationZ(udg_TempLoc)
call RemoveLocation(udg_TempLoc)
set udg_Real = ( GetUnitFlyHeight(GetEnumUnit()) - udg_Zhieght )
if ( Trig_Test_Func001Func005C() ) then
call KillUnit( GetEnumUnit() )
else
endif
endfunction

function Trig_Test_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_Test_Func001A )
endfunction

//===========================================================================
function InitTrig_Test takes nothing returns nothing
set gg_trg_Test = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Test, 0.01 )
call TriggerAddAction( gg_trg_Test, function Trig_Test_Actions )
endfunction
 
That's just your code written in JASS. What does it say in the bug report? (in that top white area, or console, or whatever you call it)

Examples:

- invalid number of arguments
- undefined variable
- sintax error
- constant function calling a non-constant function

Get it?
 
whatsworng.jpg

this is the trigger for my hieght, anyone spots bugs?
even though my movement trigger is 0.01 and the increase hieght by arrowkeys is in, i still can increase hieght.. is it because i die or?
im sorry for the bad quallity, i hope you can read it :/
 
ok, ive found the bug and fixed it, now i enabled the hieght trigger and this is what happens:

Your hieght is changed to 0 everytime the trigger runs (0.07). But you dont die, even if the real is 0. Whats wrong whit the ZHieght or the trigger?

HieghtTrigger.jpg

its the Hieght Trigger

Edit: Whit 1 in the real condition, you will die
Comeon... someone post!
 
Last edited:
Status
Not open for further replies.
Back
Top