I'm currently trying to port my mission to COOP on a dedicated server. While doing this I encounter that the scripts I wrote for SP oder COOP on a non-dedicated server are not working for the dedicated server.
One example:
I'm trying to do a HALO insertion and use an addAction to the airplane my group is in with the following script attached:
The "sleep 0.1" is mandatory otherwise I fall without a parachute. The setdir and setvelocity have no influence for the dedicated server (which is kinda annoying). When scripting for a non-dedicated server the single line [player, 1950] exec "ca\air2\halo\data\Scripts[CODE]\HALO_init.sqs"; suffices instead of ejecting and HALO_getout.Code:if(!isDedicated) then { player action [ "eject", vehicle player]; sleep 0.1; player setdir 0; [player] exec "ca\air2\halo\data\Scripts\HALO_getout.sqs"; player setvelocity [120*0.8,0,0]; }
While this is strange enough, until now I was not able to convert the following script to a format that is working for a dedicated server
Version 1:
Version 2:Code:waitUntil {getPosATL player select 2 < 25}; if(isServer) then { _scatterHeight = -20; { if(!(isPlayer _x)) then { // stupid AI drifts off several kms if not done _x addEventHandler ["HandleDamage", {false}]; unassignvehicle _x; _x setpos [ (getMarkerPos "mrkrInsertion" select 0) + (random 40) - 20, (getMarkerPos "mrkrInsertion" select 1) + (random 40) - 20, 100 - _scatterHeight]; _x flyinheight (100 - _scatterPos); _x setvelocity [(random 6)-3,(random 6)-3,0]; [_x, (100 - _scatterHeight)] exec "ca\air2\halo\data\Scripts\HALO_init.sqs"; _scatterHeight = _scatterHeight + 10; } } forEach units playerGroup; }
Code:if(isServer) then { _scatterHeight = -20; { if(!(isPlayer _x)) then { // stupid AI drifts off several kms if not done _x addEventHandler ["HandleDamage", {false}]; unassignVehicle _x; sleep 1; _xChute = createVehicle ["Parachute_US_EP1", [(getMarkerPos "mrkrInsertion" select 0) + (random 40) - 20, (getMarkerPos "mrkrInsertion" select 1) + (random 40) - 20, 50 - _scatterHeight], [], 0, "FLY"]; _xChute setPos [(getPos _xChute select 0), (getPos _xChute select 1), 50 - _scatterHeight]; _xChute setDir (random 360); _x setPos [(getPos _xChute select 0), (getPos _xChute select 1), 50 - _scatterHeight]; _x moveInDriver _xChute; _scatterHeight = _scatterHeight + 10; } } forEach units playerGroup; }
The goal of that script is to drop the AIs of the group near the landing place. Both works well for non-dedicated. For dedicated the chutes drop empty (in Version 2) and the AIs are falling of the airplane wherever the current location of that is.
I'd really appreciate some help in converting the second part to a dedicated server compatible format.
I'd also love to get some insight why the scripts for the dedicated server have to differ - is there a point of view making this reasonable?
HOME
Reply With Quote
