- Joined
- Jul 25, 2008
- Messages
- 126
I have this jass system someone made for me and its for classic mode on my game but if its tournament mode i want to turn it off i tried
but it didn't work can jass triggers not be turned off this way? do i have to use the custom script action? And if so what do i need to enter in it?
here's the code for the trigger i wanna turn off.
Code:
Trigger - Turn off Hero Dies <gen>
but it didn't work can jass triggers not be turned off this way? do i have to use the custom script action? And if so what do i need to enter in it?
here's the code for the trigger i wanna turn off.
Code:
//=========================================================================
// Returns the Name of the player in its color
//=========================================================================
function PlayerNameInColor takes player p returns string
return udg_color[GetPlayerId(p)+1]+GetPlayerName(p)+"|r"
endfunction
//=========================================================================
// Change+Show Dialog
//=========================================================================
function ShowCaptureDialog takes player to, player about returns nothing
call DialogSetMessage(udg_dialog[GetPlayerId(to)],"Kill "+PlayerNameInColor(about)+"?")
call DialogDisplay(to,udg_dialog[GetPlayerId(to)],true)
endfunction
//==========================================================================
// Dialog Button clicked: Trigger Action
//==========================================================================
function button_clicked takes nothing returns nothing
local integer i=GetPlayerId(GetTriggerPlayer())
local integer j=udg_dialog_target[i]
local force A
local force B
if udg_buttonKill[i]==GetClickedButton() then
call CustomDefeatBJ( Player(j), "Defeated")
else
set A=GetPlayersAllies(Player(j))
set B=GetForceOfPlayer(Player(j))
call SetForceAllianceStateBJ( A,B, bj_ALLIANCE_UNALLIED )
call SetForceAllianceStateBJ( B,A, bj_ALLIANCE_UNALLIED )
call DestroyForce(A)
call DestroyForce(B)
set A=GetForceOfPlayer(Player(j))
set B=GetPlayersAllies(Player(i))
call SetForceAllianceStateBJ(A ,B, bj_ALLIANCE_ALLIED_VISION )
call SetForceAllianceStateBJ( B, A, bj_ALLIANCE_ALLIED_VISION )
call DestroyForce(A)
call DestroyForce(B)
call ReviveHeroLoc(udg_hero[j],udg_hero_loc[j],false)
call SetPlayerColorBJ(Player(j),GetPlayerColor(Player(i)),true) //killed player gets color of killing player+change existing
endif
call RemoveLocation(udg_hero_loc[j])
set udg_hero_loc[j]=null
set j=0
loop
exitwhen j>=12
if udg_owned_by[j]==i then
exitwhen true
endif
set j=j+1
endloop
if j==12 then
set udg_dialog_target[i]=-1
else
set udg_dialog_target[i]=j
call ShowCaptureDialog(Player(i),Player(j))
set udg_owned_by[j]=-1
endif
endfunction
//==========================================================================
// Hero Kill Trigger Condition
//==========================================================================
function isHero takes nothing returns boolean
return IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO)
endfunction
//==========================================================================
// Hero Kill Trigger Action
//==========================================================================
function Trig_hero_kill_Actions takes nothing returns nothing
local player killer=GetOwningPlayer(GetKillingUnit())
local player owned=GetOwningPlayer(GetDyingUnit())
if GetPlayerId(owned)>=12 then //neutral Hero killed
return
endif
set udg_hero[GetPlayerId(owned)]=GetDyingUnit()
set udg_hero_loc[GetPlayerId(owned)]=GetUnitLoc(udg_hero[GetPlayerId(owned)])
if udg_dialog_target[GetPlayerId(killer)]==-1 then
call ShowCaptureDialog(killer,owned)
set udg_dialog_target[GetPlayerId(killer)]=GetPlayerId(owned)
else
set udg_owned_by[GetPlayerId(owned)]=GetPlayerId(killer)
endif
endfunction
//===========================================================================
// Init Trigger
//===========================================================================
function InitTrig_Hero_Kill takes nothing returns nothing
local integer i=0
local trigger t
set t=CreateTrigger()
loop
exitwhen i>=12
set udg_dialog[i]=DialogCreate()
set udg_buttonKill[i]=DialogAddButton( udg_dialog[i], "Kill",0 )
set udg_buttonCap[i]=DialogAddButton( udg_dialog[i], "Capture",0 )
set udg_owned_by[i]=-1
set udg_dialog_target[i]=-1
call TriggerRegisterDialogEvent(t, udg_dialog[i] )
set i=i+1
endloop
call TriggerAddAction(t,function button_clicked)
set t=null
set t=CreateTrigger( )
call TriggerAddCondition(t, Condition( function isHero ) )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction(t, function Trig_hero_kill_Actions )
set t=null
//color strings
set udg_color[1] = "|c00ff0303"
set udg_color[2] = "|c000042ff"
set udg_color[3] = "|c001ce6b9"
set udg_color[4] = "|c00540081"
set udg_color[5] = "|c00fffc01"
set udg_color[6] = "|c00ff8000"
set udg_color[7] = "|c0020c000"
set udg_color[8] = "|c00e55bb0"
set udg_color[9] = "|c00959697"
set udg_color[10] = "|c007ebff1"
set udg_color[11] = "|c00106246"
set udg_color[12] = "|c004e2a04"
endfunction
Last edited: