Jump to content
Sign in to follow this  
rjtwins

Arty on laser script help

Recommended Posts

hello all

I'm trying to make a mission in which you must laze somthing (could also be ground so no target), call a strike and arty will come down on it.

I have the player with :

this addAction ["Call firemission","arty.sqf"]

And the sqf file with :

firemission = 1;
reloaded = 0;
while {firemission>0} do
{
   hint "Shells on the way";
   heTemplate = ["IMMEDIATE", "HE", 0, 24];    
   target = getposASL lasertarget;     
   [battery1, target, heTemplate] call BIS_ARTY_F_ExecuteTemplateMission;    
   firemission=0;
   sleep 5;
   hint "Battery reloading"
   sleep 25;
   reloaded = 1;
   hint "Battery ready";
};

What am i doing wrong ??

please keep it simple :)

Share this post


Link to post
Share on other sites

Do you have battery1 properly configured and ranged to actually fire on the target? Also according to the documentation, BIS_ARTY_F_ExecuteTemplateMission only works from the server in an MP mission, I guess.

Edited by kylania

Share this post


Link to post
Share on other sites

The bis_arty_f_ thing workes just fine for me in other singleplayer missions.

And for the rang as far as i know yes, i'm using real arty (no virtual) with arty ammo in CO.

..

Gonna try with virtuals.

No luck with virtuals

Btw is there a way to test if you arty is out of reange ??

---------- Post added at 10:26 PM ---------- Previous post was at 09:08 PM ----------

okay got it working, was indeed a range problem ty :)

Edited by rjtwins
trying...

Share this post


Link to post
Share on other sites

Works fine with virtuals and no idea why the biki says that since it works in the editor.

This includes checking for a valid laser target, range check, only shows the action while arty is available, status reports of the mission.

Make sure you set firemissionAvailable to true somewhere, like the arty game logic's init. This also allows you to turn off the ability globally.

Try this:

addAction:

this addAction ["Call firemission","arty.sqf",[battery1],1,false,true,"","firemissionAvailable"];

For the crazy 24 rounds mission try:

this addAction ["Call firemission","arty.sqf",[battery1, 24],1,false,true,"","firemissionAvailable"];

arty.sqf:

_obj = _this select 0;
_unit = _this select 1;
_act = _this select 2;
_battery = (_this select 3) select 0;
_rounds = if (count (_this select 3) > 1) then {(_this select 3) select 1} else {6};
_heTemplate = ["IMMEDIATE", "HE", 2, _rounds];    
_target = laserTarget _unit;
_avail = [_battery, _heTemplate] call BIS_ARTY_F_Available;

if (!firemissionAvailable || !_avail) exitWith {hint "No artillery support available!"};

if (isNull _target ) exitWith {hint "No laser target found!"};

_pos = getposASL _target;  
[_battery, "HE"] call BIS_ARTY_F_LoadMapRanges;
_min = _battery getVariable "ARTY_MIN_RANGE";
_max = _battery getVariable "ARTY_MAX_RANGE";
_range = _battery distance _pos;
if (_range > _max || _range < _min) exitWith {_unit commandChat format["Artillery reports target not in range. p %1, m %2, x %3",_range, _min, _max]};

firemissionAvailable = false;
[_battery, _pos, _heTemplate] call BIS_ARTY_F_ExecuteTemplateMission;    

waitUntil {_battery getVariable "ARTY_ONMISSION"};
_unit commandChat "Artillery has the mission";

sleep 3;
_gridPos = mapGridPosition _pos;
_unit commandChat format["Artillery confirms %1 rounds on target grid %2.", _rounds, _gridPos];
sleep 3;

waitUntil {_battery getVariable "ARTY_SHOTCALLED"};
_unit commandChat "Artillery reports shot out";

[_battery, _unit] spawn {
   _b = _this select 0;
   _u = _this select 1;
   waitUntil {_b getVariable "ARTY_SPLASH"};
   _u commandChat "Artillery reports splash";
};

waitUntil {_battery getVariable "ARTY_COMPLETE"};
_unit commandChat "Artillery reports rounds complete";

waitUntil {[_battery, _heTemplate] call BIS_ARTY_F_Available};

//sleep 30;  // probably want this delay since the guns were ready before the mission splashed.
firemissionAvailable = true;
_unit commandChat "Artillery ready";

Edited by kylania

Share this post


Link to post
Share on other sites

lol your making it way to complicated...

afther finetuning it a bit i got this woking :).

in player ini

this addWeapon "LaserDesignator"; this addMagazine "LaserBatteries"; this addAction ["Call_firemission","arty.sqf"]

in arty.sqf

_id = _this select 2;
if (alive player) then
{
   player removeAction _id;
   hint "Shells on the way";
   heTemplate = ["IMMEDIATE", "HE", 0, 48];
   target1 = getposASL lasertarget player;  
   firemission=0;
   [RIPPER, target1, heTemplate] call BIS_ARTY_F_ExecuteTemplateMission;
   sleep 5;
   hint "Battery reloading";
   sleep 25;
   hint "Battery ready";
   player addAction ["Call_firemission","arty.sqf"]
};

ty for the hq chat codes btw i'll add that.

with the hq chat codes it looks like this

_id = _this select 2;
heTemplate = ["IMMEDIATE", "HE", 0, 48];
_unit = player;

if (alive player) then
{
   _unit removeAction _id;
   target1 = getposASL lasertarget _unit;

   if (isNull lasertarget _unit) exitWith {hint "No laser target found!"};
   [RIPPER, "HE"] call BIS_ARTY_F_LoadMapRanges;

   _min = RIPPER getVariable "ARTY_MIN_RANGE";
   _max = RIPPER getVariable "ARTY_MAX_RANGE";
   _range = RIPPER distance target1;
   if (_range > _max || _range < _min) exitWith {_unit commandChat format["Artillery reports target not in range. p %1, m %2, x %3",_range, _min, _max]};

   [RIPPER, target1, heTemplate] call BIS_ARTY_F_ExecuteTemplateMission;
   waitUntil {RIPPER getVariable "ARTY_ONMISSION"};
   _unit commandChat "Battery has solution";
   waitUntil {RIPPER getVariable "ARTY_SHOTCALLED"};
   _unit commandChat "Battery opening fire";
   [RIPPER, _unit] spawn {
       _b = _this select 0;
       _u = _this select 1;
       waitUntil {_b getVariable "ARTY_SPLASH"};
       _u commandChat "Splash";
   };
   waitUntil {RIPPER getVariable "ARTY_COMPLETE"};
   _unit commandChat "All rounds completed";
   sleep 5;
   _unit commandchat "Battery reloading";
   waitUntil {[RIPPER, heTemplate] call BIS_ARTY_F_Available};
   _unit commandChat "Battery ready";
   _unit addAction ["Call_firemission","arty.sqf"]

};

Edited by rjtwins

Share this post


Link to post
Share on other sites

I don't understand why you'd rewrite it only to hard code the variables? That makes little sense. :)

Just:

this addAction ["Call firemission","arty.sqf",[RIPPER, 48],1,false,true,"","firemissionAvailable"];

and poof - you have it working with RIPPER and shooting a ridiculous 48 rounds per mission.

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  

×