//TESH.scrollpos=240
//TESH.alwaysfold=0
function CleanBlood takes nothing returns nothing
call KillUnit(object.o.coreUnit)
//call object.o.remove()
endfunction
//*********************************************************************************************************************************
// [Object System]
// Creator: Vladimir Angelov
//
// This system uses custom value!
//*********************************************************************************************************************************
// [STATIC VARIABLES]
//
// object object.o
// ... The current unit that is being manipulated by the engine. This can be used while working with the events.
//
// object object.oc
// ... When an object collides, this is the object it has collided to.
//
// real object.gravAcc
// ... Gravity acceleration.
//
// constant integer object.flyID = 'hfly'
// ... The ID of the spell book containing the crow form ability, which will allow the units to fly.
// ... You might have to set this manually in the system.
//
// [MEMBER VARIABLES]
//
// trigger onTick
// ... Add actions to this trigger, in order to execute them after calculating the physics for each object every tick.
// ... You can use 'object.o' to get the object currently having physics applied to.
//
// trigger onGround
// ... Executes every tick while the object is colliding with the ground.
//
// trigger onOutOfBounds
// ... Executes every tick the object is out of the playable map bounds. Use this to prevent crashes.
//
// trigger onCollide
// ... Not yet implemented.
//
// trigger onStop
// ... Executes every time the unit has 0 velocity in all directions.
//
// unit coreUnit
// ... The unit to which this object is connected. This unit is the one that will have physics applied to.
//
// real radius
// ... Radius of the object. It is not yet used.
//
// real height
// ... Height of the object. It is not yet used.
//
// real mass
// ... The more mass it has, the less effect there will be when adding force to it.
//
// real friction
// ... A coeficient which determines how much speed does the object lose each tick while colliding with the ground.
// ... You can set this to 1.0 if you don't want the object to slide when touching the ground.
//
// real bounce
// ... A coeficient which determines how much speed does the object lose towards the z-coordinate on every bounce.
// ... You can set this to 0.0 if you don't want the object to be bouncy.
//
// real velX, velY, velZ
// ... Velocity of the object.
//
// real accX, accY, accZ
// ... Acceleration of the object.
//
// real locX, locY, locZ
// ... Current location of the object on the map. Note that 'locZ' is not the unit's flying heigth
// ... but the actual z-coordinate.
//
// NOTE: Add any custom member variables to the object in order to be able to 'attach' stuff to it.
// You can use the core unit's custom value to refer to it's object parent like this:
// object(GetUnitUserData(u))
//
// [MEMBER METHODS]
//
// nothing addGravity()
// ... Adds the gravitational acceleration to the object.
// ... Any object that doesn't have this called will not be affected by gravity.
//
// nothing addGravityEx(real mod)
// ... Add the gravitational acceleration to the object, but with modifier strength.
// ... -> mod: The gravitation strength gets multiplied by this value.
//
// nothing addAccel(accX, accY, accZ)
// ... Increases the acceleration of the object by a given amount in all three directions.
// ... -> accX, accY, accZ: Bonus acceleration.
//
// nothing addAccelToAngle(acc, hangle, vangle)
// ... Adds acceleration towards given angles. Can be used for platformer gravity.
// ... -> acc: Bonus acceleration.
// ... -> hangle: Horizontal angle towards which to add the acceleration.
// ... -> vangle: Vertical angle.
//
// nothing addAccelToLoc(acc, x, y, z)
// ... Adds acceleration towards a given 3D point. Can be used for gravity hole functions.
// ... -> acc: Bonus acceleration.
// ... -> x, y, z: Coordinates of the point, to which to accelrate.
//
// nothing push(pushX, pushY, pushZ)
// ... Pushes an object with given forces in all three directions.
// ... Note that this will have greater effect on lighter objects, and lesser effect on heavier ones.
// ... -> pushX, pushY, pushZ: Forces with which to push the object towards the directions.
//
// nothing pushToAngle(push, vangle, hangle)
// ... Pushes an object with a given force towards a given direction.
// ... Note that this will have greater effect on lighter objects, and lesser effect on heavier ones.
// ... -> push: The force with which you push the object.
// ... -> vangle: Vertical angle of the direction, towards which you push it.
// ... -> hangle: Horizontal angle.
//
// nothing pushToLoc(push, x, y, z)
// ... Pushes an object with a given force towards a given 3D point on the map.
// ... Note that this will have greater effect on lighter objects, and lesser effect on heavier ones.
// ... -> push: The force with which you push the object. The heaver it is, the less it will move.
// ... -> x, y, z: Coordinates of the location towards which the object will go.
//
// nothing remove()
// ... Call this when you are no longer going to need this object. Destroys all handles and frees the object index.
// ... This will however not kill or remove the core unit from the game.
//
// [STATIC METHODS]
// object object.create(u, radius, mass)
// ... Creates a new object out of a given unit.
// ... -> u: The object will be made out of this unit.
// ... -> radius: Not used yet.
// ... -> mass: Check 'real mass' for information.
//
// nothing explosion(damager, dmg, boom, x, y, z, rad)
// ... Creates an explosion at given coordinates which pushes enemies away.
// ... -> damager: The unit which will deal the damage.
// ... -> dmg: The amount of damage dealt. The farther the units are, the less damage will be dealt.
// ... Full damage will be done to a unit which is at 0 distance away from the center of the explosion.
// ... -> boom: The amount of push done to every unit inside the explosion perimeter.
// ... -> x, y, z: Coordinates of the explosion.
// ... -> rad: Perimeter of the explosion.
//
//*********************************************************************************************************************************
struct object
//Globals
static group all
static object o
static object oc
static real tickdelay
static group collideGroup
static unit collideUnit
static boolexpr collideCondition
static integer count
//Configuration
static real gravAcc = 980.665
static real maxRadius = 180
//Constants
static constant integer flyID = 'hfly'
//Events
trigger onTick
trigger onGround
trigger onOutOfBounds
trigger onCollide
trigger onStop
//Core Unit
unit coreUnit
boolean useTick
//Statistics
real radius
real height
real mass
real bounce
real friction
//Velocity
real velX
real velY
real velZ
//Acceleration
real accX
real accY
real accZ
//Coordinates
real locX
real locY
real locZ
//Custom Values
real impactDamage
integer impactGore
integer impactGoreType
real impactAoE
real impactPush
boolean underWater
method addGravity takes nothing returns nothing
set this.accZ = this.accZ - object.gravAcc
endmethod
method addGravityEx takes real mod returns nothing
set this.accZ = this.accZ - object.gravAcc * mod
endmethod
method addAccel takes real accX, real accY, real accZ returns nothing
set this.accX = this.accX + accX
set this.accY = this.accY + accY
set this.accZ = this.accZ + accZ
endmethod
method addAccelToAngle takes real acc, real hangle, real vangle returns nothing
local real power = acc
local real temp = power * Cos(bj_DEGTORAD * vangle)
set this.accZ = this.accZ + power * Sin(bj_DEGTORAD * vangle)
set this.accX = this.accX + temp * Cos(bj_DEGTORAD * hangle)
set this.accY = this.accY + temp * Sin(bj_DEGTORAD * hangle)
endmethod
method addAccelToLoc takes real acc, real x, real y, real z returns nothing
local real dx = x - this.locX
local real dy = y - this.locY
local real dist = SquareRoot(dx * dx + dy * dy)
call this.addAccelToAngle(acc, Atan2(dy, dx) * bj_RADTODEG, Atan2(z - this.locZ, dist) * bj_RADTODEG)
endmethod
method push takes real pushX, real pushY, real pushZ returns nothing
set this.velX = this.velX + pushX
set this.velY = this.velY + pushY
set this.velZ = this.velZ + pushZ
endmethod
method pushToAngle takes real push, real hangle, real vangle returns nothing
local real power = push / this.mass
local real temp = power * Cos(bj_DEGTORAD * vangle)
set this.velZ = this.velZ + power * Sin(bj_DEGTORAD * vangle)
set this.velX = this.velX + temp * Cos(bj_DEGTORAD * hangle)
set this.velY = this.velY + temp * Sin(bj_DEGTORAD * hangle)
endmethod
method pushToLoc takes real push, real x, real y, real z returns nothing
local real dx = x - this.locX
local real dy = y - this.locY
local real dist = SquareRoot(dx * dx + dy * dy)
call this.pushToAngle(push, Atan2(y - this.locY, x - this.locX) * bj_RADTODEG, Atan2(z - this.locZ, dist) * bj_RADTODEG)
endmethod
method pushToLocEx takes real push, real x, real y, real z, real offseth, real offsetv returns nothing
local real dx = x - this.locX
local real dy = y - this.locY
local real dist = SquareRoot(dx * dx + dy * dy)
call this.pushToAngle(push, Atan2(y - this.locY, x - this.locX) * bj_RADTODEG + offseth, Atan2(z - this.locZ, dist) * bj_RADTODEG + offsetv)
endmethod
static method explosion_boolexpr takes nothing returns boolean
return GetUnitUserData(GetFilterUnit()) > 0 and GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') == 0
endmethod
static method explosion takes unit damager, real dmg, real boom, real x, real y, real z, real rad, real height returns nothing
local group owned = CreateGroup()
local unit pick
local real dx
local real dy
local boolexpr cnd = Condition(function object.explosion_boolexpr)
call GroupEnumUnitsInRange(owned, x, y, rad, cnd)
loop
set pick = FirstOfGroup(owned)
exitwhen pick == null
if(object(GetUnitUserData(pick)).locZ <= z + height) then
call object(GetUnitUserData(pick)).pushToLoc(-boom, x, y, z)
set dx = x - GetUnitX(pick)
set dy = y - GetUnitY(pick)
call UnitDamageTarget(damager, pick, (rad - SquareRoot(dx * dx + dy * dy)) / rad * dmg, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(owned, pick)
endloop
call DestroyGroup(owned)
call DestroyBoolExpr(cnd)
set owned = null
set cnd = null
endmethod
static method explosionGore takes unit damager, real dmg, real boom, real x, real y, real z, real rad, real height returns nothing
local integer i = 0
local group owned = CreateGroup()
local unit pick
local real dx
local real dy
local boolexpr cnd = Condition(function object.explosion_boolexpr)
local real templife = GetUnitState(damager, UNIT_STATE_LIFE)
local object gore
local object opick
call GroupEnumUnitsInRange(owned, x, y, rad, cnd)
loop
set pick = FirstOfGroup(owned)
exitwhen pick == null
if(object(GetUnitUserData(pick)).locZ <= z + height) then
set opick = object(GetUnitUserData(pick))
call opick.pushToLoc(-boom, x, y, z)
set dx = x - GetUnitX(pick)
set dy = y - GetUnitY(pick)
set templife = GetUnitState(pick, UNIT_STATE_LIFE)
call UnitDamageTarget(damager, pick, (rad - SquareRoot(dx * dx + dy * dy)) / rad * dmg, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
if((GetUnitState(pick, UNIT_STATE_LIFE) != templife or GetUnitState(pick, UNIT_STATE_LIFE) <= 0.045) and IsHeroUnitId(GetUnitTypeId(opick.coreUnit))) then
if(GetUnitState(pick, UNIT_STATE_LIFE) <= 0.045) then
loop
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", opick.coreUnit, "origin"))
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(opick.coreUnit), GetUnitY(opick.coreUnit), 0), 1, 1, 15)
set gore.locZ = opick.locZ
set gore.velX = opick.velX
set gore.velY = opick.velY
set gore.velZ = opick.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(5000, 10000), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
call TriggerAddAction(gore.onOutOfBounds, function CleanBlood)
set i = i + 1
exitwhen i >= gore_amount
endloop
call SetUnitScale(pick, 0, 0, 0)
else
loop
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(opick.coreUnit), GetUnitY(opick.coreUnit), 0), 1, 1, 15)
set gore.locZ = opick.locZ
set gore.velX = opick.velX
set gore.velY = opick.velY
set gore.velZ = opick.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(4500, 6500), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
call TriggerAddAction(gore.onOutOfBounds, function CleanBlood)
set i = i + 1
exitwhen i >= gore_amount / 2
endloop
endif
endif
endif
call GroupRemoveUnit(owned, pick)
endloop
call DestroyGroup(owned)
call DestroyBoolExpr(cnd)
set owned = null
set cnd = null
endmethod
static method create takes unit u, real radius, real height, real mass returns object
local location point = GetUnitLoc(u)
local object o = object.allocate()
set o.onTick = CreateTrigger()
set o.onGround = CreateTrigger()
set o.onOutOfBounds = CreateTrigger()
set o.onCollide = CreateTrigger()
set o.onStop = CreateTrigger()
set o.coreUnit = u
set o.useTick = true
set o.velX = 0.00
set o.velY = 0.00
set o.velZ = 0.00
set o.accX = 0.00
set o.accY = 0.00
set o.accZ = 0.00
set o.locX = GetLocationX(point)
set o.locY = GetLocationY(point)
set o.locZ = GetUnitFlyHeight(u) + GetLocationZ(point)
set o.radius = radius
set o.height = height
set o.mass = mass
set o.bounce = 0.0
set o.friction = 1.0
set o.useTick = false
set o.underWater = false
call SetUnitUserData(u, integer(o))
call GroupAddUnit(object.all, u)
call UnitAddAbility(u, object.flyID)
call SetUnitPathing(u, false)
call RemoveLocation(point)
set point = null
return o
endmethod
method remove takes nothing returns nothing
call SetUnitPathing(this.coreUnit, true)
call GroupRemoveUnit(object.all, this.coreUnit)
call UnitRemoveAbility(this.coreUnit, object.flyID)
call TriggerClearActions(this.onTick)
call TriggerClearActions(this.onGround)
call TriggerClearActions(this.onCollide)
call TriggerClearActions(this.onOutOfBounds)
call TriggerClearActions(this.onStop)
call DestroyTrigger(this.onTick)
call DestroyTrigger(this.onGround)
call DestroyTrigger(this.onCollide)
call DestroyTrigger(this.onOutOfBounds)
call DestroyTrigger(this.onStop)
set this.coreUnit = null
set this.onTick = null
set this.onGround = null
set this.onOutOfBounds = null
set this.onCollide = null
set this.onStop = null
call this.destroy()
endmethod
static location zloc = Location(0, 0)
static method enum takes nothing returns nothing
local real tempZ
local real speed
local real angle
local string o
local integer i
set object.count = object.count + 1
set object.o = object(GetUnitUserData(GetEnumUnit()))
call MoveLocation(object.zloc, GetUnitX(object.o.coreUnit), GetUnitY(object.o.coreUnit))
set tempZ = GetLocationZ(object.zloc)
set object.o.locX = GetUnitX(object.o.coreUnit)
set object.o.locY = GetUnitY(object.o.coreUnit)
set object.o.velX = object.o.velX + object.o.accX * object.tickdelay
set object.o.velY = object.o.velY + object.o.accY * object.tickdelay
set object.o.velZ = object.o.velZ + object.o.accZ * object.tickdelay
set object.o.locX = object.o.locX + object.o.velX * object.tickdelay + object.o.accX * object.tickdelay * object.tickdelay / 2.0
set object.o.locY = object.o.locY + object.o.velY * object.tickdelay + object.o.accY * object.tickdelay * object.tickdelay / 2.0
set object.o.locZ = object.o.locZ + object.o.velZ * object.tickdelay + object.o.accZ * object.tickdelay * object.tickdelay / 2.0
if(object.o.locZ <= tempZ) then
set object.o.locZ = tempZ
set object.o.velZ = -object.o.velZ * object.o.bounce
set o = OrderId2String(GetUnitCurrentOrder(object.o.coreUnit))
call MoveLocation(object.zloc, object.o.locX + 5 * Cos(bj_DEGTORAD * GetUnitFacing(object.o.coreUnit)), object.o.locY + 5 * Sin(bj_DEGTORAD * GetUnitFacing(object.o.coreUnit)))
if(GetLocationZ(object.zloc) < tempZ) then
if((o == "move" or o == "patrol" or o == "smart")) then
//...this sucks
endif
elseif(GetLocationZ(object.zloc) > tempZ + 10) then
if(not (o == "move" or o == "patrol" or o == "smart")) then
set object.o.velZ = -object.o.velZ
set object.o.velX = -object.o.velX
set object.o.velY = -object.o.velY
set object.o.locZ = object.o.locZ + 10.00 * object.o.bounce
endif
endif
set object.o.velX = object.o.velX * (1.0 - object.o.friction)
set object.o.velY = object.o.velY * (1.0 - object.o.friction)
call TriggerExecute(object.o.onGround)
if(object.o.velX < 1 and object.o.velX > -1) then
set object.o.velX = 0
endif
if(object.o.velY < 1 and object.o.velY > -1) then
set object.o.velY = 0
endif
if(object.o.velX == 0 and object.o.velY == 0) then
call TriggerExecute(object.o.onStop)
endif
call SetUnitMoveSpeed(object.o.coreUnit, GetUnitDefaultMoveSpeed(object.o.coreUnit))
elseif(object.o.locZ >= tempZ + 15) then
call SetUnitMoveSpeed(object.o.coreUnit, 0.00)
else
set o = OrderId2String(GetUnitCurrentOrder(object.o.coreUnit))
if((o == "move" or o == "patrol" or o == "smart")) then
set object.o.locZ = tempZ
endif
endif
if(object.o.locX < GetRectMinX(bj_mapInitialPlayableArea) or object.o.locX > GetRectMaxX(bj_mapInitialPlayableArea) or object.o.locY < GetRectMinY(bj_mapInitialPlayableArea) or object.o.locY > GetRectMaxY(bj_mapInitialPlayableArea)) then
call TriggerExecute(object.o.onOutOfBounds)
else
call GroupEnumUnitsInRange(object.collideGroup, object.o.locX, object.o.locY, object.maxRadius + object.o.radius + 1, object.collideCondition)
loop
set object.collideUnit = FirstOfGroup(object.collideGroup)
exitwhen object.collideUnit == null
set object.oc = object(GetUnitUserData(object.collideUnit))
call TriggerExecute(object.o.onCollide)
set angle = Atan2(object.o.locY - object.oc.locY, object.o.locX - object.oc.locX)
set speed = SquareRoot(object.o.velX * object.o.velX + object.o.velY * object.o.velY)
set object.o.velX = 0
set object.o.velY = 0
if(object.o.locZ - object.o.velZ * object.tickdelay + 1 >= object.oc.locZ + object.oc.height) then
set object.o.velZ = -object.o.velZ * object.o.bounce
set object.o.locZ = object.oc.locZ + object.oc.height
call SetUnitMoveSpeed(object.o.coreUnit, GetUnitDefaultMoveSpeed(object.o.coreUnit))
call TriggerExecute(object.o.onGround)
else
if(object.o.mass <= object.oc.mass) then
set object.o.locX = object.oc.locX + (object.oc.radius + object.o.radius) * Cos(angle)
set object.o.locY = object.oc.locY + (object.oc.radius + object.o.radius) * Sin(angle)
else
set object.oc.locX = object.o.locX + (object.o.radius + object.oc.radius) * Cos(-angle)
set object.oc.locY = object.o.locY + (object.o.radius + object.oc.radius) * Sin(-angle)
endif
endif
call object.o.pushToAngle(speed * object.o.mass / 2, angle * bj_RADTODEG, 0)
call object.oc.pushToAngle(speed * object.o.mass / 2, -angle * bj_RADTODEG, 0)
call GroupRemoveUnit(object.collideGroup, object.collideUnit)
endloop
endif
if(object.o.useTick) then
call TriggerExecute(object.o.onTick)
endif
call SetUnitX(object.o.coreUnit, object.o.locX)
call SetUnitY(object.o.coreUnit, object.o.locY)
call SetUnitFlyHeight(object.o.coreUnit, object.o.locZ - tempZ, 0.00)
endmethod
static method mainloop takes nothing returns nothing
set object.count = 0
call ForGroup(object.all, function object.enum)
//call DisplayTextToPlayer(Player(0), 0, 0, I2S(object.count))
endmethod
static method collisionFilter takes nothing returns boolean
local object victim = object(GetUnitUserData(GetFilterUnit()))
local real dx = object.o.locX - victim.locX
local real dy = object.o.locY - victim.locY
local real dist = SquareRoot(dx * dx + dy * dy)
return GetOwningPlayer(victim.coreUnit) != GetOwningPlayer(object.o.coreUnit) and GetUnitState(victim.coreUnit, UNIT_STATE_LIFE) > 0.045 and object.o.locZ + object.o.height >= victim.locZ and object.o.locZ <= victim.locZ + victim.height and dist <= victim.radius + object.o.radius
endmethod
static method init takes real tickdelay returns nothing
local integer i = 0
local trigger trig = CreateTrigger()
call TriggerAddAction(trig, function object.mainloop)
call TriggerRegisterTimerEvent(trig, tickdelay, true)
set object.all = CreateGroup()
set object.collideGroup = CreateGroup()
set object.tickdelay = tickdelay
set object.collideCondition = Filter(function object.collisionFilter)
loop
call SetPlayerAbilityAvailable(Player(i), object.flyID, false)
set i = i + 1
exitwhen i == 12
endloop
endmethod
endstruct
//*********************************************************************************************************************************
// [Gore System] requiers [Object System]
// Creator: Vladimir Angelov
//
// BLOOOOOOOODDDDDDD
//*********************************************************************************************************************************
function noFilterFunc takes nothing returns boolean
return true
endfunction
globals
boolexpr noFilter
endglobals
Name | Type | is_array | initial_value |
dummy_caster | unit | No | |
loc | location | No | |
owned | group | No |
//TESH.scrollpos=234
//TESH.alwaysfold=0
globals
string array player_name
unit array player_hero
unit array player_vehicle
integer array player_team
unit array player_tribeselect
unit array player_tribeselect_h
real array player_mod_acc
integer array player_wid
timer array player_timer
timerdialog array player_timerdg
boolean array player_ai
constant integer MODE_CTF = 1
constant integer MODE_DM = 2
constant integer MODE_ZM = 3
integer mode = 0
integer mode_rule = 0
multiboard scores
integer array player_caps
integer array player_kills
integer array player_deaths
unit flag_blue = null
unit flag_red = null
constant integer TEAM_RED = 0
constant integer TEAM_BLUE = 1
constant real waterlevel = 695.0
endglobals
function Trig_Player_OnCollide takes nothing returns nothing
local real rand
local integer p = GetPlayerId(GetOwningPlayer(object.o.coreUnit))
if(player_ai[p]) then
set rand = (GetUnitFacing(object.o.coreUnit) + GetRandomReal(-60, 60)) * bj_DEGTORAD
call IssuePointOrder(object.o.coreUnit, "move", object.o.locX - 350 * Cos(rand), object.o.locY - 350 * Sin(rand))
endif
endfunction
function Trig_Player_OnOutOfBounds takes nothing returns nothing
local real x
local real y
if(object.o.locX >= 0) then
set x = object.o.locX
else
set x = -object.o.locX
endif
if(object.o.locY >= 0) then
set y = object.o.locY
else
set y = -object.o.locY
endif
if(x > y) then
set object.o.velX = -object.o.velX
else
set object.o.velY = -object.o.velY
endif
endfunction
globals
integer array types
endglobals
globals
integer array dg_confirmed
dialog dg_pick
endglobals
function Dialog_Confirm_Yes takes nothing returns nothing
set dg_confirmed[GetPlayerId(GetTriggerPlayer())] = 1
endfunction
function Dialog_Confirm_No takes nothing returns nothing
set dg_confirmed[GetPlayerId(GetTriggerPlayer())] = 2
endfunction
function Win takes integer team returns nothing
local integer i = 0
loop
call PauseUnit(player_hero[i], true)
set i = i + 1
exitwhen i == 12
endloop
call ClearTextMessages()
call StartSound(gg_snd_Victory)
if(team == TEAM_RED) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "The |c00FF0000Red Tribe|r has won the battle!")
elseif(team == TEAM_BLUE) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "The |c000000FFBlue Tribe|r has won the battle!")
endif
endfunction
function Multiboard_Update takes nothing returns nothing
local integer i = 0
local integer k = 1
local integer f = 1
local integer team1 = 1
local integer team1_killz = 0
local integer team1_deathz = 0
local integer team1_capz = 0
local integer team2 = 0
local integer team2_killz = 0
local integer team2_deathz = 0
local integer team2_capz = 0
call MultiboardSetItemValue(MultiboardGetItem(scores, 1, 0), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, 1, 1), "[|c00FF0000Red Tribe|r]")
call MultiboardSetItemWidth(MultiboardGetItem(scores, 1, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, 1, 2), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, 1, 3), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, 1, 4), "")
loop
if(GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING or player_ai[i]) then
if(player_team[i] == 0) then
set k = k + 1
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 0), I2S(i))
call MultiboardSetItemWidth(MultiboardGetItem(scores, k, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 1), player_name[i])
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 2), I2S(player_caps[i]))
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 3), I2S(player_kills[i]))
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 4), I2S(player_deaths[i]))
set team1_killz = team1_killz + player_kills[i]
set team1_deathz = team1_deathz + player_deaths[i]
set team1_capz = team1_capz + player_caps[i]
endif
endif
set i = i + 1
exitwhen i == 12
endloop
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 1, 0), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 1, 1), "")
call MultiboardSetItemWidth(MultiboardGetItem(scores, k + 1, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 1, 2), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 1, 3), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 1, 4), "")
set team2 = k + 2
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 2, 0), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 2, 1), "[|c000000FFBlue Tribe|r]")
call MultiboardSetItemWidth(MultiboardGetItem(scores, k + 2, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 2, 2), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 2, 3), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k + 2, 4), "")
set i = 0
set k = k + 2
loop
if(GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING or player_ai[i]) then
if(player_team[i] == 1) then
set k = k + 1
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 0), I2S(i))
call MultiboardSetItemWidth(MultiboardGetItem(scores, k, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 1), player_name[i])
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 2), I2S(player_caps[i]))
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 3), I2S(player_kills[i]))
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 4), I2S(player_deaths[i]))
set team2_killz = team2_killz + player_kills[i]
set team2_deathz = team2_deathz + player_deaths[i]
set team2_capz = team2_capz + player_caps[i]
endif
endif
set i = i + 1
exitwhen i == 12
endloop
call MultiboardSetItemValue(MultiboardGetItem(scores, team1, 2), I2S(team1_capz))
call MultiboardSetItemValue(MultiboardGetItem(scores, team1, 3), I2S(team1_killz))
call MultiboardSetItemValue(MultiboardGetItem(scores, team1, 4), I2S(team1_deathz))
call MultiboardSetItemValue(MultiboardGetItem(scores, team2, 2), I2S(team2_capz))
call MultiboardSetItemValue(MultiboardGetItem(scores, team2, 3), I2S(team2_killz))
call MultiboardSetItemValue(MultiboardGetItem(scores, team2, 4), I2S(team2_deathz))
loop
set k = k + 1
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 0), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 1), "")
call MultiboardSetItemWidth(MultiboardGetItem(scores, k, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 2), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 3), "")
call MultiboardSetItemValue(MultiboardGetItem(scores, k, 4), "")
exitwhen k == 14
endloop
if(team1_killz == mode_rule and mode == MODE_DM) then
call Win(TEAM_RED)
elseif(team2_killz == mode_rule and mode == MODE_DM) then
call Win(TEAM_BLUE)
elseif(team1_capz == mode_rule and mode == MODE_CTF) then
call Win(TEAM_RED)
elseif(team2_capz == mode_rule and mode == MODE_CTF) then
call Win(TEAM_BLUE)
endif
endfunction
function Trig_Init_Actions takes nothing returns nothing
local integer i = 0
local trigger dg_trg_yes = CreateTrigger()
local trigger dg_trg_no = CreateTrigger()
call EnableDragSelect(false, false)
call DisplayTimedTextToPlayer(Player(0), 0.0, 0.0, 100, "|c00FF0000Choose a game mode:|r")
call DisplayTimedTextToPlayer(Player(0), 0.0, 0.0, 100, "|c0000FF00-dm X|r Deathmatch, X being the max kills per team")
call DisplayTimedTextToPlayer(Player(0), 0.0, 0.0, 100, "|c0000FF00-ffa X|r Free for All, X being the max kills per player")
call DisplayTimedTextToPlayer(Player(0), 0.0, 0.0, 100, "|c0000FF00-ctf X|r Capture the Flag, X being the max captures per team")
call DisplayTimedTextToPlayer(Player(0), 0.0, 0.0, 100, "|c0000FF00-zm X|r Zombies, X being the amount of minutes to survive")
call DisplayTimedTextToPlayer(Player(0), 0.0, 0.0, 100, "|c0000FF00-def X|r Base Defence, X being the max health of the looted relic")
loop
call TriggerSleepAction(1.00)
exitwhen mode != 0
endloop
call TriggerSleepAction(1.50)
call ClearTextMessages()
set scores = CreateMultiboard()
call MultiboardSetItemsStyle(scores, true, false)
call MultiboardSetColumnCount(scores, 5)
call MultiboardSetRowCount(scores, 15)
call MultiboardSetTitleText(scores, "Waaagh!")
call MultiboardSetItemValue(MultiboardGetItem(scores, 0, 0), "ID")
call MultiboardSetItemWidth(MultiboardGetItem(scores, 0, 1), 0.08)
call MultiboardSetItemValue(MultiboardGetItem(scores, 0, 1), "Name")
call MultiboardSetItemValue(MultiboardGetItem(scores, 0, 2), "Caps")
call MultiboardSetItemValue(MultiboardGetItem(scores, 0, 3), "Kills")
call MultiboardSetItemValue(MultiboardGetItem(scores, 0, 4), "Deaths")
set types[0] = 'H00L'
set types[1] = 'H005'
set types[2] = 'H00R'
set types[3] = 'H00U'
set types[4] = 'H003'
set types[5] = 'H008'
set types[6] = 'H00D'
set types[7] = 'H00N'
set types[8] = 'H001'
set types[9] = 'H00Y'
set types[10] = 'H00J'
set flag_blue = gg_unit_n000_0013
set flag_red = gg_unit_n000_0011
if(mode == MODE_CTF) then
call CreateItem('I000', GetUnitX(flag_blue), GetUnitY(flag_blue))
call CreateItem('I001', GetUnitX(flag_red), GetUnitY(flag_red))
call EnableTrigger(gg_trg_Flag_Notice)
endif
loop
set player_tribeselect_h[i] = CreateUnit(Player(i), 'Hstm', 0, 0, 0)
set player_tribeselect[i] = CreateUnit(Player(i), 'h00z', 0, 0, 0)
if(GetPlayerId(GetLocalPlayer()) == i) then
call SelectUnit(player_tribeselect[i], true)
endif
set player_name[i] = GetPlayerName(Player(i))
set player_timer[i] = CreateTimer()
set player_team[i] = -1
set player_timerdg[i] = CreateTimerDialog(player_timer[i])
set i = i + 1
exitwhen i == 12
endloop
set i = 0
call MultiboardDisplay(scores, true)
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 12.000)
call SuspendTimeOfDay(true)
call FogMaskEnable(false)
call FogEnable(false)
call SetUnitColor(flag_red, PLAYER_COLOR_RED)
call SetUnitColor(flag_blue, PLAYER_COLOR_BLUE)
set dg_pick = DialogCreate()
call DialogSetMessage(dg_pick, "Do you want to switch your tribe?")
call TriggerAddAction(dg_trg_yes, function Dialog_Confirm_Yes)
call TriggerAddAction(dg_trg_no, function Dialog_Confirm_No)
call TriggerRegisterDialogButtonEvent(dg_trg_yes, DialogAddButton(dg_pick, "Yes", 0))
call TriggerRegisterDialogButtonEvent(dg_trg_no, DialogAddButton(dg_pick, "No", 0))
call Multiboard_Update()
set dg_trg_yes = null
set dg_trg_no = null
endfunction
function InitTrig_Init takes nothing returns nothing
set gg_trg_Init = CreateTrigger()
call TriggerAddAction(gg_trg_Init, function Trig_Init_Actions)
call object.init(0.03)
set noFilter = Filter(function noFilterFunc)
endfunction
//TESH.scrollpos=234
//TESH.alwaysfold=0
globals
boolean gore_on = true
integer gore_amount = 8
string array gore_bodyparts
endglobals
function Trig_Projectile_OnCollide takes nothing returns nothing
local object oc
local object o
local object gore
local integer i = 0
local effect array e
if(object.o.impactAoE == 0) then
call UnitDamageTarget(object.o.coreUnit, object.oc.coreUnit, object.o.impactDamage, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call object.oc.pushToAngle(object.o.impactPush, GetUnitFacing(object.o.coreUnit), 0)
if(gore_on and IsHeroUnitId(GetUnitTypeId(object.oc.coreUnit))) then
if(object.o.impactGore == GORE_BULLET) then
call DestroyEffect(AddSpecialEffectTarget(crasheffect[GetRandomInt(0, 3)], object.oc.coreUnit, gore_bodyparts[GetRandomInt(0, 3)]))
set gore = object.create(CreateUnit(Player(15), 'h01E', object.o.locX, object.o.locY, 0), 1, 1, 15)
call SetUnitPosition(gore.coreUnit, object.o.locX + 40 * Cos(GetUnitFacing(object.o.coreUnit) * bj_DEGTORAD), object.o.locY + 40 * Sin(GetUnitFacing(object.o.coreUnit) * bj_DEGTORAD))
set gore.velX = object.o.velX
set gore.velY = object.o.velY
set gore.velZ = object.o.velZ
set gore.friction = 0.20
call gore.addGravity()
set gore.locZ = object.o.locZ
call TriggerAddAction(gore.onStop, function CleanBlood)
call TriggerAddAction(gore.onOutOfBounds, function CleanBlood)
elseif(object.o.impactGore == GORE_BOOM and GetUnitState(object.oc.coreUnit, UNIT_STATE_LIFE) < 0.045) then
loop
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", object.oc.coreUnit, "origin"))
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(object.oc.coreUnit), GetUnitY(object.oc.coreUnit), 0), 1, 1, 15)
set gore.locZ = object.oc.locZ
set gore.velX = object.oc.velX
set gore.velY = object.oc.velY
set gore.velZ = object.oc.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(5000, 10000), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
call TriggerAddAction(gore.onOutOfBounds, function CleanBlood)
set i = i + 1
exitwhen i == gore_amount
endloop
call SetUnitScale(object.oc.coreUnit, 0, 0, 0)
elseif(object.o.impactGore == GORE_BOOM) then
loop
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(object.oc.coreUnit), GetUnitY(object.oc.coreUnit), 0), 1, 1, 15)
set gore.locZ = object.oc.locZ
set gore.velX = object.oc.velX
set gore.velY = object.oc.velY
set gore.velZ = object.oc.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(3500, 6500), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
call TriggerAddAction(gore.onOutOfBounds, function CleanBlood)
set i = i + 1
exitwhen i == gore_amount / 2
endloop
elseif(object.o.impactGore == GORE_PLASMA and GetUnitState(object.oc.coreUnit, UNIT_STATE_LIFE) < 0.045) then
set i = 0
set oc = object.oc
call KillUnit(object.o.coreUnit)
call object.o.remove()
loop
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", oc.coreUnit, gore_bodyparts[GetRandomInt(0, 3)]))
call TriggerSleepAction(0.00)
set i = i + 1
exitwhen i == 10
endloop
return
elseif(object.o.impactGore == GORE_PLASMA) then
set oc = object.oc
call KillUnit(object.o.coreUnit)
call object.o.remove()
loop
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", oc.coreUnit, gore_bodyparts[GetRandomInt(0, 3)]))
call TriggerSleepAction(0.00)
set i = i + 1
exitwhen i == 4
endloop
return
elseif(object.o.impactGore == GORE_FIRE and GetUnitState(object.oc.coreUnit, UNIT_STATE_LIFE) < 0.045) then
call KillUnit(object.o.coreUnit)
call object.o.remove()
loop
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl", object.oc.coreUnit, "origin"))
set e[i] = AddSpecialEffectTarget("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl", object.oc.coreUnit, gore_bodyparts[i])
set e[4+i] = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\LiquidFire\\Liquidfire.mdl", object.oc.coreUnit, gore_bodyparts[i])
set i = i + 1
exitwhen i == 3
endloop
call SetUnitVertexColor(object.oc.coreUnit, 30, 0, 0, 200)
call TriggerSleepAction(3.00)
set i = 0
loop
call DestroyEffect(e[i])
call DestroyEffect(e[4+i])
set e[i] = null
set i = i + 1
exitwhen i == 3
endloop
return
elseif(object.o.impactGore == GORE_FIRE) then
set e[0] = AddSpecialEffectTarget("Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedDamage.mdl", object.oc.coreUnit, gore_bodyparts[GetRandomInt(0, 3)])
call KillUnit(object.o.coreUnit)
call object.o.remove()
call TriggerSleepAction(3.00)
call DestroyEffect(e[0])
set e[0] = null
return
endif
endif
else
if(gore_on) then
call object.o.explosionGore(object.o.coreUnit, object.o.impactDamage, object.o.impactPush, object.oc.locX, object.oc.locY, object.oc.locZ - 350, object.o.impactAoE, 750)
else
call object.o.explosion(object.o.coreUnit, object.o.impactDamage, object.o.impactPush, object.oc.locX, object.oc.locY, object.oc.locZ - 350, object.o.impactAoE, 750)
endif
endif
call KillUnit(object.o.coreUnit)
call object.o.remove()
endfunction
function Trig_Projectile_OnOutOfBounds takes nothing returns nothing
call RemoveUnit(object.o.coreUnit)
call object.o.remove()
endfunction
function Trig_Projectile_OnGround takes nothing returns nothing
local unit proj = object.o.coreUnit
if(object.o.impactAoE > 0) then
if(gore_on) then
call object.o.explosionGore(proj, object.o.impactDamage, object.o.impactPush, object.o.locX, object.o.locY, object.o.locZ - 150, object.o.impactAoE, object.o.impactAoE + 150)
else
call object.o.explosion(proj, object.o.impactDamage, object.o.impactPush, object.o.locX, object.o.locY, object.o.locZ - 150, object.o.impactAoE, object.o.impactAoE + 150)
endif
endif
if(object.o.locZ < waterlevel) then
call DestroyEffect(AddSpecialEffect("WaterBullet.mdl", object.o.locX, object.o.locY))
endif
call KillUnit(proj)
call object.o.remove()
set proj = null
endfunction
globals
real array bullet_delay
real array bullet_target_x
real array bullet_target_y
real array bullet_target_z
integer array bullet_burst
endglobals
function Trig_Shoot_Condition takes nothing returns boolean
return GetObjectName(GetSpellAbilityId()) == "Shoot"
endfunction
function Trig_Shoot_Loop_Actions takes nothing returns nothing
local integer i = 0
local object bullet
local unit shot
local integer wid
local real a
local real angle
loop
if(bullet_burst[i] > 0) then
if(bullet_delay[i] == 0) then
set wid = player_wid[i]
set a = db_offset[wid] * player_mod_acc[i]
set angle = bj_RADTODEG * Atan2(bullet_target_y[i] - GetUnitY(player_hero[i]), bullet_target_x[i] - GetUnitX(player_hero[i]))
set shot = CreateUnit(Player(i), db_projectile[wid], GetUnitX(player_hero[i]) + Cos(angle * bj_DEGTORAD) * 120, GetUnitY(player_hero[i]) + Sin(angle * bj_DEGTORAD) * 120, angle)
call SetUnitPosition(shot, GetUnitX(player_hero[i]) + Cos(angle * bj_DEGTORAD) * 120, GetUnitY(player_hero[i]) + Sin(angle * bj_DEGTORAD) * 120)
set bullet = object.create(shot, db_size[wid], db_size[wid], 0.01)
set bullet.locZ = object(GetUnitUserData(player_hero[i])).locZ + 80
if(db_aoe[wid] == 0) then
call bullet.pushToLocEx(db_muzzlespeed[wid] / 50, bullet_target_x[i], bullet_target_y[i], bullet_target_z[i] + 60, GetRandomReal(-a, a), GetRandomReal(-a, a))
else
call bullet.pushToLocEx(db_muzzlespeed[wid] / 50, bullet_target_x[i], bullet_target_y[i], bullet_target_z[i], GetRandomReal(-a, a), GetRandomReal(-a, a))
endif
call TriggerAddAction(bullet.onGround, function Trig_Projectile_OnGround)
call TriggerAddAction(bullet.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(bullet.onCollide, function Trig_Projectile_OnCollide)
set bullet.impactDamage = GetRandomReal(db_mindmg[wid], db_maxdmg[wid])
set bullet.impactGore = db_gore[wid]
set bullet.impactGoreType = db_goretype[wid]
set bullet.impactAoE = db_aoe[wid]
set bullet.impactPush = db_push[wid]
if(GetUnitState(player_hero[i], UNIT_STATE_LIFE) > 0) then
call SetUnitAnimation(player_hero[i], "attack")
endif
set bullet_delay[i] = db_delay[player_wid[i]]
set bullet_burst[i] = bullet_burst[i] - 1
else
set bullet_delay[i] = bullet_delay[i] - 1
endif
endif
set i = i + 1
exitwhen i == 12
endloop
set shot = null
endfunction
function Trig_Shoot_Actions takes nothing returns nothing
local integer i = 0
local unit target = GetSpellTargetUnit()
local unit u = GetSpellAbilityUnit()
local location loc = GetSpellTargetLoc()
local integer p = GetPlayerId(GetOwningPlayer(u))
set bullet_delay[p] = 0
set bullet_target_x[p] = GetLocationX(loc)
set bullet_target_y[p] = GetLocationY(loc)
if(target == null) then
set bullet_target_z[p] = GetLocationZ(loc)
else
set bullet_target_z[p] = object(GetUnitUserData(target)).locZ
endif
set bullet_burst[p] = db_count[player_wid[p]]
call RemoveLocation(loc)
set u = null
set loc = null
set target = null
endfunction
function InitTrig_Shoot takes nothing returns nothing
local integer i = 0
local trigger gg_trg_Shoot_Loop = CreateTrigger()
set gg_trg_Shoot = CreateTrigger()
call TriggerAddAction(gg_trg_Shoot, function Trig_Shoot_Actions)
call TriggerAddCondition(gg_trg_Shoot, Condition(function Trig_Shoot_Condition))
call TriggerAddAction(gg_trg_Shoot_Loop, function Trig_Shoot_Loop_Actions)
call TriggerRegisterTimerEvent(gg_trg_Shoot_Loop, 0.01, true)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Shoot, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
set gore_bodyparts[0] = "head"
set gore_bodyparts[1] = "chest"
set gore_bodyparts[2] = "weapon"
set gore_bodyparts[3] = "origin"
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
real spawntime = 10.0
endglobals
function Trig_Respawn_Actions takes nothing returns nothing
local object o = object(GetUnitUserData(GetDyingUnit()))
local integer p = GetPlayerId(GetOwningPlayer(o.coreUnit))
call SetUnitOwner(player_vehicle[p], Player(15), true)
set player_vehicle[p] = null
call TimerStart(player_timer[p], spawntime, false, null)
if(GetLocalPlayer() == GetOwningPlayer(o.coreUnit)) then
call TimerDialogDisplay(player_timerdg[p], true)
endif
loop
call TriggerSleepAction(0.1)
exitwhen TimerGetRemaining(player_timer[p]) == 0.00
endloop
call TimerDialogDisplay(player_timerdg[p], false)
call o.remove()
call RemoveUnit(player_hero[p])
if(player_team[p] == 0) then
set player_hero[p] = CreateUnit(Player(p), 'h000', GetUnitX(flag_red) + GetRandomReal(-500, 500), GetRandomReal(GetUnitY(flag_red) - 500, GetUnitY(flag_red) + 500), 0)
else
set player_hero[p] = CreateUnit(Player(p), 'h000', GetUnitX(flag_blue) + GetRandomReal(-500, 500), GetRandomReal(GetUnitY(flag_blue) - 500, GetUnitY(flag_blue) + 500), 0)
endif
set player_mod_acc[p] = 1.00
set o = object.create(player_hero[p], 40, 100, 100)
call o.addGravity()
set o.friction = 0.02
set o.bounce = 0.0
call TriggerAddAction(o.onOutOfBounds, function Trig_Player_OnOutOfBounds)
call TriggerAddAction(o.onCollide, function Trig_Player_OnCollide)
if(GetPlayerId(GetLocalPlayer()) == p) then
call SetCameraTargetController(player_hero[p], 0, 0, true)
call ClearSelection()
endif
endfunction
function Trig_Respawn_Condition takes nothing returns boolean
return IsHeroUnitId(GetUnitTypeId(GetDyingUnit()))
endfunction
function InitTrig_Respawn takes nothing returns nothing
local integer i = 0
set gg_trg_Respawn = CreateTrigger()
call TriggerAddAction(gg_trg_Respawn, function Trig_Respawn_Actions)
call TriggerAddCondition(gg_trg_Respawn, Condition(function Trig_Respawn_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Respawn, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Kill_Notice_Actions takes nothing returns nothing
local integer i = 0
local integer killer = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
local integer victim = GetPlayerId(GetOwningPlayer(GetDyingUnit()))
if(player_team[killer] != player_team[victim]) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(killer)) + "] killed [" + GetPlayerName(Player(victim)) + "]")
set player_kills[killer] = player_kills[killer] + 1
set player_deaths[victim] = player_deaths[victim] + 1
elseif(killer == victim) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(killer)) + "] suicided.")
set player_deaths[victim] = player_deaths[victim] + 1
elseif(player_team[killer] == player_team[victim]) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(killer)) + "] teamkilled [" + GetPlayerName(Player(victim)) + "]")
endif
call Multiboard_Update()
endfunction
function Trig_Kill_Notice_Condition takes nothing returns boolean
return IsHeroUnitId(GetUnitTypeId(GetDyingUnit()))
endfunction
function InitTrig_Kill_Notice takes nothing returns nothing
local integer i = 0
set gg_trg_Kill_Notice = CreateTrigger()
call TriggerAddAction(gg_trg_Kill_Notice, function Trig_Kill_Notice_Actions)
call TriggerAddCondition(gg_trg_Kill_Notice, Condition(function Trig_Kill_Notice_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Kill_Notice, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Leavers_Actions takes nothing returns nothing
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(GetTriggerPlayer()) + "] has left the battlefield.")
call Multiboard_Update()
endfunction
function InitTrig_Leavers takes nothing returns nothing
local integer i = 0
set gg_trg_Leavers = CreateTrigger()
call TriggerAddAction(gg_trg_Leavers, function Trig_Leavers_Actions)
loop
call TriggerRegisterPlayerEvent(gg_trg_Leavers, Player(i), EVENT_PLAYER_LEAVE)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Music_Actions takes nothing returns nothing
call PlayMusic("Frank Klepacki - Brain Dead.mp3")
call SetMusicVolume(127)
endfunction
function InitTrig_Music takes nothing returns nothing
set gg_trg_Music = CreateTrigger()
call TriggerAddAction(gg_trg_Music, function Trig_Music_Actions)
call TriggerRegisterTimerEvent(gg_trg_Music, 2.00, true)
call TriggerRegisterTimerEvent(gg_trg_Music, 0.01, false)
endfunction
//TESH.scrollpos=61
//TESH.alwaysfold=0
function Trig_Commands_Actions takes nothing returns nothing
local string cmd = GetEventPlayerChatString()
local integer arg = 0
if(cmd == "-help") then
call DisplayTextToPlayer(Player(0), 0, 0, "[|c0000FF00Command List|r]")
call DisplayTextToPlayer(Player(0), 0, 0, "-gore ... Switches on or off blood and gore mode.")
call DisplayTextToPlayer(Player(0), 0, 0, "-kick N ... Kicks a player by ID.")
call DisplayTextToPlayer(Player(0), 0, 0, "-redbot N ... Sets a given player slot to a red tribe AI controller.")
call DisplayTextToPlayer(Player(0), 0, 0, "-bluebot N ... Sets a given player slot to a blue tribe AI controller.")
call DisplayTextToPlayer(Player(0), 0, 0, "-spawntime N ... Sets the time you have to wait to spawn after death.")
elseif(cmd == "-gore") then
set gore_on = not gore_on
if(gore_on) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|c00FF0000Blood and gore|r mode has been |c0000FF00activated|r.")
else
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|c00FF0000Blood and gore|r mode has been |c00FF0000deactivated|r.")
endif
elseif(SubString(cmd, 0, 8) == "-redbot ") then
set arg = S2I(SubString(cmd, 8, StringLength(cmd)))
if(arg > 11) then
set arg = 11
elseif(arg < 0) then
set arg = 0
endif
if(GetPlayerSlotState(Player(arg)) != PLAYER_SLOT_STATE_PLAYING and not player_ai[arg]) then
set player_ai[arg] = true
call IssueImmediateOrder(player_tribeselect[arg], "auraunholy")
else
call DisplayTextToPlayer(Player(0), 0, 0, "|c00FF0000This player slot is already in use.")
endif
elseif(SubString(cmd, 0, 9) == "-bluebot ") then
set arg = S2I(SubString(cmd, 9, StringLength(cmd)))
if(arg > 11) then
set arg = 11
elseif(arg < 0) then
set arg = 0
endif
if(GetPlayerSlotState(Player(arg)) != PLAYER_SLOT_STATE_PLAYING and not player_ai[arg]) then
set player_ai[arg] = true
call IssueImmediateOrder(player_tribeselect[arg], "auravampiric")
else
call DisplayTextToPlayer(Player(0), 0, 0, "|c00FF0000This player slot is already in use.")
endif
elseif(SubString(cmd, 0, 6) == "-kick ") then
set arg = S2I(SubString(cmd, 6, StringLength(cmd)))
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(arg)) + "] has been removed from the battlefield.")
if(GetLocalPlayer() == Player(arg)) then
call EndGame(false)
endif
set player_ai[arg] = false
call Multiboard_Update()
elseif(SubString(cmd, 0, 11) == "-spawntime ") then
set arg = S2I(SubString(cmd, 11, StringLength(cmd)))
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "The time required to spawn after death has been set to " + I2S(arg) + " seconds.")
if(arg < 0.00) then
set spawntime = 0.0
elseif(arg > 35.00) then
set spawntime = 35.00
else
set spawntime = arg
endif
elseif(SubString(cmd, 0, 4) == "-dm " and mode == 0) then
set mode = MODE_DM
set arg = S2I(SubString(cmd, 4, StringLength(cmd)))
if(arg < 0) then
set arg = 0
elseif(arg > 100) then
set arg = 5000
endif
set mode_rule = arg
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|c0000FF00Deathmatch mode has been chosen.|r Max kills: " + I2S(arg))
elseif(SubString(cmd, 0, 5) == "-ctf " and mode == 0) then
set mode = MODE_CTF
set arg = S2I(SubString(cmd, 5, StringLength(cmd)))
if(arg < 0) then
set arg = 0
elseif(arg > 50) then
set arg = 1000
endif
set mode_rule = arg
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|c0000FF00Capture the flags mode has been chosen.|r Max caps: " + I2S(arg))
elseif(SubString(cmd, 0, 4) == "-zm " and mode == 0) then
call BJDebugMsg("Mode not supported on this terrain.")
elseif(SubString(cmd, 0, 5) == "-ffa " and mode == 0) then
call BJDebugMsg("Mode not supported on this terrain.")
elseif(SubString(cmd, 0, 5) == "-def " and mode == 0) then
call BJDebugMsg("Mode not supported on this terrain.")
endif
endfunction
function InitTrig_Commands takes nothing returns nothing
set gg_trg_Commands = CreateTrigger()
call TriggerAddAction(gg_trg_Commands, function Trig_Commands_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Commands, Player(0), "-", false)
endfunction
//TESH.scrollpos=55
//TESH.alwaysfold=0
globals
boolean array key_up
boolean array key_down
boolean array key_left
boolean array key_right
endglobals
function Key_Up_Press takes nothing returns nothing
set key_up[GetPlayerId(GetTriggerPlayer())] = true
endfunction
function Key_Down_Press takes nothing returns nothing
set key_down[GetPlayerId(GetTriggerPlayer())] = true
endfunction
function Key_Left_Press takes nothing returns nothing
set key_left[GetPlayerId(GetTriggerPlayer())] = true
endfunction
function Key_Right_Press takes nothing returns nothing
set key_right[GetPlayerId(GetTriggerPlayer())] = true
endfunction
function Key_Up_Release takes nothing returns nothing
set key_up[GetPlayerId(GetTriggerPlayer())] = false
endfunction
function Key_Down_Release takes nothing returns nothing
set key_down[GetPlayerId(GetTriggerPlayer())] = false
endfunction
function Key_Left_Release takes nothing returns nothing
set key_left[GetPlayerId(GetTriggerPlayer())] = false
endfunction
function Key_Right_Release takes nothing returns nothing
set key_right[GetPlayerId(GetTriggerPlayer())] = false
endfunction
function InitTrig_Detect_Keys takes nothing returns nothing
local integer i = 0
local trigger onKeyUpPress = CreateTrigger()
local trigger onKeyDownPress = CreateTrigger()
local trigger onKeyLeftPress = CreateTrigger()
local trigger onKeyRightPress = CreateTrigger()
local trigger onKeyUpRelease = CreateTrigger()
local trigger onKeyDownRelease = CreateTrigger()
local trigger onKeyLeftRelease = CreateTrigger()
local trigger onKeyRightRelease = CreateTrigger()
call TriggerAddAction(onKeyUpPress, function Key_Up_Press)
call TriggerAddAction(onKeyDownPress, function Key_Down_Press)
call TriggerAddAction(onKeyLeftPress, function Key_Left_Press)
call TriggerAddAction(onKeyRightPress, function Key_Right_Press)
call TriggerAddAction(onKeyUpRelease, function Key_Up_Release)
call TriggerAddAction(onKeyDownRelease, function Key_Down_Release)
call TriggerAddAction(onKeyLeftRelease, function Key_Left_Release)
call TriggerAddAction(onKeyRightRelease, function Key_Right_Release)
loop
call TriggerRegisterPlayerEvent(onKeyUpPress, Player(i), EVENT_PLAYER_ARROW_UP_DOWN)
call TriggerRegisterPlayerEvent(onKeyDownPress, Player(i), EVENT_PLAYER_ARROW_DOWN_DOWN)
call TriggerRegisterPlayerEvent(onKeyLeftPress, Player(i), EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerRegisterPlayerEvent(onKeyRightPress, Player(i), EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerRegisterPlayerEvent(onKeyUpRelease, Player(i), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(onKeyDownRelease, Player(i), EVENT_PLAYER_ARROW_DOWN_UP)
call TriggerRegisterPlayerEvent(onKeyLeftRelease, Player(i), EVENT_PLAYER_ARROW_LEFT_UP)
call TriggerRegisterPlayerEvent(onKeyRightRelease, Player(i), EVENT_PLAYER_ARROW_RIGHT_UP)
set cam_dist[i] = 2000
set cam_rotation[i] = 90
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=-1
//TESH.alwaysfold=0
globals
real array cam_dist
real array cam_rotation
location locz = Location(0, 0)
endglobals
function Trig_Camera_Actions takes nothing returns nothing
local integer i = 0
loop
if(key_up[i]) then
set cam_dist[i] = cam_dist[i] - 8
if(cam_dist[i] < 1250) then
set cam_dist[i] = 1250
endif
elseif(key_down[i]) then
set cam_dist[i] = cam_dist[i] + 8
if(cam_dist[i] > 2000) then
set cam_dist[i] = 2000
endif
endif
if(key_left[i]) then
set cam_rotation[i] = cam_rotation[i] + 0.5
elseif(key_right[i]) then
set cam_rotation[i] = cam_rotation[i] - 0.5
endif
if(player_hero[i] != null) then
call MoveLocation(locz, GetUnitX(player_hero[i]), GetUnitY(player_hero[i]))
if(GetPlayerId(GetLocalPlayer()) == i) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, cam_dist[i] + GetLocationZ(locz) + GetUnitFlyHeight(player_hero[i]), 0.0)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, -55, 0.0)
call SetCameraField(CAMERA_FIELD_ROTATION, cam_rotation[i], 0.0)
if(player_vehicle[i] == null) then
call SelectUnit(player_hero[i], true)
else
call SelectUnit(player_vehicle[i], true)
endif
endif
if(player_vehicle[i] != null) then
call SetUnitX(player_hero[i], GetUnitX(player_vehicle[i]))
call SetUnitY(player_hero[i], GetUnitY(player_vehicle[i]))
call ShowUnit(player_hero[i], false)
call SetUnitInvulnerable(player_hero[i], true)
else
call ShowUnit(player_hero[i], true)
call SetUnitInvulnerable(player_hero[i], false)
endif
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function InitTrig_Camera_Loop takes nothing returns nothing
set gg_trg_Camera_Loop = CreateTrigger()
call TriggerAddAction(gg_trg_Camera_Loop, function Trig_Camera_Actions)
call TriggerRegisterTimerEvent(gg_trg_Camera_Loop, 0.01, true)
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Trig_Ride_Vehicle_Actions takes nothing returns nothing
local unit u = GetOrderedUnit()
local unit tank = GetOrderTargetUnit()
local real dx = GetUnitX(tank) - GetUnitX(u)
local real dy = GetUnitY(tank) - GetUnitY(u)
local integer p = GetPlayerId(GetOwningPlayer(u))
if(SquareRoot(dx * dx + dy * dy) < 300 and GetPlayerId(GetOwningPlayer(tank)) == 15 and GetUnitAbilityLevel(tank, 'S001') > 0) then
if(UnitItemInSlot(u, 0) == null) then
call SetUnitOwner(tank, GetOwningPlayer(u), true)
call UnitAddAbility(tank, 'S000')
call IssueTargetOrder(tank, "load", u)
call UnitRemoveAbility(tank, 'S000')
if(GetLocalPlayer() == Player(p)) then
call SetCameraTargetController(tank, 0, 0, true)
endif
set player_vehicle[p] = tank
else
call DisplayTextToPlayer(Player(p), 0, 0, "|c00FF0000You cannot ride vehicles while carrying the flag.|r")
endif
endif
set u = null
set tank = null
endfunction
function InitTrig_Ride_Vehicle takes nothing returns nothing
local integer i = 0
set gg_trg_Ride_Vehicle = CreateTrigger()
call TriggerAddAction(gg_trg_Ride_Vehicle, function Trig_Ride_Vehicle_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Ride_Vehicle, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
boolean array vehicle_shoot_dis
endglobals
function Trig_Shoot_Vehicle_Actions takes nothing returns nothing
local unit u = GetOrderedUnit()
local location loc = GetOrderPointLoc()
local location loc2 = GetUnitLoc(u)
local real angle = Atan2(GetLocationY(loc) - GetUnitY(u), GetLocationX(loc) - GetUnitX(u)) * bj_RADTODEG
local integer p = GetPlayerId(GetOwningPlayer(u))
local object shell
if(not vehicle_shoot_dis[p]) then
call SetPlayerAbilityAvailable(Player(p), 'A00Z', false)
call PauseUnit(u, true)
set shell = object.create(CreateUnit(GetOwningPlayer(u), 'h01C', GetUnitX(u), GetUnitY(u), angle), 5, 5, 1)
call SetUnitLookAt(u, "Bone_Turret", u, GetLocationX(loc) - GetUnitX(u), GetLocationY(loc) - GetUnitY(u), GetLocationZ(loc) - GetLocationZ(loc2))
call TriggerSleepAction(0.00)
call PauseUnit(u, false)
call IssueImmediateOrder(u, "stop")
call TriggerSleepAction(0.50)
call SetUnitPosition(shell.coreUnit, GetUnitX(u) + 120 * Cos(angle * bj_DEGTORAD), GetUnitY(u) + 100 * Sin(angle * bj_DEGTORAD))
set shell.locZ = GetLocationZ(loc2) + 180
call shell.pushToLoc(3500, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc))
set shell.impactGore = GORE_BOOM
set shell.impactAoE = 300
set shell.impactPush = 60000
set shell.impactDamage = GetRandomReal(800, 1000)
call TriggerAddAction(shell.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(shell.onGround, function Trig_Projectile_OnGround)
call TriggerAddAction(shell.onCollide, function Trig_Projectile_OnCollide)
call TriggerSleepAction(3.0)
call SetPlayerAbilityAvailable(Player(p), 'A00Z', true)
endif
call RemoveLocation(loc)
call RemoveLocation(loc2)
set loc = null
set loc2 = null
endfunction
function Trig_Shoot_Vehicle_Condition takes nothing returns boolean
return OrderId2String(GetIssuedOrderId()) == "volcano"
endfunction
function InitTrig_Shoot_Vehicle takes nothing returns nothing
local integer i = 0
set gg_trg_Shoot_Vehicle = CreateTrigger()
call TriggerAddAction(gg_trg_Shoot_Vehicle, function Trig_Shoot_Vehicle_Actions)
call TriggerAddCondition(gg_trg_Shoot_Vehicle, Condition(function Trig_Shoot_Vehicle_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Shoot_Vehicle, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Destroy_Vehicle_Actions takes nothing returns nothing
local integer p = GetPlayerId(GetOwningPlayer(GetDyingUnit()))
if(GetUnitName(GetDyingUnit()) == "Tank") then
call KillUnit(player_hero[p])
endif
endfunction
function InitTrig_Destroy_Vehicle takes nothing returns nothing
local integer i = 0
set gg_trg_Destroy_Vehicle = CreateTrigger()
call TriggerAddAction(gg_trg_Destroy_Vehicle, function Trig_Destroy_Vehicle_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Destroy_Vehicle, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Leave_Vehicle_Actions takes nothing returns nothing
local unit veh = GetSpellAbilityUnit()
local integer p = GetPlayerId(GetOwningPlayer(veh))
call UnitAddAbility(veh, 'Adro')
call IssuePointOrder(veh, "unloadall", GetUnitX(veh), GetUnitY(veh))
call UnitRemoveAbility(veh, 'Adro')
call TriggerSleepAction(0.00)
set player_vehicle[p] = null
if(GetLocalPlayer() == Player(p)) then
call SetCameraTargetController(player_hero[p], 0, 0, true)
endif
call SetUnitOwner(veh, Player(15), true)
set veh = null
endfunction
function Trig_Leave_Vehicle_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A010'
endfunction
function InitTrig_Leave_Vehicle takes nothing returns nothing
local integer i = 0
set gg_trg_Leave_Vehicle = CreateTrigger()
call TriggerAddAction(gg_trg_Leave_Vehicle, function Trig_Leave_Vehicle_Actions)
call TriggerAddCondition(gg_trg_Leave_Vehicle, Condition(function Trig_Leave_Vehicle_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Leave_Vehicle, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=21
//TESH.alwaysfold=0
globals
item flag_red_item = null
item flag_blue_item = null
unit flag_red_holder = null
unit flag_blue_holder = null
endglobals
function Trig_Flag_Notice_Callback takes nothing returns nothing
local item itm = GetEnumItem()
if(GetItemTypeId(itm) == 'I000') then
call PingMinimapEx(GetItemX(itm), GetItemY(itm), 1.0, 0, 0, 250, false)
set flag_blue_item = itm
else
call PingMinimapEx(GetItemX(itm), GetItemY(itm), 1.0, 250, 0, 0, false)
set flag_red_item = itm
endif
set itm = null
endfunction
function Trig_Flag_Notice_Actions takes nothing returns nothing
local integer i = 0
set flag_red_item = null
set flag_blue_item = null
call EnumItemsInRect(GetWorldBounds(), noFilter, function Trig_Flag_Notice_Callback)
set flag_red_holder = null
set flag_blue_holder = null
loop
if(UnitItemInSlot(player_hero[i], 0) != null) then
if(player_team[i] == 1) then
call PingMinimapEx(GetUnitX(player_hero[i]), GetUnitY(player_hero[i]), 1.0, 250, 0, 0, false)
set flag_red_holder = player_hero[i]
else
call PingMinimapEx(GetUnitX(player_hero[i]), GetUnitY(player_hero[i]), 1.0, 0, 0, 255, false)
set flag_blue_holder = player_hero[i]
endif
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function InitTrig_Flag_Notice takes nothing returns nothing
set gg_trg_Flag_Notice = CreateTrigger()
call TriggerAddAction(gg_trg_Flag_Notice, function Trig_Flag_Notice_Actions)
call TriggerRegisterTimerEvent(gg_trg_Flag_Notice, 1.50, true)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Get_Flag_Actions takes nothing returns nothing
local unit captor = GetManipulatingUnit()
local integer p = GetPlayerId(GetOwningPlayer(captor))
local integer it = GetItemTypeId(GetManipulatedItem())
if((player_team[p] == 0 and it == 'I001') or (player_team[p] == 1 and it == 'I000')) then
call RemoveItem(GetManipulatedItem())
if(player_team[p] == 0) then
call CreateItem(it, GetUnitX(flag_red), GetUnitY(flag_red))
else
call CreateItem(it, GetUnitX(flag_blue), GetUnitY(flag_blue))
endif
else
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(p)) + "] has got the enemy flag.")
endif
set captor = null
endfunction
function InitTrig_Get_Flag takes nothing returns nothing
local integer i = 0
set gg_trg_Get_Flag = CreateTrigger()
call TriggerAddAction(gg_trg_Get_Flag, function Trig_Get_Flag_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Get_Flag, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Capture_Actions takes nothing returns nothing
local unit captor = GetTriggerUnit()
local integer p = GetPlayerId(GetOwningPlayer(captor))
if(GetUnitY(captor) > 0) then
if(GetItemTypeId(UnitItemInSlot(captor, 0)) == 'I000') then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(GetOwningPlayer(captor)) + "] has scored a point!")
call RemoveItem(UnitItemInSlot(captor, 0))
call CreateItem('I000', GetUnitX(flag_blue), GetUnitY(flag_blue))
set player_caps[p] = player_caps[p] + 1
endif
else
if(GetItemTypeId(UnitItemInSlot(captor, 0)) == 'I001') then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(GetOwningPlayer(captor)) + "] has scored a point!")
call RemoveItem(UnitItemInSlot(captor, 0))
call CreateItem('I001', GetUnitX(flag_red), GetUnitY(flag_red))
set player_caps[p] = player_caps[p] + 1
endif
endif
call Multiboard_Update()
set captor = null
endfunction
function InitTrig_Capture takes nothing returns nothing
set gg_trg_Capture = CreateTrigger()
call TriggerAddAction(gg_trg_Capture, function Trig_Capture_Actions)
call TriggerRegisterUnitInRange(gg_trg_Capture, gg_unit_n000_0013, 150, noFilter)
call TriggerRegisterUnitInRange(gg_trg_Capture, gg_unit_n000_0011, 150, noFilter)
endfunction
//TESH.scrollpos=69
//TESH.alwaysfold=0
function SetAlliances takes integer p returns nothing
local integer i = 0
loop
if(player_team[i] == player_team[p] and p != i) then
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_HELP_REQUEST, true)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_HELP_RESPONSE, true)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_SHARED_XP, true)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_SHARED_SPELLS, true)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_HELP_REQUEST, true)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_HELP_RESPONSE, true)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_SHARED_XP, true)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_SHARED_SPELLS, true)
elseif(p != i) then
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_PASSIVE, false)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_HELP_REQUEST, false)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_HELP_RESPONSE, false)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_SHARED_XP, false)
call SetPlayerAlliance(Player(p), Player(i), ALLIANCE_SHARED_SPELLS, false)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_PASSIVE, false)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_HELP_REQUEST, false)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_HELP_RESPONSE, false)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_SHARED_XP, false)
call SetPlayerAlliance(Player(i), Player(p), ALLIANCE_SHARED_SPELLS, false)
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function Trig_Select_Tribe_Actions takes nothing returns nothing
local integer p = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
local object o
if(GetSpellAbilityId() == 'A00D') then
call SetPlayerName(Player(p), "|c00FF0000" + player_name[p] + "|r")
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(p)) + "] has chosen the Red Ork Tribe.")
call SetPlayerColor(Player(p), ConvertPlayerColor(0))
set player_team[p] = 0
call SetAlliances(p)
call Multiboard_Update()
if(player_hero[p] != null) then
call TimerStart(player_timer[p], spawntime, false, null)
if(GetLocalPlayer() == Player(p)) then
call TimerDialogDisplay(player_timerdg[p], true)
endif
loop
call TriggerSleepAction(0.10)
exitwhen TimerGetRemaining(player_timer[p]) == 0.00
endloop
call TimerDialogDisplay(player_timerdg[p], false)
endif
set player_hero[p] = CreateUnit(Player(p), 'h000', GetUnitX(flag_red) + GetRandomReal(-500, 500), GetRandomReal(GetUnitY(flag_red) - 500, GetUnitY(flag_red) + 500), 0)
set player_mod_acc[p] = 1.00
set o = object.create(player_hero[p], 40, 100, 100)
call o.addGravity()
set o.friction = 0.02
set o.bounce = 0.0
call TriggerAddAction(o.onOutOfBounds, function Trig_Player_OnOutOfBounds)
call TriggerAddAction(o.onCollide, function Trig_Player_OnCollide)
if(GetLocalPlayer() == Player(p)) then
call SetCameraTargetController(player_hero[p], 0, 0, true)
call ClearSelection()
endif
elseif(GetSpellAbilityId() == 'A00C') then
call SetPlayerName(Player(p), "|c000000FF" + player_name[p] + "|r")
call SetPlayerColor(Player(p), ConvertPlayerColor(1))
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[" + GetPlayerName(Player(p)) + "] has chosen the Blue Ork Tribe.")
set player_team[p] = 1
call SetAlliances(p)
call Multiboard_Update()
if(player_hero[p] != null) then
call TimerStart(player_timer[p], spawntime, false, null)
if(GetLocalPlayer() == Player(p)) then
call TimerDialogDisplay(player_timerdg[p], true)
endif
loop
call TriggerSleepAction(0.10)
exitwhen TimerGetRemaining(player_timer[p]) == 0.00
endloop
call TimerDialogDisplay(player_timerdg[p], false)
endif
set player_hero[p] = CreateUnit(Player(p), 'h000', GetUnitX(flag_blue) + GetRandomReal(-500, 500), GetRandomReal(GetUnitY(flag_blue) - 500, GetUnitY(flag_blue) + 500), 0)
set player_mod_acc[p] = 1.00
set o = object.create(player_hero[p], 40, 100, 100)
call o.addGravity()
set o.friction = 0.02
set o.bounce = 0.0
call TriggerAddAction(o.onOutOfBounds, function Trig_Player_OnOutOfBounds)
call TriggerAddAction(o.onCollide, function Trig_Player_OnCollide)
if(GetLocalPlayer() == Player(p)) then
call SetCameraTargetController(player_hero[p], 0, 0, true)
call ClearSelection()
endif
endif
endfunction
function InitTrig_Select_Tribe takes nothing returns nothing
local integer i = 0
set gg_trg_Select_Tribe = CreateTrigger()
call TriggerAddAction(gg_trg_Select_Tribe, function Trig_Select_Tribe_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Select_Tribe, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Select_Ork_Actions takes nothing returns nothing
local integer p = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
set player_wid[p] = GetUnitPointValue(player_hero[p])
call RemoveUnit(player_tribeselect_h[p])
set player_tribeselect_h[p] = CreateUnit(Player(p), 'Hstm', 0, 0, 0)
call Multiboard_Update()
endfunction
function InitTrig_Select_Ork takes nothing returns nothing
local integer i = 0
set gg_trg_Select_Ork = CreateTrigger()
call TriggerAddAction(gg_trg_Select_Ork, function Trig_Select_Ork_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Select_Ork, Player(i), EVENT_PLAYER_UNIT_UPGRADE_FINISH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=11
//TESH.alwaysfold=0
function Trig_Pick_Hero_Actions takes nothing returns nothing
local integer p = GetPlayerId(GetTriggerPlayer())
if(GetUnitTypeId(GetTriggerUnit()) == 'Hstm') then
if(player_hero[p] != null) then
call DialogDisplay(Player(p), dg_pick, true)
loop
call TriggerSleepAction(0.1)
exitwhen dg_confirmed[p] != 0
endloop
if(dg_confirmed[p] == 2) then
set dg_confirmed[p] = 0
if(GetPlayerId(GetLocalPlayer()) == p) then
call ClearSelection()
endif
return
endif
set dg_confirmed[p] = 0
if(player_vehicle[p] != null) then
call SetUnitOwner(player_vehicle[p], Player(15), true)
set player_vehicle[p] = null
endif
call DisableTrigger(gg_trg_Respawn)
call KillUnit(player_hero[p])
call EnableTrigger(gg_trg_Respawn)
call object(GetUnitUserData(player_hero[p])).remove()
call RemoveUnit(player_hero[p])
endif
if(GetPlayerId(GetLocalPlayer()) == p) then
call ClearSelection()
call SelectUnit(player_tribeselect[GetPlayerId(GetTriggerPlayer())], true)
endif
endif
endfunction
function InitTrig_Transfer_Selection takes nothing returns nothing
local integer i = 0
set gg_trg_Transfer_Selection = CreateTrigger()
call TriggerAddAction(gg_trg_Transfer_Selection, function Trig_Pick_Hero_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Transfer_Selection, Player(i), EVENT_PLAYER_UNIT_SELECTED, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=17
//TESH.alwaysfold=0
function Trig_Move_Actions takes nothing returns nothing
local integer i = 0
local location loc
loop
if(key_up[i]) then
set loc = PolarProjectionBJ(GetUnitLoc(player_hero[i]), 4, GetUnitFacing(player_hero[i]))
call SetUnitX(player_hero[i], GetLocationX(loc))
call SetUnitY(player_hero[i], GetLocationY(loc))
elseif(key_down[i]) then
set loc = PolarProjectionBJ(GetUnitLoc(player_hero[i]), -4, GetUnitFacing(player_hero[i]))
call SetUnitX(player_hero[i], GetLocationX(loc))
call SetUnitY(player_hero[i], GetLocationY(loc))
endif
if(key_left[i]) then
call SetUnitFacing(player_hero[i], GetUnitFacing(player_hero[i]) + 10)
elseif(key_right[i]) then
call SetUnitFacing(player_hero[i], GetUnitFacing(player_hero[i]) - 10)
endif
set i = i + 1
exitwhen i == 12
endloop
//[(First Person Shooter)]
//
//call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 0.00, 0.00)
//call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 0, 0.00)
//call SetCameraField(CAMERA_FIELD_ZOFFSET, 100 + GetLocationZ(GetUnitLoc(player_hero[GetPlayerId(GetLocalPlayer())])), 0.00)
//if(key_left[GetPlayerId(GetLocalPlayer())] or key_right[GetPlayerId(GetLocalPlayer())]) then
// call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(player_hero[GetPlayerId(GetLocalPlayer())]), 0.00)
//endif
//call SelectUnit(player_hero[GetPlayerId(GetLocalPlayer())], true)
//call SetCameraField(CAMERA_FIELD_FARZ, 999999, 0.00)
//call ForceUIKey("F")
endfunction
//===========================================================================
function InitTrig_Move takes nothing returns nothing
set gg_trg_Move = CreateTrigger()
call TriggerAddAction(gg_trg_Move, function Trig_Move_Actions)
call TriggerRegisterTimerEvent(gg_trg_Move, 0.01, true)
endfunction
//TESH.scrollpos=187
//TESH.alwaysfold=0
globals
string array db_name
integer array db_projectile
real array db_size
real array db_mindmg
real array db_maxdmg
real array db_muzzlespeed
real array db_push
real array db_aoe
real array db_offset
real array db_delay
integer array db_count
integer array db_gore
integer array db_goretype
constant integer GORE_BULLET = 'h01E'
constant integer GORE_BOOM = 'h01D'
constant integer GORE_PLASMA = 'h01H'
constant integer GORE_FIRE = 'h01F'
endglobals
function Trig_Weapon_Database_Actions takes nothing returns nothing
//Snaypaguy - Hed Splitta
set db_name[0] = "Hed Splitta"
set db_projectile[0] = 'shel'
set db_size[0] = 8
set db_mindmg[0] = 320.00
set db_maxdmg[0] = 520.00
set db_muzzlespeed[0] = 900
set db_aoe[0] = 0.0
set db_push[0] = 55500
set db_offset[0] = 2.2
set db_delay[0] = 0
set db_count[0] = 1
set db_gore[0] = GORE_BOOM
//Nob - Shottastick
set db_name[1] = "Shottastick"
set db_projectile[1] = 'h002'
set db_size[1] = 5
set db_mindmg[1] = 50.00
set db_maxdmg[1] = 100.00
set db_muzzlespeed[1] = 700.00
set db_aoe[1] = 0.0
set db_push[1] = 8000.0
set db_offset[1] = 3.8
set db_delay[1] = 16
set db_count[1] = 5
set db_gore[1] = GORE_BULLET
//Rokkitpak Gal - Dual Shotta
set db_name[2] = "Dual Shotta"
set db_projectile[2] = 'h006'
set db_size[2] = 4
set db_mindmg[2] = 120.00
set db_maxdmg[2] = 160.00
set db_muzzlespeed[2] = 700
set db_aoe[2] = 0.0
set db_push[2] = 6000.0
set db_offset[2] = 3.0
set db_delay[2] = 0.04
set db_count[2] = 4
set db_gore[2] = GORE_BULLET
//Plazma Nob - Blasta
set db_name[3] = "Blasta"
set db_projectile[3] = 'h009'
set db_size[3] = 15
set db_mindmg[3] = 160.00
set db_maxdmg[3] = 220.00
set db_muzzlespeed[3] = 500
set db_aoe[3] = 0.0
set db_push[3] = 20000.00
set db_offset[3] = 1.5
set db_delay[3] = 30
set db_count[3] = 3
set db_gore[3] = GORE_PLASMA
//Mashingunna - Mashingun
set db_name[4] = "Mashingun"
set db_projectile[4] = 'h00E'
set db_size[4] = 5
set db_mindmg[4] = 50.00
set db_maxdmg[4] = 90.00
set db_muzzlespeed[4] = 700
set db_aoe[4] = 0.0
set db_push[4] = 10000.00
set db_offset[4] = 5.5
set db_delay[4] = 12
set db_count[4] = 8
set db_gore[4] = GORE_BULLET
//Mashiingunna - Mashiingun - Explosive Rounds
set db_name[5] = "Mashingun"
set db_projectile[5] = 'h00F'
set db_size[5] = 5
set db_mindmg[5] = 75.00
set db_maxdmg[5] = 135.00
set db_muzzlespeed[5] = 700
set db_aoe[5] = 0.0
set db_push[5] = 20000.00
set db_offset[5] = 5.5
set db_delay[5] = 12
set db_count[5] = 8
set db_gore[5] = GORE_BULLET
//Spez Git - Lazor
set db_name[6] = "Lazor"
set db_projectile[6] = 'h00K'
set db_size[6] = 8
set db_mindmg[6] = 300.00
set db_maxdmg[6] = 400.00
set db_muzzlespeed[6] = 900
set db_aoe[6] = 0.0
set db_push[6] = 35500.00
set db_offset[6] = 1.5
set db_delay[6] = 0
set db_count[6] = 1
set db_gore[6] = GORE_BOOM
//Warboss - Handshotta
set db_name[7] = "Handshotta"
set db_projectile[7] = 'h00M'
set db_size[7] = 6
set db_mindmg[7] = 100.00
set db_maxdmg[7] = 150.00
set db_muzzlespeed[7] = 800
set db_aoe[7] = 0.0
set db_push[7] = 4000.00
set db_offset[7] = 3.2
set db_delay[7] = 40
set db_count[7] = 3
set db_gore[7] = GORE_FIRE
//Rokkit Nob - Rokkit Launcha
set db_name[8] = "Rokkit Launcha"
set db_projectile[8] = 'h00O'
set db_size[8] = 10
set db_mindmg[8] = 620.00
set db_maxdmg[8] = 780.00
set db_muzzlespeed[8] = 350
set db_aoe[8] = 200.00
set db_push[8] = 50000.00
set db_offset[8] = 0.00
set db_delay[8] = 0
set db_count[8] = 1
set db_gore[8] = GORE_BOOM
//Dokta - Shokagun
set db_name[9] = "Shokagun"
set db_projectile[9] = 'h00S'
set db_size[9] = 6
set db_mindmg[9] = 110.00
set db_maxdmg[9] = 120.00
set db_muzzlespeed[9] = 600
set db_aoe[9] = 0.00
set db_push[9] = 6000.00
set db_offset[9] = 2.00
set db_delay[9] = 40
set db_count[9] = 3
set db_gore[9] = GORE_PLASMA
//Faya Git - Faya Trowa
set db_name[10] = "Faya Trowa"
set db_projectile[10] = 'h00V'
set db_size[10] = 25
set db_mindmg[10] = 60.00
set db_maxdmg[10] = 80.00
set db_muzzlespeed[10] = 300
set db_aoe[10] = 0.00
set db_push[10] = 0.00
set db_offset[10] = 6.50
set db_delay[10] = 8
set db_count[10] = 10
set db_gore[10] = GORE_FIRE
//Faya Git - Faya Trowa - Concentrated
set db_name[11] = "Faya Trowa"
set db_projectile[11] = 'h00V'
set db_size[11] = 25
set db_mindmg[11] = 60.00
set db_maxdmg[11] = 80.00
set db_muzzlespeed[11] = 450
set db_aoe[11] = 0.00
set db_push[11] = 0.00
set db_offset[11] = 0.50
set db_delay[11] = 8
set db_count[11] = 10
set db_gore[11] = GORE_FIRE
//Krava - Hevi Shoota
set db_name[12] = "Hevi Shoota"
set db_projectile[12] = 'h010'
set db_size[12] = 5
set db_mindmg[12] = 50.00
set db_maxdmg[12] = 80.00
set db_muzzlespeed[12] = 800
set db_aoe[12] = 0.00
set db_push[12] = 12500.00
set db_offset[12] = 5.00
set db_delay[12] = 12
set db_count[12] = 10
set db_gore[12] = GORE_BULLET
//Tank - Tank Gun
set db_name[13] = "Tank Gun"
set db_projectile[13] = 'h00O'
set db_size[13] = 12
set db_mindmg[13] = 600.00
set db_maxdmg[13] = 800.00
set db_muzzlespeed[13] = 1000
set db_aoe[13] = 300.00
set db_push[13] = 50000.00
set db_offset[13] = 3.00
set db_delay[13] = 0
set db_count[13] = 1
set db_gore[13] = GORE_BOOM
endfunction
function InitTrig_Weapon_Database takes nothing returns nothing
set gg_trg_Weapon_Database = CreateTrigger()
call TriggerAddAction(gg_trg_Weapon_Database, function Trig_Weapon_Database_Actions)
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
globals
real array db_radius
real array db_height
string array db_deatheffect
boolean array db_rideable
integer array db_wid
integer dood_count = 0
string array crasheffect
endglobals
function Trig_Vehicle_OnCollide takes nothing returns nothing
local integer i = 0
local object gore
local string o = OrderId2String(GetUnitCurrentOrder(object.o.coreUnit))
if(o == "move" or o == "patrol" or o == "smart" and object.o.locZ + 100 > object.oc.locZ) then
call UnitDamageTarget(object.o.coreUnit, object.oc.coreUnit, 25.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
if(gore_on) then
call DestroyEffect(AddSpecialEffectTarget(crasheffect[GetRandomInt(0, 3)], object.oc.coreUnit, "chest"))
if(GetUnitState(object.oc.coreUnit, UNIT_STATE_LIFE) < 0.045 and IsHeroUnitId(GetUnitTypeId(object.oc.coreUnit))) then
loop
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", object.oc.coreUnit, "origin"))
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(object.oc.coreUnit), GetUnitY(object.oc.coreUnit), 0), 1, 1, 15)
set gore.locZ = object.oc.locZ
set gore.velX = object.oc.velX
set gore.velY = object.oc.velY
set gore.velZ = object.oc.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(5000, 10000), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
call TriggerAddAction(gore.onOutOfBounds, function CleanBlood)
set i = i + 1
exitwhen i == gore_amount
endloop
call SetUnitScale(object.oc.coreUnit, 0, 0, 0)
endif
endif
endif
endfunction
function Doodad_Setup takes nothing returns boolean
local unit ud = GetFilterUnit()
local integer i = 0
local integer p = GetUnitPointValue(ud)
local object o = object.create(ud, db_radius[p], db_height[p], 99999)
set dood_count = dood_count + 1
if(not db_rideable[p]) then
call GroupRemoveUnit(object.all, ud)
else
call TriggerAddAction(o.onCollide, function Trig_Vehicle_OnCollide)
set o.mass = 5000
call o.addGravity()
set o.friction = 0.99
set o.bounce = 0.0
endif
set ud = null
return false
endfunction
function Trig_Doodad_Database_Actions takes nothing returns nothing
local group doodads = CreateGroup()
//Barrel
set db_radius[0] = 20
set db_height[0] = 70
set db_deatheffect[0] = ""
//Laying Barrel
set db_radius[1] = 40
set db_height[1] = 40
set db_deatheffect[0] = ""
//Floating Crate
set db_radius[2] = 40
set db_height[2] = 40
set db_deatheffect[2] = "WaterBullet.mdx"
//Fountain
set db_radius[3] = 150
set db_height[3] = 120
set db_deatheffect[3] = "AquaSpike.mdx"
//Small Wall
set db_radius[4] = 20
set db_height[4] = 78
set db_deatheffect[4] = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
//Wall
set db_radius[5] = 40
set db_height[5] = 180
set db_deatheffect[5] = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
//Large Wall
set db_radius[6] = 50
set db_height[6] = 230
set db_deatheffect[6] = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
//Tree
set db_radius[7] = 50
set db_height[7] = 275
set db_deatheffect[7] = ""
//Lighter
set db_radius[8] = 15
set db_height[8] = 25
set db_deatheffect[8] = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl"
//Rock
set db_radius[9] = 80
set db_height[9] = 150
set db_deatheffect[9] = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
//Rock Smaller
set db_radius[10] = 60
set db_height[10] = 80
set db_deatheffect[10] = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
//Tank
set db_radius[11] = 180
set db_height[11] = 200
set db_deatheffect[11] = ""
set db_rideable[11] = true
set db_wid[11] = 13
//Crate
set db_radius[12] = 30
set db_height[12] = 50
set db_deatheffect[12] = ""
call GroupEnumUnitsOfPlayer(doodads, Player(15), Filter(function Doodad_Setup))
call DestroyGroup(doodads)
//call BJDebugMsg("Registered Destructable Objects: " + I2S(dood_count))
set doodads = null
endfunction
function Doodad_Death takes nothing returns nothing
local unit u = GetDyingUnit()
if(db_deatheffect[GetUnitPointValue(u)] != "") then
call DestroyEffect(AddSpecialEffect(db_deatheffect[GetUnitPointValue(u)], GetUnitX(u), GetUnitY(u)))
call object(GetUnitUserData(u)).remove()
call RemoveUnit(u)
endif
set u = null
endfunction
function InitTrig_Doodad_Database takes nothing returns nothing
local trigger gg_trg_Doodad_Death = CreateTrigger()
set gg_trg_Doodad_Database = CreateTrigger()
call TriggerAddAction(gg_trg_Doodad_Database, function Trig_Doodad_Database_Actions)
call TriggerAddAction(gg_trg_Doodad_Death, function Doodad_Death)
call TriggerRegisterPlayerUnitEvent(gg_trg_Doodad_Death, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_DEATH, noFilter)
set crasheffect[0] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodHellScream.mdl"
set crasheffect[1] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodHeadhunter.mdl"
set crasheffect[2] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodPeon.mdl"
set crasheffect[3] = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodWitchDoctor.mdl"
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Jump_Actions takes nothing returns nothing
local object o
local real angle
if(OrderId2String(GetIssuedOrderId()) == "patrol") then
set o = object(GetUnitUserData(GetOrderedUnit()))
if(GetUnitMoveSpeed(o.coreUnit) == GetUnitDefaultMoveSpeed(o.coreUnit) and o.velX < 25 and o.velY < 25 and o.velX > -25 and o.velY > -25) then
set angle = bj_RADTODEG * Atan2(GetOrderPointY() - o.locY, GetOrderPointX() - o.locX)
call o.pushToAngle(65000, angle, 75)
endif
call SetUnitFacing(o.coreUnit, angle)
call IssueImmediateOrder(o.coreUnit, "stop")
endif
endfunction
function InitTrig_Jump takes nothing returns nothing
local integer i = 0
set gg_trg_Jump = CreateTrigger()
call TriggerAddAction(gg_trg_Jump, function Trig_Jump_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Jump, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
boolean array player_scoped
endglobals
function Trig_Scope_Actions takes nothing returns nothing
local integer p = GetPlayerId(GetOwningPlayer(GetOrderedUnit()))
local string o = OrderId2String(GetIssuedOrderId())
if(o == "smart" or o == "move" or o == "patrol" or (player_scoped[p] and o == "polymorph")) then
set player_scoped[p] = false
set player_mod_acc[p] = 1.0
if(GetPlayerId(GetLocalPlayer()) == p) then
call SetCameraTargetController(player_hero[p], 0, 0, true)
endif
elseif(o == "polymorph" and not player_scoped[p]) then
set player_scoped[p] = true
set player_mod_acc[p] = 0.0
if(GetPlayerId(GetLocalPlayer()) == p) then
call ResetToGameCamera(0.0)
endif
endif
endfunction
function Trig_Scope_Condition takes nothing returns boolean
return GetUnitTypeId(GetOrderedUnit()) == 'H001'
endfunction
function InitTrig_Scope takes nothing returns nothing
local integer i = 0
set gg_trg_Scope = CreateTrigger()
call TriggerAddAction(gg_trg_Scope, function Trig_Scope_Actions)
call TriggerAddCondition(gg_trg_Scope, Condition(function Trig_Scope_Condition))
loop
set player_scoped[i] = false
call TriggerRegisterPlayerUnitEvent(gg_trg_Scope, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, noFilter)
call TriggerRegisterPlayerUnitEvent(gg_trg_Scope, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, noFilter)
call TriggerRegisterPlayerUnitEvent(gg_trg_Scope, Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Tactical_Nuke_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit sniper = GetSpellAbilityUnit()
local effect boom
local integer i = 1
local rect r = Rect(0, 0, 0, 0)
call TriggerSleepAction(6.00)
if(GetUnitState(sniper, UNIT_STATE_LIFE) > 0) then
set boom = AddSpecialEffectLoc("NuclearStrike3.mdx", loc)
call TriggerSleepAction(1.80)
if(gore_on) then
call object.explosionGore(sniper, 1000, 130500, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc) - 100, 800, 600)
else
call object.explosion(sniper, 1000, 130500, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc) - 100, 800, 600)
endif
call TriggerSleepAction(1.00)
loop
call SetBlight(Player(0), GetLocationX(loc), GetLocationY(loc), i * 20, true)
call TriggerSleepAction(0.1)
set i = i + 1
exitwhen i == 41
endloop
call TriggerSleepAction(25.00)
call SetBlight(Player(0), GetLocationX(loc), GetLocationY(loc), 800, false)
call DestroyEffect(boom)
endif
call RemoveLocation(loc)
call RemoveRect(r)
set loc = null
set sniper = null
set boom = null
set r = null
endfunction
function Trig_Tactical_Nuke_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction
function InitTrig_Tactical_Nuke takes nothing returns nothing
local integer i = 0
set gg_trg_Tactical_Nuke = CreateTrigger()
call TriggerAddAction(gg_trg_Tactical_Nuke, function Trig_Tactical_Nuke_Actions)
call TriggerAddCondition(gg_trg_Tactical_Nuke, Condition(function Trig_Tactical_Nuke_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Tactical_Nuke, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Sprint_Actions takes nothing returns nothing
local integer i = 0
local string s = ""
loop
set s = OrderId2String(GetUnitCurrentOrder(player_hero[i]))
if(GetUnitAbilityLevel(player_hero[i], 'B001') > 0 and (s == "move" or s == "smart")) then
if(object(GetUnitUserData(player_hero[i])).locZ > waterlevel) then
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", GetUnitX(player_hero[i]), GetUnitY(player_hero[i])))
else
call DestroyEffect(AddSpecialEffect("WaterBullet.mdl", GetUnitX(player_hero[i]), GetUnitY(player_hero[i])))
endif
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function InitTrig_Sprint takes nothing returns nothing
set gg_trg_Sprint = CreateTrigger()
call TriggerAddAction(gg_trg_Sprint, function Trig_Sprint_Actions)
call TriggerRegisterTimerEvent(gg_trg_Sprint, 0.25, true)
endfunction
//TESH.scrollpos=30
//TESH.alwaysfold=0
function Trig_Grenade_Actions takes nothing returns nothing
local location target = GetSpellTargetLoc()
local unit grenadier = GetSpellAbilityUnit()
local unit grenade = CreateUnit(GetOwningPlayer(grenadier), 'h004', GetUnitX(grenadier), GetUnitY(grenadier), GetUnitFacing(grenadier))
local object o_grnd = object.create(grenade, 5, 5, 1)
local real dx = GetLocationX(target) - GetUnitX(grenadier)
local real dy = GetLocationY(target) - GetUnitY(grenadier)
set o_grnd.locZ = object(GetUnitUserData(grenadier)).locZ + 80
set o_grnd.velZ = SquareRoot(dx * dx + dy * dy) / 2
set o_grnd.bounce = 0.50
set o_grnd.friction = 0.5
call o_grnd.addGravity()
call o_grnd.pushToLoc(1000, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
call TriggerAddAction(o_grnd.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call UnitApplyTimedLife(grenade, 'B000', 2.00)
call RemoveLocation(target)
set target = null
set grenadier = null
set grenade = null
endfunction
function Trig_Grenade_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'grnd'
endfunction
function Trig_Grenade_Death takes nothing returns nothing
local unit u = GetDyingUnit()
local object o = object(GetUnitUserData(u))
if(GetUnitTypeId(u) == 'h004') then
if(o.locZ < waterlevel) then
call DestroyEffect(AddSpecialEffect("GroundEXV7-Water.mdx", o.locX, o.locY))
else
call DestroyEffect(AddSpecialEffect("NewDirtEXNofire.mdl", o.locX, o.locY))
endif
if(gore_on) then
call object.explosionGore(u, 500, 60000, o.locX, o.locY, o.locZ - 350, 400, 750)
else
call object.explosion(u, 500, 60000, o.locX, o.locY, o.locZ - 350, 400, 750)
endif
call o.remove()
endif
set u = null
endfunction
function InitTrig_Grenade takes nothing returns nothing
local integer i = 0
local trigger gg_trg_GrenadeBoom = CreateTrigger()
set gg_trg_Grenade = CreateTrigger()
call TriggerAddAction(gg_trg_Grenade, function Trig_Grenade_Actions)
call TriggerAddAction(gg_trg_GrenadeBoom, function Trig_Grenade_Death)
call TriggerAddCondition(gg_trg_Grenade, Condition(function Trig_Grenade_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Grenade, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
call TriggerRegisterPlayerUnitEvent(gg_trg_GrenadeBoom, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
set gg_trg_GrenadeBoom = null
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=1
function Trig_Shoot_Specialized_Actions takes nothing returns nothing
local object bullet
local unit shot
local unit shooter = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local location loc = GetSpellTargetLoc()
local player plr = GetOwningPlayer(shooter)
local integer i = GetPlayerId(plr)
local integer wid = GetUnitPointValue(shooter)
local real angle
local real angle2
local real a = db_offset[wid] * player_mod_acc[i]
local integer cnt = 0
call SetUnitAnimation(shooter, "attack")
loop
set angle = bj_RADTODEG * Atan2(GetLocationY(loc) - GetUnitY(shooter), GetLocationX(loc) - GetUnitX(shooter))
if(cnt - (cnt / 2) * 2 == 0) then
set angle2 = angle + 20
else
set angle2 = angle - 20
endif
set shot = CreateUnit(plr, db_projectile[wid], GetUnitX(shooter), GetUnitY(shooter), angle)
set bullet = object.create(shot, 1, 1, 0.01)
set bullet.locZ = object(GetUnitUserData(shooter)).locZ + 80
call SetUnitPosition(shot, GetUnitX(shooter) + Cos(angle2 * bj_DEGTORAD) * 120, GetUnitY(shooter) + Sin(angle2 * bj_DEGTORAD) * 120)
call TriggerAddAction(bullet.onGround, function Trig_Projectile_OnGround)
call TriggerAddAction(bullet.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(bullet.onCollide, function Trig_Projectile_OnCollide)
set bullet.impactDamage = GetRandomReal(db_mindmg[wid], db_maxdmg[wid])
set bullet.impactGore = db_gore[wid]
set bullet.impactGoreType = db_goretype[wid]
set bullet.impactAoE = db_aoe[wid]
set bullet.impactPush = db_push[wid]
set cnt = cnt + 1
if(target == null) then
call bullet.pushToLocEx(db_muzzlespeed[wid] / 50, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc) + 60, GetRandomReal(-a, a), GetRandomReal(-a, a))
else
call bullet.pushToLocEx(db_muzzlespeed[wid] / 50, GetLocationX(loc), GetLocationY(loc), object(GetUnitUserData(target)).locZ + 60, GetRandomReal(-a, a), GetRandomReal(-a, a))
endif
exitwhen cnt == db_count[wid] or GetUnitState(shooter, UNIT_STATE_LIFE) <= 0
call TriggerSleepAction(db_delay[wid])
call SetUnitAnimation(shooter, "attack")
endloop
call SetUnitAnimation(shooter, "ready")
call RemoveLocation(loc)
set shot = null
set shooter = null
set loc = null
set plr = null
set target = null
endfunction
function Trig_Shoot_Specialized_Condition takes nothing returns boolean
return GetObjectName(GetSpellAbilityId()) == "Shoot "
endfunction
function InitTrig_Shoot_Specialized takes nothing returns nothing
local integer i = 0
set gg_trg_Shoot_Specialized = CreateTrigger()
call TriggerAddAction(gg_trg_Shoot_Specialized, function Trig_Shoot_Specialized_Actions)
call TriggerAddCondition(gg_trg_Shoot_Specialized, Condition(function Trig_Shoot_Specialized_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Shoot_Specialized, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=28
//TESH.alwaysfold=0
globals
group smokes = CreateGroup()
endglobals
function Trig_Smoke_Loop takes nothing returns nothing
local unit smoke = GetEnumUnit()
local integer i = 0
local real dx
local real dy
loop
if(GetUnitTypeId(player_hero[i]) == 'H005') then
set dx = GetUnitX(smoke) - GetUnitX(player_hero[i])
set dy = GetUnitY(smoke) - GetUnitY(player_hero[i])
if(SquareRoot(dx * dx + dy * dy) <= 500 and GetUnitFlyHeight(player_hero[i]) <= 100) then
call UnitAddAbility(player_hero[i], 'A00W')
else
call UnitRemoveAbility(player_hero[i], 'A00W')
endif
if(GetUnitState(smoke, UNIT_STATE_LIFE) <= 0.045) then
call UnitRemoveAbility(player_hero[i], 'A00W')
call GroupRemoveUnit(smokes, smoke)
endif
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function Trig_Smoke_Actions takes nothing returns nothing
call ForGroup(smokes, function Trig_Smoke_Loop)
endfunction
function Trig_Smoke_Bomb_Actions takes nothing returns nothing
local unit smoker = GetSpellAbilityUnit()
local integer i = 0
local real rand
local real rand2
local unit smoke
loop
set rand = GetRandomReal(0, 400)
set rand2 = GetRandomReal(0, 360) * bj_DEGTORAD
set smoke = CreateUnit(GetOwningPlayer(smoker), 'h007', GetUnitX(smoker) + rand * Cos(rand2), GetUnitY(smoker) + rand * Sin(rand2), 0)
call GroupAddUnit(smokes, smoke)
call UnitApplyTimedLife(smoke, 'B000', GetRandomReal(8.0, 10.0))
set i = i + 1
exitwhen i == 15
endloop
set smoker = null
set smoke = null
endfunction
function Trig_Smoke_Bomb_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'smok'
endfunction
function InitTrig_Smoke_Bomb takes nothing returns nothing
local integer i = 0
local trigger gg_trg_Smoke = CreateTrigger()
set gg_trg_Smoke_Bomb = CreateTrigger()
call TriggerAddAction(gg_trg_Smoke_Bomb, function Trig_Smoke_Bomb_Actions)
call TriggerAddCondition(gg_trg_Smoke_Bomb, Condition(function Trig_Smoke_Bomb_Condition))
call TriggerAddAction(gg_trg_Smoke, function Trig_Smoke_Actions)
call TriggerRegisterTimerEvent(gg_trg_Smoke, 0.1, true)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Smoke_Bomb, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=30
//TESH.alwaysfold=0
function Trig_Jump_Strike_OnGround takes nothing returns nothing
call TriggerClearActions(object.o.onTick)
call TriggerClearActions(object.o.onGround)
set object.o.useTick = false
call SetUnitAnimation(object.o.coreUnit, "attack")
if(GetUnitState(object.o.coreUnit, UNIT_STATE_LIFE) > 0) then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", object.o.locX, object.o.locY))
if(object.o.locZ < waterlevel) then
call DestroyEffect(AddSpecialEffect("Cyclon Explosion.mdx", object.o.locX, object.o.locY))
endif
call SetUnitInvulnerable(object.o.coreUnit, true)
if(gore_on) then
call object.explosionGore(object.o.coreUnit, 400, 50000, object.o.locX, object.o.locY, object.o.locZ - 600, 400, 700)
else
call object.explosion(object.o.coreUnit, 400, 50000, object.o.locX, object.o.locY, object.o.locZ - 600, 400, 700)
endif
call SetUnitInvulnerable(object.o.coreUnit, false)
set object.o.velX = 0
set object.o.velY = 0
set object.o.velZ = 0
endif
endfunction
function Trig_Jump_Strike_OnTick takes nothing returns nothing
local unit flame
local location loc
set flame = CreateUnit(Player(12), 'flam', object.o.locX, object.o.locY, GetUnitFacing(object.o.coreUnit))
call SetUnitPosition(flame, object.o.locX - 50 * Cos(GetUnitFacing(object.o.coreUnit) * bj_DEGTORAD), object.o.locY - 50 * Sin(GetUnitFacing(object.o.coreUnit) * bj_DEGTORAD))
set loc = GetUnitLoc(flame)
call SetUnitFlyHeight(flame, object.o.locZ - GetLocationZ(loc) + 70, 0)
call RemoveLocation(loc)
call UnitApplyTimedLife(flame, 'B000', 0.35)
set flame = null
set loc = null
endfunction
function Trig_Jump_Strike_Actions takes nothing returns nothing
local object o = object(GetUnitUserData(GetSpellAbilityUnit()))
local location target = GetSpellTargetLoc()
local real dx = GetLocationX(target) - GetUnitX(o.coreUnit)
local real dy = GetLocationY(target) - GetUnitY(o.coreUnit)
call o.pushToLoc(SquareRoot(dx * dx + dy * dy) * o.mass / 2, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
set o.velZ = 1000
call TriggerAddAction(o.onGround, function Trig_Jump_Strike_OnGround)
call TriggerAddAction(o.onTick, function Trig_Jump_Strike_OnTick)
set o.useTick = true
call RemoveLocation(target)
set target = null
endfunction
function Trig_Jump_Strike_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A003'
endfunction
function InitTrig_Jump_Strike takes nothing returns nothing
local integer i = 0
local trigger gg_trg_Jump_Strike_FlameOut = CreateTrigger()
set gg_trg_Jump_Strike = CreateTrigger()
call TriggerAddAction(gg_trg_Jump_Strike, function Trig_Jump_Strike_Actions)
call TriggerAddCondition(gg_trg_Jump_Strike, Condition(function Trig_Jump_Strike_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Jump_Strike, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=21
//TESH.alwaysfold=0
function Trig_Frost_Shot_OnCollide takes nothing returns nothing
local effect e
local object victim = object.oc
call SetUnitVertexColor(object.oc.coreUnit, 125, 125, 255, 155)
set e = AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", object.o.locX, object.o.locY)
call PauseUnit(victim.coreUnit, true)
call KillUnit(object.o.coreUnit)
call object.o.remove()
call TriggerSleepAction(2.00)
call SetUnitVertexColor(victim.coreUnit, 255, 255, 255, 255)
call PauseUnit(victim.coreUnit, false)
call DestroyEffect(e)
set e = null
endfunction
function Trig_Frost_Shot_OnGround takes nothing returns nothing
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", object.o.locX, object.o.locY))
call KillUnit(object.o.coreUnit)
call object.o.remove()
endfunction
function Trig_Frost_Shot_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit shot
local location loc = GetSpellTargetLoc()
local real angle
local object bullet
set angle = bj_RADTODEG * Atan2(GetLocationY(loc) - GetUnitY(caster), GetLocationX(loc) - GetUnitX(caster))
set shot = CreateUnit(GetOwningPlayer(caster), 'h00B', GetUnitX(caster) + Cos(angle * bj_DEGTORAD) * 120, GetUnitY(caster) + Sin(angle * bj_DEGTORAD) * 120, angle)
set bullet = object.create(shot, 1, 1, 0.01)
set bullet.locZ = object(GetUnitUserData(caster)).locZ + 80
call bullet.pushToLoc(16, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc) + 70)
call TriggerAddAction(bullet.onGround, function Trig_Frost_Shot_OnGround)
call TriggerAddAction(bullet.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(bullet.onCollide, function Trig_Frost_Shot_OnCollide)
call RemoveLocation(loc)
set caster = null
set shot = null
set loc = null
endfunction
function Trig_Frost_Shot_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A006'
endfunction
function InitTrig_Frost_Shot takes nothing returns nothing
local integer i = 0
set gg_trg_Frost_Shot = CreateTrigger()
call TriggerAddAction(gg_trg_Frost_Shot, function Trig_Frost_Shot_Actions)
call TriggerAddCondition(gg_trg_Frost_Shot, Condition(function Trig_Frost_Shot_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Frost_Shot, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
function Trig_Overcharge_OnGround takes nothing returns nothing
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl", object.o.locX, object.o.locY))
call DestroyEffect(AddSpecialEffect("Units\\NightElf\\Wisp\\WispExplode.mdl", object.o.locX, object.o.locY))
if(gore_on) then
call object.o.explosionGore(object.o.coreUnit, object.o.impactDamage, object.o.impactPush, object.o.locX, object.o.locY, object.o.locZ - 150, object.o.impactAoE, object.o.impactAoE + 150)
else
call object.o.explosion(object.o.coreUnit, object.o.impactDamage, object.o.impactPush, object.o.locX, object.o.locY, object.o.locZ - 150, object.o.impactAoE, object.o.impactAoE + 150)
endif
call KillUnit(object.o.coreUnit)
call object.o.remove()
endfunction
function Trig_Overcharge_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit shot
local location loc = GetSpellTargetLoc()
local real angle
local object bullet
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl", caster, "origin"))
call TriggerSleepAction(1.00)
if(GetUnitState(caster, UNIT_STATE_LIFE) > 0) then
set angle = bj_RADTODEG * Atan2(GetLocationY(loc) - GetUnitY(caster), GetLocationX(loc) - GetUnitX(caster))
set shot = CreateUnit(GetOwningPlayer(caster), 'h00A', GetUnitX(caster) + Cos(angle * bj_DEGTORAD) * 120, GetUnitY(caster) + Sin(angle * bj_DEGTORAD) * 120, angle)
set bullet = object.create(shot, 1, 1, 0.01)
set bullet.locZ = object(GetUnitUserData(caster)).locZ + 80
call bullet.pushToLoc(20, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc))
call TriggerAddAction(bullet.onGround, function Trig_Overcharge_OnGround)
call TriggerAddAction(bullet.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(bullet.onCollide, function Trig_Projectile_OnCollide)
set bullet.impactDamage = 800
set bullet.impactGore = GORE_BOOM
set bullet.impactAoE = 400
set bullet.impactPush = 65000
endif
call RemoveLocation(loc)
set caster = null
set shot = null
set loc = null
endfunction
function Trig_Overcharge_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A005'
endfunction
function InitTrig_Overcharge takes nothing returns nothing
local integer i = 0
set gg_trg_Overcharge = CreateTrigger()
call TriggerAddAction(gg_trg_Overcharge, function Trig_Overcharge_Actions)
call TriggerAddCondition(gg_trg_Overcharge, Condition(function Trig_Overcharge_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Overcharge, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Explosive_Rounds_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
if(GetSpellAbilityId() == 'A008') then
set player_wid[i] = 5
elseif(GetSpellAbilityId() == 'A007') then
call TriggerSleepAction(1.00)
set player_wid[i] = 4
endif
endfunction
function InitTrig_Explosive_Rounds takes nothing returns nothing
local integer i = 0
set gg_trg_Explosive_Rounds = CreateTrigger()
call TriggerAddAction(gg_trg_Explosive_Rounds, function Trig_Explosive_Rounds_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Explosive_Rounds, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_Slash_Actions takes nothing returns nothing
local group owned = CreateGroup()
local unit pick
local real dx
local real dy
local integer i = 0
local boolexpr cnd = Condition(function object.explosion_boolexpr)
local object o = object(GetUnitUserData(GetSpellAbilityUnit()))
local object gore
local object opick
call GroupEnumUnitsInRange(owned, o.locX, o.locY, 250, cnd)
loop
set pick = FirstOfGroup(owned)
exitwhen pick == null
set opick = object(GetUnitUserData(pick))
if(opick.locZ <= o.locZ + 100 and o.coreUnit != pick) then
call opick.pushToLoc(-40000, o.locX, o.locY, o.locZ - 100)
set dx = o.locX - GetUnitX(pick)
set dy = o.locY - GetUnitY(pick)
if(gore_on and IsHeroUnitId(GetUnitTypeId(pick))) then
set i = 0
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", pick, "origin"))
if(GetUnitState(opick.coreUnit, UNIT_STATE_LIFE) < 0.045) then
loop
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", opick.coreUnit, "origin"))
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(opick.coreUnit), GetUnitY(opick.coreUnit), 0), 1, 1, 15)
set gore.locZ = opick.locZ
set gore.velX = opick.velX
set gore.velY = opick.velY
set gore.velZ = opick.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(5000, 10000), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
set i = i + 1
exitwhen i >= gore_amount
endloop
else
loop
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(opick.coreUnit), GetUnitY(opick.coreUnit), 0), 1, 1, 15)
set gore.locZ = opick.locZ
set gore.velX = opick.velX
set gore.velY = opick.velY
set gore.velZ = opick.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(3500, 6500), GetRandomReal(0, 360), GetRandomReal(40, 60))
call TriggerAddAction(gore.onStop, function CleanBlood)
set i = i + 1
exitwhen i >= gore_amount / 2
endloop
endif
endif
call UnitDamageTarget(o.coreUnit, pick, 400, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(owned, pick)
endloop
set o.velX = 0
set o.velY = 0
set o.velZ = 0
call DestroyGroup(owned)
call DestroyBoolExpr(cnd)
set owned = null
set cnd = null
endfunction
function Trig_Slash_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00E'
endfunction
function InitTrig_Slash takes nothing returns nothing
local integer i = 0
set gg_trg_Slash = CreateTrigger()
call TriggerAddAction(gg_trg_Slash, function Trig_Slash_Actions)
call TriggerAddCondition(gg_trg_Slash, Condition(function Trig_Slash_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Slash, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=8
//TESH.alwaysfold=0
function Trig_Teleport_Actions takes nothing returns nothing
local object o = object(GetUnitUserData(GetSpellAbilityUnit()))
local location loc = GetSpellTargetLoc()
local lightning flash = AddLightningEx("AFOD", true, o.locX, o.locY, o.locZ + 60, GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc) + 60)
call SetLightningColor(flash, 1.0, 1.0, 1.0, 0.50)
call TriggerSleepAction(0.00)
call UnitDamageTarget(o.coreUnit, o.coreUnit, GetRandomReal(45, 90), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyLightning(flash)
call RemoveLocation(loc)
set flash = null
set loc = null
endfunction
function Trig_Teleport_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00G'
endfunction
function InitTrig_Teleport takes nothing returns nothing
local integer i = 0
set gg_trg_Teleport = CreateTrigger()
call TriggerAddAction(gg_trg_Teleport, function Trig_Teleport_Actions)
call TriggerAddCondition(gg_trg_Teleport, Condition(function Trig_Teleport_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Teleport, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=34
//TESH.alwaysfold=0
function Trig_Plasma_Grenade_OnGround takes nothing returns nothing
call SetUnitScale(object.o.coreUnit, 2.5, 2.5, 2.5)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl", object.o.locX, object.o.locY))
if(object.o.locZ < waterlevel) then
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", object.o.locX, object.o.locY))
endif
if(gore_on) then
call object.explosionGore(object.o.coreUnit, 400, 60000, object.o.locX, object.o.locY, object.o.locZ - 350, 400, 650)
else
call object.explosion(object.o.coreUnit, 400, 60000, object.o.locX, object.o.locY, object.o.locZ - 350, 400, 650)
endif
call KillUnit(object.o.coreUnit)
call object.o.remove()
endfunction
function Trig_Plasma_Grenade_Actions takes nothing returns nothing
local location target = GetSpellTargetLoc()
local unit grenadier = GetSpellAbilityUnit()
local unit grenade = CreateUnit(GetOwningPlayer(grenadier), 'h00G', GetUnitX(grenadier), GetUnitY(grenadier), GetUnitFacing(grenadier))
local object o_grnd = object.create(grenade, 5, 5, 1)
local real dx = GetLocationX(target) - GetUnitX(grenadier)
local real dy = GetLocationY(target) - GetUnitY(grenadier)
set o_grnd.locZ = object(GetUnitUserData(grenadier)).locZ + 80
call o_grnd.pushToLoc(600, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
set o_grnd.impactGore = GORE_BOOM
set o_grnd.impactAoE = 400
set o_grnd.impactPush = 60000
set o_grnd.impactDamage = 400
call TriggerAddAction(o_grnd.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(o_grnd.onGround, function Trig_Plasma_Grenade_OnGround)
call TriggerAddAction(o_grnd.onCollide, function Trig_Projectile_OnCollide)
call RemoveLocation(target)
set target = null
set grenadier = null
set grenade = null
endfunction
function Trig_Plasma_Grenade_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A009'
endfunction
function InitTrig_Plasma_Grenade takes nothing returns nothing
local integer i = 0
set gg_trg_Plasma_Grenade = CreateTrigger()
call TriggerAddAction(gg_trg_Plasma_Grenade, function Trig_Plasma_Grenade_Actions)
call TriggerAddCondition(gg_trg_Plasma_Grenade, Condition(function Trig_Plasma_Grenade_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Plasma_Grenade, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=1
globals
real array artillery_target_x
real array artillery_target_y
real array artillery_count
location artillery_zloc = Location(0, 0)
endglobals
function Trig_Strike_Actions takes nothing returns nothing
local integer i = 0
local real rand
local real rand2
local real x
local real y
loop
if(artillery_count[i] > 0) then
set rand = GetRandomReal(0, 800)
set rand2 = GetRandomReal(0, 360) * bj_DEGTORAD
set x = artillery_target_x[i] + rand * Cos(rand2)
set y = artillery_target_y[i] + rand * Sin(rand2)
call MoveLocation(artillery_zloc, x, y)
call AddSpecialEffect("Artillery.mdl", x, y)
if(gore_on) then
call object.explosionGore(player_hero[i], 200, 20000, x, y, GetLocationZ(artillery_zloc) - 350, 200, 700)
else
call object.explosion(player_hero[i], 200, 20000, x, y, GetLocationZ(artillery_zloc) - 350, 200, 700)
endif
set artillery_count[i] = artillery_count[i] - 1
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function Trig_Artillery_Strike_Actions takes nothing returns nothing
local integer p = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
local location loc = GetSpellTargetLoc()
call TriggerSleepAction(5.00)
if(GetUnitState(player_hero[p], UNIT_STATE_LIFE) > 0.045) then
set artillery_target_x[p] = GetLocationX(loc)
set artillery_target_y[p] = GetLocationY(loc)
set artillery_count[p] = 100
endif
call RemoveLocation(loc)
set loc = null
endfunction
function Trig_Artillery_Strike_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00X'
endfunction
function InitTrig_Artillery_Strike takes nothing returns nothing
local integer i = 0
local trigger gg_trg_Strike = CreateTrigger()
set gg_trg_Artillery_Strike = CreateTrigger()
call TriggerAddAction(gg_trg_Artillery_Strike, function Trig_Artillery_Strike_Actions)
call TriggerAddCondition(gg_trg_Artillery_Strike, Condition(function Trig_Artillery_Strike_Condition))
call TriggerAddAction(gg_trg_Strike, function Trig_Strike_Actions)
call TriggerRegisterTimerEvent(gg_trg_Strike, 0.05, true)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Artillery_Strike, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
object pwrhero
endglobals
function Trig_Power_Shield_Callback takes nothing returns nothing
local object v = object(GetUnitUserData(GetEnumUnit()))
local real dx = pwrhero.locX - v.locX
local real dy = pwrhero.locY - v.locY
local real dz = pwrhero.locZ - v.locZ
if(SquareRoot(dx * dx + dy * dy + dz * dz) <= 150 and GetOwningPlayer(pwrhero.coreUnit) != GetOwningPlayer(v.coreUnit)) then
call v.pushToLoc(-10, pwrhero.locX, pwrhero.locY, pwrhero.locZ + 60)
endif
endfunction
function Trig_Power_Shield_Actions takes nothing returns nothing
local integer i = 0
loop
if(GetUnitAbilityLevel(player_hero[i], 'B003') > 0) then
set pwrhero = object(GetUnitUserData(player_hero[i]))
call ForGroup(object.all, function Trig_Power_Shield_Callback)
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function InitTrig_Power_Shield takes nothing returns nothing
set gg_trg_Power_Shield = CreateTrigger()
call TriggerAddAction(gg_trg_Power_Shield, function Trig_Power_Shield_Actions)
call TriggerRegisterTimerEvent(gg_trg_Power_Shield, 0.01, true)
endfunction
//TESH.scrollpos=40
//TESH.alwaysfold=0
function Rocket_Control takes nothing returns nothing
local object r = object(GetUnitUserData(GetEnumUnit()))
local real facing
local real angle
if(GetUnitTypeId(r.coreUnit) == 'h00O' and GetOwningPlayer(r.coreUnit) == GetOwningPlayer(object.o.coreUnit)) then
set facing = bj_RADTODEG * Atan2(r.velY, r.velX)
set angle = bj_RADTODEG * Atan2(object.o.locY - r.locY, object.o.locX - r.locX)
set r.velX = 0
set r.velY = 0
set r.velZ = 0
if(facing - angle < 5.00 and facing - angle > -5.00) then
call r.pushToLoc(7, object.o.locX, object.o.locY, object.o.locZ)
else
call r.pushToAngle(7, GetUnitFacing(r.coreUnit), 0)
call IssueTargetOrder(r.coreUnit, "move", object.o.coreUnit)
endif
endif
endfunction
function Trig_Target_Controller_OnTick takes nothing returns nothing
call ForGroup(object.all, function Rocket_Control)
endfunction
function Trig_Target_Controller_OnCollide takes nothing returns nothing
set object.o.locX = object.oc.locX
set object.o.locY = object.oc.locY
set object.o.velX = 0
set object.o.velY = 0
set object.o.velZ = 0
endfunction
function Trig_Target_Controller_Actions takes nothing returns nothing
local location target = GetSpellTargetLoc()
local unit grenadier = GetSpellAbilityUnit()
local unit grenade = CreateUnit(GetOwningPlayer(grenadier), 'h00Q', GetUnitX(grenadier), GetUnitY(grenadier), GetUnitFacing(grenadier))
local object o_grnd = object.create(grenade, 25, 25, 1)
local real dx = GetLocationX(target) - GetUnitX(grenadier)
local real dy = GetLocationY(target) - GetUnitY(grenadier)
set o_grnd.locZ = object(GetUnitUserData(grenadier)).locZ + 80
set o_grnd.velZ = 1000
set o_grnd.bounce = 0.0
set o_grnd.friction = 1.0
call o_grnd.addGravity()
call o_grnd.pushToLoc(SquareRoot(dx * dx + dy * dy) / 2, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
call UnitApplyTimedLife(grenade, 'B000', 10.00)
call TriggerAddAction(o_grnd.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(o_grnd.onTick, function Trig_Target_Controller_OnTick)
call TriggerAddAction(o_grnd.onCollide, function Trig_Target_Controller_OnCollide)
set o_grnd.useTick = true
call RemoveLocation(target)
set target = null
set grenadier = null
set grenade = null
endfunction
function Trig_Target_Controller_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00M'
endfunction
function InitTrig_Target_Controller takes nothing returns nothing
local integer i = 0
set gg_trg_Target_Controller = CreateTrigger()
call TriggerAddAction(gg_trg_Target_Controller, function Trig_Target_Controller_Actions)
call TriggerAddCondition(gg_trg_Target_Controller, Condition(function Trig_Target_Controller_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Target_Controller, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_Destruction_Actions takes nothing returns nothing
local location target = GetSpellTargetLoc()
local unit grenadier = GetSpellAbilityUnit()
local real angle = bj_RADTODEG * Atan2(GetLocationY(target) - GetUnitY(grenadier), GetLocationX(target) - GetUnitX(grenadier))
local unit grenade = CreateUnit(GetOwningPlayer(grenadier), 'h00P', GetUnitX(grenadier), GetUnitY(grenadier), angle)
local object o_grnd = object.create(grenade, 5, 5, 1)
local real dx = GetLocationX(target) - GetUnitX(grenadier)
local real dy = GetLocationY(target) - GetUnitY(grenadier)
set o_grnd.locZ = object(GetUnitUserData(grenadier)).locZ + 80
call o_grnd.pushToLoc(SquareRoot(dx * dx + dy * dy) / 3, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
set o_grnd.velZ = o_grnd.velZ + 1500
call o_grnd.addGravity()
set o_grnd.impactDamage = 800
set o_grnd.impactGore = GORE_BOOM
set o_grnd.impactAoE = 500
set o_grnd.impactPush = 70000
call TriggerAddAction(o_grnd.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(o_grnd.onGround, function Trig_Projectile_OnGround)
call TriggerAddAction(o_grnd.onCollide, function Trig_Projectile_OnCollide)
call RemoveLocation(target)
set target = null
set grenadier = null
set grenade = null
endfunction
function Trig_Destruction_Death_Actions takes nothing returns nothing
local object o = object(GetUnitUserData(GetDyingUnit()))
if(GetUnitTypeId(o.coreUnit) == 'h00P') then
call DestroyEffect(AddSpecialEffect("BigGroundEXV1.mdx", o.locX, o.locY))
if(o.locZ < waterlevel) then
call DestroyEffect(AddSpecialEffect("GroundEXV7-Water.mdx", o.locX, o.locY))
endif
endif
endfunction
function Trig_Destruction_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00L'
endfunction
function InitTrig_Destruction takes nothing returns nothing
local integer i = 0
local trigger gg_trg_DestructionDeath = CreateTrigger()
call TriggerAddAction(gg_trg_DestructionDeath, function Trig_Destruction_Death_Actions)
set gg_trg_Destruction = CreateTrigger()
call TriggerAddAction(gg_trg_Destruction, function Trig_Destruction_Actions)
call TriggerAddCondition(gg_trg_Destruction, Condition(function Trig_Destruction_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Destruction, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
call TriggerRegisterPlayerUnitEvent(gg_trg_DestructionDeath, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_Heal_Actions takes nothing returns nothing
local unit target = GetSpellTargetUnit()
if(GetRandomReal(0, 100) > 25) then
call SetUnitState(target, UNIT_STATE_LIFE, GetUnitState(target, UNIT_STATE_LIFE) + GetRandomReal(100, 150))
else
call SetUnitState(target, UNIT_STATE_LIFE, 500)
endif
call TriggerSleepAction(0.00)
call PauseUnit(target, true)
call TriggerSleepAction(0.50)
call PauseUnit(target, false)
set target = null
endfunction
function Trig_Heal_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00P'
endfunction
function InitTrig_Heal takes nothing returns nothing
local integer i = 0
set gg_trg_Heal = CreateTrigger()
call TriggerAddAction(gg_trg_Heal, function Trig_Heal_Actions)
call TriggerAddCondition(gg_trg_Heal, Condition(function Trig_Heal_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Heal, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=72
//TESH.alwaysfold=0
globals
object pwnzor
endglobals
function Trig_Shock_Grenade_OnCollide takes nothing returns nothing
call KillUnit(object.o.coreUnit)
endfunction
function Trig_Shock_Grenade_Actions takes nothing returns nothing
local location target = GetSpellTargetLoc()
local unit grenadier = GetSpellAbilityUnit()
local unit grenade = CreateUnit(GetOwningPlayer(grenadier), 'h00T', GetUnitX(grenadier), GetUnitY(grenadier), GetUnitFacing(grenadier))
local object o_grnd = object.create(grenade, 5, 5, 1)
local real dx = GetLocationX(target) - GetUnitX(grenadier)
local real dy = GetLocationY(target) - GetUnitY(grenadier)
set o_grnd.locZ = object(GetUnitUserData(grenadier)).locZ + 80
set o_grnd.velZ = SquareRoot(dx * dx + dy * dy) / 2
set o_grnd.bounce = 0.75
set o_grnd.friction = 0.3
call o_grnd.addGravity()
call o_grnd.pushToLoc(1000, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
call TriggerAddAction(o_grnd.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(o_grnd.onCollide, function Trig_Shock_Grenade_OnCollide)
call UnitApplyTimedLife(grenade, 'B000', 2.00)
call RemoveLocation(target)
set target = null
set grenadier = null
set grenade = null
endfunction
function Trig_Shock_Grenade_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00O'
endfunction
function Trig_Shock_Grenade_Stun takes nothing returns nothing
local integer i = 0
local object pick = object(GetUnitUserData(GetEnumUnit()))
local real dx
local real dy
if(pick.locZ <= pwnzor.locZ + 350) then
call pick.pushToLoc(40000, pwnzor.locX, pwnzor.locY, pwnzor.locZ + 350)
loop
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", pick.coreUnit, gore_bodyparts[i]))
set i = i + 1
exitwhen i == 3
endloop
set dx = pwnzor.locX - GetUnitX(pick.coreUnit)
set dy = pwnzor.locY - GetUnitY(pick.coreUnit)
call UnitDamageTarget(pwnzor.coreUnit, pick.coreUnit, (500 - SquareRoot(dx * dx + dy * dy)) / 500 * 350, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call PauseUnit(pick.coreUnit, true)
endif
endfunction
function Trig_Shock_Grenade_Destun takes nothing returns nothing
call PauseUnit(GetEnumUnit(), false)
endfunction
function Trig_Shock_Grenade_Death takes nothing returns nothing
local unit u = GetDyingUnit()
local group owned = CreateGroup()
local real dx
local real dy
local boolexpr cnd = Condition(function object.explosion_boolexpr)
local object o
if(GetUnitTypeId(u) == 'h00T') then
set pwnzor = object(GetUnitUserData(u))
set o = pwnzor
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", pwnzor.locX, pwnzor.locY))
call SetUnitScale(pwnzor.coreUnit, 3.0, 3.0, 3.0)
call GroupEnumUnitsInRange(owned, pwnzor.locX, pwnzor.locY, 500, cnd)
call ForGroup(owned, function Trig_Shock_Grenade_Stun)
call TriggerSleepAction(2.00)
call ForGroup(owned, function Trig_Shock_Grenade_Destun)
call GroupClear(owned)
call o.remove()
endif
call DestroyGroup(owned)
call DestroyBoolExpr(cnd)
set u = null
set owned = null
set cnd = null
endfunction
function InitTrig_Shock_Grenade takes nothing returns nothing
local integer i = 0
local trigger gg_trg_Shock_GrenadeBoom = CreateTrigger()
set gg_trg_Shock_Grenade = CreateTrigger()
call TriggerAddAction(gg_trg_Shock_Grenade, function Trig_Shock_Grenade_Actions)
call TriggerAddAction(gg_trg_Shock_GrenadeBoom, function Trig_Shock_Grenade_Death)
call TriggerAddCondition(gg_trg_Shock_Grenade, Condition(function Trig_Shock_Grenade_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Shock_Grenade, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
call TriggerRegisterPlayerUnitEvent(gg_trg_Shock_GrenadeBoom, Player(i), EVENT_PLAYER_UNIT_DEATH, noFilter)
set i = i + 1
exitwhen i == 12
endloop
set gg_trg_Shock_GrenadeBoom = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Concentrate_Fire_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
if(GetSpellAbilityId() == 'A00U') then
set player_wid[i] = 11
elseif(GetSpellAbilityId() == 'A00Q') then
call TriggerSleepAction(1.00)
set player_wid[i] = 10
endif
endfunction
function InitTrig_Concentrate_Fire takes nothing returns nothing
local integer i = 0
set gg_trg_Concentrate_Fire = CreateTrigger()
call TriggerAddAction(gg_trg_Concentrate_Fire, function Trig_Concentrate_Fire_Actions)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Concentrate_Fire, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
group gasses = CreateGroup()
endglobals
function Poison_Loop takes nothing returns nothing
local unit gas = GetEnumUnit()
call UnitDamagePoint(gas, 0.00, 50.0, GetUnitX(gas), GetUnitY(gas), 10.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
if(GetUnitState(gas, UNIT_STATE_LIFE) <= 0.045) then
call GroupRemoveUnit(gasses, gas)
endif
set gas = null
endfunction
function Trig_Poison_Actions takes nothing returns nothing
call ForGroup(gasses, function Poison_Loop)
endfunction
function Trig_Poison_Gasses_OnGround takes nothing returns nothing
local integer i = 0
local real rand
local real rand2
local unit gas
loop
set rand = GetRandomReal(0, 400)
set rand2 = GetRandomReal(0, 360) * bj_DEGTORAD
set gas = CreateUnit(GetOwningPlayer(object.o.coreUnit), 'h00W', object.o.locX + rand * Cos(rand2), object.o.locY + rand * Sin(rand2), 0)
call GroupAddUnit(gasses, gas)
call UnitApplyTimedLife(gas, 'B000', GetRandomReal(3.0, 4.0))
set i = i + 1
exitwhen i == 30
endloop
call UnitApplyTimedLife(object.o.coreUnit, 'B000', 0.05)
call object.o.remove()
set gas = null
endfunction
function Trig_Poison_Gasses_Actions takes nothing returns nothing
local location target = GetSpellTargetLoc()
local unit grenadier = GetSpellAbilityUnit()
local unit grenade = CreateUnit(GetOwningPlayer(grenadier), 'h00X', GetUnitX(grenadier), GetUnitY(grenadier), GetUnitFacing(grenadier))
local object o_grnd = object.create(grenade, 5, 5, 1)
local real dx = GetLocationX(target) - GetUnitX(grenadier)
local real dy = GetLocationY(target) - GetUnitY(grenadier)
set o_grnd.locZ = object(GetUnitUserData(grenadier)).locZ + 80
set o_grnd.velZ = SquareRoot(dx * dx + dy * dy)
call o_grnd.addGravity()
call o_grnd.pushToLoc(500, GetLocationX(target), GetLocationY(target), GetLocationZ(target))
call TriggerAddAction(o_grnd.onOutOfBounds, function Trig_Projectile_OnOutOfBounds)
call TriggerAddAction(o_grnd.onGround, function Trig_Poison_Gasses_OnGround)
call RemoveLocation(target)
set target = null
set grenadier = null
set grenade = null
endfunction
function Trig_Poison_Gasses_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00R'
endfunction
function InitTrig_Poison_Gasses takes nothing returns nothing
local integer i = 0
local trigger gg_trg_Poison = CreateTrigger()
set gg_trg_Poison_Gasses = CreateTrigger()
call TriggerAddAction(gg_trg_Poison_Gasses, function Trig_Poison_Gasses_Actions)
call TriggerAddCondition(gg_trg_Poison_Gasses, Condition(function Trig_Poison_Gasses_Condition))
call TriggerAddAction(gg_trg_Poison, function Trig_Poison_Actions)
call TriggerRegisterTimerEvent(gg_trg_Poison, 0.1, true)
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Poison_Gasses, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Roar_Actions takes nothing returns nothing
local object o = object(GetUnitUserData(GetSpellAbilityUnit()))
call SetUnitInvulnerable(o.coreUnit, true)
call object.explosion(o.coreUnit, 500, 50000, o.locX, o.locY, o.locZ - 350, 500, 750)
call SetUnitInvulnerable(o.coreUnit, false)
set o.velZ = 0
endfunction
function Trig_Roar_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00I'
endfunction
function InitTrig_Roar takes nothing returns nothing
local integer i = 0
set gg_trg_Roar = CreateTrigger()
call TriggerAddAction(gg_trg_Roar, function Trig_Roar_Actions)
call TriggerAddCondition(gg_trg_Roar, Condition(function Trig_Roar_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Roar, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
integer array chargeticks
endglobals
function Trig_Charge_OnOutOfBounds takes nothing returns nothing
set object.o.velX = object.o.velX * 0.40
set object.o.velY = object.o.velY * 0.40
call TriggerClearActions(object.o.onTick)
call TriggerClearActions(object.o.onCollide)
call TriggerClearActions(object.o.onOutOfBounds)
call TriggerAddAction(object.o.onOutOfBounds, function Trig_Player_OnOutOfBounds)
set object.o.useTick = false
endfunction
function Trig_Charge_OnTick takes nothing returns nothing
local integer p = GetPlayerId(GetOwningPlayer(object.o.coreUnit))
if(GetUnitFlyHeight(object.o.coreUnit) < 10) then
call object.o.pushToAngle(5000, GetUnitFacing(player_hero[p]), 0)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl", object.o.locX, object.o.locY))
endif
set chargeticks[p] = chargeticks[p] + 1
if(chargeticks[p] == 45 or GetUnitState(player_hero[p], UNIT_STATE_LIFE) <= 0.045) then
set object.o.velX = object.o.velX * 0.40
set object.o.velY = object.o.velY * 0.40
call TriggerClearActions(object.o.onTick)
call TriggerClearActions(object.o.onCollide)
call TriggerClearActions(object.o.onOutOfBounds)
call TriggerAddAction(object.o.onOutOfBounds, function Trig_Player_OnOutOfBounds)
set object.o.useTick = false
endif
endfunction
function Trig_Charge_OnCollide takes nothing returns nothing
local integer i = 0
local object gore
call object.oc.pushToAngle(-50000, Atan2(object.o.locY - object.oc.locY, object.o.locX - object.oc.locX) * bj_RADTODEG, 0)
if(gore_on and IsHeroUnitId(GetUnitTypeId(object.oc.coreUnit))) then
if(GetUnitState(object.oc.coreUnit, UNIT_STATE_LIFE) < 0.045) then
loop
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", object.oc.coreUnit, "origin"))
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(object.oc.coreUnit), GetUnitY(object.oc.coreUnit), 0), 1, 1, 15)
set gore.locZ = object.oc.locZ
set gore.velX = object.oc.velX
set gore.velY = object.oc.velY
set gore.velZ = object.oc.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(5000, 10000), GetRandomReal(0, 360), GetRandomReal(40, 60))
call UnitApplyTimedLife(gore.coreUnit, 'B000', 2.00)
set i = i + 1
exitwhen i == gore_amount
endloop
call SetUnitVertexColor(object.oc.coreUnit, 255, 0, 0, 0)
else
loop
set gore = object.create(CreateUnit(Player(15), 'h01D' + GetRandomInt(0, 1), GetUnitX(object.oc.coreUnit), GetUnitY(object.oc.coreUnit), 0), 1, 1, 15)
set gore.locZ = object.oc.locZ
set gore.velX = object.oc.velX
set gore.velY = object.oc.velY
set gore.velZ = object.oc.velZ
call gore.addGravity()
set gore.friction = 0.10
call gore.pushToAngle(GetRandomReal(3500, 6500), GetRandomReal(0, 360), GetRandomReal(40, 60))
call UnitApplyTimedLife(gore.coreUnit, 'B000', 2.00)
set i = i + 1
exitwhen i == gore_amount / 2
endloop
endif
endif
call UnitDamageTarget(object.o.coreUnit, object.oc.coreUnit, 100.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set object.o.velX = 0
set object.o.velY = 0
call TriggerClearActions(object.o.onTick)
call TriggerClearActions(object.o.onCollide)
set object.o.useTick = false
endfunction
function Trig_Charge_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local object o = object(GetUnitUserData(GetSpellAbilityUnit()))
local integer p = GetPlayerId(GetOwningPlayer(o.coreUnit))
call TriggerAddAction(o.onCollide, function Trig_Charge_OnCollide)
call TriggerAddAction(o.onTick, function Trig_Charge_OnTick)
call TriggerAddAction(o.onOutOfBounds, function Trig_Charge_OnOutOfBounds)
set o.useTick = true
set chargeticks[p] = 0
call RemoveLocation(loc)
set loc = null
endfunction
function Trig_Charge_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A00Y'
endfunction
function InitTrig_Charge takes nothing returns nothing
local integer i = 0
set gg_trg_Charge = CreateTrigger()
call TriggerAddAction(gg_trg_Charge, function Trig_Charge_Actions)
call TriggerAddCondition(gg_trg_Charge, Condition(function Trig_Charge_Condition))
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Charge, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, noFilter)
set i = i + 1
exitwhen i == 12
endloop
endfunction
//TESH.scrollpos=33
//TESH.alwaysfold=0
function Trig_Move_n_Shoot_Actions takes nothing returns nothing
local integer i = 0
local integer k = 0
local integer wteam = 0
local real dx
local real dy
loop
if(player_ai[i]) then
if(GetUnitTypeId(player_hero[i]) == 'h000') then
call IssueImmediateOrderById(player_hero[i], types[GetRandomInt(0, 11)])
endif
call IssueImmediateOrder(player_hero[i], "berserk")
call IssueImmediateOrder(player_hero[i], "windwalk")
call IssueImmediateOrder(player_hero[i], "divineshield")
set wteam = player_team[i]
if(mode == MODE_CTF) then
if(wteam == TEAM_RED) then
if(UnitItemInSlot(player_hero[i], 0) != null) then
call IssueTargetOrder(player_hero[i], "move", flag_red)
else
set dx = GetItemX(flag_red_item) - GetUnitX(flag_red)
set dy = GetItemY(flag_red_item) - GetUnitY(flag_red)
if(flag_red_holder != null) then
call IssueTargetOrder(player_hero[i], "smart", flag_red_holder)
elseif(flag_red_item != null and SquareRoot(dx * dx + dy * dy) > 200) then
call IssueTargetOrder(player_hero[i], "smart", flag_red_item)
elseif(flag_blue_item != null) then
call IssueTargetOrder(player_hero[i], "smart", flag_blue_item)
elseif(flag_blue_holder != null) then
call IssueTargetOrder(player_hero[i], "smart", flag_blue_holder)
endif
endif
elseif(wteam == TEAM_BLUE) then
if(UnitItemInSlot(player_hero[i], 0) != null) then
call IssueTargetOrder(player_hero[i], "move", flag_blue)
else
set dx = GetItemX(flag_blue_item) - GetUnitX(flag_blue)
set dy = GetItemY(flag_blue_item) - GetUnitY(flag_blue)
if(flag_blue_holder != null) then
call IssueTargetOrder(player_hero[i], "smart", flag_blue_holder)
elseif(flag_blue_item != null and SquareRoot(dx * dx + dy * dy) > 200) then
call IssueTargetOrder(player_hero[i], "smart", flag_blue_item)
elseif(flag_red_item != null) then
call IssueTargetOrder(player_hero[i], "smart", flag_red_item)
elseif(flag_red_holder != null) then
call IssueTargetOrder(player_hero[i], "smart", flag_red_holder)
endif
endif
endif
elseif(mode == MODE_DM) then
if(GetRandomReal(0, 100) < 4.5 or OrderId2String(GetUnitCurrentOrder(player_hero[i])) != "smart") then
if(player_team[i] == TEAM_RED) then
call IssuePointOrder(player_hero[i], "smart", GetRandomReal(-3800, 3800) + GetUnitX(flag_blue), GetRandomReal(-500, 500) + GetUnitY(flag_blue))
else
call IssuePointOrder(player_hero[i], "smart", GetRandomReal(-3800, 3800) + GetUnitX(flag_red), GetRandomReal(-500, 500) + GetUnitY(flag_red))
endif
endif
endif
set k = 0
loop
if(k != i and player_team[k] != player_team[i] and player_hero[k] != null and GetUnitTypeId(player_hero[k]) != 'h000' and GetUnitState(player_hero[k], UNIT_STATE_LIFE) > 0.045) then
set dx = GetUnitX(player_hero[i]) - GetUnitX(player_hero[k])
set dy = GetUnitY(player_hero[i]) - GetUnitY(player_hero[k])
if(SquareRoot(dx * dx + dy * dy) < 300) then
call IssueImmediateOrder(player_hero[i], "roar")
elseif(SquareRoot(dx * dx + dy * dy) < 1000) then
call IssueTargetOrder(player_hero[i], "channel", player_hero[k])
call IssuePointOrder(player_hero[i], "coldarrows", GetUnitX(player_hero[k]), GetUnitY(player_hero[k]))
exitwhen true
elseif(SquareRoot(dx * dx + dy * dy) < 1800 and UnitItemInSlot(player_hero[i], 0) == null) then
call IssuePointOrder(player_hero[i], "move", GetUnitX(player_hero[k]) + GetRandomReal(-500, 500), GetUnitY(player_hero[k]) + GetRandomReal(-500, 500))
exitwhen true
endif
endif
set k = k + 1
exitwhen k == 12
endloop
endif
set i = i + 1
exitwhen i == 12
endloop
endfunction
function InitTrig_All_of_it takes nothing returns nothing
set gg_trg_All_of_it = CreateTrigger()
call TriggerAddAction(gg_trg_All_of_it, function Trig_Move_n_Shoot_Actions)
call TriggerRegisterTimerEvent(gg_trg_All_of_it, 1.2, true)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Explosive_Barrel_Actions takes nothing returns nothing
local object o = object(GetUnitUserData(GetDyingUnit()))
local unit killer = GetKillingUnit()
call TriggerSleepAction(0.00)
if(GetUnitTypeId(o.coreUnit) == 'bbbb') then
call AddSpecialEffect("war3mapImported\\BigGroundEXV3.mdx", o.locX, o.locY)
if(gore_on) then
call object.explosionGore(killer, 1000, 50000, o.locX, o.locY, o.locZ - 350, 500, 700)
else
call object.explosion(killer, 1000, 50000, o.locX, o.locY, o.locZ - 350, 500, 700)
endif
endif
endfunction
function InitTrig_Explosive_Barrel takes nothing returns nothing
set gg_trg_Explosive_Barrel = CreateTrigger()
call TriggerAddAction(gg_trg_Explosive_Barrel, function Trig_Explosive_Barrel_Actions)
call TriggerRegisterPlayerUnitEvent(gg_trg_Explosive_Barrel, Player(15), EVENT_PLAYER_UNIT_DEATH, noFilter)
endfunction
//TESH.scrollpos=36
//TESH.alwaysfold=0
library HandleCounter
globals
private constant integer safety = 50
endglobals
function CountHandles takes nothing returns integer
local integer i = 0
local integer i2 = 0
local integer space = 0
local integer space2 = 0
local integer count = 0
local location array loc
local integer hid = 0
local integer hid2
loop
set loc[i] = Location(0., 0.)
set hid2 = GetHandleId(loc[i]) - 0x100000
if hid2 == hid + 1 or hid == 0 then
set space = space + 1
set space2 = space2 + 1
else
set space2 = 0
endif
set hid = hid2
set i = i + 1
set count = hid
exitwhen space2 == safety
endloop
loop
exitwhen i2 > i
call RemoveLocation(loc[i2])
set loc[i2] = null
set i2 = i2 + 1
endloop
return count - space - safety - 1
endfunction
endlibrary
globals
leaderboard display
endglobals
function Trig_Handle_Counter_Actions takes nothing returns nothing
call LeaderboardSetItemValue(display, 0, CountHandles())
endfunction
function ldbd takes nothing returns nothing
set display = CreateLeaderboard()
call PlayerSetLeaderboard(Player(0), display)
call LeaderboardAddItem(display, "Handles: ", CountHandles(), Player(0))
call LeaderboardDisplay(display, true)
call LeaderboardSetLabel(display, "Handle Counter")
call LeaderboardSetSizeByItemCount(display, 2)
endfunction
function InitTrig_Handle_Counter takes nothing returns nothing
local trigger trig = CreateTrigger()
set gg_trg_Handle_Counter = CreateTrigger()
call TriggerAddAction(trig, function ldbd)
call TriggerRegisterTimerEvent(trig, 0.10, false)
call TriggerAddAction(gg_trg_Handle_Counter, function Trig_Handle_Counter_Actions)
//call TriggerRegisterTimerEvent(gg_trg_Handle_Counter, 0.20, true)
call TriggerRegisterPlayerChatEvent(gg_trg_Handle_Counter, Player(0), "debug", true)
set trig = null
endfunction