LUA question [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
Bob
Brigadier General
Brigadier General
Posts: 633
Joined: Thu May 27, 2010 4:28 am
Location: at home

LUA question [Solved]

Post 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")
?
User avatar
linksith
Command Sergeant Major
Command Sergeant Major
Posts: 284
Joined: Mon Jul 12, 2010 12:19 pm
Projects :: Waaay too many projects
Games I'm Playing :: too many
xbox live or psn: me has no xbox
Location: looking for a wifi connection

Re: LUA question

Post 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.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: LUA question

Post 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")
Bob
Brigadier General
Brigadier General
Posts: 633
Joined: Thu May 27, 2010 4:28 am
Location: at home

Re: LUA question

Post 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.
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: LUA question

Post 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")
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: LUA question

Post 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)
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: LUA question

Post by CressAlbane »

I don't think so; I believe it stands for "Region In" rather than "Region."
Bob
Brigadier General
Brigadier General
Posts: 633
Joined: Thu May 27, 2010 4:28 am
Location: at home

Re: LUA question

Post 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 `,'
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: LUA question

Post by CressAlbane »

You did fix the "REGION" thing, right?
Does the code in the OP work on its own?
Bob
Brigadier General
Brigadier General
Posts: 633
Joined: Thu May 27, 2010 4:28 am
Location: at home

Re: LUA question

Post 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!
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: LUA question [Solved]

Post by CressAlbane »

No problem. The first end closes the if structure, and the second end ends the function(regIn, character) stuff.
Post Reply