LUA questions

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
User avatar
phazon_elite
Rebel Colonel
Rebel Colonel
Posts: 597
Joined: Tue Jan 16, 2007 9:10 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: I'm sorry Link, I can't give the location. Come back when you're a little...mmmh...RICHER!
Contact:

LUA questions

Post by phazon_elite »

I'm working on a feature in a mode for my Mos Eisley: Apocalypse map that allows you to pick up new guns. I'm ok-ish at LUA, but I don't really know how to set that sort of thing up.

My next questions are if any of the following are possible:

- When you enter a certain region, you get a new weapon
- If you get a certain number of kills, you get a new weapon (I'm 99% sure this one is possible)

I'm sure these are possible, but I don't know where the said functions would go, etc.

Any help will be appreciated, thanks!

- EP-782
ryukaji
Major
Major
Posts: 513
Joined: Mon Sep 17, 2007 7:46 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Contact:

Re: LUA questions

Post by ryukaji »

1. I remember that this was tried before and I believe they couldnt get it to work.
2. What, like a bonus weapon? Sure thats possible
User avatar
phazon_elite
Rebel Colonel
Rebel Colonel
Posts: 597
Joined: Tue Jan 16, 2007 9:10 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: I'm sorry Link, I can't give the location. Come back when you're a little...mmmh...RICHER!
Contact:

Re: LUA questions

Post by phazon_elite »

ryukaji wrote:1. I remember that this was tried before and I believe they couldnt get it to work.
2. What, like a bonus weapon? Sure thats possible
You're sure? Hmm, I wonder if there is another way then, because I also remember hearing that things like that were possible, but they would affect all of the AI that used that class. Of course, in my new mode, it's just you (and maybe a few survivors and such), so it wouldnt really matter.

Anyway, I'm not really aiming for stuff like the Award weapons, but rather when you reach a certain goal you get a new weapon. A good example is OFM (Operation: Furret Master), which was the first SWBF2 RPG. When you reached a certain number of kills, you would level up, which gave you more health and shield points (if you grabbed the personal shield thing).

- EP-782<-----No sigs or personalized text allowed - GT Staff

EDIT: ^ Aww...
Last edited by phazon_elite on Wed Apr 16, 2008 7:34 pm, edited 1 time in total.
shockwave88
Private First Class
Posts: 88
Joined: Thu Jan 24, 2008 11:19 pm

Re: LUA questions

Post by shockwave88 »

hmm...... im pretty sure that in spira:besaid you got a new weapon after you levelled up (most of the time) and you levelled up after doing certain things so im pretty sure it is possible
Caleb1117
2008 Most Original Avatar
Posts: 3096
Joined: Sun Aug 20, 2006 5:55 pm
Projects :: No Mod project currently.
xbox live or psn: No gamertag set
Location: X-Fire: caleb1117 ಠ_ಠ

Re: LUA questions

Post by Caleb1117 »

1. Yes, it can be done, However, once your unit gains the new weapon, all other unit's of your class will gain it too.
User avatar
phazon_elite
Rebel Colonel
Rebel Colonel
Posts: 597
Joined: Tue Jan 16, 2007 9:10 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: I'm sorry Link, I can't give the location. Come back when you're a little...mmmh...RICHER!
Contact:

Re: LUA questions

Post by phazon_elite »

Caleb1117 wrote:1. Yes, it can be done, However, once your unit gains the new weapon, all other unit's of your class will gain it too.
Perfect! My mode has only one character, so it wont even matter.

- E...oh right...
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: LUA questions

Post by [RDH]Zerted »

phazon_elite wrote:- When you enter a certain region, you get a new weapon
- If you get a certain number of kills, you get a new weapon (I'm 99% sure this one is possible)
Both are possible. However as stated before, the changes are class changes. Meaning all units of the changed class will have the new weapons. Since you are developing a singleplayer map, this isn't a big problem. Another important thing to point out is that changing weapon and ammo will cause other players connecting to your map to crash to their desktop (this happens in MP).

You use SetProperty() and SetClassProperty() to change things from the Lua. SetProperty() works on game objects and SetClassProperty() works on classes.

For the number of kills, count each time the player kills an enemy. Once the count reaches whatever number you want it to reach, use SetClassProperty() to mess around with the player's unit class' ODF weapon slot values.

For the entering a region, just use the OnEnterRegion callback.

Read the scripting guide documentation and check the ODF documentation stuff too.
Grev
Hoth Battle Chief
Hoth Battle Chief
Posts: 3132
Joined: Sun Dec 09, 2007 11:45 pm
Projects :: No Mod project currently.
Games I'm Playing :: Minecraft
Location: A Certain Box Canyon

Re: LUA questions

Post by Grev »

Wait, for amount of kills, why dont you just use the award weap feature and localize the thing that shows up to "You have leveled up... New weapon awarded." Or something of that caliber?
User avatar
phazon_elite
Rebel Colonel
Rebel Colonel
Posts: 597
Joined: Tue Jan 16, 2007 9:10 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: I'm sorry Link, I can't give the location. Come back when you're a little...mmmh...RICHER!
Contact:

Re: LUA questions

Post by phazon_elite »

[RDH]Zerted wrote:
phazon_elite wrote:- When you enter a certain region, you get a new weapon
- If you get a certain number of kills, you get a new weapon (I'm 99% sure this one is possible)
Both are possible. However as stated before, the changes are class changes. Meaning all units of the changed class will have the new weapons. Since you are developing a singleplayer map, this isn't a big problem. Another important thing to point out is that changing weapon and ammo will cause other players connecting to your map to crash to their desktop (this happens in MP).

You use SetProperty() and SetClassProperty() to change things from the Lua. SetProperty() works on game objects and SetClassProperty() works on classes.

For the number of kills, count each time the player kills an enemy. Once the count reaches whatever number you want it to reach, use SetClassProperty() to mess around with the player's unit class' ODF weapon slot values.

For the entering a region, just use the OnEnterRegion callback.

Read the scripting guide documentation and check the ODF documentation stuff too.
Thanks Zerted! The only question now is if I need to call out the ObjectiveCampaign lua.
Post Reply