• 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] Easy way to let this function only runs once

Status
Not open for further replies.
Level 2
Joined
Dec 14, 2012
Messages
20
guys is there a easy way to run rosh_tide_ulti function only once?


JASS:
function Rosh_tide_ulti takes nothing returns nothing  // i want this to only run once
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0,20,"You are so dead!!!|c00ff0000Rwaaar!!!")
call O5R() // this calls the rosh/tide ulti I used this more then once
endfunction
function Z5R takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit s=GetAttacker()
local trigger t=null
local integer i=0
local real a=0
local unit f=null
local group g=null
local boolexpr b=null
local integer l=0
local real r=0
local timer tm=null
local integer PJE=5
if GetUnitState(u,UNIT_STATE_LIFE) <= 6000 and GetUnitTypeId(GetTriggerUnit())=='n909' then
call Rosh_tide_ulti()// this calls tide ulti on rosh
endif 
if SVX()then
call SEX()
endif
 
Level 2
Joined
Dec 14, 2012
Messages
20
At the beginning put disabletrigger ( this trigger ) also don't forget to null all local handles so they don't leak u can also do it under the events but I can't see them since u didn't post the whole trigger

so if edit this but its not triggering maybe I did it wrong

JASS:
function Rosh_tide_ulti takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0,20,"You are so dead!!!|c00ff0000Rwaaar!!!")
call O5R() // this call the spell
endfunction
function rosh_conditions takes nothing returns nothing
local unit u=GetTriggerUnit()
if GetUnitState(u,UNIT_STATE_LIFE) <= 6000 and GetUnitTypeId(GetTriggerUnit())=='n909' then
call Rosh_tide_ulti()//this adds the text and calls spell
endif
endfunction
function rosh_ulti_int takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction(t,function rosh_conditions)
set t=null 
endfunction
 
so if edit this but its not triggering maybe I did it wrong

JASS:
function Rosh_tide_ulti takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0,20,"You are so dead!!!|c00ff0000Rwaaar!!!")
call O5R() // this call the spell
endfunction
function rosh_conditions takes nothing returns nothing
local unit u=GetTriggerUnit()
if GetUnitState(u,UNIT_STATE_LIFE) <= 6000 and GetUnitTypeId(GetTriggerUnit())=='n909' then
call Rosh_tide_ulti()//this adds the text and calls spell
endif
endfunction
function rosh_ulti_int takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction(t,function rosh_conditions)
set t=null 
endfunction

This fails because you can't register EVENT_PLAYER_UNIT_ATTACKED as a generic event.

Try changing to TriggerRegisterUnitEvent(t,<roshan-unit>,EVENT_PLAYER_UNIT_ATTACKED).

Additionally, if you want to destroy trigger t within Rosh_tide_ulti function, then trigger t must not be a local trigger!
 
Status
Not open for further replies.
Top