nominesine 0 Posted February 14, 2006 I have a MP mission where one player carries a portable field radio. I want to give the playeres instruction via in-game radiocalls from HQ, and instead of using the Ofp sideRadio command I want to make the sounds come from the loon carrying the radio and simulate an old fasion portable radio. The problem is - I don't know wich player carries the radio. This is my solution in SP-mode... 1) HQ will send a radio message when the variable HQmess is set to true. 2) I run a trigger with the following condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player hasWeapon "myRadioAddon" AND HQmess Activation: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">thislist select 0 = speaker; speaker say "myRadioMessage" It works in SP. Will it work in MP? My theory is that thislist select 0 will only react to the player who is carrying the radio, label him speaker and then make speaker "say" the radio message. Am I right or wrong?!? Share this post Link to post Share on other sites
UNN 0 Posted February 15, 2006 I think, becuause triggers are fired on all clients? You will have to find the player with the radio in ThisList, for a second time. So your activation should be: If the say command is global, then use this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{If ((_x==Player) And (_x HasWeapon "myRadioAddon")) Then {_x say "myRadioMessage"}} ForEach ThisList If it's local try this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{If (_x HasWeapon "myRadioAddon") Then {_x say "myRadioMessage"}} ForEach ThisList Share this post Link to post Share on other sites
General Barron 0 Posted February 17, 2006 I'm pretty sure the "say" command is local, so it will have to be executed on all clients (at the same time). UNN's second code should work, but you will need to change the trigger's condition. For example: Player Andrew doesn't have the radio, but player Bob does. "HQmess" gets set to TRUE and broadcast to all players. Player Bob's trigger condition will be TRUE, since he (player) has the weapon, and "HQmess" is true. Player Andrew's trigger condition will still be FALSE, because he (player) does NOT have the weapon (though "HQmess" is still true). I think if you store an array of all the player units at the very beginning of the mission, it should work fine (unless there is respawning). Ex, in init.sqs: players = [p1, p2, p3, p4] --or if the players are all in the same group: players = units player_group Then, your trigger condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(({_x hasweapon "myRadioAddon"} count players) > 0) AND HQmess And the on activation (modified from UNN's post): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{If (_x HasWeapon "myRadioAddon") Then {_x say "myRadioMessage"}} ForEach players I think that should work. Share this post Link to post Share on other sites
UNN 0 Posted February 17, 2006 I did get a brief chance to test Radio triggers in MP, a while back. I was sure that when a player executed his radio option, the script in OnActivation was executed on all clients. I assumed the same applied for triggers fired in other ways to? So even though a single client might activate the trigger, the resulting on activation occurs on all clients? But like I said, it was only a brief test and was really to do with debugging user actions in MP. So I did not test it further. Share this post Link to post Share on other sites
General Barron 0 Posted February 17, 2006 So even though a single client might activate the trigger, the resulting on activation occurs on all clients? Whoops... now I'm not sure if this is the case or not. Yikes, shows my ignorance. Hmm... seems like a pretty basic MP question that someone with more experience ought to be able to answer easily... Share this post Link to post Share on other sites
Chris Death 0 Posted February 17, 2006 Just for verification i can confirm what UNN said: Radio Calls get executed on all clients ~S~ CD Share this post Link to post Share on other sites
UNN 0 Posted February 17, 2006 Thanks Chris, I guess it's because triggers will always be local to the server. Share this post Link to post Share on other sites
Garcia 0 Posted February 17, 2006 I did get a brief chance to test Radio triggers in MP, a while back. I was sure that when a player executed his radio option, the script in OnActivation was executed on all clients. I assumed the same applied for triggers fired in other ways to? So even though a single client might activate the trigger, the resulting on activation occurs on all clients? But like I said, it was only a brief test and was really to do with debugging user actions in MP. So I did not test it further. I don't think a trigger gets activated on all clients if the condition is only met on one client. In a mission I played there was a trigger activated once when east was not present. On activation the trigger set one marker to empty and showed a hint. Should have been fool proof, but one time, somehow, the trigger was executed on all machines except mine Dunno how it happened, may have been that I had desync, and then a east unit left the area and then entered it again, and that way my machine never noticed that the condition was met cause of the desync. So if the trigger was to be activated on all clients if the condition was only met in one, mine should have been activated too...(or maybe desync can mess up that too ) A fast test on a dedicated server with a trigger activated by local server showed that the trigger didn't get activated on my client. I guess it shouldn't matter if the trigger is activated on the server or on a client? Share this post Link to post Share on other sites
UNN 0 Posted February 17, 2006 So OnActivate is only called localy or globaly? Sorry, I could not say for sure from your reply. Share this post Link to post Share on other sites
Garcia 0 Posted February 17, 2006 From my experience, localy. Share this post Link to post Share on other sites
UNN 0 Posted February 18, 2006 Ok, thanks. I take it though. A basic condition like West Present would probably be activated localy on all clients, assuming nothing was created with CamCreate? So as long as the condition isn't one that can only be met localy, it will in effect fire off on all clients? Cheers Share this post Link to post Share on other sites
Garcia 0 Posted February 18, 2006 Yes, if the condition have to be met on all clients at the same time, it should be triggered on all clients, but I have experienced once that it didn't, but the reason for that was probaly desync. Share this post Link to post Share on other sites
UNN 0 Posted February 18, 2006 Ok, So for the original question, the condition could be: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(({_x HasWeapon "myRadioAddon"} Count ThisList)>0) And HQmess And the Onactivation: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{If (_x HasWeapon "myRadioAddon") Then {_x say "myRadioMessage"}} ForEach ThisList That way the condition will work on all clients and the Local command say, should be heard by everyone? Cheers Share this post Link to post Share on other sites