I can't figure out why isnt it working

Roku

New Member
Reaction score
3
Hey,
When i was really thinking im starting to get a hang of JASS, i got very disappointed that a simple trigger doesn't work. I tryed changing many things back as they were, but it still isnt working.

JASS:
scope SinisterStrike

private function Cond takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A008' ) ) then
        return false
    endif
    return true
endfunction

private function Action takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer s = GetHeroAgi(u,true)
    local real c = I2R(s)
    local real r = GetRandomReal(0.95,1.05)
    call BJDebugMsg("Init Trig")
    call UnitDamageTarget(u, GetSpellTargetUnit(), (700 + c) * r, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL , WEAPON_TYPE_WHOKNOWS)
    set u = null
endfunction

//===========================================================================
public function InitTrig_SinisterStrike takes nothing returns nothing
    local trigger t = CreateTrigger()
    call BJDebugMsg("Run Trig")
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond ) )
    call TriggerAddAction( t, function Action)
    set t = null
endfunction

endscope


Yes i know i have BJ's and the cond is wierd, those were the things i changed back and was hoping that it will work properly but it isnt. The scope name is the same as the trigger name, the rawcode is good, and none of the debug messages are showing up.
 
Reaction score
456
JASS:
public function InitTrig_SinisterStrike takes nothing returns nothing
    local trigger t = CreateTrigger()
    call BJDebugMsg("Run Trig")
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond ) )
    call TriggerAddAction( t, function Action)
    set t = null
endfunction

It would be like this after save:
JASS:
function SinisterStrike_InitTrig_SinisterStrike takes nothing returns nothing
    local trigger t = CreateTrigger()
    call BJDebugMsg("Run Trig")
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond ) )
    call TriggerAddAction( t, function Action)
    set t = null
endfunction


So, remove that public. Or then, remove that bolded part from InitTrig_SinisterStrike.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
I think this will work:

JASS:
scope SinisterStrike

private function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A008'
endfunction

private function Action takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer s = GetHeroAgi(u,true)
    local real c = I2R(s)
    local real r = GetRandomReal(0.95,1.05)
    call BJDebugMsg("Init Trig")
    call UnitDamageTarget(u, GetSpellTargetUnit(), (700 + c) * r, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL , WEAPON_TYPE_WHOKNOWS)
    set u = null
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond ) )
    call TriggerAddAction( t, function Action)
endfunction

endscope
 

Roku

New Member
Reaction score
3
Eh thanks alot.

Ghan +rep for showing me whats wrong, and Uberplayer +rep for rewriting the trigger and showing me how to improve the condition (had problems with this type before).
 
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