Home   Help Search Login Register  

Author Topic: fix reammo bug on dedi server ( help )  (Read 1391 times)

0 Members and 1 Guest are viewing this topic.

Offline RubberKite

  • Members
  • *
fix reammo bug on dedi server ( help )
« on: 11 Feb 2008, 10:45:44 »
Me and my Coop friend getting  :no: frustrated for dedi server reammo bug  :weeping:, with multi magazine gun or simply with AH1 or Other Pilot/Gunner Vehicle,

we waste a lot of time exiting and entering the vehicle in different order.

I'm very noob in the editor but I think  :scratch: that something could fix this issue with a "Trick"

I whant that when a vehicle reach the farp or E helipad and both player exit from it, the vehicle will be destroyed and replaced with new one full of ammo in each magazine....

This is not a bugfix but, in this way I can play witout this very annoing problem.

Disclaimer:

Sorry in advance if there is already a solution, I search on the forum with some keyword but I find nothing to fix this

Sorry for not perfect english

Thank u for your help

Rubber

Offline Sick

  • Members
  • *
    • Dev-Heaven.net
Re: fix reammo bug on dedi server ( help )
« Reply #1 on: 14 Feb 2008, 15:23:16 »
Simple solution: respawnVeh.sqf
Code: [Select]
private ["_type", "_veh", "_pos", "_dir"];
_veh = _this select 0;
_type = typeOf _veh;
while {alive _veh} do
{
   waitUntil { ((fuel _veh < 1 || getDammage _veh > 0)  && (count (crew _veh) == 0)) || !(alive _veh)};   
   if (_veh distance (_this select 1) < 50) then
   {
        waitUntil {local _veh}; // Vehicle must first become local again (happens after crew's out), as deleteVehicle needs to be executed locally I believe
        _pos = getPos _veh; _dir = getDir _veh;
        deleteVehicle _veh;
       _veh = _type createVehicle _pos;
       _veh setDir _dir;
   };
   sleep 1;
};

In init line of chopper:
if (isServer) then { d=[this, positionOrObjectName] execVM "respawnVeh.sqf" };

positionOrObjectName must be the heliPad thing etc.

You might still have to work a bit on the conditions for waitUntil etc to further satisfy your need. (f.i. atm it's fine if you leave the helicopter within 50m radius of positionOrObjectName)
Im sure there's other possibilities with getOut eventHandler etc, but this was the quickest I could come up with :P

« Last Edit: 14 Feb 2008, 15:46:21 by Sick »

Offline RubberKite

  • Members
  • *
Re: fix reammo bug on dedi server ( help )
« Reply #2 on: 23 Feb 2008, 20:04:04 »
 :D Sick why this nick is so familiar 

I try to do as u suggest me, thank u for 360° help

:good: