Name | Type | is_array | initial_value |
arthas_text | texttag | No | |
boiling_blood_increase | integer | No | |
boiling_blood_MS | real | No | |
boiling_blood_timer | timer | No | |
defthelyn_ganteng | unit | No | |
defthelyn_sound | sound | Yes | |
force_arthas | group | No | |
force_defthelyn | group | No | |
force_kael | group | No | |
group | group | No | |
kael_text | texttag | No | |
point1 | location | No | |
point2 | location | No | |
sound | sound | Yes | |
target_point_arthas | location | No | |
target_point_defthelyn | location | No | |
target_point_kael | location | No | |
temp_group | group | No |
//TESH.scrollpos=192
//TESH.alwaysfold=0
library AdvancedCameraSystem initializer Init
// Advanced Camera System by The_Witcher
//
// This is a very advanced advanced camera system which adjusts the camera
// distance to the target so the camera isn't looking through houses/trees/...
// and the cameras angle of attack so the view isn't blocked because of hills...
//
// useful for RPGs and that stuff
//
// To bind the camera to a unit use
// SetCameraUnit( unit )
//
// if you want to have your normal camera again use
// ReleaseCamUnit( unit )
//
// in case you want to know which unit is bound to the camera for player xy use
// GetCameraUnit( player )
//
// to change the AngleOfAttack ingame use
// SetCamDefaultAngleOfAttack( NewValue )
//
// to change the maximal camera target distance ingame use
// SetCamMaxDistance( NewValue )
//
// SETUP PART
globals
// The max. distance the camera can have to the target
private real MAX_DISTANCE = 1000
// The max. distance the zOffset behind the unit is checked (for zAngle)
private real MAX_Z_CHECK_DISTANCE = 500
// the camera angle of attack correction after the zAngle calculation
private real DEFAULT_ANGLE_OF_ATTACK = -20
// the timer interval (0.01 is best but can lagg in huge maps with many of these short intervals)
private constant real INTERVAL = 0.03
// the time the camera will need to adjust
private constant real DELAY = 0.25
// the standart z of the camera
private constant real NORMAL_HEIGHT = 100
// the accuracy increases if the value gets smaller
private constant real ACCURACY = 50
// the secondary accruracy when the camera reaches a barricade (just leave at this amount)
private constant real EXTREME_ACCURACY = 10
endglobals
// SETUP END
// don't modify the code below!
globals
private item ite
private unit array CamUnit[15]
private timer tim = CreateTimer()
private location loc = Location(0,0)
private integer active = 0
private hashtable h = InitHashtable()
endglobals
private function IsCoordPathable takes real x, real y returns boolean
call SetItemVisible(ite,true)
call SetItemPosition(ite,x,y)
set x = GetItemX( ite) - x
set y = GetItemY( ite) - y
call SetItemVisible(ite,false)
if x < 1 and x > -1 and y < 1 and y > -1 then
return true
endif
return false
endfunction
private function HideAllItems takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
call SaveInteger(h,GetHandleId(GetEnumItem()),0,1)
endif
call SetItemVisible(GetEnumItem(),false)
endfunction
private function ShowAllItems takes nothing returns nothing
if LoadInteger(h,GetHandleId(GetEnumItem()),0) == 1 then
call SetItemVisible(GetEnumItem(),true)
call FlushChildHashtable(h,GetHandleId(GetEnumItem()))
endif
endfunction
private function Actions takes nothing returns nothing
local real x
local real y
local real angle
local real rz
local real z
local integer i = 0
local integer Check
local real CheckDistance
local real DistanceDone
local rect rec
loop
exitwhen i >= bj_MAX_PLAYERS
if CamUnit[i] != null then
set DistanceDone = 0
set rz = 0
set x = GetUnitX(CamUnit[i])
set y = GetUnitY(CamUnit[i])
set Check = 1
set angle = GetUnitFacing(CamUnit[i]) - 180
set CheckDistance = ACCURACY
set z = DEFAULT_ANGLE_OF_ATTACK
if not IsUnitType(CamUnit[i], UNIT_TYPE_FLYING) then
loop
set x = x + CheckDistance * Cos(angle * bj_DEGTORAD)
set y = y + CheckDistance * Sin(angle * bj_DEGTORAD)
set DistanceDone = DistanceDone + CheckDistance
call MoveLocation(loc,x,y)
set z = GetLocationZ(loc)
if RAbsBJ(z) > RAbsBJ(rz) and DistanceDone <= MAX_Z_CHECK_DISTANCE then
set rz = z
endif
if not IsCoordPathable(x,y)then
set rec = Rect(x-ACCURACY,y-ACCURACY,x+ACCURACY,y+ACCURACY)
call EnumItemsInRect(rec,null, function HideAllItems)
if not IsCoordPathable(x,y)then
set Check = 0
endif
call RemoveRect(rec)
endif
if Check == 0 and CheckDistance == ACCURACY then
set DistanceDone = DistanceDone - CheckDistance
set x = x - CheckDistance * Cos(angle * bj_DEGTORAD)
set y = y - CheckDistance * Sin(angle * bj_DEGTORAD)
set Check = 1
set CheckDistance = EXTREME_ACCURACY
endif
exitwhen (Check == 0 and CheckDistance == EXTREME_ACCURACY) or DistanceDone > MAX_DISTANCE
endloop
else
set DistanceDone = MAX_DISTANCE
endif
call MoveLocation(loc,GetUnitX(CamUnit[i]),GetUnitY(CamUnit[i]))
set x = GetLocationZ(loc)
set z = Atan2(x-rz,200) * bj_RADTODEG + DEFAULT_ANGLE_OF_ATTACK
if IsUnitType(CamUnit[i], UNIT_TYPE_FLYING) then
set z = DEFAULT_ANGLE_OF_ATTACK
endif
if GetLocalPlayer() == Player(i) then
call CameraSetSmoothingFactor(1)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, DistanceDone, DELAY)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, z, DELAY)
call SetCameraField(CAMERA_FIELD_ZOFFSET,GetCameraField(CAMERA_FIELD_ZOFFSET)+x+GetUnitFlyHeight(CamUnit[i])+NORMAL_HEIGHT-GetCameraTargetPositionZ(),DELAY)
call SetCameraField(CAMERA_FIELD_ROTATION, angle+180, DELAY)
call SetCameraTargetController(CamUnit[i],0,0,false)
endif
endif
set i = i + 1
endloop
call EnumItemsInRect(bj_mapInitialPlayableArea,null, function ShowAllItems)
set rec = null
endfunction
function ReleaseCameraUnit takes unit u returns nothing
if CamUnit[GetPlayerId(GetOwningPlayer(u))] != null then
set CamUnit[GetPlayerId(GetOwningPlayer(u))] = null
call ResetToGameCameraForPlayer(GetOwningPlayer(u),0)
call CameraSetSmoothingFactor(0)
set active = active - 1
if active == 0 then
call PauseTimer(tim)
endif
endif
endfunction
function SetCameraUnit takes unit u returns nothing
if CamUnit[GetPlayerId(GetOwningPlayer(u))] != null then
call ReleaseCameraUnit(CamUnit[GetPlayerId(GetOwningPlayer(u))])
endif
set CamUnit[GetPlayerId(GetOwningPlayer(u))] = u
set active = active + 1
if active == 1 then
call TimerStart(tim,INTERVAL,true,function Actions)
endif
endfunction
function SetCamDefaultAngleOfAttack takes real a returns nothing
set DEFAULT_ANGLE_OF_ATTACK = a
endfunction
function SetCamMaxDistance takes real d returns nothing
set MAX_DISTANCE = d
endfunction
function GetCameraUnit takes player pl returns unit
return CamUnit[GetPlayerId(pl)]
endfunction
private function Init takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= bj_MAX_PLAYERS
set CamUnit[i] = null
set i = i + 1
endloop
set ite = CreateItem( 'wolg', 0,0 )
call SetItemVisible(ite,false)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library KeyboardSystem initializer Init
// Keyboard System by The_Witcher
// This System helps you to get rid of all the triggers
// you would need for creating an effective arrow key
// system.
// This system has aditionally the power to add a key twice press event to a trigger
// you just need to adjust this little variable:
globals
// this is the time the player has to "double press" a key
// if a key is pressed twice in this time the registered triggers are executed
private constant real DELAY = 0.2
endglobals
// Use this function to see which keys are hold down:
//
// IsKeyDown( key, pl) returns boolean
// string player
//
// key can be KEY_LEFT, KEY_RIGHT, KEY_UP or KEY_DOWN
// pl is the player who is checked
// if the function returns true the key is hold down by player pl
//
// And this 2 functions to register a double press event to a trigger
//
// TriggerRegisterKeyDoublePressEvent(t, key)
//
// TriggerRegisterPlayerKeyDoublePressEvent(t, key, pl)
//
// TriggerRegisterKeyDoubleInterruptEvent(t, key)
//
// TriggerRegisterPlayerKeyDoubleInterruptEvent(t, key, pl)
//
// t is the trigger you want to register that event to
// key is the pressed key (again can be KEY_LEFT, KEY_RIGHT, KEY_UP or KEY_DOWN)
// pl is in the second function the player who has to press
// the keys to fire the trigger
// the first function fires the trigger regardless of which player pressed the key
//
//
//--------------Don't edit anything below---------------------------
globals
private timer array time[13]
private trigger array TRIGGERS
private trigger array TRIGGERS2
private integer total = 0
private integer total2 = 0
private integer array PLAYER
private integer array PLAYER2
private string array KEY
private string array KEY2
constant string KEY_LEFT = "left"
constant string KEY_RIGHT = "right"
constant string KEY_UP = "up"
constant string KEY_DOWN = "down"
private hashtable h = InitHashtable()
endglobals
function IsKeyDown takes string key, player pl returns boolean
return LoadBoolean(h,GetPlayerId(pl),StringHash(key))
endfunction
function TriggerRegisterKeyDoublePressEvent takes trigger t, string key returns nothing
set TRIGGERS[total] = t
set KEY[total] = key
set PLAYER[total] = 100
set total = total + 1
endfunction
function TriggerRegisterPlayerKeyDoublePressEvent takes trigger t, string key, player pl returns nothing
set TRIGGERS[total] = t
set KEY[total] = key
set PLAYER[total] = GetPlayerId(pl)
set total = total + 1
endfunction
function TriggerRegisterKeyDoubleInterruptEvent takes trigger t, string key returns nothing
set TRIGGERS2[total2] = t
set KEY2[total2] = key
set PLAYER2[total2] = 100
set total2 = total2 + 1
endfunction
function TriggerRegisterPlayerKeyDoubleInterruptEvent takes trigger t, string key, player pl returns nothing
set TRIGGERS2[total2] = t
set KEY2[total2] = key
set PLAYER2[total2] = GetPlayerId(pl)
set total2 = total2 + 1
endfunction
//! textmacro TriggerActions takes NAME, VarTrue, VarFalse
private function $NAME$press takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
local integer x = 0
call SaveBoolean(h,i,StringHash("$VarTrue$"),true)
call SaveBoolean(h,i,StringHash("$VarFalse$"),false)
if LoadStr(h,i,StringHash("LastKey")) != "$VarTrue$" then
call TimerStart(time[i],0,false,null)
endif
if TimerGetRemaining(time[i]) > 0 and LoadStr(h,i,StringHash("LastKey")) == "$VarTrue$" then
call SaveInteger(h,i,StringHash("Debug"),0)
call SaveBoolean(h,i,StringHash("$VarTrue$Double"),true)
loop
exitwhen x >= total
if TriggerEvaluate(TRIGGERS[x]) and KEY[x] == "$VarTrue$" and (PLAYER[x] == 100 or PLAYER[x] == i) then
call TriggerExecute(TRIGGERS[x])
endif
set x = x + 1
endloop
endif
if LoadInteger(h,i,StringHash("Debug")) == 1 then
call TimerStart(time[i],DELAY,false,null)
else
call SaveInteger(h,i,StringHash("Debug"),1)
endif
call SaveStr(h,i,StringHash("LastKey"),"$VarTrue$")
endfunction
private function $NAME$release takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
local integer x = 0
call SaveBoolean(h,i,StringHash("$VarTrue$"),false)
if LoadBoolean(h,i,StringHash("$VarTrue$Double")) then
call SaveBoolean(h,i,StringHash("$VarTrue$Double"),false)
loop
exitwhen x >= total2
if TriggerEvaluate(TRIGGERS2[x]) and KEY2[x] == "$VarTrue$" and (PLAYER2[x] == 100 or PLAYER2[x] == i) then
call TriggerExecute(TRIGGERS2[x])
endif
set x = x + 1
endloop
endif
endfunction
//! endtextmacro
//! runtextmacro TriggerActions("LEFT","left","right")
//! runtextmacro TriggerActions("RIGHT","right","left")
//! runtextmacro TriggerActions("UP","up","down")
//! runtextmacro TriggerActions("DOWN","down","up")
//! textmacro Initiate takes NAME
set i = 0
set t = CreateTrigger()
set tt = CreateTrigger()
call TriggerAddAction(t,function $NAME$press)
call TriggerAddAction(tt,function $NAME$release)
loop
exitwhen i > 12
call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_$NAME$_DOWN)
call TriggerRegisterPlayerEvent(tt,Player(i),EVENT_PLAYER_ARROW_$NAME$_UP)
set i = i + 1
endloop
//! endtextmacro
private function Init takes nothing returns nothing
local trigger t
local trigger tt
local integer i
//! runtextmacro Initiate("LEFT")
//! runtextmacro Initiate("RIGHT")
//! runtextmacro Initiate("UP")
//! runtextmacro Initiate("DOWN")
set i = 0
loop
exitwhen i > 12
set time[i] = CreateTimer()
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=233
//TESH.alwaysfold=0
library ArrowKeyMovement initializer Init requires KeyboardSystem, ArrowKeyMovementPlugins
// Arrow key movement by The_Witcher
// this system allows each player to control 1 unit
// with his arrow keys even if he doesn't own the unit!
// It features turning on the left and right arrow, walking foreward
// by pressing the up arrow and walking backwards by pressing the down arrow...
//
// You can improve this system with plugins but you need vJass knowledge for that!
//
// --> The TurnRate of a unit inside the object editor STILL influences the turn rate from this system <--
//
// Included functions:
//
// SetMovementUnit ( whichunit, forWhichPlayer, walkAnimationIndex )
// unit player integer
// this gives the player the arrow key movement control over the unit
// while the unit moves the animation of the given index is played
// (just try around to find the index... start at 0 and increase
// by 1 until you find the walk index of that unit)
//
//
// ReleaseMovementUnit ( fromWhichPlayer )
// player
// this function removes the control from a player
//
//
// GetMovementUnit ( fromWhichPlayer ) returns unit
// player
// I think its self explaining...
//
//
// SetMovementUnitAnimation ( fromWhichPlayer, animation )
// player integer
// this function allows ingame changing of the played animation of a unit
// ------- SETUP PART ---------
globals
// the timer interval... increase if laggy
private constant real INTERVAL = 0.01
// the facing change in degrees each interval (must be a positive value)
private constant real DEFAULT_VIEW_CHANGE = 4
// when you move backwards you move slower than normal...
private constant real BACKWARDS_MOVING_FACTOR = 0.7
// if the unit turns it will turn faster the longer it does...
// some people may need that but then it should be 1.02 (1.0 means disabled)
private constant real TURN_ACCELERATION = 1.02
// (can only be 1 or -1) if you walk backwards you have 2 ways of turning
// 1. way: pressing left will make the char turn left
// 2. way: pressing left will make the char turn so he moves to the left
private constant integer REVERSED_BACKWARDS_MOVING = 1
endglobals
// --------- don't modify anything below this line ------------
globals
private integer array walking[13]
private unit array Walker[13]
private integer array animation[13]
private integer walkers = 0
private timer tim = CreateTimer()
private real array SpeedFactor[13]
private real array ViewChange[13]
private real array SpecialDirection[13]
private boolean array SpecialDirectionActive[13]
endglobals
private function Walking takes nothing returns nothing
local integer i = 0
local real x
local real y
local real X
local real Y
local boolean boolX
local boolean boolY
local boolean left
local boolean right
local boolean up
local boolean down
local unit u
loop
exitwhen i >= 13
set u = Walker[i]
if u != null then
if SpecialDirectionActive[i] then
if walking[i] != 1 then
call SetUnitTimeScale(u,SpeedFactor[i])
call SetUnitAnimationByIndex(u,animation[i])
set walking[i] = 1
else
call SetUnitTimeScale(u,SpeedFactor[i])
endif
set x = GetUnitX(u)
set y = GetUnitY(u)
set X = x + GetUnitMoveSpeed(u)*INTERVAL * Cos(SpecialDirection[i]*bj_DEGTORAD) * SpeedFactor[i]
set Y = y + GetUnitMoveSpeed(u)*INTERVAL * Sin(SpecialDirection[i]*bj_DEGTORAD) * SpeedFactor[i]
call SetUnitPosition(u,X,Y)
if(RAbsBJ(GetUnitX(u)-X)>0.5)or(RAbsBJ(GetUnitY(u)-Y)>0.5)then
call SetUnitPosition(u,X,y)
set boolX = RAbsBJ(GetUnitX(u)-X)<=0.5
call SetUnitPosition(u,x,Y)
set boolY = RAbsBJ(GetUnitY(u)-Y)<=0.5
if boolX then
call SetUnitPosition(u,X,y)
elseif boolY then
call SetUnitPosition(u,x,Y)
else
call SetUnitPosition(u,x,y)
endif
endif
else
set left = IsKeyDown(KEY_LEFT,Player(i))
set right = IsKeyDown(KEY_RIGHT,Player(i))
set up = IsKeyDown(KEY_UP,Player(i))
set down = IsKeyDown(KEY_DOWN,Player(i))
//right down
if right then
if down then
call SetUnitFacing(u,GetUnitFacing(u)-ViewChange[i] * -REVERSED_BACKWARDS_MOVING)
else
call SetUnitFacing(u,GetUnitFacing(u)-ViewChange[i])
endif
set ViewChange[i] = ViewChange[i] * TURN_ACCELERATION
elseif not left then
set ViewChange[i] = DEFAULT_VIEW_CHANGE
endif
//left down
if left then
if down then
call SetUnitFacing(u,GetUnitFacing(u)+ViewChange[i] * -REVERSED_BACKWARDS_MOVING)
else
call SetUnitFacing(u,GetUnitFacing(u)+ViewChange[i])
endif
set ViewChange[i] = ViewChange[i] * TURN_ACCELERATION
elseif not right then
set ViewChange[i] = DEFAULT_VIEW_CHANGE
endif
//up down
if up then
if walking[i] != 1 then
call SetUnitTimeScale(u,SpeedFactor[i])
call SetUnitAnimationByIndex(u,animation[i])
set walking[i] = 1
else
call SetUnitTimeScale(u,SpeedFactor[i])
endif
set x = GetUnitX(u)
set y = GetUnitY(u)
set X = x + GetUnitMoveSpeed(u)*INTERVAL * Cos(GetUnitFacing(u)*bj_DEGTORAD) * SpeedFactor[i]
set Y = y + GetUnitMoveSpeed(u)*INTERVAL * Sin(GetUnitFacing(u)*bj_DEGTORAD) * SpeedFactor[i]
//down down
elseif down then
if walking[i] != 2 then
call SetUnitTimeScale(u,-BACKWARDS_MOVING_FACTOR * SpeedFactor[i])
call SetUnitAnimationByIndex(u,animation[i])
set walking[i] = 2
else
call SetUnitTimeScale(u,-BACKWARDS_MOVING_FACTOR * SpeedFactor[i])
endif
set x = GetUnitX(u)
set y = GetUnitY(u)
set X = x - GetUnitMoveSpeed(u) * INTERVAL * Cos(GetUnitFacing(u)*bj_DEGTORAD) * BACKWARDS_MOVING_FACTOR * SpeedFactor[i]
set Y = y - GetUnitMoveSpeed(u) * INTERVAL * Sin(GetUnitFacing(u)*bj_DEGTORAD) * BACKWARDS_MOVING_FACTOR * SpeedFactor[i]
endif
//move
if down or up then
call SetUnitPosition(u,X,Y)
if(RAbsBJ(GetUnitX(u)-X)>0.5)or(RAbsBJ(GetUnitY(u)-Y)>0.5)then
call SetUnitPosition(u,X,y)
set boolX = RAbsBJ(GetUnitX(u)-X)<=0.5
call SetUnitPosition(u,x,Y)
set boolY = RAbsBJ(GetUnitY(u)-Y)<=0.5
if boolX then
call SetUnitPosition(u,X,y)
elseif boolY then
call SetUnitPosition(u,x,Y)
else
call SetUnitPosition(u,x,y)
endif
endif
else
if walking[i] != 0 then
call SetUnitAnimation(u,"stand")
call SetUnitTimeScale(u,1)
set walking[i] = 0
endif
endif
endif
endif
set i = i + 1
endloop
set u = null
endfunction
function GetMovementUnit takes player p returns unit
return Walker[GetPlayerId(p)]
endfunction
function SetMovementUnitAnimation takes player p, integer animation returns nothing
set animation[GetPlayerId(p)] = animation
endfunction
function ReleaseMovementUnit takes player p returns nothing
if Walker[GetPlayerId(p)] != null then
set Walker[GetPlayerId(p)] = null
set walkers = walkers - 1
if walkers == 0 then
call PauseTimer(tim)
endif
endif
endfunction
function SetMovementUnit takes unit u, player p, integer anim returns nothing
if u == null then
call ReleaseMovementUnit(p)
return
endif
if Walker[GetPlayerId(p)] == null then
set walkers = walkers + 1
endif
call SetUnitAnimation(Walker[GetPlayerId(p)],"stand")
set Walker[GetPlayerId(p)] = u
set animation[GetPlayerId(p)] = anim
if walkers == 1 then
call TimerStart(tim,INTERVAL,true,function Walking)
endif
endfunction
//! runtextmacro ArrowKeyMovement_Plugins_Functions()
private function Init takes nothing returns nothing
local integer abcdefg = 0
//! runtextmacro Init_ArrowKeyMovement_Plugins_Locals()
loop
exitwhen abcdefg >= 13
set SpeedFactor[abcdefg] = 1
set SpecialDirection[abcdefg] = 0
set SpecialDirectionActive[abcdefg] = false
set ViewChange[abcdefg] = DEFAULT_VIEW_CHANGE
set abcdefg = abcdefg + 1
endloop
//! runtextmacro Init_ArrowKeyMovement_Plugins()
endfunction
endlibrary
//TESH.scrollpos=105
//TESH.alwaysfold=0
library ArrowKeyMovementPlugins
// code your own plugins for my Arrow key movement system!
// how you do that is explained in detail in the "How to use the Movement System Plugins"
// comment included in this map
//
//
// the plugins I coded for the test map are:
// 1. running fast/dashing when double pressing up
// 2. turning around (180°) when double pressing down
// 3. moving left without changing face direction when double pressing left
// 4. moving right without changing face direction when double pressing right
//! textmacro Init_ArrowKeyMovement_Plugins_Locals
local trigger t
//! endtextmacro
//! textmacro Init_ArrowKeyMovement_Plugins
// This is the initialization for turning around on double down press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleDownPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_DOWN)
// This is the initialization for dashing on double up press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleUpPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_UP)
// This is the initialization for sliding left on double left press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleLeftPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_LEFT)
// This is the initialization for sliding right on double right press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleRightPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_RIGHT)
// This is the initialization for stoping the dash of double up press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleUpRelease)
call TriggerRegisterKeyDoubleInterruptEvent(t,KEY_UP)
// This is the initialization for stoping slide of double left press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleLeftRelease)
call TriggerRegisterKeyDoubleInterruptEvent(t,KEY_LEFT)
// This is the initialization for stoping slide of double right press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleRightRelease)
call TriggerRegisterKeyDoubleInterruptEvent(t,KEY_RIGHT)
//! endtextmacro
//! textmacro ArrowKeyMovement_Plugins_Functions
// This is the function for turning around on double down press
private function OnDoubleDownPress takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = Walker[GetPlayerId(p)]
set SpecialDirectionActive[GetPlayerId(p)] = false
call SetUnitFacing(u,GetUnitFacing(u)-180)
set u = null
endfunction
// This is the function for dashing on double up press
private function OnDoubleUpPress takes nothing returns nothing
local player p = GetTriggerPlayer()
set SpecialDirectionActive[GetPlayerId(p)] = false
set SpeedFactor[GetPlayerId(p)] = 2
set p = null
endfunction
// This is the function for sliding left on double left press
private function OnDoubleLeftPress takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = Walker[GetPlayerId(p)]
set SpecialDirectionActive[GetPlayerId(p)] = true
set SpecialDirection[GetPlayerId(p)] = GetUnitFacing(u) + 90
set SpeedFactor[GetPlayerId(p)] = 0.6
set p = null
set u = null
endfunction
// This is the function for sliding right on double right press
private function OnDoubleRightPress takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = Walker[GetPlayerId(p)]
set SpecialDirectionActive[GetPlayerId(p)] = true
set SpecialDirection[GetPlayerId(p)] = GetUnitFacing(u) - 90
set SpeedFactor[GetPlayerId(p)] = 0.6
set p = null
set u = null
endfunction
// This is the function for stoping the dash of double up press
private function OnDoubleUpRelease takes nothing returns nothing
local player p = GetTriggerPlayer()
set SpeedFactor[GetPlayerId(p)] = 1
set p = null
endfunction
// This is the function for stoping slide of double left press
private function OnDoubleLeftRelease takes nothing returns nothing
local player p = GetTriggerPlayer()
set SpecialDirectionActive[GetPlayerId(p)] = false
set SpeedFactor[GetPlayerId(p)] = 1
set p = null
endfunction
// This is the function for stoping slide of double right press
private function OnDoubleRightRelease takes nothing returns nothing
local player p = GetTriggerPlayer()
set SpecialDirectionActive[GetPlayerId(p)] = false
set SpeedFactor[GetPlayerId(p)] = 1
set p = null
endfunction
//! endtextmacro
endlibrary
function Trig_Unbezeichneter_Ausl__ser_001_Func001A takes nothing returns nothing
endfunction
function Trig_Unbezeichneter_Ausl__ser_001_Actions takes nothing returns nothing
call EnumDestructablesInRectAll( Rect(0, 0, 0, 0), function Trig_Unbezeichneter_Ausl__ser_001_Func001A )
endfunction
//===========================================================================
function InitTrig_Unbezeichneter_Ausl__ser_001 takes nothing returns nothing
set gg_trg_Unbezeichneter_Ausl__ser_001 = CreateTrigger( )
call TriggerAddAction( gg_trg_Unbezeichneter_Ausl__ser_001, function Trig_Unbezeichneter_Ausl__ser_001_Actions )
endfunction