Page 1 of 1

Animation triggering

Posted: Thu Jun 28, 2007 12:03 pm
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

RE: Animation triggering

Posted: Thu Jun 28, 2007 12:20 pm
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. ;)

Anims

Posted: Tue Jul 03, 2007 8:42 am
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

RE: Anims

Posted: Tue Jul 03, 2007 9:28 am
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! ;)