// ===========================
function H2I takes handle h returns integer
return h
return 0
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("jasslocalvars.w3v")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
//********Slide Engine*******
function SlideSFX takes nothing returns nothing
local unit a = udg_TempUnit
local effect b
local location c
set c = GetUnitLoc(a)
call AddSpecialEffectLocBJ( c, "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" )
set b = GetLastCreatedEffectBJ()
call TriggerSleepAction( 6.00 )
call DestroyEffectBJ( b )
call RemoveLocation(c)
set a = null
set b = null
endfunction
function SlideConditions takes real elapsed, real time returns boolean
if ( not ( time > elapsed ) ) then
return false
endif
return true
endfunction
function SlideMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer j = CreateTimer()
local unit a = GetHandleUnit( t, "slider" )
local real angle = GetHandleReal( a, "angle" )
local real speed = GetHandleReal( a, "speed" )
local real time = GetHandleReal( a, "time")
local real elapsed = GetHandleReal( a, "elapsed" )
local real newtime = elapsed+1.0
local location new = PolarProjectionBJ( GetUnitLoc( a ), speed, angle )
local boolean dusttrail = GetHandleBoolean( a, "dusttrail" )
call SetHandleReal( a, "elapsed", newtime)
call SetUnitPositionLoc( a, new)
call RemoveLocation( new )
set newtime = 0.00
call SetHandleHandle( j, "slider", a)
if (dusttrail) then
set udg_TempUnit = a
call ExecuteFunc("SlideSFX")
endif
call DestroyTimer(t)
if ( SlideConditions(elapsed, time) ) then
call TimerStart( j, 0.04, false, function SlideMove)
else
call FlushHandleLocals( a )
endif
endfunction
function Slide takes unit target, real angle, real speed, real time, boolean dusttrail returns nothing
local real t = time*25
local timer a = CreateTimer()
call SetHandleHandle( a, "slider", target)
call SetHandleReal( target, "angle", angle)
call SetHandleReal( target, "speed", speed)
call SetHandleReal( target, "time", t)
call SetHandleReal( target, "elapsed", 0.00)
call SetHandleBoolean( target, "dusttrail", dusttrail)
call TimerStart( a, 0.00, false, function SlideMove)
endfunction
//********End Engine*******
Name | Type | is_array | initial_value |
BouncyBall | unit | No | |
Death_Count | integer | Yes | |
Dethroned_Kings | force | No | |
Dino | unit | No | |
DragonBaby | unit | No | UnitNull |
DragonInteger | integer | Yes | |
DragonNest | unit | No | UnitNull |
DragonType | unitcode | Yes | |
GenInt | integer | No | 1 |
Kill_Count | integer | Yes | |
Kill_Count_Copy | integer | Yes | |
King_1 | unit | No | |
King_10 | unit | No | |
King_11 | unit | No | |
King_2 | unit | No | |
King_3 | unit | No | |
King_4 | unit | No | |
King_5 | unit | No | |
King_6 | unit | No | |
King_7 | unit | No | |
King_8 | unit | No | |
King_9 | unit | No | |
List | integer | No | |
Merchant2 | rect | No | |
Multiboard | multiboard | No | |
Multiboard_Spots | integer | Yes | |
MultiboardPlayerNo | integer | Yes | |
Player_Colors | string | Yes | |
Player_Count | integer | No | |
PlayerStartGroup | force | No | |
TempInt | integer | No | |
TempInt2 | integer | No | |
TempInt3 | integer | No | |
TempUnit | unit | No | |
Territories_Owned | integer | Yes | |
TerritoriesOwned | multiboard | Yes | |
Tribune_Timer | timer | No | |
Tribune_Timer_Window | timerdialog | No | |
UndeadDragonType | unitcode | Yes |
function Trig_Jump_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00J' ) ) then
return false
endif
return true
endfunction
function EndJump takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit a = GetHandleUnit( t, "jumper" )
local location c = GetUnitLoc( a )
local real d = GetHandleReal( t, "angle" )
local location f = PolarProjectionBJ( c, 75.00, d )
call UnitRemoveAbilityBJ( 'Amrf', a )
call PauseUnitBJ( false, a )
call SetUnitTimeScalePercent( a, 100.00 )
call DestroyTimer( t )
call FlushHandleLocals( a )
call RemoveLocation( c )
call RemoveLocation( f )
endfunction
function HalfWayHeight takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit a = GetHandleUnit( t, "jumperj" )
call SetUnitFlyHeightBJ( a, 0.00, 1000 )
call SetUnitTimeScalePercent( a, 30.00 )
call DestroyTimer(t)
endfunction
function Trig_Jump_Actions takes nothing returns nothing
local unit a = GetSpellAbilityUnit()
local timer t = CreateTimer()
local location c = GetUnitLoc( a )
local location d = GetSpellTargetLoc()
local real b = AngleBetweenPoints( c, d )
local real x = DistanceBetweenPoints( c, d )
local real y = x/25.0
local timer j = CreateTimer()
call SetHandleHandle( t, "jumper", a )
call SetHandleReal( t, "angle", b )
call SetHandleHandle( j, "jumperj", a )
call PauseUnitBJ( true, a )
call UnitAddAbilityBJ( 'Amrf', a )
call SetUnitFlyHeightBJ( a, 500.00, 1000 )
call Slide( a, b, y, 3.0, false )
call RemoveLocation( c )
call RemoveLocation( d )
call SetUnitTimeScalePercent( a, 0.00 )
call TimerStart( t, 1.0, false, function EndJump )
call TimerStart( j, 0.5, false, function HalfWayHeight )
endfunction
//===========================================================================
function InitTrig_Jump takes nothing returns nothing
set gg_trg_Jump = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Jump, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Jump, Condition( function Trig_Jump_Conditions ) )
call TriggerAddAction( gg_trg_Jump, function Trig_Jump_Actions )
endfunction