Animation not working with OnEnterRegion [Solved]

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
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Animation not working with OnEnterRegion [Solved]

Post by SkinnyODST »

I made a region, called it "testfly" and made an animation called "testflight" that goes for 10 seconds. I unticked "Play when level starts" and everything is named right in ZE and the LUA, but nothing I do seems to trigger it when I enter the testfly region.
I`ve tried -
Hidden/Spoiler:
[code]
ActivateRegion("testfly")
testfunction = OnEnterRegion(
function(region, player)
if IsCharacterHuman (player) then
PlayAnimationFromTo("testflight",0.0,10.0)
end
end,
"testfly"
)[/code]
and
Hidden/Spoiler:
[code]
ActivateRegion("testfly")
testfunction = OnEnterRegion(
function(region, player)
if IsCharacterHuman (player) then
PlayAnimation("testflight")
end
end,
"testfly"
)[/code]
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Animation not working with OnEnterRegion

Post by AnthonyBF2 »

Try:

Code: Select all

ActivateRegion("testfly")
testfunction = OnEnterRegion(
   function(region, player)
      if IsCharacterHuman (player) and IsCharacterInRegion(region) then
         PlayAnimation("testflight") 
      end
   end,
"testfly"
)
You could also try character inside the bit I added, not sure which one would make it work if that works
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Animation not working with OnEnterRegion

Post by SkinnyODST »

Still nothing
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Animation not working with OnEnterRegion

Post by Marth8880 »

Did you also remember to check "Disable Hierarchies"? These are the settings your animation group should use:

Image

Also, "testflight" is the name of the animation group, not the animation, right?

Oh, and what's the ClassLabel of the object are you trying to animate? This is found at the very top of the object's ODF. If you don't see it but you do see ClassParent, open up the ClassParent ODF and check that ODF's ClassLabel.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Animation not working with OnEnterRegion

Post by SkinnyODST »

The animation group is called "testflying" and the object I`m animating is a droid gunship I turned into a prop. It`s an armedbuilding
Here`s the entire ODF -
Hidden/Spoiler:
[GameObjectClass]

ClassLabel = "armedbuilding"
GeometryName = "cis_fly_droidgunship.msh"

[Properties]

GeometryName = "cis_fly_droidgunship"

FoleyFXGroup = "metal_foley"
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Animation not working with OnEnterRegion

Post by Marth8880 »

SkinnyODST wrote:The animation group is called "testflying"
Then that's what you need to pass into the first argument of PlayAnimation (or whichever function you end up using). You can only play animation groups, not standalone animations. The standalone animation that you create is just a set of keyframes, it doesn't determine which props are animated or anything - that's all set up in the animation group.
[color=#FFFFFF]procedural animation mode.doc[/color] wrote:Only Animation Groups may be played in-game, so this is where all the magic happens – the Animation Group panel.
[color=#FFFFFF]procedural animation mode.doc[/color] wrote: PlayAnimation("Animation Group Name")
Resumes playing of an animation group from whichever time it was at last.


PauseAnimation("Animation Group Name")
Pauses the group’s playback – objects remain where they are currently.


RewindAnimation("Animation Group Name")
Rewinds the group to the beginning. Can be called while the group is playing. If called while the group is stopped, play will resume from the beginning when Play is called.


PlayAnimationFromTo("Animation Group Name", beginTime, endTime)
beginTime and endTime are floating-point numbers, in seconds. Plays the indicated animation from beginTime to endTime. So for a 10-second animation, playing from 0 to 5 plays the first half, and playing from 5 to 10 plays the second half. See “Animation Start Points” below for more information.


SetAnimationStartPoint("Animation Group Name")
Takes the current positions of the objects referenced by the group, and uses those positions as the new start point for when that object is next animated.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Animation not working with OnEnterRegion

Post by SkinnyODST »

Marth, you are amazing! This ENTIRE time I thought I had to put in the name of the animation, not the group. Now that I can do this, things are gonna get epic! Thank you sooooo much!

And sorry for a late reply, I was having a break from modding and playing Xbox instead :)
Post Reply