• 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.

[JASS] My Second Code

Status
Not open for further replies.
Level 2
Joined
Jun 15, 2007
Messages
12
JASS:
function CheckSpell takes nothing returns boolean
return GetSpellAbilityId()=='A04E'
endfunction


function Heal_BonusA  takes nothing returns nothing

local integer loopcounter = 0
local integer currentitem
local unit x
call DisplayTextToPlayer(Player(0),0,0,"HIT")

//========================================================
//Whatever Dagger
//========================================================
if UnitHasItemOfTypeBJ(GetTriggerUnit(),'I02A') == true then
set x = GetTriggerUnit()
set currentitem = 'I02A'

call CountNumberOfItemOnUnit(currentitem,GetTriggerUnit())
call TriggerSleepAction(.15)
loop
    set loopcounter = GetHandleInt(x, "sum") 
    exitwhen loopcounter == 0
    call Deal_Healing_Bonus(25)
    set loopcounter = loopcounter - 1
endloop
endif   
set x = null
//========================================================

endfunction



function InitTrig_HealBonus takes nothing returns nothing

    set gg_trg_HealBonus = CreateTrigger()
    call TriggerRegisterUnitEvent(gg_trg_HealBonus, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_HealBonus, Condition(function CheckSpell))
    call TriggerAddAction(gg_trg_HealBonus, function Heal_BonusA)
endfunction

Of all the errors in the world I get 'Invalid # Of Arguments' on call
JASS:
TriggerAddCondition(gg_trg_HealBonus, Condition(function CheckSpell))
. When I // the TriggerAddCondition and then try to save I get the 'Invalid # Of Arguments Except For the
JASS:
TriggerAddAction(gg_trg_HealBonus, function Heal_BonusA)


Wtf?


EDIT: Nevermind, fixed it. Changed TriggerRegisterUnitEvent to the BJ version of it. For some reason it was telling me the lines below & above were wrong (Thanks blizzard).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
JASS:
TriggerRegisterUnitEvent(gg_trg_HealBonus, EVENT_PLAYER_UNIT_SPELL_EFFECT)

uhh, that requires a unit to work since you are using the unit specific event and not the player generic event.

Also remember to change the event to the unit version or else it will not work well.
 
Try:
JASS:
function TriggerRegisterAnyUnitEventBJ takes trigger trig, playerunitevent whichEvent returns nothing
    local integer index

    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(trig, Player(index), whichEvent, null)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
endfunction

It only requires the trigger and the playerunitevent. :infl_thumbs_up:
 
Status
Not open for further replies.
Top