//TESH.scrollpos=23
//TESH.alwaysfold=0
function DisplayDeathMessage takes integer v, integer k returns nothing
local string victim = udg_Blood[v+13]
local string killer = udg_Blood[k+13]
local string array p
local integer count = 0
local integer random = GetRandomInt(1,8)
local unit u
local boolean victory = udg_Vars[k+60] + 1 >= I2R(udg_Score)
set p[1] = victim+" was torn to shreds by "+killer+"."
set p[2] = victim+" got Pwnt by "+killer+"."
set p[3] = victim+" had his ass whooped by "+killer+"."
set p[4] = killer+" wiped the floor with "+victim+"."
set p[5] = victim+" is teh noobzorz!"
set p[6] = victim+"'s face just got even uglier."
set p[7] = victim+" was annihilated by "+killer+"."
set p[8] = victim+" kicked the bucket."
set udg_Flamers[v] = null
set udg_Vars[k+60] = udg_Vars[k+60] + 1
call LeaderboardSetItemValue( bj_lastCreatedLeaderboard, LeaderboardGetPlayerIndex(bj_lastCreatedLeaderboard, Player(k)), R2I(udg_Vars[k+60]) )
loop
exitwhen count == 10
call DisplayTextToPlayer(Player(count), 0,0, p[random])
set count = count + 1
endloop
if GetPlayerController(Player(v)) == MAP_CONTROL_USER then
if v < 5 then
set udg_Flamers[v] = CreateUnit(Player(v), 'h002', -3619., -261., 0.)
else
set udg_Flamers[v] = CreateUnit(Player(v), 'h002', 3619., -261., 180.)
endif
call PanCameraToTimedLocForPlayer( Player(v), Location(GetUnitX(udg_Flamers[v]), GetUnitY(udg_Flamers[v])), 2. )
endif
set count = 0
if victory == true then
loop
exitwhen count == 10
if IsPlayerEnemy(Player(k), Player(count)) == true then
call CustomDefeatBJ( Player(count), "TRIGSTR_064" )
else
call CustomVictoryBJ( Player(count), true, true )
endif
set count = count + 1
endloop
endif
endfunction
Name | Type | is_array | initial_value |
Blood | string | Yes | |
Flame | effect | Yes | |
Flamers | unit | Yes | |
Score | integer | No | |
Vars | real | Yes |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Score_Set_Actions takes nothing returns nothing
set udg_Score = S2I(SubStringBJ(GetEventPlayerChatString(), 3, 5))
call LeaderboardSetLabelBJ( GetLastCreatedLeaderboard(), ( "Spike: Win at " + ( I2S(udg_Score) + " kills." ) ) )
call DisableTrigger(GetTriggeringTrigger())
endfunction
//===========================================================================
function InitTrig_Score_Set takes nothing returns nothing
set gg_trg_Score_Set = CreateTrigger( )
call DisableTrigger( gg_trg_Score_Set )
call TriggerRegisterPlayerChatEvent( gg_trg_Score_Set, Player(0), "-k", false )
call TriggerAddAction( gg_trg_Score_Set, function Trig_Score_Set_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Melee_Initialization_Actions takes nothing returns nothing
local group spike = CreateGroup()
local unit u
local integer count = 0
call CreateQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "TRIGSTR_053", "TRIGSTR_054", "ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn.blp" )
call GroupEnumUnitsOfPlayer(spike, Player(0), null)
loop
set u= FirstOfGroup(spike)
exitwhen u == null
call GroupRemoveUnit(spike, u)
call SetUnitOwner(u, Player(bj_PLAYER_NEUTRAL_EXTRA), true )
endloop
set udg_Blood[1] = "Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl"
set udg_Blood[2] = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
set udg_Blood[3] = "Objects\\Spawnmodels\\Human\\HumanBlood\\HeroBloodElfBlood.mdl"
set udg_Blood[4] = "Objects\\Spawnmodels\\Other\\HumanBloodCinematicEffect\\HumanBloodCinematicEffect.mdl"
set udg_Blood[5] = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodMortarTeam.mdl"
set udg_Blood[6] = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodPeasant.mdl"
set udg_Blood[7] = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodPriest.mdl"
set udg_Blood[8] = "Objects\\Spawnmodels\\NightElf\\NightElfBlood\\NightElfBloodDruidoftheClaw.mdl"
set udg_Blood[9] = "Objects\\Spawnmodels\\NightElf\\NightElfBlood\\NightElfBloodHippogryph.mdl"
set udg_Blood[10] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodGrunt.mdl"
set udg_Blood[11] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodHellScream.mdl"
set udg_Blood[12] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodWolfrider.mdl"
set udg_Blood[13] = "|CFFFF0000" + GetPlayerName(Player(0)) + "|R"
set udg_Blood[14] = "|CFF0000FF" + GetPlayerName(Player(1)) + "|R"
set udg_Blood[15] = "|CFF18E7BD" + GetPlayerName(Player(2)) + "|R"
set udg_Blood[16] = "|CFF520084" + GetPlayerName(Player(3)) + "|R"
set udg_Blood[17] = "|CFFFFFF00" + GetPlayerName(Player(4)) + "|R"
set udg_Blood[18] = "|CFFFF8A08" + GetPlayerName(Player(5)) + "|R"
set udg_Blood[19] = "|CFF18BE00" + GetPlayerName(Player(6)) + "|R"
set udg_Blood[20] = "|CFFE759AD" + GetPlayerName(Player(7)) + "|R"
set udg_Blood[21] = "|CFF949694" + GetPlayerName(Player(8)) + "|R"
set udg_Blood[22] = "|CFF7BBEF7" + GetPlayerName(Player(9)) + "|R"
call SetPlayerAbilityAvailable(Player(0),'A003',false)
call SetPlayerAbilityAvailable(Player(1),'A003',false)
call SetPlayerAbilityAvailable(Player(2),'A003',false)
call SetPlayerAbilityAvailable(Player(3),'A003',false)
call SetPlayerAbilityAvailable(Player(4),'A003',false)
call SetPlayerAbilityAvailable(Player(5),'A003',false)
call SetPlayerAbilityAvailable(Player(6),'A003',false)
call SetPlayerAbilityAvailable(Player(7),'A003',false)
call SetPlayerAbilityAvailable(Player(8),'A003',false)
call SetPlayerAbilityAvailable(Player(9),'A003',false)
set udg_Vars[40] = 1
set udg_Vars[41] = 1
set udg_Vars[42] = 1
set udg_Vars[43] = 1
set udg_Vars[44] = 1
set udg_Vars[45] = 1
set udg_Vars[46] = 1
set udg_Vars[47] = 1
set udg_Vars[48] = 1
set udg_Vars[49] = 1
loop
exitwhen count == 5
if GetPlayerController(Player(count)) == MAP_CONTROL_USER then
set udg_Flamers[count] = CreateUnit(Player(count), 'h002', -3620, -260, 0)
endif
set count = count + 1
endloop
loop
exitwhen count == 10
if GetPlayerController(Player(count)) == MAP_CONTROL_USER then
set udg_Flamers[count] = CreateUnit(Player(count), 'h002', 3620, -260, 180)
endif
set count = count + 1
endloop
call DestroyGroup(spike)
set u = null
set spike = null
call DisplayTextToPlayer( Player(0),0,0, "Host: Type '-k' plus any number to set winning kills. E.g: -k50." )
call EnableTrigger(gg_trg_Score_Set)
endfunction
//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
set gg_trg_Melee_Initialization = CreateTrigger( )
call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Leaderboard_Setup_Actions takes nothing returns nothing
local integer count = 0
call CreateLeaderboardBJ( GetPlayersAll(), "TRIGSTR_056" )
call LeaderboardDisplayBJ( true, GetLastCreatedLeaderboard() )
loop
exitwhen count == 10
if GetPlayerController(Player(count)) == MAP_CONTROL_USER then
call LeaderboardAddItemBJ( Player(count), GetLastCreatedLeaderboard(), GetPlayerName(Player(count)), 0 )
endif
set count = count + 1
endloop
endfunction
//===========================================================================
function InitTrig_Leaderboard_Setup takes nothing returns nothing
set gg_trg_Leaderboard_Setup = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Leaderboard_Setup, 1.00 )
call TriggerAddAction( gg_trg_Leaderboard_Setup, function Trig_Leaderboard_Setup_Actions )
endfunction
//TESH.scrollpos=64
//TESH.alwaysfold=0
function MissileCheck takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'h000'
endfunction
function UnitCheck takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'h002' and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0
endfunction
function SpikeCheck takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'h001'
endfunction
function Trig_Periodic_Actions takes nothing returns nothing
local integer count = 0
local integer count2
local unit u
local unit bomb
local unit u2
local real x
local real y
local real x2
local real y2
local real x3
local real y3
local real angle
local real temp1
local real temp2
local real temp3
local real height1
local real height2
local real height3
local group m = CreateGroup()
local group v = CreateGroup()
local group s = CreateGroup()
call GroupEnumUnitsOfPlayer(m, Player(13), Condition(function MissileCheck))
loop
exitwhen count == 10
set u = udg_Flamers[count]
if udg_Vars[count+40] == 2 then
set x = udg_Vars[count]
set y = udg_Vars[count+10]
set x2 = udg_Vars[count+20]
set y2 = udg_Vars[count+30]
set x3 = GetUnitX(u)
set y3 = GetUnitY(u)
set temp1 = SquareRoot((x2-x)*(x2-x)+(y2-y)*(y2-y)) //maxdist
set temp2 = SquareRoot((x3-x)*(x3-x)+(y3-y)*(y3-y)) //dist
if temp2 < temp1 + 5 then
set angle = udg_Vars[count+50]
set temp2 = (temp2*2)/temp1-1
set temp2 = (-temp2*temp2+1)*(temp1/2)
set temp3 = ((GetLocationZ(Location(x2,y2))-GetLocationZ(Location(x,y)))*(temp2/temp1))
set height1 = GetLocationZ(Location(x,y))
set height2 = GetLocationZ(Location(x2,y2))
set height3 = GetLocationZ(Location(x3,y3))
call SetUnitPosition(u, x3 + 20 * Cos(angle * (3.14/180)), y3 + 20 * Sin(angle * (3.14/180)))
if height2 >= height1 then
call SetUnitFlyHeight(u, temp2 + temp3 + height1 - height3, 0)
else
call SetUnitFlyHeight(u, temp2 + temp3 + height2 , 0)
endif
else
call DestroyEffect(udg_Flame[count])
set udg_Vars[count+40] = 1
call SetUnitPathing(u, true)
call SetUnitFlyHeight(u, 0, 0)
call UnitRemoveAbility(u, 'A003')
endif
elseif udg_Vars[count+40] == 3 then
set x = GetUnitX(u)
set y = GetUnitY(u)
set temp3 = udg_Vars[count+50]
if udg_Vars[count] > udg_Vars[count+10] then
set udg_Vars[count+10] = udg_Vars[count+10] + 1
call SetUnitPosition(u, x+10*Cos(temp3*(3.14/180.)), y+10*Sin(temp3*(3.14/180.)))
call GroupEnumUnitsInRange(s, x, y, 70, Condition(function SpikeCheck))
if FirstOfGroup(s) != null then
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) - 10)
call DestroyEffect(AddSpecialEffect(udg_Blood[GetRandomInt(1,12)],x,y))
if GetUnitState(u, UNIT_STATE_LIFE) < 1 then
call DisplayDeathMessage(count,R2I(udg_Vars[count+20]))
set udg_Vars[count+40] = 1
call DestroyEffect(AddSpecialEffect("Units\\Undead\\Abomination\\AbominationExplosion.mdl",x,y))
endif
endif
else
set udg_Vars[count+40] = 1
call SetUnitPathing(u, true)
endif
endif
set count = count + 1
endloop
loop
set bomb = FirstOfGroup(m)
exitwhen bomb == null
call GroupRemoveUnit(m, bomb)
set x = GetItemUserData(UnitItemInSlot(bomb,0))
set y = GetItemUserData(UnitItemInSlot(bomb,1))
set x2 = GetItemUserData(UnitItemInSlot(bomb,2))
set y2 = GetItemUserData(UnitItemInSlot(bomb,3))
set x3 = GetUnitX(bomb)
set y3 = GetUnitY(bomb)
set temp1 = SquareRoot((x2-x)*(x2-x)+(y2-y)*(y2-y))
set temp2 = SquareRoot((x3-x)*(x3-x)+(y3-y)*(y3-y))
if temp2 < temp1 + 5 then
set temp3 = GetItemUserData(UnitItemInSlot(bomb,4))
call SetUnitPosition(bomb, x3 + 40 * Cos(temp3*(3.14/180)),y3 + 40 * Sin(temp3*(3.14/180)))
call SetUnitFlyHeight(bomb, ((GetLocationZ(Location(x2,y2))-GetLocationZ(Location(x,y)))*(temp2/temp1)) - GetLocationZ(Location(x3,y3)) + GetLocationZ(Location(x,y)) ,0)
else
call GroupEnumUnitsInRange(v, x3,y3, 300, Condition(function UnitCheck))
loop
set u2 = FirstOfGroup(v)
exitwhen u2 == null
set count2 = GetPlayerId(GetOwningPlayer(u2))
if IsUnitEnemy(u2, Player(GetItemUserData(UnitItemInSlot(bomb,5)))) == true and udg_Vars[count2+40] == 1 then
set udg_Vars[count2+40] = 3.
call SetUnitPathing(u2, false)
set udg_Vars[count2+50] = (180/3.14)*Atan2(GetUnitY(u2)-y2,GetUnitX(u2)-x2)
set udg_Vars[count2] = R2I(GetUnitState(bomb,UNIT_STATE_MANA) * 5)
set udg_Vars[count2+10] = 0
set udg_Vars[count2+20] = GetItemUserData(UnitItemInSlot(bomb,5))
endif
call GroupRemoveUnit(v,u2)
endloop
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl",x3,y3))
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",x3,y3))
call KillUnit(bomb)
call RemoveUnit(bomb)
endif
endloop
call DestroyGroup(v)
call DestroyGroup(m)
call DestroyGroup(s)
set s = null
set m = null
set v = null
set u = null
set u2 = null
set bomb = null
endfunction
//===========================================================================
function InitTrig_Periodic takes nothing returns nothing
set gg_trg_Periodic = CreateTrigger( )
call TriggerRegisterTimerEvent(gg_trg_Periodic, 0.02, true)
call TriggerAddAction( gg_trg_Periodic, function Trig_Periodic_Actions )
endfunction
//TESH.scrollpos=4
//TESH.alwaysfold=0
function Trig_JumpAbil_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Trig_JumpAbil_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer p = GetPlayerId(GetOwningPlayer(u))
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x2 = GetLocationX(GetSpellTargetLoc())
local real y2 = GetLocationY(GetSpellTargetLoc())
call UnitAddAbility(u, 'A003')
set udg_Flamers[p] = u
set udg_Vars[p] = x
set udg_Vars[p+10] = y
set udg_Vars[p+20] = x2
set udg_Vars[p+30] = y2
set udg_Vars[p+40] = 2
set udg_Vars[p+50] = (180./3.14)*Atan2(y2-y,x2-x)
set udg_Flame[p] = AddSpecialEffectTarget("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl", u, "origin")
call SetUnitPathing(u, false)
set u = null
endfunction
//===========================================================================
function InitTrig_JumpAbil takes nothing returns nothing
set gg_trg_JumpAbil = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_JumpAbil, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_JumpAbil, Condition( function Trig_JumpAbil_Conditions ) )
call TriggerAddAction( gg_trg_JumpAbil, function Trig_JumpAbil_Actions )
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_RocketAbil_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Trig_RocketAbil_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x2 = GetLocationX(GetSpellTargetLoc())
local real y2 = GetLocationY(GetSpellTargetLoc())
local real face = (180.0/3.14)*Atan2(y2-y,x2-x)
local unit b = CreateUnit(Player(13), 'h000', x, y, face)
call SetUnitFlyHeight(b, 0, 0)
call UnitAddItemById(b, 'I000')
call UnitAddItemById(b, 'I000')
call UnitAddItemById(b, 'I000')
call UnitAddItemById(b, 'I000')
call UnitAddItemById(b, 'I000')
call UnitAddItemById(b, 'I000')
call SetItemUserData(UnitItemInSlot(b,0), R2I(x))
call SetItemUserData(UnitItemInSlot(b,1), R2I(y))
call SetItemUserData(UnitItemInSlot(b,2), R2I(x2))
call SetItemUserData(UnitItemInSlot(b,3), R2I(y2))
call SetItemUserData(UnitItemInSlot(b,4), R2I((180.0/3.14)*Atan2(y2-y,x2-x)))
call SetItemUserData(UnitItemInSlot(b,5), GetPlayerId(GetOwningPlayer(u)))
call SetUnitState(b, UNIT_STATE_MANA, GetUnitState(u,UNIT_STATE_MANA))
call UnitApplyTimedLife(b, 'BTLF', 3.)
call SetUnitState(u, UNIT_STATE_MANA, 1.)
call SetUnitPathing(b, false)
set u = null
set b = null
endfunction
//===========================================================================
function InitTrig_RocketAbil takes nothing returns nothing
set gg_trg_RocketAbil = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RocketAbil, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_RocketAbil, Condition( function Trig_RocketAbil_Conditions ) )
call TriggerAddAction( gg_trg_RocketAbil, function Trig_RocketAbil_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_MapRetain_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'h002'
endfunction
function Trig_MapRetain_Actions takes nothing returns nothing
call SetUnitPosition( GetTriggerUnit(),0,0)
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()),0,0, "TRIGSTR_057" )
endfunction
//===========================================================================
function InitTrig_MapRetain takes nothing returns nothing
set gg_trg_MapRetain = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_MapRetain, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_MapRetain, Condition( function Trig_MapRetain_Conditions ) )
call TriggerAddAction( gg_trg_MapRetain, function Trig_MapRetain_Actions )
endfunction