Jump to content
weaponsfree

AI Lasers without Combat Behavior

Recommended Posts

I'm trying to get some AI to walk from point A to point B with lasers on, but NOT in combat mode. As far as I can tell, AI will only use lasers if :

 

a )  Their group has enableIRLasers to true

group enableIRLasers true

b ) Are in Combat mode.

The issue is, that I want them walking calmly, in formation, and straight through. In combat they run around, take cover, go prone etc.

I've thought to switch setunitpos to UP until they make contact, and setting it back to AUTO, but this does not keep them in formation and they still jog from cover to cover.

 

Any ideas?

Share this post


Link to post
Share on other sites

this enableGunLights "forceon";

 

Thanks but I had tried that. But it doesn't answer my needs cause you really do have to be in Combat mode, and all the problems mentioned above remain. (plus I think gunlights only works with flashlights).

I'm actually almost there. I was able to have walking, no cover, combat mode, laser on movement with :

{_x setunitpos "up"; _x disableAI "cover"; _x forcewalk true} forEach units sqd2

Now reactivating their normal combat behavior is just reversing the script 

{_x setunitpos "auto"; _x enableAI "cover"; _x forcewalk false} forEach units sqd2

But I'm having trouble setting up the trigger for reactivation. I want the group to reactivate when it spots any BLUFOR. But the knowsabout command seems to only allow sides to knowabout units/groups. Not unit/groups knowing about sides. I'm an utter noob at scripting, so not sure if there is an easy way to "reverse" the knowsabout script. Looking into that now.

Share this post


Link to post
Share on other sites

Have you tried

EAST knowsAbout (side player);
at all? I'm unable to test at this time, but you could quickly plug this in if you have not already and see what happens. This is obviously assuming the player is on the BLUFOR/WEST side; if that's not the case then you'll need to adjust accordingly.

Share this post


Link to post
Share on other sites

Have you tried

EAST knowsAbout (side player);
at all? I'm unable to test at this time, but you could quickly plug this in if you have not already and see what happens. This is obviously assuming the player is on the BLUFOR/WEST side; if that's not the case then you'll need to adjust accordingly.

 

 

I tried it, I get : Knowsabout : Type side, expected Object.

And in my case, I'm trying to know when a specific EAST group knows about WEST, or alternatively knows about the player and his squad.

 

I want this so I can deactivate those commands on an each group individually as they encounter WEST or the player.

Share this post


Link to post
Share on other sites

Why would they be wasting batteries strolling around with their lasers on?

Share this post


Link to post
Share on other sites

Why would they be wasting batteries strolling around with their lasers on?

 

Because reasons.

Or more specifically because it looks cool in the Tanoan Jungle

Or more more specifically because the mission would be too hard without enemy giving away their positions with lasers. It's a tradeoff for the sake of fun.

Or more more more specifically because I am now obsessed with finding a solution.

 

  • Like 1

Share this post


Link to post
Share on other sites

Sorry my suggestion didn't work and for wasting your time. Normally I'd test before posting, but I don't have access to Arma today.

Share this post


Link to post
Share on other sites

Sorry my suggestion didn't work and for wasting your time. Normally I'd test before posting, but I don't have access to Arma today.

No worries. My mission is stuck at the moment and my brain is fried. So I'm going to do a generic Detected by Opfor trigger that will switch all patrols back to normal until I can figure out a way to trigger them individually. (probably start a new thread since this one was about lasers and that issue is OK for me now). Thanks for the post.

Share this post


Link to post
Share on other sites

I ended up exchanging lasers for flashlights then using forceon. Not quite as cool but found it difficult to get lasers to work. 

Share this post


Link to post
Share on other sites
On 7/23/2016 at 9:41 PM, Incontinentia said:

I ended up exchanging lasers for flashlights then using forceon. Not quite as cool but found it difficult to get lasers to work. 

how force laseer on ????

help

Share this post


Link to post
Share on other sites

No way for that.

You can try:

onEachFrame { {_x action ["IRLaserOn", _x] } forEach units yourGroupHere };

with a very poor result from time to time, when framed display is in accordance with the laser beam.

Share this post


Link to post
Share on other sites

What's currently working as of 1.85 devbranch:

group this enableIRLasers true;//will activate IR lasers if unit has IR lasers on rifle and enters combat behavior
group this setBehaviour "COMBAT";//enters combat mode immediately

Should result in the group enabling IR lasers.

Only works when group is in combat behavior, no other behavior allows this...

 

As to the suggestion from @pierremgi, unfortunately this isn't reliable at all.

Last time I checked this the lasers will turn off after some time, no matter if using onEachFrame or EachFrame EH.

 

It's still odd that so much stuff (script commands etc.) are tied to AI behavior/combat modes...

Such a weird decision to make AI behavior override script commands.

Mind boggling.

 

Cheers

Share this post


Link to post
Share on other sites

I know this is late, but I know the effect you're looking for and I use it as well. It looks awesome. 

There is no known work around to make them walk normally with lasers on, but what you can do is make them do a cutscene animation like:

unit switchMove "ActsPercMstpSlowWrflDnon_sceneLopotevBandCaptured_Cooper"; 

 

Disable your units 'move' and 'target' abilities. Put them in combat mode and enableIR lasers. When the animation is triggered, he will now walk around searching your jungle with lasers on for like 30 seconds. If you finesse it enough, as I do, you can combine many animations to make a whole squad. Say, once you cross a certain trigger area, a whole squad fans out looking for you. The problem now, of course, is that you can't shoot at them. In fact, this is purely aesthetic, the units aren't even part of the game. So I use this stuff more as an intro. You have to build a whole scene brick by brick. 

But, you can work around that as well. You can force them to fire from an animation and create a whole scene if you'd like. Or, you can really get surgical with it and pinpoint their exact locations within the animation. So, once he reaches a tree or something, you setPos an identical unit with the same gear, hideObject the animated one, and boom, visibly it's the same guy, physically he's now in the game with IR lasers on. I use this method to weave together intros with real scenarios into seamless action. I have many missions with whole squads clearing out entire villages and buildings room by room by carefully weaving together animations and 'sleep' firing at specific times. It takes a lot of work, but if you're that interested in creating a reeeally awesome dramatic set up, it's possible with enough finesse. 

Share this post


Link to post
Share on other sites

Sorry to necro the thread, 

 

Any work around on this now that it's 2019?

 

 

Share this post


Link to post
Share on other sites

@Windy5000,
 

Quote

Any work around on this now that it's 2019?


It seems @Grumpy Old Man above is the answer and @bcon117, is the work around. Another work around would be to make the laser beam a static object literally attached to the rifle model but that's terrible. There may be a way to make a custom class configuration in which your custom weapon has the laser as an alternative (automatic) function (by script). But that is WAY out of my skill to help with.

Further above the simple question is posed, "But why?", and I'll ask again. The laser would only be on in the case that targets were being designated. But I won't claim to know your project. So, what do you want to happen, exactly?


 

Share this post


Link to post
Share on other sites

Well since you asked ive been designing this 2 player minimum, 1 Pilot, 1 Officer, 8 max dynamic mission. 

Been working on it for a good few years and the scopes continued to change with the awesome DLCs released. 

 

I need the AI to have their lasers on without the combat behaviour syntax. 

Not massively important but would be nice. 

 

Operation: Aegis Strike

vq4efc.jpg

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@Windy5000,
The mission sounds cool. You said,

Quote

I need the AI to have their lasers on without the combat behaviour syntax. 

But why? What I'm driving at here is that we may be able to come up with an alternate solution based on your specific criteria if we know exactly what that criteria is. For example, if this is for visual effect only the workaround above, or some variation thereof, may work for you. How are the dudes spawned? Do they interact with the player? Are they actors or enemies? This kind of thing. Why can't they be in combat behavior?

Share this post


Link to post
Share on other sites

Stay in combat mode, then, in init field of the unit (example):

this enableIRLasers true; 0={this disableAI _x} count ["target","autoTarget","weaponaim","checkVisible"]; this setunitpos "up"

 

At this time I don't know how to lower the weapon.

  • Like 2

Share this post


Link to post
Share on other sites
16 hours ago, wogz187 said:

@Windy5000,
How are the dudes spawned? Do they interact with the player? Are they actors or enemies? This kind of thing. Why can't they be in combat behavior?

 

There enemy and allied alike, i'll search for a script to get this done. 

 

Thanks for the help pierremgi

Share this post


Link to post
Share on other sites

I experimented a little and for someone wishing to reproduce a tense jungle patrol with lasers on this should do great. Only thing is they shout their combat voice commands a lot. Either use enableSentences false or wait to use the second version after 1.95 is released.

Version 1: 

Spoiler

TAG_fnc_removeEHs = {
	params ["_x"];
	_x enableAI "COVER"; 
	_x setUnitPos "AUTO"; 
	_x forceWalk false;
	private _firedNearEH = _x getVariable ["TAG_firedNearEH",-1];
	_x setVariable ["TAG_firedNearEH", nil];
	if(_firedNearEH >= 0) then {
		_x removeEventHandler ["FiredNear", _firedNearEH];
	};

	private _firedManEH = _x getVariable ["TAG_firedManEH",-1];
	_x setVariable ["TAG_firedManEH", nil];
	if(_firedManEH >= 0) then {
		_x removeEventHandler ["FiredMan", _firedManEH];
	};
};

units testGrp apply {
	_x enableIRLasers true;
	_x disableAI "COVER"; 
	_x setUnitPos "UP"; 
	_x forceWalk true; 
	
	_x setVariable [
		"TAG_firedNearEH",
		_x addEventHandler [
			"FiredNear", 
			{
				params ["_unit", "_shooter"];
				if([side _unit, side _shooter] call BIS_fnc_sideIsEnemy) then {
					units group _unit apply { _x call TAG_fnc_removeEHs; };
				};
			}
		]
	];

	_x setVariable [
		"TAG_firedManEH",
		_x addEventHandler [
			"FiredMan", 
			{
				params ["_unit"];
				units group _unit apply { _x call TAG_fnc_removeEHs; };
			}
		]
	];
};
testGrp setBehaviour "COMBAT";
testGrp setSpeedMode "LIMITED";

 

 

Version 2 (Requires 1.95):

Spoiler

TAG_fnc_removeEHs = {
	params ["_x"];
	_x enableAI "COVER"; 
	_x enableAI "RADIOPROTOCOL";
	_x setUnitPos "AUTO"; 
	_x forceWalk false;
	private _firedNearEH = _x getVariable ["TAG_firedNearEH",-1];
	_x setVariable ["TAG_firedNearEH", nil];
	if(_firedNearEH >= 0) then {
		_x removeEventHandler ["FiredNear", _firedNearEH];
	};

	private _firedManEH = _x getVariable ["TAG_firedManEH",-1];
	_x setVariable ["TAG_firedManEH", nil];
	if(_firedManEH >= 0) then {
		_x removeEventHandler ["FiredMan", _firedManEH];
	};
};

units testGrp apply {
	_x enableIRLasers true;
	_x disableAI "COVER"; 
	_x disableAI "RADIOPROTOCOL";
	_x setUnitPos "UP"; 
	_x forceWalk true; 
	
	_x setVariable [
		"TAG_firedNearEH",
		_x addEventHandler [
			"FiredNear", 
			{
				params ["_unit", "_shooter"];
				if([side _unit, side _shooter] call BIS_fnc_sideIsEnemy) then {
					units group _unit apply { _x call TAG_fnc_removeEHs; };
				};
			}
		]
	];

	_x setVariable [
		"TAG_firedManEH",
		_x addEventHandler [
			"FiredMan", 
			{
				params ["_unit"];
				units group _unit apply { _x call TAG_fnc_removeEHs; };
			}
		]
	];
};
testGrp setBehaviour "COMBAT";
testGrp setSpeedMode "LIMITED";

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×