Jump to content
Sign in to follow this  
Przemek_kondor

respawnVehicle problem

Recommended Posts

Hi,

In my mission when I create vehicles, I add respawn option to it:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

...

_veh = _vehicleClass createVehicle _position;

_veh respawnVehicle [];

_veh addEventHandler ["DAMMAGED" , {_this spawn ptr_destroy_vehicle}];

where ptr_destroy_vehicle holds script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

private ["_veh", "_dammage"];

_veh = _this select 0;

sleep DESTROY_VEHICLE_DELAY;

if( not (isNull _veh ))then

{

_dammage = getDammage _veh;

if( (_dammage < 1.0) AND (_dammage > 0.0) )then

{

waitUntil { (count (crew _veh)) == 0 };

sleep 5;

_veh setPos [0, 0];

_veh setDammage 1.0;

sleep 30;

deleteVehicle _veh;

};

};

But after several vehicle respawns crash-to-desctop occurs.

Propably it is caused by deleteVehicle but how then remove unnecessary vehicles (wrecks)?

Share this post


Link to post
Share on other sites

hi,

shoudn't<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_veh respawnVehicle [];be<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_veh respawnVehicle [-1, 0];?

anyway, may it crashes because u're deleting a non-local vehicle? Try with:

ptr_destroy_vehicle<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_veh = _this select 0;

if (local _veh) then

{

sleep DESTROY_VEHICLE_DELAY;

if (!isNull _veh) then

{

deleteVehicle _veh;

};

};

ohh... shoudn't it be a "killed" EH instead of "dammaged"?

I'm sorry I'm posting more questions that u did but I don't have the certainty you're probably searching for, but worth a try, doesn't? smile_o.gif

Share this post


Link to post
Share on other sites

CTD occurs even I test mission on my preview-local server (without other players) so all vehicles are local.

EH "Dammaged" works properly - is fired when vehicle is completely or partialy damaged.

For sure problem is with deleting vehicle because when I remove line: "deleteVehicle _veh" everything is ok except map full of wrecks.

Propably arma holds and uses reference to wreck but doesn't delete it automaticly. If it's true - this feature is useless (in most of PvP missions).

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  

×