Jump to content
Sign in to follow this  
dragonsyr

Plannedextraction dedicated Server problem

Recommended Posts

//////////////////////////////////////////////////////
//  From trigger:
//  nul = [player] execVM "plannedExtraction.sqf";
//
//  Pre-place "hStart" and "hEnd" markers on the map.
/////////////////////////////////////////////////////

// Wait till the Functions module is ready.
waituntil {!isnil "bis_fnc_init"};

// Declare everything.
_unit = _this select 0;
//_unit = player; // who called it.
_chopperType = "CH_47F_EP1";  // Type of transport.
_start = getMarkerPos "hStart";  // location of start/spawn/delete location.
_end = getMarkerPos "hEnd";  // location of drop off.
_landPos = [_unit, 20, getdir _unit] call BIS_fnc_relPos;  // location of pickup, 20m in front of caller

if (isServer) then {
// message letting them know it's coming.
hintSilent "Extraction chopper inbound!";  

// Create a little shiney ball we can use to get the direction from start to caller with
_blinky = "Sign_sphere10cm_EP1" createVehicle _start;
_flightPath = [_blinky, _unit] call BIS_fnc_relativeDirTo;		

// Spawn the helo, facing the user, in the air at the start location.
_ch = [[_start select 0, _start select 1, 50], _flightPath, _chopperType, side _unit] call BIS_fnc_spawnVehicle;

// Name the helo globally so that waypoint orders will work.
transporthelo = _ch select 0;
_chGroup = _ch select 2; // group of helo so waypoints work.
_chGroup setBehaviour "CARELESS"; // Make sure they don't get distracted.
// transporthelo setCaptive true; // uncomment this to make your ride safe.
transporthelo flyInHeight 100;

// These lines might be needed in MP.    Didn't test it yet.
_ch select 0 setVehicleInit "transporthelo = this; this setVehicleVarName ""transporthelo""";
processInitCommands;

// Delete the cute little light that let us spawn facing the right direction
// and create landing spots for pickup and dropoff.
deleteVehicle _blinky;
_lzPickup = "HeliHEmpty" createvehicle _landPos;
_lzDropOff = "HeliHEmpty" createvehicle _end;

// Give the helo a waypoint to where the player is and make it land, engines on.
wp0 = _chGroup addwaypoint [_landPos, 20];
wp0 setwaypointtype "MOVE";
wp0 setWaypointStatements ["","transportHelo land ""GET IN"""];

// Wait till the player's group is in the helo.
waitUntil{{_x in transporthelo} count units group _unit == count units group _unit};

// Once they are, off we go by setting a TRANSPORT UNLOAD waypoint.
// It'll auto boot the leader once there, but he'll have to tell the others to get out.
wp1 = _chGroup addwaypoint [_end, 20];
wp1 setwaypointtype "TR UNLOAD";
wp1 setWaypointStatements ["","transportHelo land ""GET OUT"""];

// Wait till the player's group is out of the helo.
waitUntil{{_x in transporthelo} count units group _unit == 0};

// Once they are out, set a waypoint back to the start and clean up by deleting the helo and landing pads.
wp2 = _chGroup addwaypoint [_start, 20];
wp2 setwaypointtype "MOVE";
wp2 setWaypointStatements ["true","{deleteVehicle _x} forEach crew transporthelo; deletevehicle transporthelo;"];
deleteVehicle _lzPickup;
deleteVehicle _lzDropOff;
};

I want to run this on my dedi server but when i call the script, the helicopter crash about 100 meters from the start location.

the hello cant see my position i think. no _blinky , no hintsilent. only spawn on air and then crash....

in mp the script working.

is there a solution for dedi?

Thanks in advance

Edited by dragonsyr

Share this post


Link to post
Share on other sites

Did you place a function smodule on the map? Did you use waitUntil {!IsNil "Bis_Fnc_Init"} to make sure the functions module is initialized? Also, you either need to use createCenter to create a side, or place a unit of the desired side on the map, otherwise the vehicle spawns empty.

Share this post


Link to post
Share on other sites
Did you place a function smodule on the map?

how can i do that?

Did you use waitUntil {!IsNil "Bis_Fnc_Init"} to make sure the functions module is initialized?

Yes. in the beggining of the script.

Also, you either need to use createCenter to create a side, or place a unit of the desired side on the map, otherwise the vehicle spawns empty.

more specific?

thanks

Share this post


Link to post
Share on other sites

Lets say you have 1 west player on the map & no east units on the map. If you use Bis_Fnc_SpawnVehicle to create a east unit, it will spawn empty since the sides center wasn't created, as it doesn't know what units to put into the vehicle. You could simply place one east unit on the map for it to work. Or use createcenter command.

Share this post


Link to post
Share on other sites
Lets say you have 1 west player on the map & no east units on the map. If you use Bis_Fnc_SpawnVehicle to create a east unit, it will spawn empty since the sides center wasn't created, as it doesn't know what units to put into the vehicle. You could simply place one east unit on the map for it to work. Or use createcenter command.

and where you see that the script is for east unit? this is east unit? _chopperType = "CH_47F_EP1??

so, u know what code i can use inside the above script to make it work?

Share this post


Link to post
Share on other sites

Finaly , i found how can use this script on dedicated server

here it is

// plannedExtraction.sqf
if (!isDedicated && (player == player)) then
{ waitUntil {!isNull player}; 


// Wait till the Functions module is ready.
waituntil {!isnil "bis_fnc_init"};

// Declare everything.

_unit = player; // who called it.
_chopperType = "CH_47F_EP1";  // Type of transport.
_start = getMarkerPos "hStart";  // location of start/spawn/delete location.
_end = getMarkerPos "hEnd";  // location of drop off.
_landPos = [_unit, 20, getdir _unit] call BIS_fnc_relPos;  // location of pickup, 20m in front of caller


// message letting them know it's coming.
hintSilent "Extraction chopper inbound!";  

// Create a little shiney ball we can use to get the direction from start to caller with
_blinky = "Sign_sphere10cm_EP1" createVehicle _start;
_flightPath = [_blinky, _unit] call BIS_fnc_relativeDirTo;		

// Spawn the helo, facing the user, in the air at the start location.
_ch = [[_start select 0, _start select 1, 50], _flightPath, _chopperType, side _unit] call BIS_fnc_spawnVehicle;
// These lines might be needed in MP.    Didn't test it yet.
_ch select 0 setVehicleInit "transporthelo = this; this setVehicleVarName ""transporthelo""";
processInitCommands;
// Name the helo globally so that waypoint orders will work.
transporthelo = _ch select 0;
_chGroup = _ch select 2; // group of helo so waypoints work.
_chGroup setBehaviour "CARELESS"; // Make sure they don't get distracted.
// transporthelo setCaptive true; // uncomment this to make your ride safe.
//transporthelo flyInHeight 100;



// Delete the cute little light that let us spawn facing the right direction
// and create landing spots for pickup and dropoff.
deleteVehicle _blinky;
_lzPickup = "HeliHEmpty" createvehicle _landPos;
_lzDropOff = "HeliHEmpty" createvehicle _end;

// Give the helo a waypoint to where the player is and make it land, engines on.
wp0 = _chGroup addwaypoint [_landPos, 20];
wp0 setwaypointtype "MOVE";
wp0 setWaypointStatements ["","transportHelo land ""GET IN"""];

// Wait till the player's group is in the helo.
waitUntil{{_x in transporthelo} count units group _unit == count units group _unit};

// Once they are, off we go by setting a TRANSPORT UNLOAD waypoint.
// It'll auto boot the leader once there, but he'll have to tell the others to get out.
wp1 = _chGroup addwaypoint [_end, 20];
wp1 setwaypointtype "TR UNLOAD";
wp1 setWaypointStatements ["","transportHelo land ""GET OUT"""];

// Wait till the player's group is out of the helo.
waitUntil{{_x in transporthelo} count units group _unit == 0};

// Once they are out, set a waypoint back to the start and clean up by deleting the helo and landing pads.
wp2 = _chGroup addwaypoint [_start, 20];
wp2 setwaypointtype "MOVE";
wp2 setWaypointStatements ["true","{deleteVehicle _x} forEach crew transporthelo; deletevehicle transporthelo;"];
deleteVehicle _lzPickup;
deleteVehicle _lzDropOff;
};

the only issue is that i cant see the blinky object in front of me when i trigger the script. i dont know what is the problem , but i get no errors and this is good. :-)

the script works perfect ....

someday i ll try to change the blinky object to something else, maybe a smoke, and see what happend.

thank you all.

Edit : Dont forget to put 2 markers named hStart , hEnd , in your mission

Also the caller must be the last unit that board the heli

edit

i change blinky object with shells of smoke and other signs , but nothing . anyway .... the script is working
Edited by dragonsyr

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  

×