Page 1 of 1

Pick up object ---> Give weapon?

Posted: Sat Dec 29, 2007 4:25 pm
by Aman/Pinguin
Okay I'm trying something at the moment...
Is it possible that if you pick up an ammo pack or something like that, you get a weapon? Maybe there's a lua command for this?

Re: Pick up object ---> Give weapon?

Posted: Sat Dec 29, 2007 5:27 pm
by Caleb1117
It is possible, but it would affect every class of the type.
So you pick up a rifle, every other unit of whatever class you are, gets one too.

Re: Pick up object ---> Give weapon?

Posted: Sat Dec 29, 2007 5:29 pm
by Aman/Pinguin
And HOW does it work? :P

Re: Pick up object ---> Give weapon?

Posted: Sun Dec 30, 2007 12:26 am
by trainmaster611
I don't know much about this. Zerted has said it is possible to have pick-upable weapons. Does he mind if he explains how this might work publicly? :P

Re: Pick up object ---> Give weapon?

Posted: Sun Dec 30, 2007 7:42 am
by Aman/Pinguin
Hopefuly... :?

EDIT: Is there maybe a way, to activate award weapons with Picking up a item?

Re: Pick up object ---> Give weapon?

Posted: Sun Dec 30, 2007 7:08 pm
by Syth
Well im definitely not zerted, but basically picking up a flag is an "event", and on an event you can set things to happen, like changing a units inventory. But im pretty sure you can't have the game recognize what unit your currently useing, and i know the changes you make will apply to all of that specific unit.

So if as a clone sniper (if there was a way for the game to recognize you as a sniper) you pick up a weapon (technically a flag), all snipers will get that weapon(which may cause crashing).

Re: Pick up object ---> Give weapon?

Posted: Sun Dec 30, 2007 7:12 pm
by Aman/Pinguin
Don't worry, I've got a solucion for this. I don't tell which one though :lol: .

Re: Pick up object ---> Give weapon?

Posted: Tue Jan 01, 2008 12:00 pm
by RepSharpshooter
I am interested in this as well. I'm trying to look through the luas to find something of use.

Re: Pick up object ---> Give weapon?

Posted: Wed Jan 02, 2008 7:11 pm
by Maveritchell
When you modify a unit's weapon midgame, it basically will affect every unit of that class spawned thereafter. I've never tested it with multiple units of the same class on the field, but I don't think that a crash would be caused by increasing the amount of units.

Basically, the way it works is when an event is triggered (like the flag pickup mentioned earlier), you modify the property WeaponName in the unit's .odf through the .lua command SetClassProperty. You can only modify that property if it had a previously existing property, so you couldn't "create" a weaponslot if one didn't exist before.

Also, like I mentioned, this change is only applied to all units spawned after the change is made. Therefore, you'd have to make it so that the player either reselected the unit from a command post or that the player was forced to respawn.