Page 1 of 1
LUA questions
Posted: Wed Apr 16, 2008 6:29 pm
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
Re: LUA questions
Posted: Wed Apr 16, 2008 6:45 pm
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
Re: LUA questions
Posted: Wed Apr 16, 2008 6:56 pm
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...
Re: LUA questions
Posted: Wed Apr 16, 2008 7:31 pm
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
Re: LUA questions
Posted: Wed Apr 16, 2008 9:41 pm
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.
Re: LUA questions
Posted: Wed Apr 16, 2008 10:06 pm
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...
Re: LUA questions
Posted: Thu Apr 17, 2008 5:12 pm
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.
Re: LUA questions
Posted: Thu Apr 17, 2008 5:25 pm
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?
Re: LUA questions
Posted: Thu Apr 17, 2008 5:37 pm
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.