Advertisement

Author Topic: My Artillery Script  (Read 863 times)

0 Members and 1 Guest are viewing this topic.

Offline Ghost644

  • Members
  • *
    • Ghostland
My Artillery Script
« on: 05 Jul 2009, 03:43:56 »
I made an Artillery script which I am pretty satisfied with the results. I plane on making it better and more customizable but for now it is fine. Few issues:

  • script runs but artillery does not fire for clients, always works for host(untested on dedi server)
  • cannot get BIS_ARTY_F_LoadMapRanges to load arty ranges
  • setradiomsg does not hide for clients

I am still learning how to do this scripting stuff and understand some of it but global, local still gets me. To use create an empty marker named whatever you like. Create Functions and Artillery Modules naming the Artillery Module. Create artillery pieces and add artillery ammo to them and name leader. create radio trigger, repeatedly, onact put
Code: [Select]
arty = [artmodule,"marker",rounds in # format,leader name] execVM "dta\scripts\artillery.sqf";make sure to adjust array for what you named your stuff

Code: [Select]
/*script by: Ghost    designed for 3 arty triggers of 4,8,16 rounds setup: create marker type: empty, create 3 radio triggers repeat onact: arty = [firebase,"arty",4,gun1] execVM "dta\scripts\artillery.sqf"; Make sure you have the Functions and ArtilleryModule on map as well. Name Arty Module Whatever you like ie firebase and link module to your arty pieces.
*/

if (!isServer) exitWith {};

waituntil {!isnil "bis_fnc_init"};

_battery = _this select 0;
_marker = _this select 1;
_rnds = _this select 2;
_artleader = _this select 3;

_hetemplate = ["IMMEDIATE", "HE", 0.5, _rnds];

hint "Left click on map to set target coordinates";

_map = [_battery, "HE"] call BIS_ARTY_F_LoadMapRanges;

mapclick = false;

onMapSingleClick """arty"" setMarkerPos _pos; clickpos = _pos; mapclick = true; onMapSingleClick """";true;";

waituntil {mapclick};
_pos = clickpos;

if ([_battery, _hetemplate] call BIS_ARTY_F_StillViable) then
{

_marker setmarkertype "mil_destroy";

1 setRadioMsg "NULL"; radio1=false;
2 setRadioMsg "NULL"; radio2=false;
3 setRadioMsg "NULL"; radio3=false;

sleep 2;

// Check to see if position is in range before we fire.
// Second item in _fmTemplate is the ordType (HE, ILLUM, etc)
if ([_battery, _pos, _hetemplate select 1] call BIS_ARTY_F_PosInRange) then
{
_disp = [_battery, 200] call BIS_ARTY_F_SetDispersion;
sleep 1;
_fire = [_battery, _pos, _hetemplate] call BIS_ARTY_F_ExecuteTemplateMission;
waitUntil {_battery getVariable "ARTY_ONMISSION"};
_artleader sidechat "Artillery Firing.";

waitUntil {_battery getVariable "ARTY_SPLASH"};
_artleader sidechat "Incoming!";

waitUntil {_battery getVariable "ARTY_COMPLETE"};

sleep 30;

_marker setmarkertype "empty";
1 setRadioMsg "Artillery 4rnds HE"; radio1=true;
2 setRadioMsg "Artillery 8rnds HE"; radio2=true;
3 setRadioMsg "Artillery 16rnds HE"; radio3=true;

_artleader sidechat "Artillery Ready.";
} else
{
_artleader sidechat "Target out of range! Try again.";
_marker setmarkertype "empty";
1 setRadioMsg "Artillery 4rnds HE"; radio1=true;
2 setRadioMsg "Artillery 8rnds HE"; radio2=true;
3 setRadioMsg "Artillery 16rnds HE"; radio3=true;
};
} else
{
hint "Artillery Dead";
1 setRadioMsg "NULL"; radio1=false;
2 setRadioMsg "NULL"; radio2=false;
3 setRadioMsg "NULL"; radio3=false;
};

if (true) exitWith {};
Ghost

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: My Artillery Script
« Reply #1 on: 05 Jul 2009, 07:45:46 »
1. To avoid overwriting other peoples gvs:
Code: [Select]
arty =
=>
Code: [Select]
YourTag_Arty =
http://www.ofpec.com/tags/

2. Extract the modules.pbo and study the arty scripts.
Maybe you can disable its communication.

3. Check existing arty functions to study and learn:

Real Artillery by Jones
Fire Control Calculator by Blake
Chops Artillery by Chops Updated to 1.3 by Viper169th
OnMapClick Artillery by SoLo
Viper Artillery by Viper169th
Physics-based Artillery by Luke

 :good: