Why doesn't the unit cast the ability?

Evan1993

Ultra Cool Member
Reaction score
30
I don't get it.
It cant be the wait because it is plenty long enough and it cant be the unit because it gets the ability...

Code:
function Trig_Hunger_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A07L' ) ) then
        return false
    endif
    return true
endfunction
function Trig_Hunger_Actions takes nothing returns nothing
    local unit u
    set u =  GetSpellTargetUnit()
    call UnitAddAbility( u,  'A032')
    call IssueImmediateOrderById( u , 'A032' )
    call PolledWait (1.50)
    call UnitRemoveAbility( u, 'A032'  )
endfunction

//===========================================================================
function InitTrig_Hunger takes nothing returns nothing
    set gg_trg_Hunger = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hunger, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Hunger, Condition( function Trig_Hunger_Conditions ) )
    call TriggerAddAction( gg_trg_Hunger, function Trig_Hunger_Actions )
endfunction
 
D

Dino.pl

Guest
Try replacing
Code:
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hunger, EVENT_PLAYER_UNIT_SPELL_CAST )
with
Code:
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hunger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
 
D

Dino.pl

Guest
Then
Code:
call IssueImmediateOrderById( u , 'A032' )
must be wrong.
Make it in GUI and then convert it.
 

Evan1993

Ultra Cool Member
Reaction score
30
If I think I know what your saying then I'd get this IssueImmediateOrderBJ witch is not what I what. I'm useing an item ability so that it whould not work.
 
D

Dino.pl

Guest
What I'm trying to say:
Try to make the function in GUI - check if it works by running the trigger withing your JASS function.
If it does, convert it to custom text and copy into the JASS trigger.
 

Evan1993

Ultra Cool Member
Reaction score
30
um, like this?
I tested it and it didn't work.

Code:
HungerGUI
    Events
        Unit - A unit Begins casting an ability
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Hunger 
    Actions
        Custom script:   local unit u
        Custom script:   set u =  GetSpellTargetUnit()
        Custom script:   set udg_LOCALGUI = u
        Unit - Add Life Feed  to LOCALGUI
        Custom script:   call IssueImmediateOrderById( u , 'A032' )
        Wait 2.00 seconds
        Custom script:   set udg_LOCALGUI = u
        Unit - Remove Life Feed  from LOCALGUI
 
D

Dino.pl

Guest
Um, no, not like this.
If you don't get any help, I'll post a working trigger tomorrow.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
IssueImmediateOrderById doesn't take the ability id as an argument, it takes another integer.

To find out what this integer is give the ability to a unit, make this trigger:
Code:
    Events
        Unit - A unit Is issued an order with no target
        Unit - A unit Is issued an order targets a point
        Unit - A unit Is issued an order targets an object
    Conditions
    Actions
        Custom script:   call BJDebugMsg( I2S( GetIssuedOrderId() ) )
Then order that unit to cast the spell youself.

The numer that pop up on the screen is what you should write insteed of the 'A032' in the IssueImmediateOrderById function.
 

emjlr3

Change can be a good thing
Reaction score
395
an idea I had that would be much better then you current set up

create a local trigger that runs when the units cast an ability, if it is equal to the ability u added, then remove the ability

thus there is no wait, and it will look better
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top