Page 2 of 2

Re: LUA Command SetClassProperty Question

Posted: Thu Jun 21, 2012 4:34 am
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.

Re: LUA Command SetClassProperty Question

Posted: Thu Jun 21, 2012 10:36 am
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?

Re: LUA Command SetClassProperty Question

Posted: Thu Jun 21, 2012 2:58 pm
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.

Re: LUA Command SetClassProperty Question

Posted: Thu Jun 21, 2012 3:12 pm
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.

Re: LUA Command SetClassProperty Question

Posted: Thu Jun 21, 2012 4:05 pm
by THEWULFMAN
I see. I'm terribly sorry, I thought you had misunderstood what Mav was trying to tell you.

Re: LUA Command SetClassProperty Question

Posted: Thu Jun 21, 2012 4:26 pm
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.