Page 1 of 1

LUA question [Solved]

Posted: Tue Jul 26, 2011 9:29 am
by Bob
what do I have to script if I want only team 1 to be affected from this:

Code: Select all

    OnEnterRegion(
    function(regIn,character)
    PlayAnimation("ANIMGROUP")
    end,
    "REGION"
    )
    ActivateRegion("REGION")
?

Re: LUA question

Posted: Tue Jul 26, 2011 2:08 pm
by linksith
I think there might be something in the documentation that can help you I'm not sure but I thought I'd mention it.

Re: LUA question

Posted: Tue Jul 26, 2011 2:29 pm
by THEWULFMAN
Something I threw together, no idea if its even close.

Code: Select all

    OnEnterRegion(
    function(regIn,character)
    if GetCharacterTeam(character) == 1 then
    PlayAnimation("ANIMGROUP")
    end
    end
    )
    ActivateRegion("REGION")

Re: LUA question

Posted: Tue Jul 26, 2011 2:45 pm
by Bob
THEWULFMAN wrote:Something I threw together, no idea if its even close.
BF2 doesn't like your idea and performs a crash :(
linksith wrote:I think there might be something in the documentation that can help you I'm not sure but I thought I'd mention it.
found something about "filters" ind the Battlefront2_scripting_system.doc, but not how to set 'em up. I didn't even understood what they are.

Re: LUA question

Posted: Tue Jul 26, 2011 2:50 pm
by CressAlbane
THEWULFMAN wrote:Something I threw together, no idea if its even close.

Code: Select all

    OnEnterRegion(
    function(regIn,character)
    if GetCharacterTeam(character) == 1 then
    PlayAnimation("ANIMGROUP")
    end
    end
    )
    ActivateRegion("REGION")
Try this:

Code: Select all

    OnEnterRegion(
    function(regIn,character)
    if GetCharacterTeam(character) == 1 then
    PlayAnimation("ANIMGROUP")
    end
    end,
    "REIGON"
    )
    ActivateRegion("REGION")

Re: LUA question

Posted: Tue Jul 26, 2011 2:54 pm
by THEWULFMAN
CressAlbane wrote: OnEnterRegion(
function(regIn,character)
if GetCharacterTeam(character) == 1 then
PlayAnimation("ANIMGROUP")
end,
"REGION"
)
ActivateRegion("REGION")

I fixed your fixing of my fail :P


Oh, I just noticed. Shouldn't

Code: Select all

function(regIn,character)
be this?

Code: Select all

function(region,character)

Re: LUA question

Posted: Tue Jul 26, 2011 2:57 pm
by CressAlbane
I don't think so; I believe it stands for "Region In" rather than "Region."

Re: LUA question

Posted: Tue Jul 26, 2011 2:59 pm
by Bob
CressAlbane wrote:Try this:

Code: Select all

    OnEnterRegion(
    function(regIn,character)
    if GetCharacterTeam(character) == 1 then
    PlayAnimation("ANIMGROUP")
    end
    end,
    "REGION"
    )
    ActivateRegion("REGION")
Also crash
MungeLog wrote:unexpected symbol near `,'

Re: LUA question

Posted: Tue Jul 26, 2011 3:00 pm
by CressAlbane
You did fix the "REGION" thing, right?
Does the code in the OP work on its own?

Re: LUA question

Posted: Tue Jul 26, 2011 3:05 pm
by Bob
CressAlbane wrote:Does the code in the OP work on its own?
tryin' right now. is there a reason why there are sometimes 2 "end"s in your codes?

EDIT OF DOOM
did it with 2 ends and now everything works. many thanks, mah boi!

Re: LUA question [Solved]

Posted: Wed Jul 27, 2011 1:04 am
by CressAlbane
No problem. The first end closes the if structure, and the second end ends the function(regIn, character) stuff.