+++ STEP 5 - DEFINING A MADSTATE FILE +++
When you export your DAE file and run HODOR, a HOD file will be generated as usual. An addition file called a .MAD file will also be generated. To get the game to recognise and play your animations, you will also need a .madstate file. Here is the mine (trp_interceptor.madstate):
TRP_INTERCEPTOR_Launched_OnSet = function(ship)
startTime = 0
if(isAnimRunning(ship, "Wings_Close") ~= 0) then
startTime = getAnimLength(ship, "Wings_Close") - getTime(ship, "Wings_Close")
stopAnim(ship, "Wings_Close")
endEffect(ship, "Wings_Close")
end
startAnim(ship, "Wings_Open")
startEffect(ship, "Wings_Open")
setTime(ship,"Wings_Open",startTime)
setPauseTime(ship, "Wings_Open", 1000)
end
TRP_INTERCEPTOR_Docked_OnSet = function(ship)
startTime = 0
if(isAnimRunning(ship, "Wings_Open") ~= 0) then
startTime = getAnimLength(ship, "Wings_Open") - getTime(ship, "Wings_Open")
stopAnim(ship, "Wings_Open")
endEffect(ship, "Wings_Open")
end
startAnim(ship, "Wings_Close")
startEffect(ship, "Wings_Close")
setTime(ship,"Wings_Close",startTime)
setPauseTime(ship, "Wings_Close", 1000)
end
For this script I have copied the stock Taiidan Interceptor file and modified it, which is usually the best way to construct these .madstate files (unless you really know what you are doing). The two functions play the “Wings_Open” and “Wings_Close” animations, whilst checking that the other animation is not already playing.
The other script that needs to refer to the animations is the .events file. Here are is relevant section of trp_interceptor.events:
In the animation chunk:
animation6 =
{
name = "Wings_Open",
length = 2,
loop = 0,
parent = "",
minimum = 0,
maximum = 0,
markers = {""}
},
animation7 =
{
name = "Wings_Close",
length = 2,
loop = 0,
parent = "",
minimum = 0,
maximum = 0,
markers = {""}
},
And in the events chunk:
Wings_Open =
{
{ "anim", "Wings_Open", },
{ "animtime", "0", },
{ "marker", "EngineNozzle1", },
{ "fx", "resourcing_dust_spray_full", },
{ "sound", "SP_ELEMENTS/KPR_ATTACKDROID_OPEN", },
{ "fx_scale", "0.4", },
},
Wings_Close =
{
{ "anim", "Wings_Close", },
{ "animtime", "0", },
{ "marker", "EngineNozzle1", },
{ "fx", "resourcing_dust_spray_full", },
{ "sound", "SP_ELEMENTS/KPR_ATTACKDROID_CLOSE", },
{ "fx_scale", "0.4", },
},
The final result:
