Forum Jump :

Author Message


Posts: 25
Rank:


Level: Member

Country: nz
Location: Christchurch, New Zealand
Occupation:
Age:
In-game name: madiba127

 
#1 Posted at 2011-01-08 00:38        
     
i am new here and i have searched all over the place for the answer to my question but i can't find one

so what i am trying to do is have some AI shoot at targets (the practice Range Ones) but they don't, i would like them to do this over and over (forever) as i am trying to make a movie with ARMA II (so far so good) and it involves a training base where i am using AI as soldiers being trained

any one know how to get the AI to attack/shoot the range targets over and over again and in prone/crouch positions

sorry if I'm to hard to understand its hard to describe what i am trying to do

===Madiba127===

This post was edited by Foxhound (2011-01-24 11:20, ago)

===Madiba127===

http://madiba127.proboards.com

Author Message


Posts: 25
Rank:


Level: Member

Country: nz
Location: Christchurch, New Zealand
Occupation:
Age:
In-game name: madiba127

 
#2 Posted at 2011-01-14 08:20        
     
ok so i take it that no one knows how to do this which i am fine with as this is not a high priority for me

===Madiba127===

http://madiba127.proboards.com

Advertisement


Author Message


Posts: 510
Rank:


Level: Member

Country: us
Location: Baltimore, Maryland
Occupation:
Age:
In-game name:

 
#3 Posted at 2011-01-14 23:00        
     
well it is possible as i have done it many times however, when i ported my template from A2 to A2OA it seemed to stop working..dont know why, i use the same code in but for some reason they only shoot the first magazine then quite, i use to have it set up so they would use a ammobox with infinite ammo(but man after awhile it got annoying lmao), im at work but ill try to upload a deamo to get you started untill i find an solution!

Dave,

"Respect is the key to life... with out it we have nothing"

Author Message


Posts: 25
Rank:


Level: Member

Country: nz
Location: Christchurch, New Zealand
Occupation:
Age:
In-game name: madiba127

 
#4 Posted at 2011-01-16 21:18        
     
thanks

===Madiba127===

http://madiba127.proboards.com

Author Message


Posts: 510
Rank:


Level: Member

Country: us
Location: Baltimore, Maryland
Occupation:
Age:
In-game name:

 
#5 Posted at 2011-01-17 14:01        
     
still have not had time to look into this, but try this for now and let me know! Target1 (the object the AI will shoot at), Gunman1 (the AI who will target your Object=Target1).

Gunman1 doTarget Target1; Gunman1 doFire Target1;

"Respect is the key to life... with out it we have nothing"

Author Message

palyarmerc  

I live inside the editor


Posts: 753
Rank:


Level: Member

Country: uk
Location:
Occupation: *Retired from ArmA*
Age:
In-game name: Paly

 
#6 Posted at 2011-01-17 16:19        
     
soldier2390 method worked ok, but not with all objects, just shooting range target (still testing)

This post was edited by palyarmerc (2011-01-19 01:15, ago)

....that's all folks....!

Author Message


Posts: 510
Rank:


Level: Member

Country: us
Location: Baltimore, Maryland
Occupation:
Age:
In-game name:

 
#7 Posted at 2011-02-02 16:54        
     
yeah i noticed that too, seems to only work on targets and "Sometimes" other AI! however unfutunitly i find it way easier to have AI shoot there own guys, then the enemy lol!

"Respect is the key to life... with out it we have nothing"

Author Message


Posts: 25
Rank:


Level: Member

Country: nz
Location: Christchurch, New Zealand
Occupation:
Age:
In-game name: madiba127

 
#8 Posted at 2011-03-17 08:34        
     
so i decide to use the targets after changing a lot on my FOB but the ai only attack once and then stop, but i want them to keep attacking

===Madiba127===

http://madiba127.proboards.com

Author Message


Posts: 18
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#9 Posted at 2012-08-01 14:55        
     
I have this script, It's the AI Fire script and an unlimited ammo script, try that
Gunman1 doTarget Target1; Gunman1 doFire Target1;this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]


Author Message


Posts: 23
Rank:


Level: Hidden

Country: iq
Location:
Occupation:
Age: 24
In-game name: Mohammed

 
#10 Posted at 2012-08-01 15:00        
     
i really knows a bit about arma2 scripts but i think that should be a script or something to make the AI fire at specified area ??


Author Message


Posts: 18
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#11 Posted at 2012-08-02 22:02        
     
I actually got the answer [Thank you ltsThomas]
Heres the Script
Gunman1 doTarget Target1; Gunman1 doFire Target1;
this allowdamage false; this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]
I tried it, it works, Have them fire at a vehicle like a Takistani Army UAZ, put this allowdamagefalse in the init and then add the usual targeting scripts to the people, name the UAZ Target1, the shooter Gunman1 and voila!

This post was edited by Seancm98 (2012-08-03 15:05, ago)


Author Message


Posts: 24
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#12 Posted at 2013-04-02 20:32        
     
So does this work?


Author Message


Posts: 2
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#13 Posted at 2015-08-29 17:48        
     
Found this script and got it running in Arma3 as I wanted to have some ambient shooting at the Kamino Shooting-Range. It seems this is only working on Training targets, which is fair enough for me. Unfortunatly my tanks only shoot once, but not repeatingly. Any suggestion how to adjust this script to let it run infinitely?

this doTarget Target1; this doFire Target1;  this allowdamage false; this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]


Author Message


Posts: 59
Rank:


Level: Member

Country: ca
Location: Quebec
Occupation:
Age:
In-game name:

 
#14 Posted at 2015-08-29 18:26        
     
Try this...

// CALL USING: nul = [unit_Name, _target_Name] execVM "fireRange.sqf";

private ["_Unit","_Target","_Group","_Magazine","_Primary","_CurrentWeapon","_WeaponMode","_Ammo"];

_Unit	= _this select 0;
_Target	= _this select 1;

while {true} do {

_Group = group _Unit;
_Magazine = primaryWeaponMagazine _Unit;
_PrimaryWeapon	= primaryWeapon _Unit;
_CurrentWeapon	= currentWeapon _Unit;
	
if 	(_CurrentWeapon != _PrimaryWeapon)
then 	{_Unit selectWeapon _PrimaryWeapon};

sleep 1;

_WeaponMode	= currentWeaponMode _Unit;
_Ammo 		= _Unit ammo _PrimaryWeapon;

doStop _Unit;
_Group 	reveal 	_Target;
_Unit 	doTarget _Target;
_Unit 	doWatch _Target;
_Unit 	setBehaviour "COMBAT";
_Unit 	setCombatMode "YELLOW";
_Unit 	setUnitPos "MIDDLE";

if (_Ammo == 0 ) then {reload _Unit;};

sleep 1;

_Unit 	disableAI "TARGET";
_Unit 	disableAI "AUTOTARGET";

for [{_i = _Ammo},{_i > 0},{_i =_i-1}] do
{
	_Unit forceWeaponFire [_PrimaryWeapon, _WeaponMode];
	sleep (0.01+(random 1));
};

sleep 1;

reload _Unit;

};


Author Message


Posts: 59
Rank:


Level: Member

Country: ca
Location: Quebec
Occupation:
Age:
In-game name:

 
#15 Posted at 2015-09-02 11:41        
     
The previous example did not seem to work apparently... this one might...requires testing in-game.


// CALL USING: nul = [unit_Name, _target_Name] execVM "fireRange.sqf";

private ["_Unit","_Target","_Group","_Magazine","_Primary","_CurrentWeapon","_WeaponMode","_Ammo","_magazineClass"];

_Unit	= _this select 0;
_Target	= _this select 1;

while {true} do {

_Group = group _Unit;
_Magazine = primaryWeaponMagazine _Unit;
_PrimaryWeapon	= primaryWeapon _Unit;
_CurrentWeapon	= currentWeapon _Unit;
	
if 	(_CurrentWeapon != _PrimaryWeapon)
then 	{_Unit selectWeapon _PrimaryWeapon};

sleep 1;

_WeaponMode	= currentWeaponMode _Unit;
_Ammo 		= _Unit ammo _PrimaryWeapon;
_magazineClass  = currentMagazine _Unit;

doStop _Unit;
_Group 	reveal 	_Target;
_Unit 	doTarget _Target;
_Unit 	doWatch _Target;
_Unit 	setBehaviour "COMBAT";
_Unit 	setCombatMode "YELLOW";
_Unit 	setUnitPos "MIDDLE";

if (_Ammo == 0 ) then {reload _Unit;};

sleep 1;

_Unit 	disableAI "TARGET";
_Unit 	disableAI "AUTOTARGET";

for [{_i = _Ammo},{_i > 0},{_i =_i-1}] do
{
	_Unit forceWeaponFire [_PrimaryWeapon, _WeaponMode];
	sleep (0.01+(random 1));
};

sleep 1;
_Unit addMagazine _magazineClass;
sleep 1;
reload _Unit;

};






Tags: Ai, Range