// ****************************************************************************
// **
// ** GENERAL AND MISCELANEOUS FUNCTIONS
// **
// ****************************************************************************
constant function ScriptSystemPeriod takes nothing returns real
return 0.01
endfunction
constant function ParticlePeriod takes nothing returns real
return 0.01
endfunction
constant function CameraPeriod takes nothing returns real
return 0.01
endfunction
function I2E takes integer i returns effect
return i
return null
endfunction
function B2I takes boolean b returns integer
if b then
return 1
endif
return 0
endfunction
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function H2S takes handle h returns string
return I2S( H2I( h ) )
endfunction
function DuplicateGroup takes group g returns group
return GetRandomSubGroup((CountUnitsInGroup( g )), g)
endfunction
function GC takes nothing returns gamecache
if udg_gameCache == null then
call FlushGameCache(InitGameCache( "CinemaCache" ))
set udg_gameCache = InitGameCache( "CinemaCache" )
endif
return udg_gameCache
endfunction
function MakeUnitFlyable takes unit u returns nothing
call UnitAddAbility(u, 'Amrf')
call UnitRemoveAbility(u, 'Amrf')
endfunction
function CreateActor takes player p, integer unitType returns unit
local unit u = CreateUnit(p, unitType, 0.0, 0.0, 0.0)
local integer i = 0
local integer h = H2I(u)
local string s = I2S(h)
call MakeUnitFlyable(u)
loop
set i = i + 1
exitwhen i > 4
call StoreReal( GC(), s, "colour"+I2S(i), 100.0 )
endloop
set u = null
return h
return null
endfunction
function InitCinematicSystem takes nothing returns nothing
call ExecuteFunc("ScriptSystemInit")
call ExecuteFunc("CameraSystemInit")
call ExecuteFunc("ParticleInit")
endfunction
// ****************************************************************************
// **
// ** CAMERA SYSTEM
// **
// ****************************************************************************
function CameraMainLoop takes nothing returns nothing
local real array a
local real array v
local real array s
local real array time
local integer i = 0
local gamecache g = GC()
loop
exitwhen i == 9
set i = i + 1
set time[i] = GetStoredReal( g, "camera", "time" + I2S(i) ) + CameraPeriod()
if time[i] > GetStoredReal( g, "camera", "endtime" + I2S(i) ) then
if GetStoredReal( g, "camera", "acc2" + I2S(i) ) != 0 then
call StoreReal( g, "camera", "acc" + I2S(i), GetStoredReal( g, "camera", "acc2" + I2S(i) ) )
call StoreReal( g, "camera", "startvel" + I2S(i), GetStoredReal( g, "camera", "vel" + I2S(i) ) )
call StoreReal( g, "camera", "startdis" + I2S(i), GetStoredReal( g, "camera", "dis" + I2S(i) ) )
call StoreReal( g, "camera", "time" + I2S(i), 0.00 )
call StoreReal( g, "camera", "acc2" + I2S(i), 0.00 )
set time[i] = 0.00
else
endif
endif
set a[i] = GetStoredReal( g, "camera", "acc" + I2S(i) )
set v[i] = GetStoredReal( g, "camera", "startvel" + I2S(i) )
set s[i] = GetStoredReal( g, "camera", "startdis" + I2S(i) )
call StoreReal( g, "camera", "time" + I2S(i), (time[i]) )
set s[i] = s[i] + ( v[i] * time[i] ) + ( a[i] * time[i] * time[i] / 2 )
set v[i] = v[i] + ( a[i] * time[i] )
if i > 3 and i < 7 then
if s[i] > 360 then
set s[i] = s[i] - 360
elseif s[i] < 0 then
set s[i] = s[i] + 360
endif
endif
call StoreReal( g, "camera", "vel" + I2S(i), v[i] )
call StoreReal( g, "camera", "dis" + I2S(i), s[i] )
endloop
call PanCameraToTimed( s[1], s[2], 0.00 )
call SetCameraField( CAMERA_FIELD_ZOFFSET, s[3], 0.00 )
call SetCameraField( CAMERA_FIELD_ROTATION, s[4], 0.00 )
call SetCameraField( CAMERA_FIELD_ANGLE_OF_ATTACK, s[5], 0.00 )
call SetCameraField( CAMERA_FIELD_ROLL, s[6], 0.00 )
call SetCameraField( CAMERA_FIELD_FIELD_OF_VIEW, s[7], 0.00 )
call SetCameraField( CAMERA_FIELD_FARZ, s[8], 0.00 )
call SetCameraField( CAMERA_FIELD_TARGET_DISTANCE, s[9], 0.00 )
set g = null
endfunction
function CameraStatChangeLin takes integer stat, real endvalue, real time returns nothing
local real startvalue = GetStoredReal( GC(), "camera", "dis" + I2S( stat ) )
local real distance = endvalue - startvalue
local real velocity = distance/time
call StoreReal( GC(), "camera", "startdis" + I2S( stat ), startvalue )
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), velocity )
call StoreReal( GC(), "camera", "acc" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "time" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "endtime" + I2S( stat ), time )
endfunction
function CameraStatChangeLinRad takes integer stat, real endvalue, real time returns nothing
local real startvalue = GetStoredReal( GC(), "camera", "dis" + I2S( stat ) )
local real distance = endvalue - startvalue
local real velocity1 = distance/time
local real velocity2 = -( RSignBJ(distance) * (360 - RAbsBJ(distance)) )/time
call StoreReal( GC(), "camera", "startdis" + I2S( stat ), startvalue )
if RAbsBJ(velocity1) < RAbsBJ(velocity2) then
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), velocity1 )
else
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), velocity2 )
endif
call StoreReal( GC(), "camera", "acc" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "time" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "endtime" + I2S( stat ), time )
endfunction
function CameraStatChange takes integer stat, real endvalue, real time returns nothing
local real startvalue = GetStoredReal( GC(), "camera", "dis" + I2S( stat ) )
local real startvelocity = GetStoredReal( GC(), "camera", "vel" + I2S( stat ) )
local real distance = endvalue - startvalue
local real accel = 2 * ( distance - startvelocity * time ) / ( time * time )
call StoreReal( GC(), "camera", "startdis" + I2S( stat ), startvalue )
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), startvelocity )
call StoreReal( GC(), "camera", "acc" + I2S( stat ), accel )
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "time" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "endtime" + I2S( stat ), time )
endfunction
function CameraStatChangeRad takes integer stat, real endvalue, real time returns nothing
local real startvalue = GetStoredReal( GC(), "camera", "dis" + I2S( stat ) )
local real startvelocity = GetStoredReal( GC(), "camera", "vel" + I2S( stat ) )
local real distance = endvalue - startvalue
local real accel1 = 2 * ( distance - startvelocity * time ) / ( time * time )
local real accel2 = 2 * ( -( RSignBJ(distance) * (360 - RAbsBJ(distance)) ) - startvelocity * time ) / ( time * time )
call StoreReal( GC(), "camera", "startdis" + I2S( stat ), startvalue )
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), startvelocity )
if RAbsBJ(accel1) < RAbsBJ(accel2) then
call StoreReal( GC(), "camera", "acc" + I2S( stat ), accel1 )
else
call StoreReal( GC(), "camera", "acc" + I2S( stat ), accel2 )
endif
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "time" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "endtime" + I2S( stat ), time )
endfunction
function CameraStatChangeAdv takes integer stat, real endvalue, real endvelocity, real time returns nothing
local real startvalue = GetStoredReal( GC(), "camera", "dis" + I2S( stat ) )
local real startvelocity = GetStoredReal( GC(), "camera", "vel" + I2S( stat ) )
local real distance = endvalue - startvalue
local real accel1 = 4 * ( distance ) / ( time * time ) - ( endvelocity + 3 * startvelocity ) / time
local real accel2 = ( 3 * endvelocity + startvelocity ) / time - 4 * ( distance ) / ( time * time )
call StoreReal( GC(), "camera", "startdis" + I2S( stat ), startvalue )
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), startvelocity )
call StoreReal( GC(), "camera", "acc" + I2S( stat ), accel1 )
call StoreReal( GC(), "camera", "time" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "endtime" + I2S( stat ), (time / 2) )
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), accel2 )
endfunction
function CameraStatChangeAdvRad takes integer stat, real endvalue, real endvelocity, real time returns nothing
local real startvalue = GetStoredReal( GC(), "camera", "dis" + I2S( stat ) )
local real startvelocity = GetStoredReal( GC(), "camera", "vel" + I2S( stat ) )
local real distance = endvalue - startvalue
local real accel1 = 4 * ( distance ) / ( time * time ) - ( endvelocity + 3 * startvelocity ) / time
local real accel2 = ( 3 * endvelocity + startvelocity ) / time - 4 * ( distance ) / ( time * time )
local real accel3 = 4 * ( -( RSignBJ(distance) * (360 - RAbsBJ(distance)) ) ) / ( time * time ) - ( endvelocity + 3 * startvelocity ) / time
local real accel4 = ( 3 * endvelocity + startvelocity ) / time - 4 * ( -( RSignBJ(distance) * (360 - RAbsBJ(distance)) ) ) / ( time * time )
call StoreReal( GC(), "camera", "startdis" + I2S( stat ), startvalue )
call StoreReal( GC(), "camera", "startvel" + I2S( stat ), startvelocity )
if (RAbsBJ(accel3) + RAbsBJ(accel4)) > (RAbsBJ(accel1) + RAbsBJ(accel2)) then
call StoreReal( GC(), "camera", "acc" + I2S( stat ), accel1 )
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), accel2 )
else
call StoreReal( GC(), "camera", "acc" + I2S( stat ), accel3 )
call StoreReal( GC(), "camera", "acc2" + I2S( stat ), accel4 )
endif
call StoreReal( GC(), "camera", "time" + I2S( stat ), 0.00 )
call StoreReal( GC(), "camera", "endtime" + I2S( stat ), (time / 2) )
endfunction
function ApplyCameraInstantly takes camerasetup whichSetup returns nothing
local integer i = 0
call StoreReal( GC(), "camera", "startdis1", CameraSetupGetDestPositionX( whichSetup ) )
call StoreReal( GC(), "camera", "startdis2", CameraSetupGetDestPositionY( whichSetup ) )
call StoreReal( GC(), "camera", "startdis3", CameraSetupGetField( whichSetup, CAMERA_FIELD_ZOFFSET ) )
call StoreReal( GC(), "camera", "startdis4", CameraSetupGetField( whichSetup, CAMERA_FIELD_ROTATION ) )
call StoreReal( GC(), "camera", "startdis5", CameraSetupGetField( whichSetup, CAMERA_FIELD_ANGLE_OF_ATTACK ) )
call StoreReal( GC(), "camera", "startdis6", CameraSetupGetField( whichSetup, CAMERA_FIELD_ROLL ) )
call StoreReal( GC(), "camera", "startdis7", CameraSetupGetField( whichSetup, CAMERA_FIELD_FIELD_OF_VIEW ) )
call StoreReal( GC(), "camera", "startdis8", CameraSetupGetField( whichSetup, CAMERA_FIELD_FARZ ) )
call StoreReal( GC(), "camera", "startdis9", CameraSetupGetField( whichSetup, CAMERA_FIELD_TARGET_DISTANCE ) )
loop
set i = i + 1
exitwhen i > 9
call StoreReal( GC(), "camera", "startvel" + I2S(i), 0.00 )
call StoreReal( GC(), "camera", "dis" + I2S(i), GetStoredReal(GC(),"camera","startdis"+I2S(i)) )
call StoreReal( GC(), "camera", "vel" + I2S(i), 0.00 )
call StoreReal( GC(), "camera", "acc" + I2S(i), 0.00 )
call StoreReal( GC(), "camera", "acc2" + I2S(i), 0.00 )
call StoreReal( GC(), "camera", "time" + I2S(i), 0.00 )
endloop
endfunction
function ApplyCameraLinear takes camerasetup whichSetup, real duration returns nothing
call CameraStatChangeLin(1, CameraSetupGetDestPositionX( whichSetup ), duration)
call CameraStatChangeLin(2, CameraSetupGetDestPositionY( whichSetup ), duration)
call CameraStatChangeLin(3, CameraSetupGetField( whichSetup, CAMERA_FIELD_ZOFFSET ), duration)
call CameraStatChangeLinRad(4, CameraSetupGetField( whichSetup, CAMERA_FIELD_ROTATION ), duration)
call CameraStatChangeLinRad(5, CameraSetupGetField( whichSetup, CAMERA_FIELD_ANGLE_OF_ATTACK ), duration)
call CameraStatChangeLinRad(6, CameraSetupGetField( whichSetup, CAMERA_FIELD_ROLL ), duration)
call CameraStatChangeLin(7, CameraSetupGetField( whichSetup, CAMERA_FIELD_FIELD_OF_VIEW ), duration)
call CameraStatChangeLin(8, CameraSetupGetField( whichSetup, CAMERA_FIELD_FARZ ), duration)
call CameraStatChangeLin(9, CameraSetupGetField( whichSetup, CAMERA_FIELD_TARGET_DISTANCE ), duration)
endfunction
function ApplyCameraSmooth takes camerasetup whichSetup, real duration returns nothing
call CameraStatChange(1, CameraSetupGetDestPositionX( whichSetup ), duration)
call CameraStatChange(2, CameraSetupGetDestPositionY( whichSetup ), duration)
call CameraStatChange(3, CameraSetupGetField( whichSetup, CAMERA_FIELD_ZOFFSET ), duration)
call CameraStatChangeRad(4, CameraSetupGetField( whichSetup, CAMERA_FIELD_ROTATION ), duration)
call CameraStatChangeRad(5, CameraSetupGetField( whichSetup, CAMERA_FIELD_ANGLE_OF_ATTACK ), duration)
call CameraStatChangeRad(6, CameraSetupGetField( whichSetup, CAMERA_FIELD_ROLL ), duration)
call CameraStatChange(7, CameraSetupGetField( whichSetup, CAMERA_FIELD_FIELD_OF_VIEW ), duration)
call CameraStatChange(8, CameraSetupGetField( whichSetup, CAMERA_FIELD_FARZ ), duration)
call CameraStatChange(9, CameraSetupGetField( whichSetup, CAMERA_FIELD_TARGET_DISTANCE ), duration)
endfunction
function ApplyCameraSmoothStop takes camerasetup whichSetup, real duration returns nothing
call CameraStatChangeAdv(1, CameraSetupGetDestPositionX( whichSetup ), 0.00, duration)
call CameraStatChangeAdv(2, CameraSetupGetDestPositionY( whichSetup ), 0.00, duration)
call CameraStatChangeAdv(3, CameraSetupGetField( whichSetup, CAMERA_FIELD_ZOFFSET ), 0.00, duration)
call CameraStatChangeAdvRad(4, CameraSetupGetField( whichSetup, CAMERA_FIELD_ROTATION ), 0.00, duration)
call CameraStatChangeAdvRad(5, CameraSetupGetField( whichSetup, CAMERA_FIELD_ANGLE_OF_ATTACK ), 0.00, duration)
call CameraStatChangeAdvRad(6, CameraSetupGetField( whichSetup, CAMERA_FIELD_ROLL ), 0.00, duration)
call CameraStatChangeAdv(7, CameraSetupGetField( whichSetup, CAMERA_FIELD_FIELD_OF_VIEW ), 0.00, duration)
call CameraStatChangeAdv(8, CameraSetupGetField( whichSetup, CAMERA_FIELD_FARZ ), 0.00, duration)
call CameraStatChangeAdv(9, CameraSetupGetField( whichSetup, CAMERA_FIELD_TARGET_DISTANCE ), 0.00, duration)
endfunction
function CameraSystemInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( t, CameraPeriod() )
call TriggerAddAction( t, function CameraMainLoop )
set t = null
call ApplyCameraInstantly( GetCurrentCameraSetup() )
endfunction
// ****************************************************************************
// **
// ** PARTICLE SYSTEM
// **
// ****************************************************************************
function ParticleMove takes unit u returns nothing
local gamecache g = GC()
local string s = H2S(u)
local real x = GetStoredReal( g, s, "x" )
local real y = GetStoredReal( g, s, "y" )
local real z = 0
local real vx = GetStoredReal( g, s, "vx" )
local real vy = GetStoredReal( g, s, "vy" )
local real vz = 0
local real az = GetStoredReal( g, s, "az" )
local real slidetime = GetStoredReal( g, s, "slidetime" )
local real facing = GetStoredReal( g, s, "facing" )
local real turnrate = GetStoredReal( g, s, "turnrate" )
local real turntime = GetStoredReal( g, s, "turntime" )
local real array colour
local real array vcolour
local real colourtime = GetStoredReal( g, s, "colourtime" )
local integer i = 0
local location loc
if slidetime > 0.0 then
if az != 0 then
set z = GetStoredReal( g, s, "z" )
set vz = GetStoredReal( g, s, "vz" )
set vz = vz + az
set z = z + vz + GetStoredReal( g, s, "PrevLocz" )
endif
set slidetime = slidetime - ParticlePeriod()
set x=x+vx
set y=y+vy
if az != 0 then
set loc = Location( x,y )
set z = z - GetLocationZ( loc )
call StoreReal( g, s, "PrevLocz", GetLocationZ(loc) )
call RemoveLocation( loc )
call SetUnitFlyHeight( u, z, 0 )
endif
call SetUnitX(u,x)
call SetUnitY(u,y)
call StoreReal( g, s, "x", x)
call StoreReal( g, s, "y", y)
call StoreReal( g, s, "z", z)
call StoreReal( g, s, "vz", vz)
call StoreReal( g, s, "slidetime", slidetime)
set loc = null
endif
if turntime > 0.0 then
set facing = facing + turnrate
set turntime = turntime - ParticlePeriod()
call SetUnitFacing( u, facing )
call StoreReal( g, s, "facing", facing )
call StoreReal( g, s, "turntime", turntime )
endif
if colourtime > 0.0 then
set colourtime = colourtime - ParticlePeriod()
call StoreReal( g, s, "colourtime", colourtime )
loop
set i = i + 1
exitwhen i > 4
set colour[i] = GetStoredReal( g, s, "colour"+I2S(i) )
set vcolour[i] = GetStoredReal( g, s, "vcolour"+I2S(i) )
set colour[i] = colour[i] + vcolour[i]
call StoreReal( g, s, "colour"+I2S(i), colour[i] )
set colour[i] = I2R(PercentTo255(colour[i]))
endloop
call SetUnitVertexColor(u, R2I(colour[1]), R2I(colour[2]), R2I(colour[3]), R2I(colour[4]))
endif
if slidetime <= 0.0 and turntime <= 0.0 and colourtime <= 0.0 then
call GroupRemoveUnit(udg_particles, u)
call SetUnitFlyHeight( u, 0, 0 )
call StoreReal( g, s, "z", z)
return
endif
endfunction
function Particles takes nothing returns nothing
local group g = DuplicateGroup( udg_particles )
local unit u
loop
set u = FirstOfGroup( g )
exitwhen u == null
call GroupRemoveUnit( g, u )
call ParticleMove( u )
endloop
call DestroyGroup( g )
set u = null
set g = null
endfunction
function UnitSlide takes unit u, real destX, real destY, real duration, real g returns nothing
local real x = GetUnitX( u )
local real y = GetUnitY( u )
local string h = H2S( u )
local location loc
local real z
if duration < ParticlePeriod() then
set duration = ParticlePeriod()
endif
if g != 0 then
set loc = Location(x,y)
set z = GetLocationZ(loc)+GetStoredReal( GC(), h, "z" )
call StoreReal( GC(), h, "PrevLocz", GetLocationZ(loc) )
call RemoveLocation(loc)
set loc = Location(destX, destY)
set z = GetLocationZ(loc)-z
call RemoveLocation(loc)
set z = (g*duration/2)+(z/duration)
call StoreReal( GC(), h, "z", GetStoredReal( GC(), h, "z" ))
call StoreReal( GC(), h, "vz", (z*ParticlePeriod()))
call StoreReal( GC(), h, "az", (-g*ParticlePeriod()*ParticlePeriod()))
else
call StoreReal( GC(), h, "az", 0.00)
endif
call StoreReal( GC(), h, "x", x)
call StoreReal( GC(), h, "y", y)
set x = (destX - x)/duration*ParticlePeriod()
set y = (destY - y)/duration*ParticlePeriod()
call StoreReal( GC(), h, "vx", x)
call StoreReal( GC(), h, "vy", y)
call StoreReal( GC(), h, "slidetime", duration)
call GroupAddUnit( udg_particles, u )
set loc = null
endfunction
function UnitTurn takes unit u, real destAng, real duration, integer clockwise returns nothing
// input angle between 0.00 and 360.00 please
local real angle = GetUnitFacing(u)
local string s = H2S(u)
local real turnspeed
if duration < ParticlePeriod() then
set duration = ParticlePeriod()
endif
if clockwise > 0 and angle > destAng then
set destAng = destAng + 360.0
elseif clockwise < 0 and angle < destAng then
set destAng = destAng - 360.0
elseif clockwise == 0 then
if (angle - destAng) > 180 then
set destAng = destAng + 360
elseif (angle - destAng) < -180 then
set destAng = destAng - 360
endif
endif
set turnspeed = (destAng - angle)/duration*ParticlePeriod()
call StoreReal( GC(), s, "facing", angle )
call StoreReal( GC(), s, "turnrate", turnspeed )
call StoreReal( GC(), s, "turntime", duration )
call GroupAddUnit( udg_particles, u )
endfunction
function UnitColour takes unit u, real red, real green, real blue, real opacity, real duration returns nothing
local real array colour
local string s
local integer i = 0
if duration < ParticlePeriod() then
set duration = ParticlePeriod()
endif
set colour[1] = red
set colour[2] = green
set colour[3] = blue
set colour[4] = opacity
set s = H2S(u)
loop
set i = i + 1
exitwhen i > 4
set colour[i] = colour[i] - GetStoredReal( GC(), s, "colour"+I2S(i))
set colour[i] = colour[i] / duration * ParticlePeriod()
call StoreReal(GC(), s, "vcolour"+I2S(i), colour[i])
endloop
call StoreReal(GC(), s, "colourtime", duration)
call GroupAddUnit( udg_particles, u )
endfunction
function ParticleInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( t, ParticlePeriod() )
call TriggerAddAction( t, function Particles )
set t = null
endfunction
// ****************************************************************************
// **
// ** SCRIPT SYSTEM
// **
// ****************************************************************************
function PlayScene takes integer scene returns nothing
call StoreInteger( GC(), "Interpreter", "Scene", scene )
call StoreReal( GC(), "Interpreter", "SceneTime", 0.00 )
call StoreInteger( GC(), "Interpreter", "PendingAction", GetStoredInteger( GC(), "Scene"+I2S(scene), "FirstSpot" ) )
endfunction
function PlaySceneFromTime takes integer scene, real time returns nothing
local string s
local integer previous = GetStoredInteger( GC(), "Scene"+I2S(scene), "LastSpot" )
if time < 0.00 then
call BJDebugMsg( "User error: negative action time" )
return
endif
loop
set s = "S"+I2S(scene)+"A"+I2S(previous)
exitwhen time > GetStoredReal( GC(), s, "Time" )
set previous = GetStoredInteger( GC(), s, "PrevAction" )
endloop
call StoreInteger( GC(), "Interpreter", "Scene", scene )
call StoreReal( GC(), "Interpreter", "SceneTime", time )
call StoreInteger( GC(), "Interpreter", "PendingAction", previous )
endfunction
function ScriptInterpreter takes nothing returns nothing
local gamecache g = GC()
local integer scene = GetStoredInteger( g, "Interpreter", "Scene" )
local integer action = GetStoredInteger( g, "Interpreter", "PendingAction" )
local real time = GetStoredReal( g, "Interpreter", "SceneTime" )
local string s
if scene == 0 then
return
endif
set time = time + ScriptSystemPeriod()
loop
set s = "S"+I2S(scene)+"A"+I2S(action)
exitwhen time < GetStoredReal( g, s, "Time" )
if action == 0 then
return
endif
call ExecuteFunc( GetStoredString( g, s, "ActionType" ) )
if scene != GetStoredInteger( g, "Interpreter", "Scene" ) then
return
endif
set action = GetStoredInteger( g, s, "NextAction" )
call StoreInteger( g, "Interpreter", "PendingAction", action )
endloop
call StoreReal( g, "Interpreter", "SceneTime", time )
endfunction
function WriteToScene takes integer scene returns nothing
call StoreInteger( GC(), "Scripter", "Scene", scene )
endfunction
function GetActionSpot takes integer scene, real time returns integer
local gamecache g = GC()
local string s
local integer previous = GetStoredInteger( g, "Scene"+I2S(scene), "LastSpot" )
local integer length = GetStoredInteger( g, "Scene"+I2S(scene), "Length" ) + 1
local integer next = 0
if time < 0.00 then
call BJDebugMsg( "User error: negative action time" )
return -1
endif
call StoreInteger( g, "Scene"+I2S(scene), "Length", length )
loop
if previous == 0 then
call StoreInteger( g, "Scene"+I2S(scene), "FirstSpot", length )
endif
set s = "S"+I2S(scene)+"A"+I2S(previous)
exitwhen time >= GetStoredReal( g, s, "Time" )
set previous = GetStoredInteger( g, s, "PrevAction" )
endloop
if previous == GetStoredInteger( g, "Scene"+I2S(scene), "LastSpot" ) then
call StoreInteger( g, "Scene"+I2S(scene), "LastSpot", length )
call StoreInteger( g, s, "NextAction", length )
else
set next = GetStoredInteger(g, s, "NextAction" )
call StoreInteger( g, s, "NextAction", length )
set s = "S"+I2S(scene)+"A"+I2S(next)
call StoreInteger( g, s, "PrevAction", length )
endif
set s = "S"+I2S(scene)+"A"+I2S(length)
call StoreInteger( g, s, "PrevAction", previous )
call StoreInteger( g, s, "NextAction", next )
return length
endfunction
// next scene
function NextScene takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
call PlayScene(scene+1)
endfunction
function ScriptNextScene takes real time returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "NextScene" )
call StoreReal( GC(), s, "Time", time )
endfunction
// external function
function ScriptExternalFunc takes real time, string funcName returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", funcName )
call StoreReal( GC(), s, "Time", time )
endfunction
// special effect
function SpecialEffectDestroy takes nothing returns nothing
local timer t = GetExpiredTimer()
local effect eff = I2E(GetStoredInteger( GC(), H2S(t), "effect" ))
call DestroyEffect( eff )
call FlushStoredMission( GC(), H2S(t) )
call DestroyTimer( t )
set t = null
set eff = null
endfunction
function SpecialEffectDestroyOverTime takes effect eff, real duration returns nothing
local timer t = CreateTimer()
call StoreInteger( GC(), H2S(t), "effect", H2I(eff) )
call TimerStart(t, duration, false, function SpecialEffectDestroy)
set t = null
endfunction
function SpecialEffectPoint takes nothing returns nothing
local effect eff = null
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local real x = GetStoredReal( GC(), s, "real1" )
local real y = GetStoredReal( GC(), s, "real2" )
local real z = GetStoredReal( GC(), s, "real3" )
local real duration = GetStoredReal( GC(), s, "real4" )
local string path = GetStoredString( GC(), s, "str1" )
local destructable d = CreateDestructableZ( 'OTip', x, y, z, 0.00, 1, 0 )
set eff = AddSpecialEffect(path, x, y)
call RemoveDestructable( d )
call SpecialEffectDestroyOverTime(eff, duration)
set d = null
set eff = null
endfunction
function ScriptPointEffect takes real time, real x, real y, real z, string path, real duration returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "SpecialEffectPoint" )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", x )
call StoreReal( GC(), s, "real2", y )
call StoreReal( GC(), s, "real3", z )
call StoreReal( GC(), s, "real4", duration )
call StoreString( GC(), s, "str1", path )
endfunction
function SpecialEffectActor takes nothing returns nothing
local effect eff = null
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local real duration = GetStoredReal( GC(), s, "real1" )
local string path = GetStoredString( GC(), s, "str1" )
local string attPoint = GetStoredString( GC(), s, "str2" )
set eff = AddSpecialEffectTarget(path, udg_actor[actID], attPoint)
call SpecialEffectDestroyOverTime(eff, duration)
set eff = null
endfunction
function ScriptActEffect takes real time, integer actor, string path, string attachpoint, real duration returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "SpecialEffectActor" )
call StoreReal( GC(), s, "Time", time )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "real1", duration )
call StoreString( GC(), s, "str1", path )
call StoreString( GC(), s, "str2", attachpoint )
endfunction
// play sound
function PlaySoundPath takes nothing returns nothing
local sound snd = null
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer volume = GetStoredInteger( GC(), s, "int1" )
local real pitch = GetStoredReal( GC(), s, "real1" )
local string path = GetStoredString( GC(), s, "str1" )
set snd = CreateSound(path, false, false, false, 10, 10, "")
call SetSoundPitch(snd, pitch)
call SetSoundVolume(snd, volume)
call StartSound(snd)
call KillSoundWhenDone(snd)
set snd = null
endfunction
function PreloadSoundPath takes nothing returns nothing
local timer t = GetExpiredTimer()
local string path = GetStoredString( GC(), H2S(t), "path" )
local sound snd = CreateSound(path, false, false, false, 10, 10, "")
call SetSoundVolume(snd, 0)
call StartSound(snd)
call KillSoundWhenDone(snd)
set snd = null
call FlushStoredMission( GC(), H2S(t) )
call DestroyTimer(t)
set t = null
endfunction
function ScriptPlaySound takes real time, string path, real pitch, integer volume returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local timer t = CreateTimer()
call StoreString( GC(), H2S(t), "path", path )
call TimerStart(t, 1.00, false, function PreloadSoundPath)
set t = null
call StoreString( GC(), s, "ActionType", "PlaySoundPath" )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", pitch )
call StoreInteger( GC(), s, "int1", volume )
call StoreString( GC(), s, "str1", path )
endfunction
// ability level
function ActorAbilityLevel takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local integer abilityID = GetStoredInteger( GC(), s, "int1" )
local integer level = GetStoredInteger( GC(), s, "int2" )
call UnitRemoveAbility( udg_actor[actID], abilityID )
call UnitAddAbility( udg_actor[actID], abilityID )
call SetUnitAbilityLevel( udg_actor[actID], abilityID, level )
endfunction
function ScriptActAbilityLvl takes real time, integer actor, integer abilityID, integer level returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorAbilityLevel" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreInteger( GC(), s, "int1", abilityID )
call StoreInteger( GC(), s, "int2", level )
endfunction
// play animation
function ActorPlayAnimation takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local integer animationID = GetStoredInteger( GC(), s, "int1" )
local real animationBlend = GetStoredReal( GC(), s, "real1" )
call SetUnitBlendTime(udg_actor[actID], animationBlend)
call SetUnitAnimationByIndex( udg_actor[actID], animationID )
endfunction
function ScriptActAnimPlay takes real time, integer actor, integer animationID, real animationBlend returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorPlayAnimation" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreInteger( GC(), s, "int1", animationID )
call StoreReal( GC(), s, "real1", animationBlend )
endfunction
function ActorResetAnimation takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
call ResetUnitAnimation( udg_actor[actID] )
endfunction
function ScriptActAnimReset takes real time, integer actor returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorResetAnimation" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
endfunction
// animation speed
function ActorSpeedAnimation takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local real animationSpeed = GetStoredReal( GC(), s, "real1" )
call SetUnitTimeScale( udg_actor[actID], animationSpeed )
endfunction
function ScriptActAnimSpeed takes real time, integer actor, real speed returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorSpeedAnimation" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", speed )
endfunction
// slide unit
function ActorSlide takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local real destX = GetStoredReal( GC(), s, "real1" )
local real destY = GetStoredReal( GC(), s, "real2" )
local real duration = GetStoredReal( GC(), s, "real3" )
local real g = GetStoredReal( GC(), s, "real4" )
call UnitSlide( udg_actor[actID], destX, destY, duration, g )
endfunction
function ScriptActSlide takes real time, integer actor, real x, real y, real duration, real g returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorSlide" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", x )
call StoreReal( GC(), s, "real2", y )
call StoreReal( GC(), s, "real3", duration )
call StoreReal( GC(), s, "real4", g )
endfunction
// turn unit
function ActorTurn takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local real destAng = GetStoredReal( GC(), s, "real1" )
local real duration = GetStoredReal( GC(), s, "real2" )
local integer clockwise = GetStoredInteger( GC(), s, "int1" )
call UnitTurn( udg_actor[actID], destAng, duration, clockwise )
endfunction
function ScriptActTurn takes real time, integer actor, real destAng, real duration, integer clockwise returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorTurn" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", destAng )
call StoreReal( GC(), s, "real2", duration )
call StoreInteger( GC(), s, "int1", clockwise )
endfunction
function ActorFace takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local integer targetID = GetStoredInteger( GC(), s, "int1" )
local integer headORchest = GetStoredInteger( GC(), s, "int2" )
local real x = GetStoredReal( GC(), s, "real1" )
local real y = GetStoredReal( GC(), s, "real2" )
local real z = GetStoredReal( GC(), s, "real3" )
local real animationBlend = GetStoredReal( GC(), s, "real4" )
if headORchest == 0 then
set s = "Bone_Head"
else
set s = "Bone_Chest"
endif
call SetUnitBlendTime(udg_actor[actID], animationBlend)
call SetUnitLookAt( udg_actor[actID], s, udg_actor[targetID], x,y,z )
endfunction
function ScriptActFace takes real time, integer actor, integer destActor, integer headORchest, real xoff, real yoff, real zoff, real animationBlend returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorFace" )
call StoreInteger( GC(), s, "actor", actor )
call StoreInteger( GC(), s, "int1", destActor )
call StoreInteger( GC(), s, "int2", headORchest )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", xoff )
call StoreReal( GC(), s, "real2", yoff )
call StoreReal( GC(), s, "real3", zoff )
call StoreReal( GC(), s, "real4", animationBlend )
endfunction
function ActorFaceReset takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local real animationBlend = GetStoredReal( GC(), s, "real1" )
call SetUnitBlendTime(udg_actor[actID], animationBlend)
call ResetUnitLookAt( udg_actor[actID] )
endfunction
function ScriptActFaceReset takes real time, integer actor, real animationBlend returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorFaceReset" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", animationBlend )
endfunction
// vertex colouring
function ActorColour takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer actID = GetStoredInteger( GC(), s, "actor" )
local real red = GetStoredReal( GC(), s, "real1" )
local real green = GetStoredReal( GC(), s, "real2" )
local real blue = GetStoredReal( GC(), s, "real3" )
local real opacity = GetStoredReal( GC(), s, "real4" )
local real duration = GetStoredReal( GC(), s, "real5" )
call UnitColour( udg_actor[actID], red, green, blue, opacity, duration )
endfunction
function ScriptActColour takes real time, integer actor, real red, real green, real blue, real opacity, real duration returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "ActorColour" )
call StoreInteger( GC(), s, "actor", actor )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", red )
call StoreReal( GC(), s, "real2", green )
call StoreReal( GC(), s, "real3", blue )
call StoreReal( GC(), s, "real4", opacity )
call StoreReal( GC(), s, "real5", duration )
endfunction
// camera scripting
function CameraChange takes nothing returns nothing
local integer scene = GetStoredInteger( GC(), "Interpreter", "Scene" )
local integer action = GetStoredInteger( GC(), "Interpreter", "PendingAction" )
local string s = "S"+I2S(scene)+"A"+I2S(action)
local integer camID = GetStoredInteger( GC(), s, "actor" )
local integer changeType = GetStoredInteger( GC(), s, "int1" )
local real duration = GetStoredReal( GC(), s, "real1" )
if changeType == 1 then
call ApplyCameraInstantly( udg_camera[camID] )
elseif changeType == 2 then
call ApplyCameraLinear( udg_camera[camID], duration )
elseif changeType == 3 then
call ApplyCameraSmooth( udg_camera[camID], duration )
elseif changeType == 4 then
call ApplyCameraSmoothStop( udg_camera[camID], duration )
endif
endfunction
function ScriptCamera takes real time, integer camera, real duration, integer changeType returns nothing
local integer scene = GetStoredInteger( GC(), "Scripter", "Scene" )
local integer action = GetActionSpot( scene, time )
local string s = "S"+I2S(scene)+"A"+I2S(action)
call StoreString( GC(), s, "ActionType", "CameraChange" )
call StoreInteger( GC(), s, "actor", camera )
call StoreInteger( GC(), s, "int1", changeType )
call StoreReal( GC(), s, "Time", time )
call StoreReal( GC(), s, "real1", duration )
endfunction
function ScriptSystemInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( t, ScriptSystemPeriod() )
call TriggerAddAction( t, function ScriptInterpreter )
set t = null
endfunction
Name | Type | is_array | initial_value |
actor | unit | Yes | |
BlazingWind | unit | No | |
camera | camerasetup | Yes | |
gameCache | gamecache | No | |
Hero | unit | No | |
Heroine | unit | No | |
Music | sound | No | |
particles | group | No |
The system requires the following global variables to be set up in the map that wants to use it:
gameCache game cache variable
particles unit group variable
actor unit array
camera camera object array
note that variable names are case sensitive, so make sure you name them right. Actually, whole Jass
is case sensitive, so be careful not to mistype function names as well when you script your cinematic.
Once the variables are set up, just copy the entire content of this map's custom script section to the
same place in your map.
In a trigger running at map initialization, call the following function to set the systems up:
//function InitCinematicSystem takes nothing returns nothing
There, the systems are up and running.
Then, you must set all the units and cameras you want the script system to use to the two corresponding
variable arrays: actor for units and camera for, you guessed it, cameras. The script system can only use
units and camera objects that are stored there. You can store preplaced camera objects and units there
with GUI, but for units, it is preferred you generate them with the following function:
//function CreateActor takes player p, integer unitType returns unit
This function creates the unit for the given player, and also sets some things up for that unit, like
allowing the particle system to change it's flying height even if it's a ground unit, and setting up
the unit's vertex colouring data. The unit is created in the middle of the map, but you can easily move
it with the script system.
That's it, once you have everything set up like this, you are ready to start writing your cinematic's
script.
THE SCRIPT SYSTEM
The script system is used, as the name implies, to script your cinematic. It is an assortment of functions
that you use for scripting different actions, like sliding units and playing their animations. When one of
the scripting functions is used, it stores to the system's database when and what action should be executed.
Normaly, all scripting should be done at map initialization. Just make a trigger that runs at Map Init,
convert it to custom text, and start filling in script functions. You can break it up into more triggers
for organisational purposes. It is also advised that you add a lot of comments to your script, so you can
easily find your way around it, it is very difficult to find what you want to change in an uncommented
script.
//function WriteToScene takes integer scene returns nothing
This function comes first. It tells the system which scene you want to write into. This way, you don't need
to specify that for each action individually; simply use this function to start writing to the first scene,
once you store all the actions for it, move to the next scene, again with this function. Use values above 0
for scene numbers.
Once you select which scene you want to write to with the WriteToScene function, it's time to start scripting.
Here are all the functions avaliable:
//function ScriptNextScene takes real time returns nothing
//function ScriptExternalFunc takes real time, string funcName returns nothing
//function ScriptPlaySound takes real time, string path, real pitch, integer volume returns nothing
//function ScriptPointEffect takes real time, real x, real y, real z, string path, real duration returns nothing
//function ScriptActEffect takes real time, integer actor, string path, string attachpoint, real duration returns nothing
//function ScriptActAbilityLvl takes real time, integer actor, integer abilityID, integer level returns nothing
//function ScriptActAnimPlay takes real time, integer actor, integer animationID, real animationBlend returns nothing
//function ScriptActAnimReset takes real time, integer actor returns nothing
//function ScriptActAnimSpeed takes real time, integer actor, real speed returns nothing
//function ScriptActSlide takes real time, integer actor, real x, real y, real duration, real g returns nothing
//function ScriptActTurn takes real time, integer actor, real destAng, real duration, integer clockwise returns nothing
//function ScriptActFace takes real time, integer actor, integer destActor, integer headORchest, real xoff, real yoff, real zoff, real animationBlend returns nothing
//function ScriptActFaceReset takes real time, integer actor, real animationBlend returns nothing
//function ScriptActColour takes real time, integer actor, real red, real green, real blue, real opacity, real duration returns nothing
//function ScriptCamera takes real time, integer camera, real duration, integer changeType returns nothing
Notice how all these functions take a real named "time" as their first parameter. This tells the system how
much time after the start of the scene you are writing to the action you are writing should occur. Normaly,
for organisational purposes as well as for efficiency, you would write actions in consecutive order: the ones
that happen later should also be scripted later.
Note that when writing down your initialization functions, they can get quite long as you add more and more
length and detail to your cinematic. They may get so long that they reach the threadlimit (especially if you
mix the order a lot, like first scripting a part of the scene that happens towards it's end and then a part
that comes before it, since in that case the system wastes a lot of function calls looking backwards through
the database searching for where to insert the new action) and end without executing fully. In such a case,
use short waits to break the function up.
Now let's look at the functions one by one to see what actions they script:
- ScriptExternalFunc
As the name implies, this function allows you to run functions from outside the system, functions you
create yourself. This is useful when you want to do an effect at some point that is too rare to have
it's own script system function. You can make your own external function even if you don't know Jass;
just make a trigger with all the actions you want to execute, then convert it to custom text. All the
trigger's actions will be put into one function named "Trig_TriggerName_Actions", use that function name
as the argument for the ScriptExternalFunc function.
Note: Be sure to type the function name exactly, Jass is case sensitive. Mistyping it will cause a crash.
Note: If you are typing your external functions in Jass, remember that they must take and return nothing.
-ScriptNextScene
This is used in multi-scene cinematics to go from one scene to the next. It causes the system to start
playing the next scene from the beginning when it gets to this action, no matter if there are any actions
after this one left in the scene. If a scene finishes without having an action like this in it, the system
goes into idle mode.
-ScriptPlaySound
This function scripts the playing of a sound. The "path" parameter is, like with special effect functions,
the path to the file, only this time it's a sound file. The volume goes from 0 to 127, while pitch can be
any real value, 1.0 means normal speed, 0.5 halved speed, 2 double sound speed.
- ScriptPointEffect
This function is used to create special effects at a point for a given duration. The x, y and z parameters
are the coordinates at which the special effect is to be created, the string parameter named path is the
filename of the special effect model you want to use. Duration is given in seconds.
- ScriptActEffect
This is similar to the other special effect function, only this one creates it on a unit. Like all other
scripting functions that work with units, it can only work with units that are stored in the "actor" unit
variable array. The integer parameter named actor that the function takes represents the array index
under which the unit you want to attach the special effect to is stored. path and duration parameters are
the same as with the previous function, and the string attachpoint is the attachment point where you want
the effect to be (for example, "origin" or "overhead").
-ScriptActAbilityLevel
I mainly used this function for changing the level of a chaos-based ability which switched between
different versions of the unit. This way, I could have more different models in one unit, so I didn't have
to swap a bunch of actors all the time, but just change this single one. I suppose this could also be used
with some passive abilities as an alternate way of attaching special effects to a unit.
-ScriptActAnimPlay
This is used for playing actor animations. It takes an integer argument (the one named animationID) to
determine what animation to play. The reason the function uses animation IDs instead of strings is that
with strings, you can only specify a "stand" or an "attack" animation, but you can't specify which one if
the unit has more. With animation IDs, you can do that, but you need to first determine which ID the
animation you want to play has. The real parameter named animationBlen is the blend time, it determines
the duration over which the unit model moves from the previous animation to the new one. Note that this
time scales along with animation speed.
-ScriptActAnimReset
Resets the animation of an actor. Useful when a unit is in the background and you don't want to bother with
it, but just want it to stand there like it does in regular games, randomly choosing between it's stand
animations.
-ScriptActAnimSpeed
Changes the animation speed of the unit. It was made seperate from ScriptActAnimPlay, so you can change
animation speed mid-animation, not just at start. However, animations aren't as accurate as we would want,
if you have a quickly moving model and then try to completely pause it, it doesn't seem to always pause at
the exact same spot in the animation, so this isn't precise enough to do things like stopping attack
animations in an action scene right when the blades clash.
-ScriptActSlide
Slides the actor from it's current location to the new coordinates over the given duration. The real
parameter named g should be 0 for sliding on the ground, but above 0 for jumping. The higher the value,
the higher the arc in which the unit flies (the height of the arc also depends on the duration). Normal
values for this parameters are around a few hundred.
-ScriptActTurn
This causes an actor to turn to a certain angle over the given duration. The real parameter destAng is
the new angle, it's value should be between 0 and 360, with 0 being East and 90 North. The integer
parameter named clockwise determines in which direction the actor should rotate, values above 0 mean to
the left (counter clockwise), values below 0 to the right (clockwise). The size of the integer doesn't
matter, only if it's positive or negative. If it's 0, the unit will turn in the direction where the
turn is shorter.
-ScriptActFace
Causes the actor to face another actor with either it's head or chest bone. With which is determined by
the headORchest parameter, a value of 0 means head while anything else means chest. Note that only one
bone can rotate at a time, whenever this action is used it will first reset all facings, this is a
limitation of the Warcraft engine and might be adressed in future versions. The xoff, yoff and zoff
parameters determine the offset of the facing point from the origin point of the facing destination
actor. The animationBlend parameter determines the duration over which the head will turn, 0 is instant.
-ScriptActFaceReset
Resets the facing of the actor, all bones face forward. The animationBlend parameter again determines the
duration over which the head or chest face forward again.
-ScriptActColour
Changes the vertex colouring of the target unit over the given duration. The red, green and blue real
parameters range from 0 to 100, 0 being no colour and 100 full colour. The real parameter named opacity
determines the transparency of the unit, 0 means invisible while 100 means non-transparent.
-ScriptCamera
Used for scripting camera movement. The integer parameter named camera specifies the array index of the
camera global array, the camera that's stored there will be applied over the given duration. The integer
changeType specifies how the camera should move. 1 means instant change, in that case the duration
parameter is ignored. 2 means linear change, that is equal to the regular Warcraft camera movement. 3 is
a curved change, in that case the camera will keep it's starting movement speed and change it gradually
as it moves instead. 4 is another curved movement, but it is calculated so that the camera movement comes
to a halt just when it reaches it's destination.
Note that all camera movements (except the type 1, which isn't movement but an instant change) continiue
even after the duration passes, use the instant camera change to stop all movement. For more details on
camera movement, consult the next part of this readme.
//It's always useful to have a copy of the list of scripting functions near (Yep, it is ^_^):
//function ScriptNextScene takes real time returns nothing
//function ScriptExternalFunc takes real time, string funcName returns nothing
//function ScriptPlaySound takes real time, string path, real pitch, integer volume returns nothing
//function ScriptPointEffect takes real time, real x, real y, real z, string path, real duration returns nothing
//function ScriptActEffect takes real time, integer actor, string path, string attachpoint, real duration returns nothing
//function ScriptActAbilityLvl takes real time, integer actor, integer abilityID, integer level returns nothing
//function ScriptActAnimPlay takes real time, integer actor, integer animationID, real animationBlend returns nothing
//function ScriptActAnimReset takes real time, integer actor returns nothing
//function ScriptActAnimSpeed takes real time, integer actor, real speed returns nothing
//function ScriptActSlide takes real time, integer actor, real x, real y, real duration, real g returns nothing
//function ScriptActTurn takes real time, integer actor, real destAng, real duration, integer clockwise returns nothing
//function ScriptActFace takes real time, integer actor, integer destActor, integer headORchest, real xoff, real yoff, real zoff, real animationBlend returns nothing
//function ScriptActFaceReset takes real time, integer actor, real animationBlend returns nothing
//function ScriptActColour takes real time, integer actor, real red, real green, real blue, real opacity, real duration returns nothing
//function ScriptCamera takes real time, integer camera, real duration, integer changeType returns nothing
function Trig_Scene1Init_Actions takes nothing returns nothing
local real x
call WriteToScene(1)
//Settings
call ScriptActSlide(0.0, 1, -3364, -210, 0.0, 0.0)
call ScriptActSlide(0.0, 2, 2490, -210, 0.0, 0.0)
call ScriptActSlide(0.0, 11, 0, 2450, 0.0, 0.0)
call ScriptActSlide(0.0, 4, 20, 2420, 0.0, 0.0)
call ScriptActSlide(0.0, 5, 40, 2400, 0.0, 0.0)
call ScriptActSlide(0.0, 6, 60, 2420, 0.0, 0.0)
call ScriptActSlide(0.0, 7, -30, 2430, 0.0, 0.0)
call ScriptActSlide(0.0, 8, -50, 2400, 0.0, 0.0)
call ScriptActSlide(0.0, 9, -70, 2390, 0.0, 0.0)
call ScriptActSlide(0.0, 10, -40, 2410, 0.0, 0.0)
call ScriptCamera(0.0, 3, 1.0, 1)
call ScriptActTurn(0.0, 1, 0, 0, 0)
call ScriptActTurn(0.0, 2, 180, 0, 0)
call ScriptActTurn(0.0, 11, 259.5, 0, 0)
call ScriptExternalFunc(0.0, "Trig_Music_Actions")
//Intro
call ScriptExternalFunc(2.0, "Trig_FadeIn_Actions")
call ScriptCamera(2.0, 4, 6.0, 4)
call ScriptExternalFunc(4.0, "Trig_Transmission1_Actions")
call ScriptExternalFunc(4.5, "Trig_FaceBeginHero_Actions")
call ScriptExternalFunc(7.0, "Trig_FadeOut_Actions")
call ScriptCamera(8.0, 4, 0.0, 1)
call ScriptCamera(8.0, 5, 0.0, 1)
call ScriptCamera(8.0, 6, 4.0, 4)
call ScriptExternalFunc(8.0, "Trig_VolumeBegin_Actions")
call ScriptExternalFunc(8.0, "Trig_FadeIn2_Actions")
call ScriptActAnimSpeed(8.5, 1, 0.30)
call ScriptActAnimPlay(8.5, 1, 8, 3.40)
call ScriptExternalFunc(11.0, "Trig_FadeOut_Actions")
call ScriptCamera(12.0, 6, 0.0, 1)
call ScriptCamera(12.0, 4, 0.0, 1)
call ScriptCamera(12.0, 7, 4.0, 2)
call ScriptExternalFunc(12.0, "Trig_FadeIn2_Actions")
call ScriptExternalFunc(12.5, "Trig_Transmission2_Actions")
call ScriptCamera(16.0, 7, 0.0, 1)
call ScriptExternalFunc(15.0, "Trig_FadeOut_Actions")
call ScriptExternalFunc(16.0, "Trig_RemoveBeginHero_Actions")
//First Meeting
call ScriptCamera(16.5, 8, 0.0, 1)
call ScriptCamera(16.5, 9, 6.5, 3)
call ScriptExternalFunc(16.5, "Trig_FadeIn2_Actions")
call ScriptActAnimSpeed(16.5, 1, 0.10)
call ScriptActAnimSpeed(16.5, 2, 0.06)
call ScriptActAnimPlay(16.5, 1, 5, 0.20)
call ScriptActAnimPlay(16.5, 2, 4, 0.12)
call ScriptExternalFunc(16.6, "Trig_VolumeBegin2_Actions")
call ScriptActSlide(17.0, 1, -1900, -210, 6.0, 110)
call ScriptActSlide(17.0, 2, 400, -210, 7.0, 100)
call ScriptExternalFunc(21.7, "Trig_WaterWaves1_Actions")
call ScriptActSlide(21.7, 1, -1900, -210, 100.0, 0)
call ScriptActSlide(21.7, 1, -1300, -210, 3.0, 180)
call ScriptActSlide(22.7, 2, 400, -210, 100.0, 0)
call ScriptActSlide(22.7, 2, -800, -210, 5.5, 230)
call ScriptExternalFunc(22.7, "Trig_WaterWaves2_Actions")
call ScriptCamera(23.0, 10, 7.0, 3)
call ScriptActSlide(23.2, 1, -1300, -210, 100.0, 0)
call ScriptExternalFunc(23.2, "Trig_WaterWaves1b_Actions")
call ScriptActAnimSpeed(23.2, 1, 0.09)
call ScriptActAnimPlay(23.5, 1, 2, 1.00)
call ScriptActSlide(23.2, 1, -100, -210, 5.0, 270)
call ScriptActAnimSpeed(25.0, 2, 0.50)
call ScriptActAnimPlay(25.0, 2, 6, 0.30)
call ScriptActTurn(25.1, 2, 179, 1.70, 1)
call ScriptActAnimSpeed(26.0, 1, 0.65)
call ScriptActAnimPlay(26.5, 2, 6, 0.70)
call ScriptPlaySound(26.8, "Sound\\Units\\Combat\\MetalHeavyChopFlesh2.wav", 1.30, 90)
call ScriptActSlide(26.9, 2, -270, -260, 0.3, 1)
call ScriptActAnimSpeed(26.9, 2, 0.50)
call ScriptActAnimPlay(26.9, 2, 5, 0.10)
call ScriptPlaySound(27.05, "Sound\\Buildings\\Naga\\NagaBuildingCancel.wav", 2.00, 100)
call ScriptPointEffect(27.05, -400, -240, -180, "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", 2)
call ScriptActAnimSpeed(27.1, 1, 0.08)
call ScriptActAnimPlay(27.1, 1, 5, 0.7)
call ScriptActColour(27.2, 2, 0, 0, 0, 40, 1)
call ScriptActSlide(27.6, 1, -100, -210, 100.0, 0)
call ScriptExternalFunc(27.6, "Trig_WaterWaves1b_Actions")
call ScriptActSlide(27.6, 1, 200, -210, 7, 130)
//Water-Cliff
call ScriptActSlide(29.0, 2, 20, -245, 3.5, 650)
call ScriptActTurn(29.0, 1, 270, 2.5, -1)
call ScriptActTurn(29.0, 2, 80, 3, 0)
call ScriptActColour(29.0, 2, 100, 100, 100, 100, 0.3)
call ScriptActAnimSpeed(29.0, 2, 0.40)
call ScriptActAnimPlay(29.0, 2, 10, 0.20)
call ScriptPlaySound(29.3, "Sound\\Buildings\\Naga\\NagaBuildingCancel.wav", 2.00, 100)
call ScriptPointEffect(29.3, -290, -230, -160, "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", 2)
call ScriptCamera(30.0, 12, 1.9, 3)
call ScriptActTurn(30.5, 2, 30, 1, 0)
call ScriptActAnimSpeed(30.7, 2, 1.10)
call ScriptActAnimPlay(30.7, 2, 1, 0.40)
call ScriptExternalFunc(30.9, "Trig_DazzlingDamage_Actions")
call ScriptPlaySound(30.9, "Sound\\Units\\Combat\\MetalLightSliceMetal3.wav", 1.00, 100)
call ScriptActSlide(31.0, 1, 200, -210, 100, 0)
call ScriptActSlide(31.0, 1, 0, 2400, 2, 130)
call ScriptActAnimSpeed(31.0, 1, 0.30)
call ScriptActAnimPlay(31.0, 1, 4, 0.60)
call ScriptActAnimSpeed(31.5, 2, 0.06)
call ScriptActAnimPlay(31.5, 2, 4, 0.50)
call ScriptCamera(31.9, 13, 1.8, 4)
call ScriptActAnimSpeed(32.0, 1, 0.00)
call ScriptActSlide(32.5, 2, 20, -245, 100, 0)
call ScriptActSlide(32.5, 2, 0, 400, 6.0, 80)
call ScriptActTurn(32.5, 2, 90, 1, 0)
call ScriptExternalFunc(33.0, "Trig_ShakeIt_Actions")
call ScriptExternalFunc(33.0, "Trig_UnhideRox_Actions")
call ScriptActSlide(33.1, 4, 400, 450, 2.4, 120)
call ScriptActSlide(33.1, 5, 700, 200, 2.5, 550)
call ScriptActSlide(33.1, 6, 100, 550, 2.2, 750)
call ScriptActSlide(33.1, 7, -50, 400, 3.5, 300)
call ScriptActSlide(33.1, 8, -170, 300, 3.1, 620)
call ScriptActSlide(33.1, 9, -430, 470, 2.8, 400)
call ScriptActSlide(33.1, 10, -600, 250, 2.9, 340)
call ScriptPlaySound(33.2, "Abilities\\Spells\\Other\\TinkerRocket\\TinkerMissileDeath1.wav", 1.20, 120)
//Blade Crush
call ScriptCamera(33.7, 13, 0.0, 1)
call ScriptCamera(35.0, 14, 0.0, 1)
call ScriptCamera(35.0, 15, 7.4, 2)
call ScriptActAnimSpeed(35.1, 11, 0.34)
call ScriptActAnimPlay(35.1, 11, 3, 0.2)
call ScriptExternalFunc(35.1, "Trig_Replace_Actions")
call ScriptActSlide(35.5, 2, 0, 400, 100, 0)
call ScriptActSlide(35.5, 2, 0, 600, 4.0, 120)
call ScriptExternalFunc(35.5, "Trig_WaterWaves2_Actions")
call ScriptCamera(36.0, 15, 4.0, 4)
call ScriptActSlide(36.8, 11, 0, 300, 100, 0)
call ScriptActSlide(36.8, 11, 180, 300, 8.7, 73)
call ScriptActAnimSpeed(37.2, 11, 0.02)
call ScriptActSlide(37.7, 2, 0, 600, 100, 0)
call ScriptActSlide(37.7, 2, 0, 1350, 5.4, 280)
call ScriptExternalFunc(37.7, "Trig_WaterWaves2b_Actions")
call ScriptActAnimSpeed(38.5, 11, 0.01)
call ScriptActAnimSpeed(39.4, 2, 1.00)
call ScriptActAnimPlay(39.4, 2, 9, 1.00)
call ScriptCamera(40.0, 16, 4.5, 4)
call ScriptActFace(40.0, 2, 11, 0, 0, 0, 90, 5.0)
call ScriptActAnimSpeed(40.2, 2, 0.01)
call ScriptPlaySound(40.9, "Abilities\\Spells\\Human\\Defend\\DefendCaster.wav", 2.00, 110)
call ScriptExternalFunc(40.9, "Trig_SlowMotionIn_Actions")
call ScriptActSlide(41.0, 2, 0, 900, 30, 0)
call ScriptActSlide(41.0, 11, 0, 200, 100, 0)
call ScriptCamera(44.5, 19, 11.0, 3)
call ScriptPlaySound(46.6, "Sound\\Units\\Combat\\MetalLightSliceMetal3.wav", 0.50, 100)
call ScriptExternalFunc(46.6, "Trig_BlazingWind_Actions")
call ScriptPlaySound(47.5, "Abilities\\Weapons\\PhoenixMissile\\PhoenixAttack.wav", 0.14, 127)
call ScriptExternalFunc(54.2, "Trig_EndBlazingWind_Actions")
call ScriptExternalFunc(54.2, "Trig_SlowMotionOut_Actions")
call ScriptActSlide(54.3, 11, 0, 0, 100, 0)
call ScriptActSlide(54.3, 11, 0, 0, 4.2, 0)
call ScriptPlaySound(54.6, "Sound\\Units\\Combat\\MetalLightSliceFlesh3.wav", 1.20, 105)
set x = 54
//Land Battle
call ScriptActAnimSpeed(x+0.6, 2, 0.15)
call ScriptActAnimPlay(x+0.6, 2, 7, 1.00)
call ScriptActSlide(x+0.6, 2, 2015, -2315, 100, 0)
call ScriptActSlide(x+0.6, 2, 2015, -2315, 3.2, 0)
call ScriptActFaceReset(x+0.6, 2, 2.00)
call ScriptCamera(x+1.0, 22, 3.0, 4)
call ScriptExternalFunc(x+2.5, "Trig_FadeOut3_Actions")
call ScriptActAnimSpeed(x+3.0, 2, 0.01)
call ScriptExternalFunc(x+3.0, "Trig_Replace2_Actions")
call ScriptExternalFunc(x+3.0, "Trig_Volume_Actions")
call ScriptCamera(x+4.0, 22, 0.0, 1)
call ScriptCamera(x+4.0, 20, 0.0, 1)
call ScriptExternalFunc(x+4.0, "Trig_Fog1_Actions")
call ScriptActSlide(x+4.1, 2, 2015, -2315, 0.0, 0)
call ScriptActTurn(x+4.1, 2, 110, 0, 0)
call ScriptActAnimSpeed(x+4.1, 2, 0.20)
call ScriptActAnimPlay(x+4.1, 2, 8, 0.00)
call ScriptActSlide(x+4.1, 1, 1000, -2725, 0.0, 0.0)
call ScriptActTurn(x+4.1, 1, 25, 0, 0)
call ScriptActAnimSpeed(x+4.1, 1, 1.00)
call ScriptActAnimPlay(x+4.1, 1, 6, 0.2)
call ScriptActAnimSpeed(x+4.2, 2, 0.00)
call ScriptCamera(x+4.5, 21, 6.0, 4)
call ScriptExternalFunc(x+4.5, "Trig_FadeIn2_Actions")
call ScriptExternalFunc(x+9.5, "Trig_FadeOut_Actions")
call ScriptExternalFunc(x+10.1, "Trig_Volume2_Actions")
call ScriptCamera(x+10.5, 21, 0.0, 1)
call ScriptCamera(x+10.5, 23, 0.0, 1)
call ScriptCamera(x+10.5, 24, 4.5, 3)
call ScriptActSlide(x+10.5, 1, 1495, -2540, 2.0, 0.0)
call ScriptActAnimSpeed(x+10.5, 1, 0.80)
call ScriptActAnimPlay(x+10.5, 1, 5, 0.2)
call ScriptExternalFunc(x+10.5, "Trig_FadeIn2_Actions")
call ScriptActSlide(x+12.5, 1, 2080, -2308, 3.3, 55)
call ScriptActAnimSpeed(x+12.5, 1, 0.40)
call ScriptActAnimPlay(x+12.5, 1, 2, 0.3)
call ScriptActSlide(x+13.9, 2, 2295, -2291, 2.9, 65)
call ScriptActAnimSpeed(x+13.9, 2, 0.25)
call ScriptActAnimPlay(x+13.9, 2, 10, 0.1)
call ScriptActTurn(x+13.9, 2, 200, 1.5, -1)
call ScriptPlaySound(x+14.7, "Sound\\Units\\Combat\\MetalLightChopFlesh3.wav", 1.00, 80)
call ScriptCamera(x+15.0, 25, 4.0, 3)
call ScriptActAnimSpeed(x+16.5, 2, 0.85)
call ScriptActAnimPlay(x+16.5, 2, 6, 0.2)
call ScriptActTurn(x+16.7, 2, 255, 0.8, 1)
call ScriptActTurn(x+16.7, 1, 80, 0.4, 0)
call ScriptActSlide(x+17.0, 1, 2240, -2294, 1.0, 20)
call ScriptActAnimSpeed(x+17.0, 1, 0.70)
call ScriptActAnimPlay(x+17.0, 1, 9, 0.5)
call ScriptActTurn(x+17.1, 1, 350, 0.8, 0)
call ScriptActAnimSpeed(x+17.6, 2, 0.80)
call ScriptActAnimPlay(x+17.6, 2, 7, 0.3)
call ScriptPlaySound(x+17.6, "Sound\\Units\\Combat\\WoodLightBashFlesh3.wav", 1.00, 85)
call ScriptActSlide(x+17.6, 2, 2650, -2284, 1.0, 10)
call ScriptActTurn(x+17.6, 2, 170, 1.0, 0)
call ScriptActAnimSpeed(x+17.9, 1, 0.80)
call ScriptActAnimPlay(x+17.9, 1, 8, 1.0)
call ScriptActAnimSpeed(x+18.9, 1, 0.01)
call ScriptCamera(x+18.5, 26, 4.7, 3)
call ScriptActSlide(x+19.3, 1, 2650, -2287, 0.9, 265)
call ScriptActAnimSpeed(x+19.3, 1, 1.00)
call ScriptActAnimPlay(x+19.3, 1, 7, 0.2)
call ScriptActTurn(x+19.4, 1, 330, 0.6, 0)
call ScriptActAnimSpeed(x+19.4, 2, 1.10)
call ScriptActAnimPlay(x+19.4, 2, 6, 0.2)
call ScriptActSlide(x+19.4, 2, 2810, -2281, 0.7, 15)
call ScriptPlaySound(x+19.9, "Sound\\Units\\Combat\\MetalLightSliceMetal2.wav", 1.00, 105)
call ScriptActSlide(x+20.2, 1, 2840, -2280, 1.0, 70)
call ScriptActAnimSpeed(x+20.3, 1, 1.10)
call ScriptActAnimPlay(x+20.3, 1, 1, 0.2)
call ScriptActTurn(x+20.3, 1, 40, 0.6, 0)
call ScriptActSlide(x+20.4, 2, 1960, -2501, 1.9, 190)
call ScriptActAnimSpeed(x+20.4, 2, 0.25)
call ScriptActAnimPlay(x+20.4, 2, 10, 0.3)
call ScriptActTurn(x+20.6, 2, 0, 1.3, 0)
call ScriptPlaySound(x+20.9, "Sound\\Units\\Combat\\MetalLightChopFlesh3.wav", 1.00, 60)
call ScriptActTurn(x+21.0, 1, 160, 0.6, 0)
set x = x + 21
//Land Battle 2
call ScriptActSlide(x+0.7, 1, 2140, -2501, 1.75, 280)
call ScriptActAnimSpeed(x+0.7, 1, 0.8)
call ScriptActAnimPlay(x+0.7, 1, 8, 0.5)
call ScriptActTurn(x+0.7, 1, 190, 0.1, 1)
call ScriptActTurn(x+0.8, 1, 180, 0.5, 1)
call ScriptActTurn(x+1.3, 1, 170, 0.5, 1)
call ScriptActAnimSpeed(x+1.4, 1, 0.03)
call ScriptActTurn(x+1.8, 1, 160, 0.5, 1)
call ScriptActAnimSpeed(x+2.1, 2, 0.40)
call ScriptActAnimPlay(x+2.1, 2, 7, 0.7)
call ScriptCamera(x+2.2, 27, 4.6, 4)
call ScriptActSlide(x+2.5, 1, 2000, -2501, 0.7, 50)
call ScriptActAnimSpeed(x+2.5, 1, 1.0)
call ScriptActAnimPlay(x+2.5, 1, 1, 0.2)
call ScriptActTurn(x+2.5, 1, 190, 0.5, 1)
call ScriptActAnimSpeed(x+2.5, 2, 1.0)
call ScriptActAnimPlay(x+2.5, 2, 6, 0.2)
call ScriptActTurn(x+2.5, 2, 20, 0.6, 0)
call ScriptActSlide(x+2.5, 2, 1750, -2501, 0.8, 0)
call ScriptPlaySound(x+3.1, "Sound\\Units\\Combat\\MetalLightSliceMetal3.wav", 1.10, 100)
call ScriptActSlide(x+3.5, 1, 1800, -2501, 0.9, 30)
call ScriptActAnimPlay(x+3.5, 1, 7, 0.2)
call ScriptActTurn(x+3.5, 1, 155, 0.5, 0)
call ScriptActAnimPlay(x+3.5, 2, 1, 0.2)
call ScriptActTurn(x+3.5, 2, 340, 0.6, 0)
call ScriptActSlide(x+3.5, 2, 1570, -2501, 0.9, 10)
call ScriptPlaySound(x+4.1, "Sound\\Units\\Combat\\MetalLightSliceMetal1.wav", 1.10, 100)
call ScriptActSlide(x+4.5, 1, 1630, -2501, 0.9, 30)
call ScriptActAnimPlay(x+4.5, 1, 1, 0.2)
call ScriptActTurn(x+4.5, 1, 190, 0.5, 0)
call ScriptActAnimPlay(x+4.5, 2, 6, 0.2)
call ScriptActTurn(x+4.5, 2, 5, 0.6, 0)
call ScriptActSlide(x+4.5, 2, 1390, -2501, 0.9, 10)
call ScriptPlaySound(x+5.1, "Sound\\Units\\Combat\\MetalLightSliceMetal2.wav", 1.10, 100)
call ScriptActAnimSpeed(x+5.1, 2, 0.05)
call ScriptActTurn(x+5.1, 2, 345, 0.6, 1)
call ScriptActAnimSpeed(x+5.4, 1, 0.4)
call ScriptActAnimPlay(x+5.4, 1, 10, 0.6)
call ScriptActSlide(x+5.6, 1, 2150, -2490, 0.8, 100)
call ScriptActTurn(x+5.7, 1, 170, 0.6, 0)
call ScriptActAnimSpeed(x+6.0, 2, 0.40)
call ScriptActAnimPlay(x+6.0, 2, 7, 0.60)
call ScriptActSlide(x+6.1, 2, 1325, -2640, 0.8, 150)
call ScriptActTurn(x+6.3, 2, 20, 0.7, 1)
set x = x + 5
//End
call ScriptCamera(x+1.8, 28, 6.0, 3)
call ScriptActSlide(x+7.0, 1, 1000, -3500, 0.0, 0.0)
call ScriptActTurn(x+7.0, 1, 30, 0.0, 0)
call ScriptCamera(x+7.8, 29, 3.2, 4)
call ScriptActSlide(x+9.9, 1, 1280, -2630, 1.0, 20)
call ScriptActAnimSpeed(x+10.0, 1, 1.00)
call ScriptActAnimPlay(x+10.1, 1, 7, 0.2)
call ScriptPlaySound(x+10.5, "Sound\\Units\\Combat\\MetalHeavySliceFlesh3.wav", 1.20, 100)
call ScriptActAnimSpeed(x+10.5, 2, 0.60)
call ScriptActAnimPlay(x+10.5, 2, 3, 0.10)
call ScriptActSlide(x+10.5, 2, 1445, -2570, 0.4, 0)
call ScriptExternalFunc(x+10.5, "Trig_Transmission3_Actions")
call ScriptCamera(x+10.6, 34, 0.0, 1)
call ScriptCamera(x+10.6, 35, 6.0, 4)
call ScriptActTurn(x+10.6, 2, 320, 0.3, 0)
call ScriptActTurn(x+11.0, 1, 40, 0.7, 0)
call ScriptActAnimSpeed(x+11.2, 1, 0.70)
call ScriptActAnimPlay(x+11.2, 1, 6, 0.6)
call ScriptActFace(x+11.2, 1, 2, 0, 0, 0, 90, 0.7)
call ScriptActAnimSpeed(x+11.3, 2, 0.70)
call ScriptActAnimPlay(x+11.3, 2, 5, 0.30)
call ScriptActTurn(x+11.3, 2, 230, 0.7, 0)
call ScriptActFace(x+11.5, 2, 1, 0, 0, 0, 90, 0.6)
call ScriptExternalFunc(x+12.5, "Trig_Transmission4_Actions")
call ScriptExternalFunc(x+14.5, "Trig_Transmission5_Actions")
call ScriptCamera(x+16.0, 29, 0.0, 1)
call ScriptCamera(x+16.0, 32, 24.5, 4)
call ScriptExternalFunc(x+16.0, "Trig_Fog2_Actions")
call ScriptExternalFunc(x+18.0, "Trig_Credits1_Actions")
call ScriptExternalFunc(x+23.0, "Trig_RemoveText_Actions")
call ScriptExternalFunc(x+23.0, "Trig_Credits2_Actions")
call ScriptExternalFunc(x+29.5, "Trig_RemoveText_Actions")
call ScriptExternalFunc(x+29.5, "Trig_Credits3_Actions")
call ScriptExternalFunc(x+34.0, "Trig_RemoveText_Actions")
call ScriptExternalFunc(x+34.0, "Trig_Credits4_Actions")
call ScriptExternalFunc(x+36.5, "Trig_RemoveText_Actions")
call ScriptExternalFunc(x+36.5, "Trig_Credits5_Actions")
call ScriptExternalFunc(x+39.0, "Trig_RemoveText_Actions")
call ScriptExternalFunc(x+39.0, "Trig_FadeOut_Actions")
call ScriptCamera(x+40.5, 32, 0.0, 1)
call ScriptExternalFunc(x+45.5, "Trig_End_Actions")
endfunction
//===========================================================================
function InitTrig_Scene1Init takes nothing returns nothing
set gg_trg_Scene1Init = CreateTrigger()
call TriggerAddAction(gg_trg_Scene1Init, function Trig_Scene1Init_Actions)
endfunction
//function Trig_Real_Store_Actions takes nothing returns nothing
//Settings
call ScriptActSlide(0.0, 1, -3364, -210, 0.0, 0.0)
call ScriptActSlide(0.0, 2, 4700, -10000, 0.0, 0.0)
call ScriptCamera(0.0, 3, 1.0, 1)
call ScriptActTurn(0.0, 3, 0, 0, 0)
//Move
call ScriptExternalFunc(2.0, "Trig_FadeIn_Actions")
call ScriptActAnimSpeed(4.0, 3, 0.15)
call ScriptActAnimPlay(4.0, 3, 0, 0.30)
call ScriptActSlide(5.0, 3, 5700, -10000, 5.0, 100)
call ScriptActSlide(9.0, 3, 5700, -10000, 100.0, 0)
call ScriptActSlide(9.0, 3, 6200, -10000, 4.0, 150)
call ScriptActSlide(12.0, 3, 6200, -10000, 100.0, 0)
call ScriptActSlide(12.0, 3, 6500, -10000, 4.0, 45)
call ScriptActSlide(15.0, 3, 6500, -10000, 100, 0)
call ScriptActSlide(15.0, 3, 6700, -10000, 3.0, 150)
endfunction
call ScriptCamera(16.5, 9, 6.5, 3)
call ScriptCamera(23.0, 10, 7.5, 3)
call ScriptActTurn(26.6, 2, 178, 1.42, 1)
call ScriptActSlide(31.5, 2, 0, -500, 8.0, 450)
call ScriptCamera(31.8, 13, 2.2, 4)
call ScriptCamera(34.0, 13, 0.0, 1)
call ScriptCamera(35.0, 14, 0.0, 1)
call ScriptCamera(35.0, 15, 7.0, 3)
call ScriptExternalFunc(119.0, "Trig_FadeOut_Actions")
call ScriptExternalFunc(126.0, "Trig_End_Actions")
call ScriptActAnimSpeed(76.5, 2, 0.90)
call ScriptActAnimPlay(76.5, 2, 4, 0.15)
call ScriptActSlide(76.6, 2, 1325, -2664, 3.1, 0)
call ScriptActTurn(79.7, 2, 20, 1.3, 0)
call ScriptActAnimSpeed(79.7, 2, 0.40)
call ScriptActAnimPlay(79.7, 2, 7, 1.00)
call ScriptCamera(102.5, 31, 8.0, 3)
call ScriptCamera(x+16.0, 30, 6.0, 3)
call ScriptCamera(x+21.0, 31, 9.5, 3)
call ScriptCamera(x+30.5, 32, 10.0, 4)
call ScriptActTurn(x+0.7, 1, 190, 0.1, 1)
call ScriptActTurn(x+0.8, 1, 180, 0.5, 1)
call ScriptActTurn(x+1.3, 1, 170, 0.5, 1)
//===========================================================================
function InitTrig_Real_Store takes nothing returns nothing
set gg_trg_Real_Store = CreateTrigger( )
call TriggerAddAction( gg_trg_Real_Store, function Trig_Real_Store_Actions )
endfunction