andersson 285 Posted January 11, 2008 Hello. I'm trying to make a MP mission where I want 2 players to have their own group of 1 pilot and 1 sf. I also want both pilot and sf to be playable so the player can switch between them. Player1's group: - pilot1 - sf1 Player2's group: - pilot2 - sf2 I know that teamswitch doesnt work in MP, but selectplayer does. The problem I have is how to make only one player switch units. I tried a radiotrigger, but that ended up with both players in the same unit. F.ex if player1 switches to sf1 both player1 and player2 are in sf1 unit... It doesnt matter what player activates the trigger, the result is the same. I suppose the trigger is executed on all machines with the result all players are moved into the same unit. So is there some way to make only the local player switch unit? I havent figured out if its possible to script it as you cant choose what unit/player that will be switched (selectplayer unit). I'm working in a LAN environment. No dedicated server. 2 computers, one is host. Share this post Link to post Share on other sites
sickboy 13 Posted January 11, 2008 You could use addAction: http://community.bistudio.com/wiki/addAction This will only execute the script locally on the machine where the action is executed. For radio triggers: I am unsure if you can extract the player who called the radio. If you could then you could use radio triggers aswell, while using a check in the condition field, if player == (thePlayerThatCalledTheRadioTrigger) Also, are you sure about teamSwitch not working in MP. I could swear I was experimenting with it back around v1.02? Share this post Link to post Share on other sites
andersson 285 Posted January 11, 2008 May I ask how such a script could look? I have made some pathetic tries but I havent grokked how sqf works.. Share this post Link to post Share on other sites
The_Captain 0 Posted January 12, 2008 There's a sneaky way to get radio commands to execute only on the local machine: for a radio alpha to execute on the local machine only: trigger 1: activation: radio alpha (repeatedly) condition: this && !radio_alpha onAct: (your code here); radio_alpha = true; publicvariable "radio_alpha"; trigger 2: activation: radio alpha (repeatedly) timeout: min/mid/max: 2 condition: this on Act: radio_alpha = false; This effectively stops clients besides the client that executed the radio command from having the effects execute locally. You might also want to use "addswitchableunit _newunit" and "removeswitchableunit _oldunit" in the radio trigger to prevent crashes. (I think if you don't addswitchableunit the new unit, and selectplayer a second time, the game crashes) the Teamswitch dialog activates in MP if you use the "addswitchableunit" command and there are more than one 'playable' unit (eg, the original player and the new unit). I generally make sure I only have one switchable unit so the dialog is disabled, but you may want to experiment with it. Also, I think you need to make sure the player unit is local to the computer calling the command, otherwise you may get a crash. If you selectplayer to a unit local to another client it may crash the game.. I haven't experimented with this in a while but I believe it to be the case. Share this post Link to post Share on other sites
andersson 285 Posted January 12, 2008 Thank you for some interesting input! I have to play around with that tomorrow. Share this post Link to post Share on other sites
andersson 285 Posted January 12, 2008 It worked like a sharm! I put this into the activationfield on trigger 1: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">addswitchableunit sf1; selectplayer sf1; group player selectleader player; removeswitchableunit pilot1; radio_alpha = true; publicvariable "radio_alpha"; Selectleader was necessary to keep control over the radio, it also makes it easier to keep control over the group. I also put this in the activationfield on the unit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">radio_alpha =false; publicvariable "radio_alpha"; If not I had to activate radio alpha 2 times the first time. So I copied everything for unit sf1 and changed everything to bravo and pilot 1. Then I did the same with the other group, carlie, delta and so on. So now I have 2 independent groups, one for me and one for my MP-buddy, and we can change between pilot and sf! The only problem is that as you have 4 radiotriggers you can change into a unit in the other group, even into the other players unit. But as this is coop and its easy to change back its no big problem. Now I only have to finnish my mission. You and a friend works as sf behind enemy lines. The concept is to take out enemy tanks and AA, but its to difficult if you only play as pilot or as sf. You have to use both assets. you have 1 AI pilot in your group as gunner if the other person wants to have his own chopper as support or if you need someone to lase a target as sf. Take out enemy radars as SF to make it easier to blast all AA as pilot. As SF you can blow it up, lase it, recce for flightroute planning. Then you can (one of you or both) get into the air as pilot and blow up enemies, transport your specops or give support in any way from the air. Its all up to you. You have an airfield, one pilot each and 1 sf-soldier. Enemy area have randomly placed AA and radars + DAC. Solve it as you wish. Share this post Link to post Share on other sites