Need Some Help With Unit Fly Height

CrackUps

New Member
Reaction score
7
I've begun to create a map and was just working with the Hero selection and am having trouble setting the fly height of one of the units after it is purchased.

The unit is the 'Dragonhawk Rider' I want the units movement type to be Foot but I want it to have a fly height of 150. I've got a trigger that should set the unit's fly height after it is purchased.

Basically what the trigger does is check to see what type of unit is purchased and if it is the Dragonhawk Rider it adds and removes the 'Storm Crow Form' ability and then sets the units fly height to 150 however there appears to be no change.

I'm not sure if my description is easy enough to understand so I've attached the map for someone to have a look at the triggers, it shouldnt be hard it's the very beginning of the creation of the map and there's only 5 triggers at the moment.

Could someone please take a look at this and identify the problem for me or suggest alternatives,

Thanks.
 

Attachments

  • Arena.w3x
    70.7 KB · Views: 113

UndeadDragon

Super Moderator
Reaction score
447
I am not sure if the problem is in the trigger. I changed the movement type to Hover and it works fine. It cannot pass through trees, for example.
 

CrackUps

New Member
Reaction score
7
Well I'm sure there is some sort of problem with the trigger, instead of changing the units fly height for example try make the trigger kill the unit.

So instead of:

call UnitAddAbility(h, 'Arav')
call UnitRemoveAbility(h, 'Arav')
call SetUnitFlyHeight(h, 150.00, 0.00)

change it to:

call KillUnit(h)

Again nothing happens when you do this so some how its not registering what the last created unit is or something like that.
 

CrackUps

New Member
Reaction score
7
I think the hover works because in the object editor the fly height is set to 150.

I dont think its this:

JASS:
if GetUnitTypeId(u) == 'N000' then


Because if I put in:

JASS:
call BJDebugMsg("Test")


After it then in game after you select the Dragonhawk it displays the message so it must recognize the unit type is 'N000'.

I think I'll just use the movement type hover rather then trigger it but I still wanna find out the cause of this problem.
 

Tom Jones

N/A
Reaction score
437
The problem is that CreateUnit(...) doesn't assign anything to bj_lastCreatedUnit. Thus the unit your referencing is either null or some undesired unit. To solve this assign the unit directly to h:

JASS:
function Trig_Purchase_Hero_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit s =  GetSoldUnit()
    local unit h
    local player p = GetOwningPlayer(s)
    call RemoveUnit(s)
    set h = CreateUnit(p, GetUnitTypeId(u), 0, 0, bj_UNIT_FACING) //Correct.
    //set h = bj_lastCreatedUnit
    if GetUnitTypeId(u) == 'N000' then
        call UnitAddAbility(h, 'Arav')
        call UnitRemoveAbility(h, 'Arav')
        call SetUnitFlyHeight(h, 150.00, 0.00)
    else
    endif
    set u = null
    set s = null
    set h = null
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top