Animation triggering

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Moonwolf=SotG=
Private First Class
Posts: 78
Joined: Wed Oct 25, 2006 9:23 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Deventer, Holland
Contact:

Animation triggering

Post by Moonwolf=SotG= »

My question: how do you trigger animations? because that will be useful if i want to make hidden doors and stuff like that,
and with triggering i mean, get close or destroy something else
Darth_Z13
Jedi High Council
Jedi High Council
Posts: 2275
Joined: Sat Jun 17, 2006 9:51 am
xbox live or psn: Xanthius Wylon
Location: Canada

RE: Animation triggering

Post by Darth_Z13 »

You have to script it.

This code activates the animation.

Code: Select all

            PlayAnimation("squadcrash")   
You have to understand scripting to get it to work. Unless you want it to play as soon as the map starts which is an option in animation mode.

Look in the shipped scripts to figure it out. ;)
User avatar
Moonwolf=SotG=
Private First Class
Posts: 78
Joined: Wed Oct 25, 2006 9:23 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Deventer, Holland
Contact:

Anims

Post by Moonwolf=SotG= »

Thank you, i suppose that;s in the .lua script? but that was not exactly what i meant, i meant triggering by getting close to it, like with doors, or with destroying something else, like the mygeeto shield power supply or the bridge on mustafar
Darth_Z13
Jedi High Council
Jedi High Council
Posts: 2275
Joined: Sat Jun 17, 2006 9:51 am
xbox live or psn: Xanthius Wylon
Location: Canada

RE: Anims

Post by Darth_Z13 »

Oh I see what you mean.

Doors like on the Death Star, Mustafar etc. should open when someone gets close without any scripting at all. Just place them in your map. And make sure to copy over the 'MUNGED' folder from the world you are taking those objects from, or else your map will crash.

As for your other question, here is some code from Mygeeto's campaign script. This is what you'll probably need to work with:

Code: Select all

--Start Shield Work

function Init(numberStr)
   
     shieldName = "force_shield_" .. numberStr;
     genName = "generator_" .. numberStr;
     upAnim = "shield_up_" .. numberStr;
     downAnim = "shield_down_" .. numberStr;
     
     PlayShieldUp(shieldName, genName, upAnim, downAnim);
     
     BlockPlanningGraphArcs("shield_" .. numberStr);
     EnableBarriers("shield_" .. numberStr);
   
end

function ShieldDied(actor)
     fullName = GetEntityName(actor);
     numberStr = string.sub(fullName, -2, -1);
     
     shieldName = "force_shield_" .. numberStr;
     genName = "generator_" .. numberStr;
     upAnim = "shield_up_" .. numberStr;
     downAnim = "shield_down_" .. numberStr;
     
     PlayShieldDown(shieldName, genName, upAnim, downAnim);
     
     UnblockPlanningGraphArcs("shield_" .. numberStr);
     DisableBarriers("shield_" .. numberStr);

end

--Rewarding player Mission Victory for Destorying the Core (mostly for MP) -- 

function CoreDied(actor)
--	ShowMessageText("level.myg1.obj.c8", 1)
	MapRemoveEntityMarker("backgen1")
    MapRemoveEntityMarker("backgen2")
    PlayAnimation("cshield_down_04")
    PlayAnimation("cshield_down_05")
	PlayAnimation("cshield_down_06")
	PlayAnimation("cshield_down_07")
	DisableBarriers("coresh1")
	SetProperty("backgen1", "MaxHealth", 1e+37)
    SetProperty("backgen1", "CurHealth", 1e+37)
    SetProperty("backgen2", "MaxHealth", 1e+37)
    SetProperty("backgen2", "CurHealth", 1e+37)
--    KillObject("backgen2")
--    KillObject("backgen1")
end

function Revived(actor)

     fullName = GetEntityName(actor);
     numberStr = string.sub(fullName, -2, -1);
     
     shieldName = "force_shield_" .. numberStr;
     genName = "generator_" .. numberStr;
     upAnim = "shield_up_" .. numberStr;
     downAnim = "shield_down_" .. numberStr;
     
     PlayShieldUp(shieldName, genName, upAnim, downAnim);
     BlockPlanningGraphArcs("shield_" .. numberStr);
     EnableBarriers("shield_" .. numberStr);
end

-- Drop Shield
function PlayShieldDown(shieldObj, genObj, upAnim, downAnim)
      RespawnObject(shieldObj);
      KillObject(genObj);
      PauseAnimation(upAnim);
      RewindAnimation(downAnim);
      PlayAnimation(downAnim);
    
end
-- Put Shield Backup
function PlayShieldUp(shieldObj, genObj, upAnim, downAnim)
      RespawnObject(shieldObj);
      RespawnObject(genObj);
      PauseAnimation(downAnim);
      RewindAnimation(upAnim);
      PlayAnimation(upAnim);
end
Good luck! ;)
Post Reply