Jump to content
Sign in to follow this  
Katash

Resupply Script - Need Help

Recommended Posts

I've written one that works but its very buggy,

All I want is the option when in an 81mm mortar to 'Resupply Asset'

Then to add 1 magazine of HE, WP & Illum rounds

Giving some feedback to the user about the state of reload

then exit.

Here is the one I've written so far, I'm using it on a modified Domination map with 3 81mm Mortars, script invoked by addaction command in init line of each unit but when using it for any length of time the server crashes

mortar_reload.sqf

// by Xeno Modified By Katash
private ["_config","_count","_i","_magazines","_object","_type","_type_name"];

_object = _this select 0;

_type = typeof _object;

if (isNil "x_reload_time_factor") then {x_reload_time_factor = 1;};

if (!alive _object) exitWith {};

_type_name = [_type,0] call XfGetDisplayName;

[_object,format ["Re-Supplying %1... Please stand by...", _type_name]] call XfVehicleChat;

_object removeMagazines "ARTY_8Rnd_81mmHE_M252";

_object removeMagazines "ARTY_8Rnd_81mmWP_M252";

_object removeMagazines "ARTY_8Rnd_81mmillum_M252";

sleep 5;

[_object,format ["Reloading 81mm HE", _type_name]] call XfVehicleChat;

sleep 10;

_object addMagazine "ARTY_8Rnd_81mmHE_M252";

sleep 2;

[_object,format ["Reloading 81mm WP", _type_name]] call XfVehicleChat;

sleep 10;

_object addMagazine "ARTY_8Rnd_81mmWP_M252";

sleep 2;

[_object,format ["Reloading 81mm Illumination", _type_name]] call XfVehicleChat;

sleep 10;

_object addMagazine "ARTY_8Rnd_81mmillum_M252";

sleep 2;

[_object, format ["%1 is ready...", _type_name]] call XfVehicleChat;

if (true) exitWith {}; 

Any scripting 'vets' here either point out any probable cause for the crash or possably create a better one?

Thanks in advance

Katash

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  

×