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

Post Reply
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Play more than 1 animation with OnEnterRegion?

Post by SkinnyODST »

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]ActivateRegion("crashplace")
testfunction = OnEnterRegion(
function(region, player)
if IsCharacterHuman (player) then
PlayAnimation("gunshipcrash")
end
end,
"crashplace"
)[/code]

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
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Play more than 1 animation with OnEnterRegion?

Post by AQT »

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]ActivateRegion("crashplace")
testfunction = OnEnterRegion(
function(region, player)
if IsCharacterHuman (player) then
PlayAnimation("gunshipcrash")
PlayAnimation("rockroll")
end
end,
"crashplace"
)[/code]
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Play more than 1 animation with OnEnterRegion?

Post by SkinnyODST »

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:
Post Reply