delta99 34 Posted March 15, 2009 What is the best (suggested) way to propogate an addaction change on a vehicle in multiplayer. What I mean by this is that lets say there is an addaction attached to a vehicle and once that action is clicked by a user it should dissappear from all users addaction on that vehicle. Currently a removal of the addaction only happens on the client side. How does one propogate this in multiplayer so that the removal happens on all clients? Can one just do a publicVariable call on the vehicle? Is this efficient? Does it even work? Share this post Link to post Share on other sites
UNN 0 Posted March 16, 2009 If you use AddPublicVariableEventHandler you can set it up so it will handle any user action you want removing. So for each client at startup you would add: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"UNN_REMOVEACTION" AddPublicVariableEventHandler {_Params=_This Select 1; (_Params Select 0) RemoveAction (_Params Select 1)} In the script called by your action you would have something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0; _Unit=_This Select 1; _ID=_This Select 2; UNN_REMOVEACTION=[_Vehicle,_ID]; PublicVariable "UNN_REMOVEACTION"; Share this post Link to post Share on other sites
delta99 34 Posted March 16, 2009 Thanks UNN. After further investigation I think I've seen folks using this to execute code fragments in a similar manner so will start using a method like this for my work. BTW, what happens to JIP players? Would they have these processed as well or would they just catch subsequent variable changes? Share this post Link to post Share on other sites
UNN 0 Posted March 16, 2009 A JIP player will be sent the content of the last broadcast with PublicVariable. So it will also trigger the event. If your using it on more than one vehicle you can either create global vars for each vehicle. Or create an array of all the vehicles assigned an action along with the ID's. Or use SetVehicleInit instead, that will automatically remember all the calls to remove actions. Your spoilt for choice Share this post Link to post Share on other sites
delta99 34 Posted March 16, 2009 It is on a number of vehicles but I have to see my logic to see if it will work if it receives the last broadcast variable state. Its basically more of a state of the action item rather than just removing it (ie. it will be in a state of either one or another action itme). So I think this might work. If it doesn't, I don't like having a global variable per vehicle so I'll probably go the SetVehicleInit route. Thanks for all the help. Share this post Link to post Share on other sites