Name | Type | is_array | initial_value |
deathTerrain | integer | No | 0 |
initSpeed | real | No | 0.00 |
maxSlideTerrains | integer | No | 0 |
offsetDist | real | No | 0.00 |
onIce | boolean | Yes | false |
Slideables | group | No | |
slideTerrain | integer | Yes | 0 |
Speed | real | Yes | 0.00 |
speedMultiplier | real | Yes | 0.00 |
Steerable | boolean | Yes | true |
timeStep | real | No | 0.00 |
//***************************************************************************************************
// *
// ##### / ## ####### ####### *
// ###### / ##### / ### / ### *
// /# / / ##### / ## / ## *
// / / ## # ## ## # ## # *
// / ### # ### ### *
// ## ## # ## ### ## ### *
// ## ## # ### ### ### ### *
// ## ## # ### ### ### ### *
// ## ## # ### /## ### /## *
// ## ## # #/ /## #/ /## *
// ## ## # #/ ## #/ ## *
// ## # # # / # / *
// ### / ## / ## / *
// #######/ ########/ ########/ *
// #### ##### ##### *
// *
// Created By N[o]obleT *
// *
//__________________________________________________________________________________________________*
//__________________________________________________________________________________________________*
// *
// It should be first noted that there are two ways this system can be used. *
// *
// The first and easiest way is through a terrain check (found under the TerrainCheck *
// folder). This will check if any of the units are on your designated sliding terrain. *
// If a unit is, it will make them slideable. It's simple, but a major downside is *
// that there little control over the area a unit can actually slide, and the path becomes very *
// strict (or "tight"). *
// *
// The other way to slide a unit in this system is through region checks. This is more time- *
// consuming, but in the long run it is better due to the high customizability. *
// *
// IMPORTING: *
// When you import this system, it's recommended that you copy every folder except for "Misc" into *
// your map. Make sure you do not rearrange the orders of the triggers or folders, doing this may *
// cause an error when saving the map. Once you've copied the folders over to your map, save your *
// map. There shouldn't be any errors when you save, but if there are you should contact me. *
// *
// HOW TO USE: *
// *
// How to use the REGION CHECK way: *
// 1.)If you'd like to use region checks, first disable every trigger under TerrainCheck. *
// 2.)Next make sure all the triggers in the RegionCheck folder are enabled. *
// 3.)Make note of the regions I used (and where i put them) in the map: *
// a. At any terrain touching ice, I made a region named SlideRect<#>. If a unit leaves these *
// regions, he will be able to slide. *
// *
// b. At any place where the safe path goes from touching snow and ice to ONLY touching snow, *
// I created a region named SlideFalse<#>. This is because if a unit leaves a SlideRect, *
// he will slide, but what if he leaves the region going away from the ice, like down a *
// grass path? Then these regions will catch him before he slides on grass, which would be *
// f'd up. Make sure that when you create these regions that they are not touching (leave *
// a slight gap). *
// *
// 4.)Update all of the CheckLeave/CheckFalse/CheckEnter triggers with the new regions you added. *
// *
// How to use the TERRAIN CHECK way: *
// 1.)Disable every trigger under RegionCheck. Enable every trigger under TerrainCheck. *
// 2.)Make sure the terrain type in TerrainSetup is the same terrain you're using to slide on. *
// 3.)Also change the terrain type (it says 'Nsnw') in TerrainCheck to the terrain you're using *
// for the opposite terrain of the path. Read ALL the comments, they are there for a reason. *
// *
// I HOPE YOU ENJOY IT! *
//__________________________________________________________________________________________________*
v1.0 - Initial Release
v1.1 - Addition of arrays/Collision and Off-path-death triggers.
v1.2 - Cleaned up some code/Minor bug fixes
v1.3 - Added testing functions
v1.4 - Added patrollers and other maze-like features.
v1.5 - Bug fix (thanks Aspard)/Rearranged the triggers/Clarified some triggers and functions.
v1.6 - Bug fixes, updated some code for aesthetics and effeciency
v.a - Documented a known bug, changed a testing trigger to avoid clicking an in-game hotkey.
v1.7 - Improved readability. Added TerrainCheck with changeable offset. Made changing the periodic timer in the Slide trigger easier.
v1.8 - Updated documentation. Changed tileset. Added support for multiple tile checks. Added more support for slower/faster sliding.
If you use a timeStep value of around 0.02 or greater, clicking rapidly (while turning is DISABLED) to the side of ones runner, the runner will sometimes turn towards that direction.
This bug gets increasingly more apparent with higher timeStep values.
Here is a list of all the terrain types and their respective integer codes (remember, when using them they must be wrapped in '', for example: 'Nsnw' or 'Ldrt')
Ldrt = Lordaeron Summer Dirt (cliff)
Ldro = Lordaeron Summer Rough Dirt
Ldrg = Lordaeron Summer Grassy Dirt
Lrok = Lordaeron Summer Rock
Lgrs = Lordaeron Summer Grass (cliff)
Lgrd = Lordaeron Summer Dark Grass
Fdrt = Lordaeron Fall Dirt (cliff)
Fdro = Lordaeron Fall Rough Dirt
Fdrg = Lordaeron Fall Grassy Dirt
Frok = Lordaeron Fall Rock
Fgrs = Lordaeron Fall Grass (cliff)
Fgrd = Lordaeron Fall Dark Grass
Wdrt = Lordaeron Winter Dirt
Wdro = Lordaeron Winter Rough Dirt
Wsng = Lordaeron Winter Grassy Snow
Wrok = Lordaeron Winter Rock
Wgrs = Lordaeron Winter Grass (cliff)
Wsnw = Lordaeron Winter Snow (cliff)
Bdrt = Barrens Dirt
Bdrh = Barrens Rough Dirt
Bdrr = Barrens Pebbles
Bdrg = Barrens Grassy Dirt
Bdsr = Barrens Desert (cliff)
Bdsd = Barrens Dark Desert
Bflr = Barrens Rock
Bgrr = Barrens Grass (cliff)
Adrt = Ashenvale Dirt (cliff)
Adrd = Ashenvale Rough Dirt
Agrs = Ashenvale Grass (cliff)
Arck = Ashenvale Rock
Agrd = Ashenvale Lumpy Grass
Avin = Ashenvale Vines
Adrg = Ashenvale Grassy Dirt
Alvd = Ashenvale Leaves
Cdrt = Felwood Dirt (cliff)
Cdrd = Felwood Rough Dirt
Cpos = Felwood Poison
Crck = Felwood Rock
Cvin = Felwood Vines
Cgrs = Felwood Grass (cliff)
Clvg = Felwood Leaves
Ndrt = Northrend Dirt (cliff)
Ndrd = Northrend Dark Dirt
Nrck = Northrend Rock
Ngrs = Northrend Grass
Nice = Northrend Ice
Nsnw = Northrend Snow (cliff)
Nsnr = Northrend Rocky Snow
Ydrt = Cityscape Dirt (cliff)
Ydtr = Cityscape Rough Dirt
Yblm = Cityscape Black Marble
Ybtl = Cityscape Brick
Ysqd = Cityscape Square Tiles (cliff)
Yrtl = Cityscape Round Tiles
Ygsb = Cityscape Grass
Yhdg = Cityscape Grass Trim
Ywmb = Cityscape White Marble
Vdrt = Village Dirt (cliff)
Vdrr = Village Rough Dirt
Vcrp = Village Crops
Vcbp = Village Cobble Path
Vstp = Village Stone Path
Vgrs = Village Short Grass
Vrck = Village Rocks
Vgrt = Village Thick Grass (cliff)
Qdrt = Village Fall Dirt (cliff)
Qdrr = Village Fall Rough Dirt
Qcrp = Village Fall Crops
Qcbp = Village Fall Cobble Path
Qstp = Village Fall Stone Path
Qgrs = Village Fall Short Grass
Qrck = Village Fall Rocks
Qgrt = Village Fall Thick Grass (cliff)
Xdrt = Dalaran Dirt (cliff)
Xdtr = Dalaran Rough Dirt
Xblm = Dalaran Black Marble
Xbtl = Dalaran Brick
Xsqd = Dalaran Square Tiles (cliff)
Xrtl = Dalaran Round Tiles
Xgsb = Dalaran Grass
Xhdg = Dalaran Grass Trim
Xwmb = Dalaran White Marble
Ddrt = Dungeon Dirt (cliff)
Dbrk = Dungeon Brick
Drds = Dungeon Red Stone
Dlvc = Dungeon Lava Cracks
Dlav = Dungeon Lava
Ddkr = Dungeon Dark Rock
Dgrs = Dungeon Grey Stones
Dsqd = Dungeon Square Tiles (cliff)
Gdrt = Underground Dirt (cliff)
Gbrk = Underground Brick
Grds = Underground Red Stone
Glvc = Underground Lava Cracks
Glav = Underground Lava
Gdkr = Underground Dark Rock
Ggrs = Underground Grey Stones
Gsqd = Underground Square Tiles (cliff)
Zdrt = Sunken Ruins Dirt (cliff)
Zdtr = Sunken Ruins Rough Dirt
Zdrg = Sunken Ruins Grassy Dirt
Zbks = Sunken Ruins Small Bricks
Zsan = Sunken Ruins Sand
Zbkl = Sunken Ruins Large Bricks (cliff)
Ztil = Sunken Ruins RoundTiles
Zgrs = Sunken Ruins Grass
Zvin = Sunken Ruins Dark Grass
Idrt = Icecrown Dirt
Idtr = Icecrown Rough Dirt
Idki = Icecrown Dark Ice
Ibkb = Icecrown Black Bricks
Irbk = Icecrown Runed Bricks (cliff)
Itbk = Icecrown Tiled Bricks
Iice = Icecrown Ice
Ibsq = Icecrown Black Squares
Isnw = Icecrown Snow (cliff)
Odrt = Outland Dirt
Odtr = Outland Light Dirt
Osmb = Outland Rough Dirt (cliff)
Ofst = Outland Cracked Dirt
Olgb = Outland Flat Stones
Orok = Outland Rock
Ofsl = Outland Light Flat Stone
Oaby = Outland Abyss (cliff)
Kdrt = Black Citadel Dirt (cliff)
Kfsl = Black Citadel Light Dirt
Kdtr = Black Citadel Rough Dirt
Kfst = Black Citadel Flat Stones
Ksmb = Black Citadel Small Bricks
Klgb = Black Citadel Large Bricks
Ksqt = Black Citadel Square Tiles
Kdkt = Black Citadel Dark Tiles (cliff)
Jdrt = Dalaran Ruins Dirt (cliff)
Jdtr = Dalaran Ruins Rough Dirt
Jblm = Dalaran Ruins Black Marble
Jbtl = Dalaran Ruins Brick
Jsqd = Dalaran Ruins Square Tiles (cliff)
Jrtl = Dalaran Ruins Round Tiles
Jgsb = Dalaran Ruins Grass
Jhdg = Dalaran Ruins Grass Trim
Jwmb = Dalaran Ruins White Marble
cAc2 = Ashenvale Dirt (non-cliff)
cAc1 = Ashenvale Grass (non-cliff)
cBc2 = Barrens Desert (non-cliff)
cBc1 = Barrens Grass (non-cliff)
cKc1 = Black Citadel Dirt (non-cliff)
cKc2 = Black Citadel Dark Tiles (non-cliff)
cYc2 = Cityscape Dirt (non-cliff)
cYc1 = Cityscape Square Tiles (non-cliff)
cXc2 = Dalaran Dirt (non-cliff)
cXc1 = Dalaran Square Tiles (non-cliff)
cJc2 = Dalaran Ruins Dirt (non-cliff)
cJc1 = Dalaran Ruins Square Tiles (non-cliff)
cDc2 = Dungeon Dirt (non-cliff)
cDc1 = Dungeon Square Tiles (non-cliff)
cCc2 = Felwood Dirt (non-cliff)
cCc1 = Felwood Grass (non-cliff)
cIc2 = Icecrown Runed Bricks (non-cliff)
cIc1 = Icecrown Snow (non-cliff)
cFc2 = Lordaeron Fall Dirt (non-cliff)
cFc1 = Lordaeron Fall Grass (non-cliff)
cLc2 = Lordaeron Summer Dirt (non-cliff)
cLc1 = Lordaeron Summer Grass (non-cliff)
cWc2 = Lordaeron Winter Grass (non-cliff)
cWc1 = Lordaeron Winter Snow (non-cliff)
cNc2 = Northrend Dirt (non-cliff)
cNc1 = Northrend Snow (non-cliff)
cOc1 = Outland Abyss (non-cliff)
cOc2 = Outland Rough Dirt (non-cliff)
cZc2 = Sunken Ruins Dirt (non-cliff)
cZc1 = Sunken Ruins Large Bricks (non-cliff)
cGc2 = Underground Dirt (non-cliff)
cGc1 = Underground Square Tiles (non-cliff)
cVc2 = Village Dirt (non-cliff)
cVc1 = Village Thick Grass (non-cliff)
cQc2 = Village Fall Dirt (non-cliff)
cQc1 = Village Fall Thick Grass (non-cliff)
function SlideA takes nothing returns nothing
local unit u = GetEnumUnit ( ) //Set the picked unit
local integer i = GetPlayerId ( GetOwningPlayer( u ) ) + 1 //Set the Player number of the unit.
local real x = GetUnitX ( u ) //Set the units X
local real y = GetUnitY ( u ) //Set the units Y
if udg_onIce[ i ] == true and GetUnitState( u, UNIT_STATE_LIFE ) > 0 then //Check if the unit is on ice and is alive
call SetUnitX( u , x + udg_Speed[ i ] * Cos( GetUnitFacing( u ) * 0.017453292 ) ) //Set the units x-axis position
call SetUnitY( u , y + udg_Speed[ i ] * Sin( GetUnitFacing( u ) * 0.017453292 ) ) //Set the units y-axis position
call IssueImmediateOrder( u,"stop" ) // !!!Add a "//" before this line to turn on realistic sliding!!!
endif
set u = null //Nulling the local unit variable (otherwise it will leak)
endfunction
function SlideG takes nothing returns nothing
call ForGroup( udg_Slideables , function SlideA ) //Pick every unit in Slideables and runs function SlideA for each picked unit
endfunction
function InitSlide takes nothing returns nothing
local timer t = CreateTimer( )
call TimerStart( t, udg_timeStep, true, function SlideG ) // Tell the timer to run SlideG every udg_timeStep seconds
set t = null
endfunction
function InitTrig_Slide takes nothing returns nothing
//Ignore this function, it's required by the World Editor but I don't need anything done in it.
endfunction
function SteerObj takes nothing returns nothing
local unit u = GetTriggerUnit ( )
local integer i = GetPlayerId ( GetOwningPlayer( u ) ) + 1
local real x = GetUnitX ( u )
local real y = GetUnitY ( u )
local real a = GetWidgetX ( GetOrderTarget( ) )
local real b = GetWidgetY ( GetOrderTarget( ) )
if udg_Steerable[ i ] == true then
if udg_onIce[ i ] == true and IsUnitInGroup( u , udg_Slideables ) then
call SetUnitFacing( u , 57.2957795 * Atan2( b - y , a - x ) ) //Set the unit facing to Angle between points (x,y) and (a,b)
endif
endif
set u = null //Nulling the unit variable
endfunction
function SteerLoc takes nothing returns nothing
local unit u = GetTriggerUnit ( )
local integer i = GetPlayerId ( GetOwningPlayer( u ) ) + 1
local real x = GetUnitX ( u )
local real y = GetUnitY ( u )
local real a = GetOrderPointX ( )
local real b = GetOrderPointY ( )
if udg_Steerable[ i ] == true then
if udg_onIce[ i ] == true and IsUnitInGroup( u , udg_Slideables ) then
call SetUnitFacing( u , 57.2958279 * Atan2( b - y , a - x ) ) //Set the unit facing to Angle between points (x,y) and (a,b)
endif
endif
set u = null //Nulling the unit variable
endfunction
function InitTrig_Steer takes nothing returns nothing
local integer i = 0
local trigger SO = CreateTrigger( )
local trigger SL = CreateTrigger( )
call TriggerAddAction( SO , function SteerObj )
call TriggerAddAction( SL , function SteerLoc )
loop
exitwhen i > 11
call TriggerRegisterPlayerUnitEvent( SO , Player( i ) , EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER , null )
call TriggerRegisterPlayerUnitEvent( SL , Player( i ) , EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER , null )
set i = i + 1
endloop
set SO = null
set SL = null
endfunction
function TerrainCheckOffsetCheck takes real x, real y, integer whichTerrain, boolean inverseCheck returns boolean
local integer terrain = 0
local integer degrees = 0
local real a = 0
local real b = 0
loop
exitwhen degrees > 360
set a = x + udg_offsetDist * Cos( degrees * 0.017453292 ) //Set x = unit's x + offsetDist facing n degrees
set b = y + udg_offsetDist * Sin( degrees * 0.017453292 ) //"" y " "" y " "" "" " ""
set terrain = GetTerrainType( a, b ) //Set terrain = terrain type at ( a, b )
if inverseCheck == true then
if terrain != whichTerrain then //Check if the terrain type at the unit's position offset by offsetDist facing n is NOT equal to the specified terrain
return true // If so then return true and
exitwhen true // exit the loop
endif
else
if terrain == whichTerrain then //Check if the terrain type at the unit's position offset by offsetDist facing n is equal to the specified terrain
return true // If so then return true and
exitwhen true // exit the loop
endif
endif
set degrees = degrees + 1 //Add 1 to degrees
endloop
return false //If nothing else was true, then return false
endfunction
function TerrainCheckOnIce takes integer whichPlayer, integer terrain, real x, real y returns boolean
local integer i = 1
loop
exitwhen i > udg_maxSlideTerrains
if terrain == udg_slideTerrain[ i ] or TerrainCheckOffsetCheck( x, y, udg_slideTerrain[ i ], false ) then //If the terrain at the unit is one of the sliding terrains then:
set udg_Speed[ whichPlayer ] = ( udg_initSpeed * 100 * udg_timeStep ) * udg_speedMultiplier[ i ] // Set that unit's speed to the original speed setting multiplied by the terrain's corresponding udg_speedMultiplier array
return true // Return that yes, the given parameters are on ice.
endif
set i = i +1
endloop
return false
endfunction
//===========================================================================
function InitTrig_TerrainCheckFunctions takes nothing returns nothing
//Ignore this function, it's required by the World Editor but I don't need anything done in it.
endfunction
function TerrainCheckSlide_A2 takes nothing returns nothing
local unit u = GetEnumUnit ( ) //Set the picked unit as variable "u"
local integer i = GetPlayerId ( GetOwningPlayer( u ) ) + 1 //Get the Player number of the unit.
local real x = GetUnitX ( u ) //Get the units X
local real y = GetUnitY ( u ) //Get the units Y
local integer t = GetTerrainType ( x , y ) //Get the terrain type at the location of the unit
if GetUnitState( u , UNIT_STATE_LIFE ) > 0 then //Check if unit is alive
if TerrainCheckOnIce( i, t, x, y ) then //Check the parameters against the function TerrainCheckOnIce (located in the TerrainCheckFunctions trigger)
set udg_onIce[ i ] = true //Set OnIce[OwningPlayer'sNumber] = true, allowing the unit to slide.
else
set udg_onIce[ i ] = false //Set OnIce[OwningPlayer'sNumber] = false, disabling the unit's slide.
endif
endif
set u = null //Nulling the unit variable
endfunction
function TerrainCheckSlide_A1 takes nothing returns nothing
call ForGroup( udg_Slideables , function TerrainCheckSlide_A2 ) //Pick every unit in Slideables and runs function TerrainCheckSlide_A2 for each picked unit
endfunction
function InitTrig_TerrainCheckSlide takes nothing returns nothing
local timer t=CreateTimer( )
call TimerStart( t, 0.05, true, function TerrainCheckSlide_A1 ) //Tell the timer to run TerrainCheckSlide_A1 every 0.05 seconds
set t=null
endfunction
function TerrainCheckDeath_A2 takes nothing returns nothing
local unit u = GetEnumUnit ( ) //Sets the picked unit as variable "u"
local real x = GetUnitX ( u ) //Gets the units X
local real y = GetUnitY ( u ) //Gets the units Y
local integer terrain = GetTerrainType ( x , y ) //Gets the terrain type at the location of the unit
if GetUnitState( u , UNIT_STATE_LIFE ) > 0 and terrain == udg_deathTerrain then //Check if unit is alive and is on the specified death terrain, if he is then do:
if not TerrainCheckOffsetCheck( x, y, udg_deathTerrain, true ) then //Check if the unit is NOT close to any non-death terrain
call KillUnit(u) //If he isn't then kill him
endif
endif
set u = null //Nulling the unit variable
endfunction
function TerrainCheckDeath_A1 takes nothing returns nothing
call ForGroup( udg_Slideables , function TerrainCheckDeath_A2 ) //Pick every unit in Slideables and runs function TerrainCheckDeathA2 for each picked unit
endfunction
function InitTrig_TerrainCheckDeath takes nothing returns nothing
local timer t=CreateTimer( )
call TimerStart( t, 0.05, true, function TerrainCheckDeath_A1 ) // Tell the timer to run TerrainCheckDeathA1 every 0.05 seconds
set t=null
endfunction
function locust takes unit u returns nothing
call UnitAddAbility(u, 'Aloc')
call ShowUnit(u, false)
call UnitRemoveAbility(u, 'Aloc')
call ShowUnit(u, true)
set u=null
endfunction
function InitTrig_Init takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 600.00, "TRIGSTR_018" )
call FogEnable( false )
call FogMaskEnable( false )
call locust(gg_unit_Edem_0000)
call locust(gg_unit_Edem_0004)
endfunction
function Trig_Pats_Actions takes nothing returns nothing
local location l
local unit u
//
set l = GetRectCenter(gg_rct_Patrol)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_2)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_2)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_3)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_3)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_4)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_4)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_5)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_5)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_6)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_6)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_7)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_7)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_8)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_8)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_9)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_9)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_10)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_10)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
//
set l = GetRectCenter(gg_rct_Patrol_Copy_11)
set u = CreateUnitAtLoc(Player(2), 'nwen', l, 0)
call locust(u)
set l = GetRectCenter(gg_rct_Spawn_Copy_11)
call IssuePointOrderLoc(u, "patrol", l)
call RemoveLocation(l)
set u = null
endfunction
function InitTrig_Pats takes nothing returns nothing
set gg_trg_Pats = CreateTrigger( )
call TriggerAddAction( gg_trg_Pats, function Trig_Pats_Actions )
endfunction
function Revive_Actions takes nothing returns nothing
local unit u = GetTriggerUnit ( ) //Get the triggering unit as u
local player p = GetOwningPlayer ( u ) //Get the owning player of u
local location loc = GetStartLocationLoc ( GetPlayerStartLocation( p ) ) //Get the initial start location of that player
call TriggerSleepAction ( 1 ) //Wait a second...
call ReviveHeroLoc ( u, loc, false ) //Revive u at loc without revival effects
call PanCameraToTimedLocForPlayer ( p, loc, 0 ) //Place the player's camera at the revival loc
call SelectUnitForPlayerSingle ( u, p ) //Select the revived unit
call RemoveLocation ( loc ) //Cleanup the leak
set u = null //Cleanup the local
set p = null //Cleanup the local
set loc = null //Cleanup the local
endfunction
//===========================================================================
function InitTrig_Revive takes nothing returns nothing
set gg_trg_Revive=CreateTrigger()
call TriggerRegisterUnitEvent(gg_trg_Revive,gg_unit_Edem_0000,EVENT_UNIT_DEATH)
call TriggerRegisterUnitEvent(gg_trg_Revive,gg_unit_Edem_0004,EVENT_UNIT_DEATH)
call TriggerAddAction(gg_trg_Revive,function Revive_Actions)
endfunction
function Trig_ToggleSteering_Actions takes nothing returns nothing
local integer i = GetPlayerId( GetTriggerPlayer( ) ) + 1 //Get the triggering player's id as i
if udg_Steerable[i]==true then //If the player's steering is on, then do:
call DisplayTextToPlayer( GetTriggerPlayer( ),0,0,"Steering for your runner is now disabled." ) // Tell them their steering is being turned off
set udg_Steerable[i]=false // DISABLE STEERING
else //Else do:
call DisplayTextToPlayer( GetTriggerPlayer( ),0,0,"Steering for your runner is now enabled." ) // Tell them their steering is being turned back on
set udg_Steerable[ i ] = true // ENABLE STEERING
endif
endfunction
//===========================================================================
function InitTrig_ToggleSteering takes nothing returns nothing
set gg_trg_ToggleSteering = CreateTrigger ( )
call TriggerRegisterPlayerEventEndCinematic ( gg_trg_ToggleSteering, Player( 0 ) )
call TriggerRegisterPlayerEventEndCinematic ( gg_trg_ToggleSteering, Player( 1 ) )
call TriggerAddAction ( gg_trg_ToggleSteering, function Trig_ToggleSteering_Actions )
endfunction
function HandleCounterCallback takes nothing returns nothing
local location array loc
local integer a = 0
local integer index
local integer prevIndex = 0
local integer next = 0
loop
set loc[ a ] = Location( 0, 0 )
set index = GetHandleId( loc[ a ] ) - 0x100000
set a = a + 1
if index == prevIndex + 1 then
set next = next + 1
else
set next = 0
endif
set prevIndex = index
exitwhen next >= 50
endloop
call LeaderboardSetItemValue( bj_lastCreatedLeaderboard, 0, index - a )
loop
set a = a - 1
call RemoveLocation( loc[ a ] )
set loc[ a ] = null
exitwhen a <= 0
endloop
endfunction
function HandleCounterActions takes nothing returns nothing
local timer tim = GetExpiredTimer ( )
local leaderboard LEADERBOARD = CreateLeaderboard( )
set bj_lastCreatedLeaderboard = LEADERBOARD
call LeaderboardSetLabel( LEADERBOARD, "Handle Counter" )
call PlayerSetLeaderboard( GetLocalPlayer( ), LEADERBOARD )
call LeaderboardDisplay( LEADERBOARD, true )
call TimerStart( tim, 0.25, true, function HandleCounterCallback )
call LeaderboardAddItem( LEADERBOARD, "Max Handles", 0, Player( 0 ) )
call LeaderboardSetSizeByItemCount( LEADERBOARD, 1 )
set tim = null
endfunction
function InitTrig_HandleCounter takes nothing returns nothing
call TimerStart(CreateTimer() , 0., false, function HandleCounterActions)
endfunction