Problems with animations. Please HELP!

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
correctmushroom2013
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Fri Jul 19, 2013 11:10 am
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 BDO
xbox live or psn: No gamertag set
Location: Russian Federation

Problems with animations. Please HELP!

Post by correctmushroom2013 »

I created an animation gate. When destroyed console, the gate opens.
Question: how to make that when I fix the console, the gate closes? :cry:
Please explain in detail how to make it work.
Here is my lua script:
Hidden/Spoiler:
function ScriptPostLoad()
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "gatelock" then
PlayAnimation("open")
RewindAnimation("open")
end
end
)
repairobja = OnObjectRepair(
function(object, repairer/characterId?!)
if GetEntityName(object) == "gatelock" then
RespawnObject("gatelock")
RewindAnimation("open")
end
end
)
I have created only one animation - opening the gate.
Please help! :runaway:
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Problems with animations. Please HELP!

Post by AQT »

RewindAnimation doesn't actually play the animation you specify backwards. All it does is instantaneously return the animated object to the first frame of the animation. What you want to do is create a second animation called, say, closed. This animation would have the same frames as the "open" animation, but with the frames in reversed order. Then use PlayAnimation("closed") instead of RewindAnimation("open").
correctmushroom2013
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Fri Jul 19, 2013 11:10 am
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 BDO
xbox live or psn: No gamertag set
Location: Russian Federation

Re: Problems with animations. Please HELP!

Post by correctmushroom2013 »

I did as you said. But the animation does not occur.
Here is my lua:
Hidden/Spoiler:
function ScriptPostLoad()
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "gatepanel" then
PlayAnimation("open")
end
end
)
repairobja = OnObjectRepair(
function(object, repairer)
if GetEntityName(object) == "gatepanel" then
PlayAnimation("closed")
end
end
)
Perhaps this is the wrong lua code?I replaced the animation "closed" in the code to "objectkill" and the animation is playing.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Problems with animations. Please HELP!

Post by AQT »

Try replacing repairer with actor. If that doesn't work, I don't have any other ideas.
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Problems with animations. Please HELP!

Post by Locutus »

Use this instead:

Code: Select all

OnObjectRespawn(
      function (object)
            if GetEntityName(object) == "gatepanel" then
                  PlayAnimation("closed")
            end   
      end
) 
correctmushroom2013
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Fri Jul 19, 2013 11:10 am
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 BDO
xbox live or psn: No gamertag set
Location: Russian Federation

Re: Problems with animations. Please HELP!

Post by correctmushroom2013 »

Animation work: "open" and "closed", but only once. What to do?

I break the panel - the gate is opening.
I repair the panel - the gates closes.
I break the panel - nothing happens ...
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Problems with animations. Please HELP!

Post by Locutus »

AQT mentioned what you need in the second post.
Add RewindAnimation("NAME") before PlayAnimation("NAME").
correctmushroom2013
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Fri Jul 19, 2013 11:10 am
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 BDO
xbox live or psn: No gamertag set
Location: Russian Federation

Re: Problems with animations. Please HELP!

Post by correctmushroom2013 »

Works only animation "closed." I added the same line in the animation "open", but it does not work.

My lua:
Hidden/Spoiler:
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "gatepanel" then
RewindAnimation ("open")
PlayAnimation("open")
end
end
)

OnObjectRespawn(
function (object)
if GetEntityName(object) == "gatepanel" then
RewindAnimation ("closed")
PlayAnimation("closed")
end
end
)
EDIT
Please reply!
No matter what I did, animations do not work. :faint:

Double posting is against the RULES; please EDIT your post instead -Staff
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Problems with animations. Please HELP!

Post by Locutus »

Your problem is that your animations don't play a second time, right?
Vanilla scripts often use PauseAnimation before rewinding them, maybe that helps:

PauseAnimation("NAME")
RewindAnimation("NAME")
PlayAnimation("NAME")

Also, make sure there is no space between RewindAnimation and the opening bracket.
correctmushroom2013
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Fri Jul 19, 2013 11:10 am
Projects :: Droid Factory Conquest
Games I'm Playing :: SWBF2 BDO
xbox live or psn: No gamertag set
Location: Russian Federation

Re: Problems with animations. Please HELP!

Post by correctmushroom2013 »

You'll excuse me, I'm an idiot. It does not work. I even combine these lines, but nothing else.
The same thing happens. :cry:
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Problems with animations. Please HELP!

Post by AceMastermind »

The bridge on Mustafar and the gate on Kashyyyk would be 2 stock examples you can use as a template.
Post Reply