LUA Command SetClassProperty 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

User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: LUA Command SetClassProperty Question

Post by lucasfart »

Never forget the search tool. It can be extremely helpful. :wink:

forums/viewtopic.php?f=27&t=28028&p=477 ... +4#p477326

When you say they "don't work", does that mean nothing happens, or that it crashes? Because if it just doesn't show up you've probably done something wrong. If it crashes, then yes, it probably won't work.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: LUA Command SetClassProperty Question

Post by razac920 »

Maveritchell wrote:
razac920 wrote:So I've tried using SetClassProperty on a weapon in MP, and while it doesn't crash, it doesn't work either. Nothing happens, since it strangely could not find my weapon class to edit in the first place, even though I was just using default weapons in a test map. Has anyone been able to change a weapon's properties mid game with SetClassProperty?
You don't set weapon class properties, you make weapon variations with the changes you want and then adjust the unit class properties so that the unit uses a different weapon.
When I said something didn't work, I was referring to using SetClassProperty on a weapon class instead of a unit class. And that didn't crash MP but didn't accomplish its goal either. I tried it again on the Mod Tools exe, also didn't work, I checked the log, and it said that it couldn't find the "all_weap_inf_rifle" class, even though I had loaded the stock all_inf_rifleman unit. And Maveritchell is saying it's impossible to edit weapon properties like this, so I think I'll abandon that attempt. And thank you for the link, I think I had seen that a LONG time ago, before this project, but unfortunately I don't think it helps. I want to have more than 20 classes I could switch to by using teams 3 and up's classes. As I understand it, what Zerted did was to take half the classes in team 1, hide them from team 1, and get you to spawn in team 3 when you pick them (but with a team 1 class) and take half the classes in team 2, hide them from team 2, and get you to spawn in team 4 when picked. Unfortunately, then, the 20 class cap still applies then (or 18 if with heroes). So I guess this can't be done then?
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: LUA Command SetClassProperty Question

Post by THEWULFMAN »

What Maveritchell is telling you; is that you edit the unit class properties to change the weapon it has, as a workaround for not being able to edit weapon class properties.

As an example, let's say you want to have a wave mode where after each wave, your rifle gets more powerful. Logic dictating that the shortest part between two points is a straight line, you'd think you'd edit the rifle's class properties. That, however, is not how the Zero engine works.

The workaround is simple. You have several different rifle classes, let's say five of them. The base rifle's ordnance does 50 damage points. Each succeeding rifle class ups the damage by 20%(60, 72, 86.4, and so on). When the wave is over, using SetClassProperty, you change which rifle version you have to the next most powerful version. This creates the illusion of the weapon properties changing, when it's actually the unit class that is changing.

Just make sure you load the other weapon classes in the unit's req file, otherwise it won't have other versions of the weapon to change it. If you need anything explained in greater detail, just let us know. We're happy to help.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: LUA Command SetClassProperty Question

Post by razac920 »

Ah yes WULFMAN I understand all of that, and in fact have something like that running in single player. The only reason I wanted to edit the weapon directly was to see if in multiplayer I could make players switch guns by making the one they're currently using be an award weapon (which they can't get), and make another current award weapon no longer be an award weapon (so it would appear for them). However, this didn't work, as you say, because SetClassProperty doesn't apply to weapon classes.

I'm just trying to come up with a workaround for multiplayer, since using SetClassProperty to change a class's guns will crash the game for everyone but the host.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: LUA Command SetClassProperty Question

Post by THEWULFMAN »

I see. I'm terribly sorry, I thought you had misunderstood what Mav was trying to tell you.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: LUA Command SetClassProperty Question

Post by razac920 »

Oh it's fine, don't worry about it. Thanks for trying to help though.

I guess this thread can be marked solved now.
Post Reply