Page 1 of 2
LUA Command SetClassProperty Question [Solved]
Posted: Wed Jun 13, 2012 10:53 pm
by razac920
Hi everyone, I'm working on a mod that requires the use of SetClassProperty to change a unit's weapons. I've read posts saying that this will break multiplayer compatibility, but I'd just like to confirm where this is the case, even if no other players (human or computer) have selected the class I'd be editing. Thanks.
Re: LUA Command SetClassProperty Question
Posted: Wed Jun 13, 2012 11:47 pm
by Marth8880
Did you read that using SetClassProperty to change weapons would break multiplayer compatibility, or that using it in general would break it?
Re: LUA Command SetClassProperty Question
Posted: Thu Jun 14, 2012 12:24 am
by razac920
In the FAQ section on SetClassProperty, [RDH]Zerted wrote, "I do know that changing which weapons a unit hold will cause crashes for other players in MP". I'm just wondering if no other players are in that class, will there still be crashes? Or is there any hope of MP working?
Re: LUA Command SetClassProperty Question
Posted: Thu Jun 14, 2012 1:50 am
by fasty
razac920 wrote:In the FAQ section on SetClassProperty, [RDH]Zerted wrote, "I do know that changing which weapons a unit hold will cause crashes for other players in MP". I'm just wondering if no other players are in that class, will there still be crashes? Or is there any hope of MP working?
Yes it would crash everyone if you changed what weapons they hold. One thing you can do is change the properties of the weapons like damage and range. (This is if you are the server host of course).
Re: LUA Command SetClassProperty Question
Posted: Thu Jun 14, 2012 2:06 am
by razac920
Oh, okay, that's what I was afraid of. Guess it has to be single player only, then :/
Re: LUA Command SetClassProperty Question
Posted: Thu Jun 14, 2012 2:17 am
by lucasfart
You guys are both kinda right. There are some which are important/essential, and others which have little/no effect.
BFront2.log errors explained wrote:Fix your SoldierAnimation memory pool errors after creating a new map to shorten the length of your debug log and to increase online stability
BFront2.log errors explained wrote:
All ParticleTransformer memory pool errors can be ignored. When playing the actual game (not the debug exe) the game will automatically update these pools as needed:
Code:
Message Severity: 2
C:\Battlefront2\main\RedEngineFL\Memory\RedMemoryPool.cpp(170)
Memory pool "ParticleTransformer::SizeTransf" is full; raise count to at least 1075
Re: LUA Command SetClassProperty Question
Posted: Thu Jun 14, 2012 12:16 pm
by Maveritchell
razac920 wrote:Hi everyone, I'm working on a mod that requires the use of SetClassProperty to change a unit's weapons. I've read posts saying that this will break multiplayer compatibility, but I'd just like to confirm where this is the case, even if no other players (human or computer) have selected the class I'd be editing. Thanks.
What Zerted says there isn't 100% true. SetClassProperty can be used post-load (i.e. mid-mission) on some properties without detrimental effects (I've used this in both MP game modes and scripted missions). I can't confirm that it will always work (and of course Zerted was talking about a specific use - changing weapon types), but here's what I've done and I can confirm does work:
-SetProperty on pretty much anything (within the realm of what SetProperty can modify) works fine postload
-SetClassProperty works fine on some properties postload (I obviously haven't tested all of them, but I know that health properties, energy properties, shield properties, and points to unlock all seem to work fine)
-SetClassProperty works fine on pretty much anything as long as the property is set pre-load (i.e. you can adjust what weapons a unit has without issue in MP provided it's done in the ScriptInit section)
Re: LUA Command SetClassProperty Question
Posted: Thu Jun 14, 2012 1:27 pm
by razac920
Ah okay. Well unfortunately, my mod will require many mid-mission weapon changes, so I guess MP can't work for it. Thanks for clearing it up for me, though.
Edit: I came up with another idea; would using SetClassProperty to edit "MedalsTypeToUnlock" in a weapon's odf work in the middle of a mission? Or would that cause a MP crash as well?
Re: LUA Command SetClassProperty Question
Posted: Sat Jun 16, 2012 5:14 pm
by [RDH]Zerted
You have to try it and find out. Setup a dedicated server (you can't test it as the server host) with your mod then join that server. If when that part of your code gets run and you crash, it won't work in MP.
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 1:21 pm
by razac920
Umm how do you join a dedicated server that you're hosting? I only have one computer and one copy of SWBF2
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 1:35 pm
by Marth8880
Are you using the BlackBagOps Server Manager or SWBF2 to host your server?
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 1:49 pm
by razac920
I was using SWBF2, I didn't know about any server managers
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 2:30 pm
by Marth8880
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 2:56 pm
by razac920
Okay, I think I have everything set up, but when I run swbf2sm.exe I don't see any mod maps at all, just the stock ones
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 3:25 pm
by Marth8880
Ah, yes. I'm not
entirely sure whether really anyone has ever managed to get mod(s)/( maps) working with the BlackBagOps Server Manager other than maybe Fasty. I'll have to look into it myself sometime. (Do I foresee Unification on a server?

)
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 3:31 pm
by Locutus
It's pretty simple.
Just copy the maps you want to use in your servers Addon folder.
(In case you want to run the ConvoPack you also need to replace the server's common.lvl, shell.lvl and ingame.lvl with the ones from patch 1.3 to make the maps appear in the list.)
Re: LUA Command SetClassProperty Question
Posted: Mon Jun 18, 2012 3:37 pm
by Marth8880
Huh, it's that simple?

Alright, then.

Re: LUA Command SetClassProperty Question
Posted: Wed Jun 20, 2012 3:54 pm
by razac920
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?
Re: LUA Command SetClassProperty Question
Posted: Wed Jun 20, 2012 5:35 pm
by Maveritchell
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.
Re: LUA Command SetClassProperty Question
Posted: Wed Jun 20, 2012 10:58 pm
by razac920
Ah okay, I was afraid of that, so the ONLY way to change weapons in MP is to switch classes altogether, then? Since SetClassProperty on WeaponName would not work, and SetClassProperty on the weapon's odf doesn't work. Only possible alternative I can think of is to with scripting disallow weapons from causing damage (forcing the player to switch to the weapon you want) or MAYBE to somehow remove other weapon ammo except for the player's intended weapon... Maybe through making an ammo powerup that gives negative ammo? There's some line in the powerup dispenser making it immune to refilling from anything other than an ammo droid, but again you'd face the problem that you can't edit weapon odf's mid-game. The reason I ask is that I'm working on a Gun Game mode that works in single player, but have no idea how to make it work online. Scripting out damage/kills from the wrong weapon might be my only option, but it seems like a very nasty hack, as you can still see the old weapon and ordnance, etc.
Alternatively, I just change classes, each with one weapon. I would prefer to have more than just 20 weapons to cycle through, but visually that would look nicest.
Oh but I should ask, is there a way to spawn the human in classes of team 3, 4, 5, etc.? The BF2 Limitations post states that "Human characters can only spawn teams 1 or 2, but you can give the illusion of up to 9 (since 9 is the team limit) selectable teams." What is this illusion, and how does it work?