What's wrong with this function?

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
JASS:
function Stun takes unit WhichUnit returns nothing
    local location Point
    set Point = GetUnitLoc(WhichUnit)
    call CreateNUnitsAtLoc( 1, 'u000', Player(PLAYER_NEUTRAL_AGGRESSIVE), Point, bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
    call UnitAddAbilityBJ( 'A00D', GetLastCreatedUnit() )
    call IssueTargetOrderBJ( GetLastCreatedUnit(), "thunderbolt", WhichUnit )
    call RemoveLocation (Point)
endfunction

'A00D' is an ability based off Storm Bolt and stuns perfectly, with a duration of 0.00 so that the buff can be manually removed.

I tried calling this function, but it doesn't work. The strange thing is that I made it with GUI actions, converted them and changed the variables. The original actions, however, work perfectly. Did I change something extra or miss something out?

EDIT: Apparently it was some error with calling the function directly onto preplaced units. Setting them to a variable and calling it on them instead worked fine.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
In the editor it says thunderbolt >.<

As for the unit creation, that was an interesting thing to learn.
 

luorax

Invasion in Duskwood
Reaction score
67
In the editor it says thunderbolt >.<

What the object editor says, that's the correct. Or create a new trigger, place an "issue XYZ Order" action in it and convert it to custom text.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
pkmf... you just learning jass? if so i would direct you ->here<-, its where i learned jass :)
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Dawut? I've been using functions for a while now, but I'm not really planning to code in full JASS anytime soon. Thanks for the concern anyway :)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
see all that red in your original trigger? those are BJs, or blizzard.j that basically call another function, ie:
[ljass]call DoNothing()[/ljass] actually calls:
JASS:
function DoNothing takes nothing returns nothing
endfunction


sometimes they call something inside, like: [ljass]call TriggerRegisterAnyUnitEvent(trigger, UNIT_DIES_EVENT)[/ljass]

actually does this:

JASS:
function TriggerRegisterAnyUnitEvent takes trigger t, event e returns event//i think, this is freehand
    local integer i = 1
    loop
        exitwhen i == CountPlayersInForce(bj_FORCE_ALL_PLAYERS)
        call TriggerRegisterPlayerUnitEvent(t, i, null, e)
        set i = i + 1
    endloop
endfunction


remember this is freehand, but i believe thats what it calls
so it actually adds an event for every player, when you could just register them for individual players (like making conditions for the trigger), there are many versions of BJs and they all call some other function or functions, sometimes all they do is plug in the parameters into another function period, you can get rid of them by clicking on them, seeing what they do, and pulling that out and using that instead
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top