• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Cinematic: SetUnitFlyHeight is looking at me doing nothing

Status
Not open for further replies.
Level 17
Joined
Dec 11, 2014
Messages
2,004
Let's say I'm making a Cinematic, and my Dude (gg_unit_H001_0013) is gonna Teleport a LOT in my Fight. Therefore, I used this Snippet as I'm too lazy.

JASS:
function TL takes location l, real i, real stay, real out returns nothing
 local location upos = GetUnitLoc(gg_unit_H001_0013)
 local effect p = AddSpecialEffectLoc("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", upos)
 local unit dl = CreateUnitAtLoc(Player(0), 'Dum2', upos, 270)
 local timer ti = CreateTimer()
 local timer tstay = CreateTimer()
 local timer tout = CreateTimer()
   set bj_lastCreatedUnit = dl
     call SetUnitAnimation(gg_unit_H001_0013, "stand channel")
     call GroupAddUnit(udg_Turn_Group, dl)
     call UnitAddAbility(dl, 'Arav')
     call SetUnitFlyHeight(dl, 800.00, 800.00 / i)
     call UnitRemoveAbility(dl, 'Arav')
     call TimerStart(ti, i, false, function go)
     call TimerStart(tstay, i + stay, false, function back)
     call TimerStart(tout, i + stay + out, false, function finish)
  call DestroyEffect(p)
  call RemoveLocation(upos)
 set udg_TLloc = l
 set upos = null
 set p = null
 set dl = null
 set ti = null
 set tstay = null
 set tout = null
endfunction

Give it where to Create, how much to channel, how much to stay invisible, how much to wait for coming back. The Whole Thing is Functioning, so other Functions who the Timers are Refering are working, BUT!
call SetUnitFlyHeight(dl, 800.00, 800.00 / i) Is doing nothing. It's just Watching me killing myself why a Native doesn't work when the GUI version does.

Any Ideas? Why isn't it working?

Side-note: Hive's JASS highlighter is a bit different than JNGP's :p
Took me a while to find my 'Arav' in there -__-
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
JNGP can be configured, but I agree black underlined rawcodes are better. What is the real i set to? because afaik the last argument is actually how many seconds it should take him, so if you set it to something like 2 it will take him 400 seconds to fly to 800 height, and you cant really notice that change(unless Im completly wrong and then ignore what I said)
 
Level 6
Joined
Jun 18, 2004
Messages
119
JASS:
     call UnitAddAbility(dl, 'Arav')
     call SetUnitFlyHeight(dl, 800.00, 800.00 / i)
     call UnitRemoveAbility(dl, 'Arav')
perhaps removing the Arav ability causes it to stop its (current) flyheight change? What we usually do is add/remove Arav and afterwards change the flyheight. Just a thought though.
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
Thank you for your Comments! I'll try to Answer them all.

Alright, Giving everything I have used and Changed now. Also:

'Dum2' is a Flying Unit.
'Dum2' has 0 Collision Pathing thingie.

JASS:
function go takes nothing returns nothing
    call SetUnitX(gg_unit_H001_0013, GetLocationX(udg_TLloc))
    call SetUnitY(gg_unit_H001_0013, GetLocationY(udg_TLloc))
    call ShowUnit(gg_unit_H001_0013, false)
    call UnitAddAbility(bj_lastCreatedUnit, 'Arav')
    call SetUnitFlyHeight(bj_lastCreatedUnit, 0.00, 0.00)
    call UnitRemoveAbility(bj_lastCreatedUnit, 'Arav')
    call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 0.1)
   call RemoveLocation(udg_TLloc)
endfunction

function back takes nothing returns nothing
 local location upos = GetUnitLoc(gg_unit_H001_0013)
 local effect p = AddSpecialEffectLoc("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", upos)
 local unit dl = CreateUnitAtLoc(Player(0), 'Dum2', upos, 270)
   set bj_lastCreatedUnit = dl
     call ShowUnit(gg_unit_H001_0013, true)
     call SetUnitAnimation(gg_unit_H001_0013, "stand channel")
     call GroupAddUnit(udg_Turn_Group, dl)
     call UnitAddAbility(dl, 'Arav')
     call SetUnitFlyHeight(dl, 0, 0)
  call DestroyEffect(p)
  call RemoveLocation(upos)
 set upos = null
 set p = null
 set dl = null
endfunction

function finish takes nothing returns nothing
    call UnitAddAbility(bj_lastCreatedUnit, 'Arav')
    call SetUnitFlyHeight(bj_lastCreatedUnit, 0, 0.00)
    call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 0.1)
    call SetUnitAnimation(gg_unit_H001_0013, "stand")
endfunction

function TL takes location l, real i, real stay, real out returns nothing
 local location upos = GetUnitLoc(gg_unit_H001_0013)
 local effect p = AddSpecialEffectLoc("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", upos)
 local unit dl = CreateUnitAtLoc(Player(0), 'Dum2', upos, 270)
 local timer ti = CreateTimer()
 local timer tstay = CreateTimer()
 local timer tout = CreateTimer()
   set bj_lastCreatedUnit = dl
     call SetUnitAnimation(gg_unit_H001_0013, "stand channel")
     call GroupAddUnit(udg_Turn_Group, dl)
     call UnitAddAbility(dl, 'Arav')
     call SetUnitFlyHeight(dl, 800.00, 0)
     call TimerStart(ti, i, false, function go)
     call TimerStart(tstay, i + stay, false, function back)
     call TimerStart(tout, i + stay + out, false, function finish)
  call DestroyEffect(p)
  call RemoveLocation(upos)
 set udg_TLloc = l
 set upos = null
 set p = null
 set dl = null
 set ti = null
 set tstay = null
 set tout = null
endfunction

JNGP can be configured, but I agree black underlined rawcodes are better. What is the real i set to? because afaik the last argument is actually how many seconds it should take him, so if you set it to something like 2 it will take him 400 seconds to fly to 800 height, and you cant really notice that change(unless Im completly wrong and then ignore what I said)
Rate in Flying Height is [Height / time]. (Found it in a recent thread by Bribe)

Anything else in your map using setunitflyheight which could interfere? Your formula looks correct. You don't have to remove the ability after setting the fly height - you can do it before. It just has to be done once per unit.
Erm... Yes. Paladon's Jump system. But I guess It doesn't interfere, am I right?

Removed Removing 'Arav'. Not Working.

Just a small question: What did you use for the "i" variable?

I sense a divide by nil error.

The Teleport has 3 phases:
1. The Guy starts channeling for "i" seconds. In "i" seconds, "dl" will reach 800.00 Flying Height.
2. The Guy is Invisible and Hidden for "stay" seconds.
3. How Long ("out") it channels to come back to normal.
I sense a divide by nil error
Whut.

JASS:
     call UnitAddAbility(dl, 'Arav')
     call SetUnitFlyHeight(dl, 800.00, 800.00 / i)
     call UnitRemoveAbility(dl, 'Arav')
perhaps removing the Arav ability causes it to stop its (current) flyheight change? What we usually do is add/remove Arav and afterwards change the flyheight. Just a thought though.
Wait, did just iNfraNe, winner of the Cinematic contest and Maker of The Cinematic System I'll use later answer me? Wow!

So you Add AND remove Arav, not Add, Use and Remove! I always thought it's like the first one.

Removed Removing 'Arav'. Not Working.

What is Arav?

Storm Crow form ability from Druid of the Talon. Use it to be able to Fly.

he asked what you pass into function as the first argument, not where you use i, that is very apparent from the code

?

So! Still Not working :p
but Thank you for your kind comments :)
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
Thank you again for your comments.

Yep, infrane is active again. Pretty good times!

:D
make it in gui and convert. see if it still doesn't.

How should I make it a Call then? Also, the BJ is the same as the Native. Worthless BJ I'd Say (Some BJ's are sometimes useful ima).
You didn't answer my question. What did you input for "i" when you tested this?

2.
Yea, what inputs did you use when you tested? Also, did you try placing debug messages in between all lines to see if the thread crashes somewhere?

call TL(udg_Temp_P, 2, 2, 2)

Also, there isn't any "Thread Crash". The Timers work properly, the whole thing as well. Even the Trigger isn't crashed (the one with the call).
 
Level 6
Joined
Jun 18, 2004
Messages
119
Just a thought again:

you use the gg_unit_H001_0013 variable for all stuff, except for the flyheight. That and dl from the looks of it is a dummy unit. What is it you're actually trying to make change in flyheight? Actually, just tell us what you want to do exactly, then we can easily find the mistake and correct it :)
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
Thanks for your kind comments. I'll do my best to answer them correctly.



You don't need to have Arav/Amrf on unit when changing his height, instead add it and delete, and then start to manipulate with height. game will think unit can fly once this ability been added to him

Erm... OK, but still this doesn't solve the problem :p
Is the unit "dl" properly created?

Yes.
Try setting your dummy unit s movement type to fly and see
if it helps

It already is flying movement type in OE.
Just a thought again:

you use the gg_unit_H001_0013 variable for all stuff, except for the flyheight. That and dl from the looks of it is a dummy unit. What is it you're actually trying to make change in flyheight? Actually, just tell us what you want to do exactly, then we can easily find the mistake and correct it :)

gg_unit_H001_0013 is the guys I'd like to TL(Teleport [by] Lightning {dl}) and dl is the Dummy Lightning ('Dum2'). gg_unit_H001_0013 is an Actor, teleporting a Lot. That's what I want. I could do it in GUI, but I just wanted to use a Custom script due to me being too lazy.

PS: udg_Turn_Group is a Unit Group (really?) that Turns people. Not sure whether this is a problem or not :p
 
Level 6
Joined
Jun 18, 2004
Messages
119
So this dummy unit has a lightning model and you want that to move in the z axis? I still don't have a clear picture of what you want. Can you copy this function to a map with all that's needed and show it? I'll give it a shot then.
 
Level 6
Joined
Jun 18, 2004
Messages
119
Status
Not open for further replies.
Top