Page 1 of 1
OnEnterRegion doesn`t work with animations?
Posted: Thu Nov 17, 2016 3:54 am
by SkinnyODST
No matter what I do I can`t seem to get an animation working when I enter a region using the OnEnterRegion function in my LUA. I`m trying this on a world with no other animations.
This is what it looks like, it`s placed right under the FunctionScriptPostLoad
animthing = the region that is supposed to trigger the animation
animthang = the animation
I`ve tried a couple different way to set it out like,
PlayAnimation "animthang"
PlayAnimation = "animthang"
and
PlayAnimation = ("animthang") but none have had any effect.
Oh and by the way, I`m trying to animate a rock, "kas2_prop_rock_L"
Re: OnEnterRegion doesn`t work with animations?
Posted: Thu Nov 17, 2016 6:05 am
by AnthonyBF2
You're using 'player' in the function call but character for the other thing, they need to be the same.
Try:
Code: Select all
ActivateRegion("animthing")
testfunction = OnEnterRegion(
function(region, character)
if IsCharacterHuman(character) then PlayAnimation ("animthang")
end
end,
"animthing"
)
Re: OnEnterRegion doesn`t work with animations?
Posted: Thu Nov 17, 2016 11:34 am
by ForceMaster
I think you need to use some like this:
ActivateRegion("animthing")
testfunction = On
CharacterEnterRegion(
function(region,
character)
if IsCharacterHuman(
character) then PlayAnimation ("animthang")
end
end,
"animthing"
)
In these functions the arguments needs to coincide.
Hope help you

Re: OnEnterRegion doesn`t work with animations?
Posted: Fri Nov 18, 2016 1:07 am
by SkinnyODST
Still doesn`t work. However I`ve noticed that if I put something after "On" in "testfunction = OnEnterRegion(" such as "testfunction = OnPlayerEnterRegion(" or "testfunction = OnCharacterEnterRegion(", the AI will not spawn, and the anim still won`t play.
Re: OnEnterRegion doesn`t work with animations?
Posted: Fri Nov 18, 2016 5:39 am
by Marth8880
ForceMaster wrote:I think you need to use some like this:
ActivateRegion("animthing")
testfunction = OnCharacterEnterRegion(
function(region, character)
if IsCharacterHuman(character) then PlayAnimation ("animthang")
end
end,
"animthing"
)
In these functions the arguments needs to coincide.
Nope, it's only OnEnterRegion, as per the documentation.
https://sites.google.com/site/swbf2modt ... ing_system
The function's arguments do need to coincide with their references inside the actual function, though, yes. So for example, this would be correct:
Code: Select all
testfunction = OnEnterRegion(
function(region, player) -- note the argument `character` matches the argument passed to IsCharacterHuman below
if IsCharacterHuman(character) then PlayAnimation("animthang")
end
end,
"animthing"
)
Whereas this would be incorrect:
Code: Select all
testfunction = OnEnterRegion(
function(region, player) -- note the argument `player` does not match the argument passed to IsCharacterHuman below
if IsCharacterHuman(character) then PlayAnimation("animthang")
end
end,
"animthing"
)