Jump to content
Sign in to follow this  
Spatsiba

Ghillie Suit Stealth Simulation

Recommended Posts

Hi! 

 

I've been thinking about making a script for snipers wearing ghillie suits to remain undetected if they're laying down completly still. 

My idea is to make a very basic version then build from there. The only issue is that I've not done any arma scripting for years and I'm not too experienced with what's local/server etc. 

 

So far what I thought of is this: 

standStill = False; //Sets the variable that checks if player standing still to false
layDown = False; //Sets the variable that checks if player laying down to false
_unit = player; 
_minSleep = 1;
_maxSleep = 3;
_waitSleep = (random (_maxTime - _minTime)) + _minTime; //Randomly picks 1-3 seconds to sleep
Snipers = { //Names of snipers
	"Dingo1",
	"Dingo2"
};

//Checks if player is whitelisted for stealth
if (_unit in _snipers) then
	{
	_snipers = true
};

//Checks if the player is standing still
_CheckStill = if ((speed (vehicle _unit)) == 0) then 
	{
	standStill = true
	} 
	else 
	{
	standStill = false
};
	
//Checks if a player is laying down
_CheckDown = if (stance player == "PRONE") then 
	{
	layDown = true
	}
	else 
	{
	layDown = false
};

//Makes player civilian to enemy if laying down and standing still
_ActivateStealth = if (standStill) and (layDown) then 
	{
    sleep _waitSleep;
	_unit setCaptive true
	}
	else 
	{
	_unit SetCaptive false
};

It's a bit messy but I've just started. Would appreciate if someone a bit more experienced could help me out both with writing this and implementing it in-game. 

 

One of the issues I have is whether I should even use (server/client)Init.sqf to run it and how. I remember execVM being needed for certain things but can't remember for what etc. 

Share this post


Link to post
Share on other sites
10 minutes ago, 1212PDMCDMPPM said:

I should be far easier to play with the camoufflage coefficient:

 

ex:

player setUnitTrait ["camouflageCoef",0.5];

https://community.bistudio.com/wiki/setUnitTrait

 

Do you have any experience with camouflageCoef? Will it work for enemies going straight by you? 

 

I've tried my current version (slightly edited from current state) and it worked pretty well. The idea is to allow snipers to lay down and not be spotted even if the enemy is walking straight over you. 

Share this post


Link to post
Share on other sites

I've played with camouflageCoef to decrease the AI ability to detect players during a sandstrom (created through fog and particle use). It's useless once the player is detected but it definitively decrease the ability for the AI to identify the player as a ennemy (or see it at all).

 

The issue with your script is that the sniper is setCaptive as soon as he's lying and not moving. I think it's too easy to break "aggro" from the AI, even with a 1-3 second sleep.

Also, not sure if the first comment is still valid:

https://community.bistudio.com/wiki/setCaptive

Share this post


Link to post
Share on other sites
56 minutes ago, 1212PDMCDMPPM said:

I've played with camouflageCoef to decrease the AI ability to detect players during a sandstrom (created through fog and particle use). It's useless once the player is detected but it definitively decrease the ability for the AI to identify the player as a ennemy (or see it at all).

 

The issue with your script is that the sniper is setCaptive as soon as he's lying and not moving. I think it's too easy to break "aggro" from the AI, even with a 1-3 second sleep.

Also, not sure if the first comment is still valid:

https://community.bistudio.com/wiki/setCaptive

Good point. It'd need some kind of check to see if the sniper has been spotted and then do a timer of maybe 5 minutes before you can hide again. I'll look into the whole unitTrait. Didn't know it existed. 

 

Thanks! :)

Share this post


Link to post
Share on other sites

I like this! I would agree with 1212PDMCDMPPM (Dat name) and your last statement. A cool-down for being spotted (maybe even just using KnowsAbout?) would be awesome. Maybe you could have a dual check of KnowsAbout and distance. I am thinking if the AI step right on top of the player they might actually respond (So within 1-2 meters most likely).

 

Awesome work man.


In my opinion you simply need to run this script serverside with a simple execvm. A 'general' rule of thumb when working with AI is to have the script run on the machine that the AI is local to. To my knowledge setCaptive is global so you shouldn't have to worry about that locality mess.

 

As for using execVM or not - it depends on how you handle the loop. If you put the whole script in a while {true} do {}; loop you could simply use execVM

If you execute the script over and over again it might be worth using a compile preproccessfilenumbers (Or something like that) to have the script saved into memory so it can be executed faster by using [] spawn FunctionName.

 

Also, for scripts that run over and over again it might be handy to make them as optimized as possible. When possible you might at least think about replacing == with isEqualTo. It is slightly faster for comparing numbers and much faster for comparing strings.

 

Share this post


Link to post
Share on other sites
Guest

Also be aware that you can modify / rewrite AI fsms.

That actually may be a better way of modifing AIs.

 

Regards.

Share this post


Link to post
Share on other sites
On 2016-12-15 at 8:04 PM, genesis92x said:

I like this! I would agree with 1212PDMCDMPPM (Dat name) and your last statement. A cool-down for being spotted (maybe even just using KnowsAbout?) would be awesome. Maybe you could have a dual check of KnowsAbout and distance. I am thinking if the AI step right on top of the player they might actually respond (So within 1-2 meters most likely).

 

Awesome work man.


In my opinion you simply need to run this script serverside with a simple execvm. A 'general' rule of thumb when working with AI is to have the script run on the machine that the AI is local to. To my knowledge setCaptive is global so you shouldn't have to worry about that locality mess.

 

As for using execVM or not - it depends on how you handle the loop. If you put the whole script in a while {true} do {}; loop you could simply use execVM

If you execute the script over and over again it might be worth using a compile preproccessfilenumbers (Or something like that) to have the script saved into memory so it can be executed faster by using [] spawn FunctionName.

 

Also, for scripts that run over and over again it might be handy to make them as optimized as possible. When possible you might at least think about replacing == with isEqualTo. It is slightly faster for comparing numbers and much faster for comparing strings.

 

Thanks for the feedback. I don't have much free time with work, school and other personal stuff. Especially during the holidays coming up but I'll definitely not give up on this. It's for a mission I'm doing for me and my friends. Behind enemy lines sniper mission taking down HVT using ACE etc. So we don't have a time frame at all. 

 

As for you suggestions I was thinking "if isServer" to run the script and "execVM" to launch it so thanks for clearing that up for me. I'm looking into camo coef and knowsabout as of now and playing around with it a bit. 

 

If you'd like to help out optimize it or just making it hit me up with a PM! It would be highly appreciated since I don't have much time. 

 

On 2016-12-16 at 8:07 AM, harmdhast said:

Also be aware that you can modify / rewrite AI fsms.

That actually may be a better way of modifing AIs.

 

Regards.

 

I have absolutely 0 experience with FSM's. I tried looking into it, checking if vehicles are blown up etc but I never understood it fully. How it works I mean. Thanks for your input though! :)

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
Sign in to follow this  

×