Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Luftwaffles

Private
Registered:
Posts: 14
Reply with quote  #1 

Anyone know what's wrong? They fire their rockets then stop. I'm not looking for the rockets to hit a target; I'm just using them for ambiance at the beginning of the mission. Here is what I'm using that I've adapted from the direct artillery script I found on the Iron Front forums:

 

_d30=_this select 0

(gunner _d30) disableAI "AUTOTARGET"

_d30TARG1=_this select 1

_GUNHEIGHT=_this select 2

_Radius=_this select 3

_droptime=_this select 4

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)

_X = GetMarkerpos _d30TARG1 select 0;

_Y = GetMarkerpos _d30TARG1 select 1;

_d30 DoWatch [_X,_Y,_GUNHEIGHT];

~(3+(Random 10))

#start
if (isServer) exitWith {};

_d30 setVehicleAmmo 3;

~3
_X3=_X-(Random 20);
_Y3=_Y-(Random 20);
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X3,_Y3,_GUNHEIGHT2];

?(not alive gunner _d30): exit

_d30 fire "Lib_BM13"

~_droptime

_X1 = GetMarkerpos _d30TARG1 select 0;

_Y1 = GetMarkerpos _d30TARG1 select 1;

_X1 = _X1+((Random _Radius)-40);

_Y1 = _Y1+((Random _Radius)-40);

_Bomb="ARTY_40Rnd_120mmHE_BM21" CreateVehicle [_X1,_Y1,0];

~(5+(Random 3))
_X2=_X+(Random 20)
_Y2=_Y+(Random 20)

0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #2 
Yes it looks like this line is wrong

_d30 setVehicleAmmo 3;


It should be

_d30 setVehicleAmmo 1;


With this code you can only have a number between 0 and 1, 0 being empty and 1 being full and anything inbetween for example 0.5 being half full etc

Try that.
0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #3 
No that doesnt work either, it re-fills its ammo, but doesn't carry on fireing. Will continue to have a look

[EDIT] Its a looping script and the one you posted above doesnt loop, your missing this lot off the bottom of the script, just copy and paste it to the bottom of your script and it will work.

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X2,_Y2,_GUNHEIGHT2];
~3
goto "start"


and change the setvehicle ammo thing to 1

 

 

 



0
[EVO] Dan

Sergeant
Registered:
Posts: 85
Reply with quote  #4 
It isn't in a while loop, so it just goes top to bottom and then exits, so I guess that could be the issue your having (so fires once, rearms, then you need to reexecute the script for it to fire again. I assume your doing it on a radio trigger or are you using another method? Either way you need to either reexecute the script, or create a while loop that perhaps loops however many times you want it to fire before exiting the script.
0
Luftwaffles

Private
Registered:
Posts: 14
Reply with quote  #5 

I changed that in my script, and then when I was looking, apparently I was also missing the "goto_start" or whatnot at the end of the script, so I'm guessing that's what went wrong : )

 

Thank you very much!

0
Luftwaffles

Private
Registered:
Posts: 14
Reply with quote  #6 
How could I make it fire and reload say 5 times before resting, Dan? Mine just constant fires, but once I get past the beginning they won't actually be doing anything but soaking up resources : ) So how would I make a "while loop" out of that script?
0
[EVO] Dan

Sergeant
Registered:
Posts: 85
Reply with quote  #7 
you could put a while loop with the reload and fire part in it. Then at the bottom (but still inside) of the loop, you could have a counter that added a number.

So something like

_n = 0;
while{_n >= 4} do{

insert code..

_n = _n + 1;
};

That would fire 5 times before exiting (provided I managed to put the sign the right way around)
0
Luftwaffles

Private
Registered:
Posts: 14
Reply with quote  #8 

This is kinda new to me, so I'm completely lost as to where to put that coding or what to put in. Could you show me? Currently my script is this:


; ****************************************************************
; Script file for Armed Assault
; Created by: TODO: Author Name
; ****************************************************************

_d30=_this select 0

(gunner _d30) disableAI "AUTOTARGET"

_d30TARG1=_this select 1

_GUNHEIGHT=_this select 2

_Radius=_this select 3

_droptime=_this select 4

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)

_X = GetMarkerpos _d30TARG1 select 0;

_Y = GetMarkerpos _d30TARG1 select 1;

_d30 DoWatch [_X,_Y,_GUNHEIGHT];

~(3+(Random 10))

#start
if (isServer) exitWith {};

_d30 setVehicleAmmo 1;

~3
_X3=_X-(Random 20);
_Y3=_Y-(Random 20);
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X3,_Y3,_GUNHEIGHT2];

?(not alive gunner _d30): exit

_d30 fire "Lib_BM13"

~_droptime

_X1 = GetMarkerpos _d30TARG1 select 0;

_Y1 = GetMarkerpos _d30TARG1 select 1;

_X1 = _X1+((Random _Radius)-40);

_Y1 = _Y1+((Random _Radius)-40);

_Bomb="ARTY_40Rnd_120mmHE_BM21" CreateVehicle [_X1,_Y1,0];

~(5+(Random 3))
_X2=_X+(Random 20)
_Y2=_Y+(Random 20)


goto "start"

0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #9 
This is the script as it should be for a visual effect of the Kat constantly firing, reloading and firing. The only thing that will stop it firing is killing the gunner or destroying the Kat.
The part I added is in blue and the part thats in red is something that wont work at all due to that class name being a magazine and not a round.

This script as it is won't have the simulation of 16 rockets landing, it will if using a round class name where the writing is red have a single round landing for each loop of the script, and I think in this case there are 16 rockets fired for each script loop.
_d30=_this select 0

(gunner _d30) disableAI "AUTOTARGET"

_d30TARG1=_this select 1

_GUNHEIGHT=_this select 2

_Radius=_this select 3

_droptime=_this select 4

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)

_X = GetMarkerpos _d30TARG1 select 0;

_Y = GetMarkerpos _d30TARG1 select 1;

_d30 DoWatch [_X,_Y,_GUNHEIGHT];

~(3+(Random 10))

#start
if (isServer) exitWith {};

_d30 setVehicleAmmo 3;

~3
_X3=_X-(Random 20);
_Y3=_Y-(Random 20);
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X3,_Y3,_GUNHEIGHT2];

?(not alive gunner _d30): exit

_d30 fire "Lib_BM13"

~_droptime

_X1 = GetMarkerpos _d30TARG1 select 0;

_Y1 = GetMarkerpos _d30TARG1 select 1;

_X1 = _X1+((Random _Radius)-40);

_Y1 = _Y1+((Random _Radius)-40);

_Bomb="ARTY_40Rnd_120mmHE_BM21" CreateVehicle [_X1,_Y1,0];

~(5+(Random 3))
_X2=_X+(Random 20)
_Y2=_Y+(Random 20)

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X2,_Y2,_GUNHEIGHT2];
~3
goto "start"
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.