Play more than 1 animation with OnEnterRegion?

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

1st Warning
User avatar
Posts: 481
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF2

Play more than 1 animation with OnEnterRegion?

Postby SkinnyODST » Wed Jan 11, 2017 11:04 pm

Thanks to Marth8880, I can now play an animation with the OnEnterRegion function! I wish to know if it`s possible to play more than 1 anim with it, I have an anim group with 2 anims in it, and when I set it up for the OnEnterRegion trigger, it didn`t work. So I removed one of the animations and now it works. I can play both anims, but I`d need to use 2 OnEnterRegion functions in my LUA. But I`d like to know if there is a way I can use 1.

The 2 anims here are called "gunshipcrash" and "rockroll". They both have their own separate anim groups. The region is called "crashplace".
Hidden/Spoiler:
Code: Select all
ActivateRegion("crashplace")
testfunction = OnEnterRegion(
   function(region, player)
      if IsCharacterHuman (player) then
         PlayAnimation("gunshipcrash")
      end
   end,
"crashplace"
)

This works, but to try and get them BOTH to play using this one bit of code, I tried adding the name of the other anim group after the ("gunshipcrash") part. The only way I could do it without errors was like this -
PlayAnimation("gunshipcrash", "rockroll")
But that didn`t work. It only plays "gunshipcrash". I added in another OnEnterRegion function just for the "rockroll" anim, and they both worked. Is it possible to play them both with only 1 OnEnterRegion code or do I need to use 2?

Thanks

Gametoast Staff
User avatar
Posts: 4861
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA
Projects :: Republic Commando - Battlefront

Re: Play more than 1 animation with OnEnterRegion?

Postby AQT » Thu Jan 12, 2017 1:08 am

It should have worked when you put both animations in the same animation group. There's nothing wrong with having more than one animation in an animation group. But if you still plan on keeping them in separate animation groups, have you tried just using the PlayAnimation line twice simply like so?
Hidden/Spoiler:
Code: Select all
ActivateRegion("crashplace")
testfunction = OnEnterRegion(
   function(region, player)
      if IsCharacterHuman (player) then
         PlayAnimation("gunshipcrash")
         PlayAnimation("rockroll")
      end
   end,
"crashplace"
)

1st Warning
User avatar
Posts: 481
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF2

Re: Play more than 1 animation with OnEnterRegion?

Postby SkinnyODST » Thu Jan 12, 2017 10:03 pm

That worked! I do remember trying that but I think I put a "," after the first "PlayAnimation". And *sigh*, now all the anims work in the one group. I swear I was testing it all day yesterday and if it didn`t only play 1, it would freeze the game. Now they all work. My version of Battlefront must be haunted by the ghost of Darth Plagious the Wise or something. But you did help! Now I can play multiple anim groups if I want to! So not ALL your time was wasted here. Sorry! :cpu:

Return to SWBF2 Modding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest