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

Non-working triggers...

Status
Not open for further replies.
Level 4
Joined
Jun 7, 2008
Messages
37
JASS:
function Trig_Result3_Actions takes nothing returns nothing
local location l 
local location p
local unit c
local integer f = 0
loop 
set l = GetRandomLocInRect(gg_rct_Respawn)
set p = GetRandomLocInRect(gg_rct_Respawn)
set c = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', l, 0.)
call UnitAddAbility(c, 'A004')
call IssuePointOrderLoc(c, "impale", p)
call UnitApplyTimedLife(c, 'BOsf', 3)
set f = f+1
exitwhen f == 5
endloop
call RemoveLocation(l)
call RemoveLocation(p)
set c = null
set l = null
set p = null
endfunction

//===========================================================================
function InitTrig_Result3 takes nothing returns nothing
    set gg_trg_Result3 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Result3, function Trig_Result2_Actions )
endfunction

JASS:
function I_Hate_Boolxpr takes nothing returns boolean
    return (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true)
endfunction

function Trig_Result4_Actions takes nothing returns nothing
local location l 
local unit t
local unit c
local integer f = 0
local group g
call GroupEnumUnitsInRect(g, gg_rct_Respawn, Condition(function I_Hate_Boolxpr))
loop 
set l = GetRandomLocInRect(gg_rct_Respawn)
set c = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', l, 0.)
set t = FirstOfGroup(g)
call UnitAddAbility(c, 'A005')
call SetUnitAbilityLevel(c, 'A005', 1)
call IssueTargetOrder(c, "thunderbolt", t)
call UnitApplyTimedLife(c, 'BOsf', 3)
call GroupRemoveUnit(g, t)
exitwhen IsUnitGroupEmptyBJ(g) == true
endloop
call RemoveLocation(l)
call DestroyGroup(g)
set g = null
set c = null
set l = null
endfunction

//===========================================================================
function InitTrig_Result4 takes nothing returns nothing
    set gg_trg_Result4 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Result4, function Trig_Result2_Actions )
endfunction

JASS:
function Trig_Result5_Actions takes nothing returns nothing
local location l = GetRandomLocInRect(gg_rct_Respawn)
local location p = GetRandomLocInRect(gg_rct_Respawn)
local unit c = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', l, 0.)
call UnitAddAbility(c, 'S001')
call IssuePointOrderLoc(c, "deathanddecay", p)
call UnitApplyTimedLife(c, 'BOsf', 3)
call RemoveLocation(l)
call RemoveLocation(p)
set c = null
set l = null
set p = null
endfunction

//===========================================================================
function InitTrig_Result5 takes nothing returns nothing
    set gg_trg_Result5 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Result5, function Trig_Result2_Actions )
endfunction

The one thing that they have in common is that they don't work. Could you please lend me a hand here?
 
Level 4
Joined
Jun 7, 2008
Messages
37
Oh, totally forgot that - the triggers are ran in another trigger:

JASS:
function Trig_Hocus_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000' 
endfunction

function Trig_Hocus_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = GetRandomInt(1, 7)
if i == 1 then
call KillUnit(u)
elseif i == 2 then
call TriggerExecute(gg_trg_Result2)
elseif i == 3 then
call TriggerExecute(gg_trg_Result3)
elseif i == 4 then
call TriggerExecute(gg_trg_Result4)
elseif i == 5 then
call TriggerExecute(gg_trg_Result5)
elseif i == 6 then
call SetGameSpeed(MAP_SPEED_FASTEST)
elseif i == 7 then
call SetGameSpeed(MAP_SPEED_SLOWEST)
endif
endfunction

//===========================================================================
function InitTrig_Hocus takes nothing returns nothing
    set gg_trg_Hocus = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hocus, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Hocus, Condition( function Trig_Hocus_Conditions ) )
    call TriggerAddAction( gg_trg_Hocus, function Trig_Hocus_Actions )
endfunction

I guess just calling the functions would be quicker, but I can't really bother with doing it unless it's required for them to work or something...
 
Level 11
Joined
Apr 6, 2008
Messages
760
MY GOD! lots and lots of locations :D

nah just kidding but i should use X/Y instead of locations wayyy better.

call TriggerExecute(gg_trg_Result4) i wouldnt use that

do like call Trig_Result4_Actions() instead

like

JASS:
function Trig_Result3_Actions takes nothing returns nothing
local unit c
local real min_x = GetRectMinX(gg_rct_Respawn) // u should save this in a Globals constant real (VJass)
local real min_y = GetRectMinY(gg_rct_Respawn) // -||-
local real max_x = GetRectMaxX(gg_rct_Respawn) // -||-
local real max_y = GetRectMaxY(gg_rct_Respawn) // -||-
local real x
local real y
local real tx
local real ty
local integer f = 0

loop
    set x = GetRandomReal(min_x,max_x)
    set y = GetRandomReal(min_y,max_y)
    set tx = GetRandomReal(min_x,max_x)
    set ty = GetRandomReal(min_y,max_y)
    set c = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', x,y, 0.)
    call UnitAddAbility(c, 'A004')
    call IssuePointOrder(c, "impale",x,y )
    call UnitApplyTimedLife(c, 'BOsf', 3)
    set f = f+1
    exitwhen f == 5
endloop

set c = null
endfunction


function Trig_Hocus_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction

function Trig_Hocus_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = GetRandomInt(1, 7)

if i == 1 then
call KillUnit(u)
elseif i == 2 then
call Trig_Result3_Actions()
elseif i == 3 then
//blAHBLAH
elseif i == 6 then
call SetGameSpeed(MAP_SPEED_FASTEST)
elseif i == 7 then
call SetGameSpeed(MAP_SPEED_SLOWEST)
endif
endfunction

function InitTrig_Hocus takes nothing returns nothing
    local trigger trig = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Trig_Hocus_Conditions ) )
    call TriggerAddAction( trig, function Trig_Hocus_Actions )
endfunction
 
Level 4
Joined
Jun 7, 2008
Messages
37
I dunno what's wrong, sometimes even the messages telling me which result I got (1,2,3, etc) won't appear...

JASS:
function Trig_Hocus_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000' 
endfunction

function Trig_Result2_Actions takes nothing returns nothing
local location l = GetRandomLocInRect(gg_rct_cast)
local location p = GetRandomLocInRect(gg_rct_cast)
local unit c = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', l, 0.)
call IssuePointOrderLoc(c, "inferno", p)
call UnitApplyTimedLife(c, 'BOsf', 3)
call RemoveLocation(l)
call RemoveLocation(p)
set c = null
set l = null
set p = null
endfunction

function Trig_Result3_Actions takes nothing returns nothing
local unit c
local real min_x = GetRectMinX(gg_rct_Respawn) // u should save this in a Globals constant real (VJass)
local real min_y = GetRectMinY(gg_rct_Respawn) // -||-
local real max_x = GetRectMaxX(gg_rct_Respawn) // -||-
local real max_y = GetRectMaxY(gg_rct_Respawn) // -||-
local real x
local real y
local real tx
local real ty
local integer f = 0
loop    
set x = GetRandomReal(min_x,max_x)    
set y = GetRandomReal(min_y,max_y)    
set tx = GetRandomReal(min_x,max_x)    
set ty = GetRandomReal(min_y,max_y)    
set c = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', x,y, 0.)       
call IssuePointOrder(c, "impale",x,y )    
call UnitApplyTimedLife(c, 'BOsf', 3)    
set f = f+1    
exitwhen f == 5
endloop
set c = null
endfunction

function I_Hate_Boolxpr takes nothing returns boolean
    return (IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true)
endfunction

function Trig_Result4_Actions takes nothing returns nothing
local location l 
local unit t
local unit c
local integer f = 0
local group g
call GroupEnumUnitsInRect(g, gg_rct_Respawn, Condition(function I_Hate_Boolxpr))
loop 
set l = GetRandomLocInRect(gg_rct_cast)
set c = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', l, 0.)
set t = FirstOfGroup(g)
call IssueTargetOrder(c, "thunderbolt", t)
call UnitApplyTimedLife(c, 'BOsf', 3)
call GroupRemoveUnit(g, t)
exitwhen IsUnitGroupEmptyBJ(g) == true
endloop
call RemoveLocation(l)
call DestroyGroup(g)
set g = null
set c = null
set l = null
set t = null
endfunction

function Trig_Result6_Actions takes nothing returns nothing
local unit t
local integer f = 0
local group g
loop 
call GroupEnumUnitsInRect(g, gg_rct_Respawn, Condition(function I_Hate_Boolxpr))
set t = FirstOfGroup(g)
call UnitAddAbility(t, 'A008')
call UnitRemoveAbility(t, 'A008')
call SetUnitFlyHeight(t, 1000., 1.)
call TriggerSleepAction(1.)
call SetUnitFlyHeight(t, 0., 1.)
call GroupRemoveUnit(g, t)
endloop
call DestroyGroup(g)
set g = null
set t = null
endfunction

function Trig_Result5_Actions takes nothing returns nothing
local location l = GetRandomLocInRect(gg_rct_cast)
local location p = GetRandomLocInRect(gg_rct_cast)
local unit c = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h001', l, 0.)
call IssuePointOrderLoc(c, "deathanddecay", p)
call UnitApplyTimedLife(c, 'BOsf', 5)
call RemoveLocation(l)
call RemoveLocation(p)
set c = null
set l = null
set p = null
endfunction


function Trig_Hocus_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer i = GetRandomInt(1, 8)
if i == 1 then
call KillUnit(u)
call DisplayTextToForce(GetPlayersAll(), "1")
elseif i == 2 then
call Trig_Result2_Actions()
call DisplayTextToForce(GetPlayersAll(), "2")
elseif i == 3 then
call Trig_Result3_Actions()
call DisplayTextToForce(GetPlayersAll(), "3")
elseif i == 4 then
call Trig_Result4_Actions()
call DisplayTextToForce(GetPlayersAll(), "4")
elseif i == 5 then
call Trig_Result5_Actions()
call DisplayTextToForce(GetPlayersAll(), "5")
elseif i == 6 then
call Trig_Result6_Actions()
call DisplayTextToForce(GetPlayersAll(), "6")
elseif i == 7 then
call SetGameSpeed(MAP_SPEED_FASTEST)
call DisplayTextToForce(GetPlayersAll(), "7")
elseif i == 8 then
call SetGameSpeed(MAP_SPEED_SLOWEST)
call DisplayTextToForce(GetPlayersAll(), "8")
endif
endfunction

//===========================================================================
function InitTrig_Hocus takes nothing returns nothing
    set gg_trg_Hocus = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hocus, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Hocus, Condition( function Trig_Hocus_Conditions ) )
    call TriggerAddAction( gg_trg_Hocus, function Trig_Hocus_Actions )
endfunction
 
Status
Not open for further replies.
Top