//Handlers script by kattana.
function Cache takes nothing returns gamecache
if (udg_cache==null) then
set udg_cache=InitGameCache("cach")
endif
return udg_cache
endfunction
function Handler takes handle h returns integer
return h
return 0
endfunction
function Change takes handle h,string s, integer i returns nothing
call StoreInteger(Cache(), I2S(Handler( h )), s, i)
endfunction
function Changes takes handle h, string s, unit i returns nothing
call StoreUnit(Cache(), I2S(Handler( h )), s, i)
endfunction
function StoreHandle takes handle h, handle j, string s returns nothing
call Change(h,s,Handler(j))
endfunction
function GetLinkedInteger takes handle h,string s returns integer
return GetStoredInteger(Cache(),I2S(Handler( h )),s)
endfunction
function GetLinkedUnit takes handle h,string s returns unit
return GetLinkedInteger(h,s)
return null
endfunction
function GetLinkedDoodad takes handle h,string s returns handle
return GetLinkedInteger(h,s)
return null
endfunction
function Flush takes handle h returns nothing
call FlushStoredMission(Cache(),I2S(Handler( h )))
endfunction
//dontask
function destroysfx takes effect e, effect f returns nothing
call TriggerSleepAction( 0.1 )
call DestroyEffect(e)
call DestroyEffect(f)
set e = null
set f = null
endfunction
Name | Type | is_array | initial_value |
cache | gamecache | No | |
colour | string | Yes | |
Dialog | dialog | No | |
dialogscore | integer | No | |
fraglimit | integer | No | |
frags | integer | No | |
kill10 | button | No | |
kill20 | button | No | |
kill30 | button | No | |
kill40 | button | No | |
kill50 | button | No | |
Kills | integer | Yes | |
unit | unit | No | |
win | boolean | No | |
winner | player | No |
//*****************************************************************************
//* Name: TeleFrag
//* Author: Edwardswolentoe
//* Description: Telefragness!
//* Variables: None.
//*****************************************************************************
function cond takes nothing returns boolean
if ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("smart") ) ) then
return true
endif
if ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("patrol") ) ) then
return true
endif
if ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("move") ) ) then
return true
endif
return false
endfunction
function cond2 takes nothing returns boolean
if ( not ( GetUnitTypeId(GetOrderedUnit()) == 'E000' ) ) then
return false
endif
if ( not cond() ) then
return false
endif
return true
endfunction
function ohmy takes nothing returns boolean
return ( IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetOrderedUnit())) == false)
endfunction
function damagere takes nothing returns nothing
call UnitDamageTargetBJ( GetOrderedUnit(), GetEnumUnit(), 9999.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
endfunction
function Move takes nothing returns nothing // This is the moving trigger.
local unit u
local location l
local location o
local effect e
local group g
local effect r
local location p
call SetUnitVertexColorBJ( GetOrderedUnit(), 80.00, 100, 100, 20.00 )
set p = GetUnitLoc(GetOrderTargetUnit())
set o = GetOrderPointLoc()
set u = GetOrderedUnit()
call SetUnitPositionLocFacingLocBJ( GetOrderedUnit(), o, o )
call SetUnitPositionLocFacingLocBJ( GetOrderedUnit(), p, p )
call IssueImmediateOrderBJ(GetOrderedUnit(), "stop" )
set l = GetUnitLoc(GetOrderedUnit())
set g = GetUnitsInRangeOfLocMatching(150.00, l, Condition(function ohmy))
call ForGroupBJ( g, function damagere )
call AddSpecialEffectTargetUnitBJ( "origin", GetOrderedUnit(), "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" )
call DestroyEffect(GetLastCreatedEffectBJ())
call AddSpecialEffectTargetUnitBJ( "origin", GetOrderedUnit(), "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl" )
set e = GetLastCreatedEffectBJ()
call AddSpecialEffectTargetUnitBJ( "origin", GetOrderedUnit(), "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl" )
set r = GetLastCreatedEffectBJ()
call IssueImmediateOrderBJ(GetOrderedUnit(), "stop" )
call RemoveLocation(l)
call RemoveLocation(o)
call RemoveLocation(p)
call DestroyGroup(g)
set p = null
set l = null
set o = null
set u = null
set g = null
call destroysfx(r, e)
set r = null
set e = null
call SetUnitVertexColorBJ( GetOrderedUnit(), 100, 100, 100, 0 )
endfunction
//===========================================================================
function InitTrig_Fragger takes nothing returns nothing
set gg_trg_Fragger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fragger, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fragger, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_Fragger, Condition( function cond2 ) )
call TriggerAddAction( gg_trg_Fragger, function Move )
endfunction
function Condia takes nothing returns boolean
if ( not ( GetUnitTypeId(GetDyingUnit()) == 'E000' ) ) then
return false
endif
return true
endfunction
function Revive takes nothing returns nothing
local effect e
local location l = GetRectCenter(GetPlayableMapRect())
call TriggerSleepAction( 2.5 )
call ReviveHeroLoc( GetDyingUnit(), l, false )
call SetUnitInvulnerable( GetDyingUnit(), true )
call AddSpecialEffectTargetUnitBJ( "origin", GetDyingUnit(), "Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl" )
set e = GetLastCreatedEffectBJ()
call TriggerSleepAction( 2.5 )
call SetUnitInvulnerable( GetDyingUnit(), false )
call DestroyEffectBJ(e)
call RemoveLocation(l)
set e = null
endfunction
//===========================================================================
function InitTrig_Death takes nothing returns nothing
set gg_trg_Death = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Death, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Death, Condition( function Condia ) )
call TriggerAddAction( gg_trg_Death, function Revive )
endfunction
function Trig_Computer_Copy_Func001C takes nothing returns boolean
if ( ( GetPlayerController(Player(0)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(1)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(2)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(3)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(4)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(5)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(6)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(7)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(8)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(9)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(10)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
if ( ( GetPlayerController(Player(11)) == MAP_CONTROL_COMPUTER ) ) then
return true
endif
return false
endfunction
function Trig_Computer_Copy_Conditions takes nothing returns boolean
if ( not Trig_Computer_Copy_Func001C() ) then
return false
endif
return true
endfunction
function Trig_Computer_Copy_Func002Func001001002 takes nothing returns boolean
return ( GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_COMPUTER )
endfunction
function Trig_Computer_Copy_Func002Func001A takes nothing returns nothing
local location v
set v = GetRandomLocInRect(GetPlayableMapRect())
call IssuePointOrderLocBJ( GetEnumUnit(), "smart", v )
call RemoveLocation(v)
set v = null
endfunction
function Trig_Computer_Copy_Func002Func002001002 takes nothing returns boolean
return ( GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_COMPUTER )
endfunction
function Trig_Computer_Copy_Func002Func002Func002001002002 takes nothing returns boolean
return (GetFilterUnit() != udg_unit)
endfunction
function Trig_Computer_Copy_Func002Func002Func002A takes nothing returns nothing
local location l
set l = GetUnitLoc(GetEnumUnit())
call IssuePointOrderLocBJ( udg_unit, "smart", l )
call RemoveLocation(l)
set l = null
endfunction
function Trig_Computer_Copy_Func002Func002A takes nothing returns nothing
local group h
set udg_unit = GetEnumUnit()
set h = GetRandomSubGroup(1, GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Computer_Copy_Func002Func002Func002001002002)))
call ForGroupBJ( h, function Trig_Computer_Copy_Func002Func002Func002A )
call DestroyGroup(h)
set h = null
endfunction
function Trig_Computer_Copy_Func002C takes nothing returns boolean
if ( not ( GetRandomInt(1, 6) == 6 ) ) then
return false
endif
return true
endfunction
function Trig_Computer_Copy_Actions takes nothing returns nothing
local group o
local group p
if ( Trig_Computer_Copy_Func002C() ) then
set o = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Computer_Copy_Func002Func002001002))
call ForGroupBJ( o, function Trig_Computer_Copy_Func002Func002A )
else
set p = GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Computer_Copy_Func002Func001001002))
call ForGroupBJ( p, function Trig_Computer_Copy_Func002Func001A )
endif
call DestroyGroup(o)
call DestroyGroup(p)
set o = null
set p = null
endfunction
//===========================================================================
function InitTrig_Computer_Movement takes nothing returns nothing
set gg_trg_Computer_Movement = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Computer_Movement, 0.80 )
call TriggerAddCondition( gg_trg_Computer_Movement, Condition( function Trig_Computer_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Computer_Movement, function Trig_Computer_Copy_Actions )
endfunction