Changing Weapon

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
KnightsFan
Second Lance Corporal
Second Lance Corporal
Posts: 108
Joined: Fri Mar 06, 2009 9:34 pm

Changing Weapon

Post by KnightsFan »

What I'm trying to do is change my character's weapon. It never changes, and I'm not getting any errors related to the unit, nor the weapon.

I changed the "WeaponName" to "WeaponName1" in the ODF, and put this in my script when an objective is completed:

Code: Select all

SetClassProperty("usf_inf_rev", "WeaponName1", "usf_weap_inf_m249")
Both the class and the weapon do exist and work.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Changing Weapon

Post by Fiodis »

You do know that the unit in question has to enter and exit a cp (usually done through respawning) for the change to take effect, right?
User avatar
KnightsFan
Second Lance Corporal
Second Lance Corporal
Posts: 108
Joined: Fri Mar 06, 2009 9:34 pm

Re: Changing Weapon

Post by KnightsFan »

Uh, no, I didn't. *is embarrassed*
Well, that... changes things. I don't suppose there's a way around it, like killing and respawning in under a second? Or changing the ordnance, rate of fire and geometry of the gun?
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Changing Weapon

Post by Fiodis »

Create a CP that you can enter from far away (not sure about that, maybe properties in ZE or the odf), place one and give it a unique name, kill it upon mission start, and when you want to change someone's weapon, respawn the cp, force them into it like you would into a vehicle, force them out as you would a vehicle, and kill the cp. I think that ought to work. Not sure if you can treat CPs as vehicles, though.
Post Reply