Page 1 of 1

Scripting Animated Props(ex. retractable bridge)

Posted: Tue Jul 18, 2006 3:38 pm
by Astute
I just don't understand how to animate props using the scripting system. I've looked at some examples(death star bridges, the kasyykk door), but it just doesn't make any sense how they work.

Here is how the problem lays out.

Sea Door on Kasyykkk

[GameObjectClass]

ClassLabel = "prop"
GeometryName = "kas2_prop_sea_walldoor.msh"


[Properties]

GeometryName = "kas2_prop_sea_walldoor"

The panel you shoot to raise the gate
[GameObjectClass]

ClassLabel = "destructablebuilding"
GeometryName = "kas2_prop_door_mech.msh"


[Properties]

GeometryName = "kas2_prop_door_mech"

DestroyedGeometryName = "kas2_prop_door_mech_destroyed"
ExplosionName = "com_inf_rechargedroid_exp"
MaxHealth = 120

TargetPointOffset = "0 -1 -1.8"

FoleyFXGroup = "metal_foley"

[InstanceProperties]

CaptureRegion = ""
ControlRegion = ""
KillRegion = ""
SpawnPath = ""
AllyPath = ""
AllyCount = 65536
Radius = 0.0
ValueBleed = 10
Value_ATK_Alliance = 0
Value_ATK_CIS = 1000
Value_ATK_Empire = 0
Value_ATK_Republic = 0
Value_DEF_Alliance = 0
Value_DEF_CIS = 1000
Value_DEF_Empire = 0
Value_DEF_Republic = 0
Value_DEF_Locals = 0
VO_All_AllCapture = ""
VO_All_AllLost = ""
VO_All_AllInDispute = ""
VO_All_AllSaved = ""
VO_All_AllInfo = ""
VO_All_ImpCapture = ""
VO_All_ImpLost = ""
VO_All_ImpInDispute = ""
VO_All_ImpSaved = ""
VO_All_ImpInfo = ""
VO_Imp_AllCapture = ""
VO_Imp_AllLost = ""
VO_Imp_AllInDispute = ""
VO_Imp_AllSaved = ""
VO_Imp_AllInfo = ""
VO_Imp_ImpCapture = ""
VO_Imp_ImpLost = ""
VO_Imp_ImpInDispute = ""
VO_Imp_ImpSaved = ""
VO_Imp_ImpInfo = ""
VO_Rep_RepCapture = ""
VO_Rep_RepLost = ""
VO_Rep_RepInDispute = ""
VO_Rep_RepSaved = ""
VO_Rep_RepInfo = ""
VO_Rep_CISCapture = ""

and finally info in the lua that makes it work

function ScriptPostLoad()

AddDeathRegion("deathregion")
AddDeathRegion("deathregion2")

EnableSPHeroRules()

--CP SETUP for CONQUEST

cp1 = CommandPost:New{name = "CP1CON"}
cp3 = CommandPost:New{name = "CP3CON"}
cp4 = CommandPost:New{name = "CP4CON"}
cp5 = CommandPost:New{name = "CP5CON"}

conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "game.modes.con", textDEF = "game.modes.con2", multiplayerRules = true}

conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)

conquest.OnStart = function(self)
conquest.goal1 = AddAIGoal(REP, "Defend", 30, "gatepanel")
conquest.goal2 = AddAIGoal(CIS, "Destroy", 30, "gatepanel")
conquest.goal3 = AddAIGoal(CIS, "Destroy", 10, "woodl")
conquest.goal4 = AddAIGoal(CIS, "Destroy", 10, "woodc")
conquest.goal5 = AddAIGoal(CIS, "Destroy", 10, "woodr")
conquest.goal6 = AddAIGoal(REP, "Defend", 10, "woodl")
conquest.goal7 = AddAIGoal(REP, "Defend", 10, "woodc")
conquest.goal8 = AddAIGoal(REP, "Defend", 10, "woodr")
end

conquest:Start()

--Gate Stuff --
BlockPlanningGraphArcs("seawall1")
BlockPlanningGraphArcs("woodl")
BlockPlanningGraphArcs("woodc")
BlockPlanningGraphArcs("woodr")
DisableBarriers("disableme");

SetProperty("woodl", "MaxHealth", 15000)
SetProperty("woodl", "CurHealth", 15000)
SetProperty("woodr", "MaxHealth", 15000)
SetProperty("woodr", "CurHealth", 15000)
SetProperty("woodc", "MaxHealth", 15000)
SetProperty("woodc", "CurHealth", 15000)
SetProperty("gatepanel", "MaxHealth", 1000)
SetProperty("gatepanel", "CurHealth", 1000)


OnObjectKillName(PlayAnimDown, "gatepanel");
OnObjectRespawnName(PlayAnimUp, "gatepanel");
OnObjectKillName(woodl, "woodl");
OnObjectKillName(woodc, "woodc");
OnObjectKillName(woodr, "woodr");
OnObjectRespawnName(woodlr, "woodl");
OnObjectRespawnName(woodcr, "woodc");
OnObjectRespawnName(woodrr, "woodr");
end

function PlayAnimDown()
PauseAnimation("thegateup");
RewindAnimation("thegatedown");
PlayAnimation("thegatedown");

ShowMessageText("level.kas2.objectives.gateopen",1)
ScriptCB_SndPlaySound("KAS_obj_13")
SetProperty("gatepanel", "MaxHealth", 2200)
-- SetProperty("gatepanel", "CurHealth", 50000)
-- PlayAnimation("gatepanel");
--SetProperty("gatepanel", "MaxHealth", 1e+37)
--SetProperty("gatepanel", "CurHealth", 1e+37)


-- Allowing AI to run under gate
UnblockPlanningGraphArcs("seawall1");
DisableBarriers("seawalldoor1");
DisableBarriers("vehicleblocker");

end

function PlayAnimUp()
PauseAnimation("thegatedown");
RewindAnimation("thegateup");
PlayAnimation("thegateup");



-- Allowing AI to run under gate
BlockPlanningGraphArcs("seawall1");
EnableBarriers("seawalldoor1");
EnableBarriers("vehicleblocker");
SetProperty("gatepanel", "MaxHealth", 1000)
SetProperty("gatepanel", "CurHealth", 1000)

end

btw, ingame the gate is named "gate01", and the panel is named "gatepanel"

Now, I understand how the process works, like calling the different fuctions and the different entires. The problem is what's in green. Where did they get these animations? It's not listed in the gate odf, as well as there is nothing in the LUA that directly points to the gate and tells it to use that animation. Also, I was unable to find any animation file relating to the animations. Where did it come from? and how do I harness it for my own use? Hopefully there is some simple solution or i'm just overlooking something.

RE: Scripting Animated Props(ex. retractable bridge)

Posted: Tue Jul 18, 2006 3:51 pm
by Rekubot
The only reason I can think of is that just by saying "thegateup" or "thegatedown", the game engine already has the animation ready and waiting, so it automatically moves the gate up and down below the ground. That's quite an unlikely explanation though. What does it say at the green part for the Death Star bridge?

Posted: Tue Jul 18, 2006 4:06 pm
by Dragonum
its the gatepanel what trigger the animation.
is the gatepanel destroyed, the gate went down and if the gatepanel is repeared the get went up.

and you have to make a animation in ZE.
one for gate up and one for gate down

RE: Scripting Animated Props(ex. retractable bridge)

Posted: Tue Jul 18, 2006 4:07 pm
by Murdocr
i'm pretty sure the anims are in ZE so you name the animation when you make it there, and it saves it in your world folder someplace. i'm not certain though, as i've never done this.
BTW if you havn't already seen this there is a tut in the faq for ZE anims
http://www.gametoast.com/index.php?name ... pic&t=5865

RE: Scripting Animated Props(ex. retractable bridge)

Posted: Tue Jul 18, 2006 4:09 pm
by xwingguy
It's all down in ZE garanteed

Posted: Tue Jul 18, 2006 4:17 pm
by Astute
Hmm, ZE animations, never messed with those. Still, thats very confusing how it's not shown in the ODF. Thx for the quick reply guys, i'll have to test this.

Posted: Tue Jul 18, 2006 4:18 pm
by Vyse
Astute wrote:Hmm, ZE animations, never messed with those. Still, thats very confusing how it's not shown in the ODF. Thx for the quick reply guys, i'll have to test this.
Here is a tutorial Jawa_Killer made, if ya need help.

http://www.gametoast.com/index.php?name ... pic&t=5865

Posted: Tue Jul 18, 2006 5:07 pm
by Astute
Wow, impressive. Wish I had explored this animation thing sooner(I just figured it was for vehicles and junk). One question, how cumbersome(lag wise) are these animations? will 2 animated objects be too much?

Posted: Tue Jul 18, 2006 5:30 pm
by Karnage
Nope, I loop animated two objects and it doesn't seem to effect the gameplay.