Home   Help Search Login Register  

Author Topic: Creepy! Artillery Q?  (Read 3859 times)

0 Members and 1 Guest are viewing this topic.

Offline Lucky Ed

  • Members
  • *
Creepy! Artillery Q?
« on: 05 Jun 2009, 17:15:39 »
I want to make a ARTY fire mission with a creeping barrage. I'm using the ARTY gamelogic and this '[group arty_1, getPosASL targetUnit, ["IMMEDIATE", "HE", 0, 3]] call BIS_ARTY_F_ExecuteTemplateMission'  in a trigger that is set off by enemy precense

This works lige a charm for the first salvo

Q: but to make the creeping barrage, I need a way to detect when my ART have fired thier 3 rounds. This so I can use that info to set of another trigger, to give them a new 3 round target (using invisble H-pad).

Can this somehow be done?
Saw som script in the ArtyDemo_MLRS_SOM that said 'Som1 getVariable "initDone"' to set off a trigger. Can I use something like that?

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Creepy! Artillery Q?
« Reply #1 on: 05 Jun 2009, 18:11:38 »
No, that has nothing whatsoever to do with what you are doing. It is to allow the SecOps module to fully initialize itself before you start sending it requests. You should give the arty logic to the mission template, not its group (the logic should be synced with the group of guns, not grouped with it).

You can wait until a battery is finished its mission with BIS_ARTY_F_Available. e.g.
Code: [Select]
_pos = getPosASL targetUnit;
for "_i" from 1 to 10 do
{
  [batteryLogic, _pos, ["IMMEDIATE", "HE", 0, 3]] call BIS_ARTY_F_ExecuteTemplateMission;
  waitUntil { [batteryLogic] call BIS_ARTY_F_Available };
  // Alter _pos array.
};

And to check they can still fire (not destroyed or drunk or whatnot):
Code: [Select]
[batteryLogic] call BIS_ARTY_F_StillViable

Hmm, there may be a way to get creeping artillery already in the artillery module. Haven't looked deeply enough to see if that is possible yet though.
« Last Edit: 05 Jun 2009, 18:13:22 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Lucky Ed

  • Members
  • *
Re: Creepy! Artillery Q?
« Reply #2 on: 06 Jun 2009, 12:11:15 »
So the code you wrote, if I'm understanding it correct, is going to shot 3 rounds, wait for the game logic to complete it, alter the position og the target (that code I have to write myself  :D) and does it 10 times in a row? (That's what the for '"_i" from 1 to 10 do' is for right?).

Man alot have changed since the "good ol'" sqs days" Think I'll have to read the beginners tutorial again.  ;)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Creepy! Artillery Q?
« Reply #3 on: 07 Jun 2009, 14:47:50 »
Yup, you got it. I just gave you a very rough starting point. You might find something like:
Code: [Select]
// Gives 11 target points (once every 10m for 100m)
_length = 100;
_spacing = 10;
for "_offset" from -(_length / 2) to +(_length / 2) step _spacing do
to be more useful, since then the target unit would be in the centre of the barrage, not at the end.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Lucky Ed

  • Members
  • *
Re: Creepy! Artillery Q?
« Reply #4 on: 09 Jun 2009, 13:37:48 »
Ok, so I tried this in a script:

Code: [Select]
_art = _this select 0;
_tar = _this select 1;


for "_x" from 1 to 10 do
{
  [_art, getPosASL _tar, ["IMMEDIATE", "HE", 0, 3]] call BIS_ARTY_F_ExecuteTemplateMission;
  waitUntil { [_art] call BIS_ARTY_F_Available };
};

Where I pass this in a trigger

Code: [Select]
call { [ArtM1,targetUnit1] execVM "arty.sqf"; }
This makes the mortars fire 3 rounds at _tar and then nothing
I have a group of  3 motars named arty1 where the leader is synched to the ArtM1 gamelogic.
By my understanding this should fire 3 rounds wait for the ArtM1 to be available again and then fire 3 rounds 9 times more? why does this not happen?

Spooner:
Though I understand the meaning of the code
Code: [Select]
// Gives 11 target points (once every 10m for 100m)
_length = 100;
_spacing = 10;
for "_offset" from -(_length / 2) to +(_length / 2) step _spacing do
I have no idea  how to implement it into the script. What would "_offset" be and how do I get the _length to be a [x,y,z] coordiante?  
« Last Edit: 09 Jun 2009, 14:35:19 by Lucky Ed »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Creepy! Artillery Q?
« Reply #5 on: 10 Jun 2009, 02:24:49 »
Hmm, it works fine for me generally, but when I tested with the mortar group placed on steep rough terrain, the formation they took was so close together that they blew each other up when the second one fired a round (the second and third were both in exactly the same position! Thus, manually check where they end up getting placed and consider using a formation "NONE" for each of them so you can have complete control over their placement!!!

Remember that it takes about 20 seconds before the mission is over when I tested firing from one end of utes to the other with mortars. Other ranges and weapons could be very different.

Incidentally, don't use _x as the iterator in a for loop. _x is a special system variable used in forEach loops. Works fine, I'm sure, but not good practice.

Haven't time to test it, but start with something like:
Code: (creep.sqf) [Select]
// From editor:
// call { [battery, mytarget, 45, 100, 10] execVM "creep.sqf"; }

_art = _this select 0;
_tar = _this select 1; // Object or position of centre of line.
_dir = _this select 2; // Direction of creep.
_length = _this select 3;
_spacing = _this select 4;

_centre = if (isObject _tar) then { getPos _tar } else { _tar };

for "_offset" from -(_length / 2) to +(_length / 2) step _spacing do
{
  _pos = [(_centre  select 0) + ((sin _dir) * _offset),
              (_centre  select 1) + ((cos _dir) * _offset),
              (_centre  select 2)];

  [_art, _pos, ["IMMEDIATE", "HE", 0, 3]] call BIS_ARTY_F_ExecuteTemplateMission;
  waitUntil { [_art] call BIS_ARTY_F_Available };
};
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Lucky Ed

  • Members
  • *
Re: Creepy! Artillery Q?
« Reply #6 on: 10 Jun 2009, 19:52:12 »
Must be something buggy about my game, I can't get anything to work when I try to use scripts. :(

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Creepy! Artillery Q?
« Reply #7 on: 12 Jun 2009, 02:47:59 »
Well, I did say I hadn't tested the script, so it might well have errors in it. Sorry that I don't have time to spend on it (I can write most of it from my head, but I always make a dumb mistake; proper testing, however, will take 30 minutes not 5, so take what I've given you and fix it or hope that someone else will make it work).

Something new for Arma2 is that you no longer get popup messages when there are script errors; it just puts a message in the RPT log. Thus, you don't get the same amount of error feedback you used to get in Arma1.
« Last Edit: 12 Jun 2009, 02:55:47 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)