Jump to content
Sign in to follow this  
2nd ranger

Multiplayer script setPos problem

Recommended Posts

Hi,

I have a script I thought was fairly straightforward that screws up during a hosted MP game.

The parts I have made red are what don't work. The script starts to go wrong at the first red section, everything before that works.

{
unassignvehicle _x;
_x action ["EJECT", vod1];
sleep 0.2;

} foreach units vod1grp;

sleep 1;
enablesentences true;
logic1 globalradio "msg_ied";
TeamLeader2 say "IED";

sleep 2;

{_x setunitpos "middle"} forEach units TeamTwo; 

enablesentences false;

hideobject vodDriver;
hideobject vodGunner;
hideobject vodGunner2;

[color="Red"]
Wounded1 setpos getpos WOunded1Pos;

sleep 0.5;

Wounded2 setpos getpos WOunded2Pos;

sleep 0.5;

Wounded3 setpos getpos WOunded3Pos;[/color]

sleep 1; 

[color="Red"]
{
        _x setunitpos "middle";
 _x setcombatmode "yellow";

} foreach [ambush1, ambush2];

dmy=[vod1, "chatter_vod", 90 , 10] execvm "JBOY_soundLoop.sqf";[/color] 

SR_TskPatrol setTaskState "Canceled";

{_x allowdamage true} foreach [T1_gl,T1_rpk,T1_rpg];

This is executed by a vodnik entering a trigger, OnAct: nul = execVM "Boom.sqf". What is supposed to happen is that after an explosion, the vehicle crew is ejected and then deleted. Immediately afterward, three identical units (Wounded1, 2, 3) are setPos'd to the ground near the Vodnik. Then two enemy units (ambush1, ambush2) who are prone and combat mode set to "blue" are commanded to get up and open fire. JBoy's soundloop function then makes the vehicle play a looped radio chatter sound.

What happened in MP was that only one of the 'wounded' units was setpos'd, and although friendly units engaged the ambushers, the ambushers did not fire back, which basically halts the mission.

The wounded units are running a script by Big Dawg KS so you can drag/carry them but not heal them.

I'm fairly new at SQF scripting so if someone could point out anything suspicious or even something that could be simplified, then that would be helpful!

EDIT:

Huh, does it matter if you use nul = execVM "Boom.sqf" instead of nul = [] execVM "Boom.sqf"?

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites
I have a script I thought was fairly straightforward that screws up during a hosted MP game.

Probably looking at a locality issue here, setPos acts up when more than one machine has to fight over the command. Try replacing the red block to only run on the server:

if (isServer) then {
   Wounded1 setpos getpos WOunded1Pos;  
   sleep 0.5; 
   Wounded2 setpos getpos WOunded2Pos;
   sleep 0.5; 
   Wounded3 setpos getpos WOunded3Pos; 
   sleep 1;   
   {
       _x setunitpos "middle";
       _x setcombatmode "yellow";      
   } foreach [ambush1, ambush2];
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×