Home   Help Search Login Register  

Author Topic: Virtual Artillery during Warfare *RESOLVED*  (Read 1550 times)

0 Members and 1 Guest are viewing this topic.

Offline Pr0ph3t

  • Members
  • *
Virtual Artillery during Warfare *RESOLVED*
« on: 24 Jul 2010, 07:41:40 »
Hey everyone,

I wrote a script that let's you select a coordinate on the map and a strike follows. It works in singleplayer / preview but as soon as I export it to multiplayer and try, the arty never fires.

Basically I have:

2 arty modules synched with their appropriate group (3mlrs + 3 m119)
radio juliet calls mlrs (ArtyFireMLRS.sqs)
radio india calls m119 (ArtyFireM119.sqs)
radio alpha calls position which loads MapClick.sqs
mapclick stores to artmaker, which passes to the arty fires..

In other words here is the sequence for a firemission

Radio Alpha -> MapClick.sqs -> ArtMarker.sqs -> ArtyFireMLRS.sqs --OR-- ArtyFireM119.sqs

MapClick.sqs
=-=-=-=-=-
onMapSingleClick "_pos exec ""ArtMarker.sqs"""

------------------------------------------------------

ArtMarker.sqs
=-=-=-=-=-=-=
   _Marker = createmarker ["ArtTgt1", _this]
   _Marker setMarkerType "Destroy"
   _Marker setMarkerColor "ColorRed"
   _Marker setMarkertext  "ARTILLERY TARGET"

   tgt1 = "Sign_Danger" createVehicle (getMarkerPos "ArtTgt1")

   ~60

   deleteVehicle tgt1

   deleteMarker "ArtTgt1"
   
-------------------------------------------------------------------------------------------
ArtyFireMLRS.sqs
=-=-=-=-=-=-=-

_battery = ArtBattery1;
_targetpos = getMarkerPos "ArtTgt1";
_rounds = "ARTY_12Rnd_227mmHE_M270";
_hetemplate = ["TIMED", "HE", 1, 75];


if ([_battery, _targetpos, _heTemplate select 1] call BIS_ARTY_F_PosInRange) then
{
        {this removemagazines _x} foreach magazines units group BatteryGroup1;
   {this addMagazine _rounds} foreach units group BatteryGroup1;

   [_battery, true] call BIS_ARTY_F_SetShellSpawn;

   [_battery, _targetpos, _hetemplate] call BIS_ARTY_F_ExecuteTemplateMission;

   hint "Commencing fire mission, emptying rocket salvos on designated coordinates";
}
else{hint "Target either too far or too close!";};

---------------------------------------------------------------------------------------------------

ArtyFireM119.sqs
=-=-=-=-=-=-=-

_battery = ArtBattery2;
_targetpos = getMarkerPos "ArtTgt1";
_rounds = "ARTY_30Rnd_105mmHE_M119";
_hetemplate = ["TIMED", "HE", 3, 75];

if ([_battery, _targetpos, _heTemplate select 1] call BIS_ARTY_F_PosInRange) then
{
        {this removemagazines _x} foreach magazines units group BatteryGroup2;
   {this addMagazine _rounds} foreach units group BatteryGroup2;

   [_battery, true] call BIS_ARTY_F_SetShellSpawn;

   [_battery, _targetpos, _hetemplate] call BIS_ARTY_F_ExecuteTemplateMission;

   hint "Commencing fire mission 75 second voley of 3 second M119 HE bursts";
}
else{hint "Target either too far or too close!";};

-----------------------------------------------------------------------------------------------

Can't get this to work in warfare / multiplayer but works fine everywhere else... any ideas?

The artymodules are synched to 3 grouped virtual logics each.
The MLRS has the init to setvirtual gun (as on the biki)

EDIT
~~~

Ok so a few things where done wrong here.

My first attempt was to use physical artillery which would never work because the units could never get into formation (warfare randomizes starting positions) and I think the whole synch to 2 module thing messes it up (synched to warfare + arty)

SO Instead I decided to go virtual artillery. The beginner mistake I made was to think that it would automatically spawn the units and fire whereas it retains its original location.

so I placed the artillery units in the middle of the map without synching them to the warfare module. And it works.  Unless the target is too far or too close.

Now the final addition I would like to make to this script is a HINT that pops up and tells you the distance between the virtual arty and your target, and for some reason my script will never show TARGET TOO CLOSE OR TOO FAR
« Last Edit: 24 Jul 2010, 19:26:34 by Pr0ph3t »