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

Many triggers in one

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
I'm learning JASS so i've got 2 questions.
-I saw few times that several triggers are squeezed inside single trigger,but i don't know how to do it because i can't add multiple events for different actions inside single trigger =/
Shortly,how to add functions of multiple triggers into one trigger?

-Why doesn't this work:
JASS:
function Drone_Bomb_Cast takes nothing returns nothing
    local location Loc1
    local location Loc2
    set Loc1 = GetUnitLoc(GetTriggerUnit())
    set Loc2 = GetSpellTargetLoc()
    call CreateUnitAtLoc(GetPlayerId(GetOwningPlayer(GetTriggerUnit())),'h002',Loc1,AngleBetweenPoints(Loc1,Loc2))
endfunction

It says invalid argument type for last line.
 
Last edited:
Ok, first off: More than one trigger events into a single trigger.
You will firstly need a trigger with the main event. Let's say that we want a passive skill, which, when you take damage, it will heal you for 3* damage taken. Here:
JASS:
function Trig_On_Conditions takes nothing returns boolean
    return GetLearnedSkill() == 'AHbn'
endfunction

function NewTrigger takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real r = GetEventDamage()
    local real r2 = r * 3
    call SetWidgetLife (u, r2)
    set u = null
endfunction

function Trig_On_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent (t, u, EVENT_UNIT_DAMAGED)
    call TriggerAddAction (t, function NewTrigger)
    set u = null
endfunction

//===========================================================================
function InitTrig_On takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( t, Condition( function Trig_On_Conditions ) )
    call TriggerAddAction( t, function Trig_On_Actions )
endfunction

Second, should be:
JASS:
call CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()),'h002',Loc1,AngleBetweenPoints(Loc1,Loc2))
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Thanks,just one more question. Can i,for example,create a trigger that will execute at the start of map which will create all map's triggers so all triggers are actually put in one.
Also,do i have to null local variable 't'?

EDIT: can't give you +repz0rz cuz i must spread first,sry =/
 
Last edited:
Status
Not open for further replies.
Top