Page 1 of 1

Multiplayer compatibility question

Posted: Wed Apr 08, 2015 12:03 am
by razac920
Can you use SetClassProperty to change PointsToUnlock on a class midgame?

Re: Multiplayer compatibility question

Posted: Wed Apr 08, 2015 4:19 am
by AnthonyBF2
PointsToUnlock is sort of a visual thing, it has to match both people for it to work right.
If client has free specials but host defines a value, then they will spawn as soldier until they actually have the points for the specials.

If you want all people to have the specials at once (or lock it at once) you could add a custom FC button to do that function so that the client side will then match the host. They would have to press the custom button on their own, you can probably tell them to do this using ShowMessageText.

If anyone has a special currently and the points are raised, it will not work until they've died and tried to rechoose that class.

Bots how ever use specials any time they wish.

Re: Multiplayer compatibility question

Posted: Wed Apr 08, 2015 10:25 pm
by [RDH]Zerted
Yes you can. Just make sure both the clients and server make the change, as well as new players joining mid game.

Re: Multiplayer compatibility question

Posted: Wed Apr 08, 2015 11:32 pm
by razac920
And how does one ensure that both the clients and server make the change? It's not like the server and clients are running different LUA scripts?

Re: Multiplayer compatibility question

Posted: Thu Apr 09, 2015 12:05 am
by [RDH]Zerted
Well then you're likely good. You can have the server and client run different scripts. I don't know what you're doing.

Re: Multiplayer compatibility question

Posted: Thu Apr 09, 2015 12:23 am
by AnthonyBF2
I may not have been clear, you can build a custom fake console command that lowers or raises the points for your characters.

You can then run show message text to tell the player on the screen they should pause and press the custom FC command so that their special's points will then match host.

If client sees a limit, and host has free, player still has to earn points
If client has free and host defines a value, client will spawn as first unit on their team until points are earned.

Allowing the client side to think the points have changed(FC command)will match the host.

Re: Multiplayer compatibility question

Posted: Thu Apr 09, 2015 1:40 am
by [RDH]Zerted
I understood that, but it's way overkill depending how it's being used. You can use it in ScriptInit or ScriptPostLoad without needing a FC command. Say you want to lower unlock points every time a CP is captured. Using SetClassProperty() in the OnCaptured event call back will update the values for both clients and server because both of them run that code.

The main issue is for people joining mid-game. They wouldn't have seen the CP captured event (or your server message) and thus their unlock values would be different (I'm fairly certain but never tested it). However depending on the mission that might not matter.