Jump to content
Sign in to follow this  
Delta Hawk

Hiding in dead bodies

Recommended Posts

I'm trying to make a WWII mission where you can hide in dead bodies in the snow to avoid detection when a patrol walks by. Any idea of how to do this? I got the distance to the dead body figured out but the unitpos thing is giving me troubles. Also how do I make a person appear invisible to the enemy? Thanks!

Share this post


Link to post
Share on other sites
I'm trying to make a WWII mission where you can hide in dead bodies in the snow to avoid detection when a patrol walks by. Any idea of how to do this?

Try this (not tested):

player addAction ["Hide corpse", "hideCorpse.sqf", nil, 1, true, true, "",
"
	_object = cursorTarget;

	(_object isKindOf 'CAManBase') and {!(alive _object)} and {(player distance _object) <= 5}
"
];

hideCorpse.sqf

_corpse = cursorTarget;

hideBody _corpse;

Share this post


Link to post
Share on other sites
Try this (not tested):

player addAction ["Hide corpse", "hideCorpse.sqf", nil, 1, true, true, "",
"
	_object = cursorTarget;

	(_object isKindOf 'CAManBase') and {!(alive _object)} and {(player distance _object) <= 5}
"
];

hideCorpse.sqf

_corpse = cursorTarget;

hideBody _corpse;

Oh, I don't mean that, though that could come in handy later. I mean like laying in a pile of dead bodies and staying still to avoid detection by a passing patrol, like in Enemy at the Gates. I got it to where if you lie down near a dead body and you don't move it triggers something, but I don't know how to make the player invisible to the enemy until he either leave hiding or shoots or something.

Here's my trigger conditions so far...

2 > player distance deadbody1 && 0 == speed player && ((boundingbox PLAYER) select 1) select 2 < 1.1

---------- Post added at 13:39 ---------- Previous post was at 13:10 ----------

Ok, so it seems I can use the setcaptive function to work as a way of hiding when lying down next to dead bodies. I can also undo the setcaptive function when my conditions for hiding are no longer valid. Now, I need to figure out a way of making to where you are "no longer hiding" if you fire your weapon.

---------- Post added at 14:10 ---------- Previous post was at 13:39 ----------

In fact, it would be better if your ability to hide was determined on the person you are hiding from's current behavior. For example, it's easy for you to hide in dead bodies if the enemy is "safe" or "careless", but not so easy if he is "aware" since he would be looking and almost impossible if his behavior is "combat".

Share this post


Link to post
Share on other sites

"hideObject", "knowsAbout" and "reveal" is what comes to mind, but I think knowsAbout would be difficult to assess what kind of return to trigger from. I mean, if the enemy is standing over the hidden soldier, how much is knowsAbout going to return?

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

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

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

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

Edited by OpusFmSPol

Share this post


Link to post
Share on other sites

Thanks for the reply OpusFMSPol. I don't want the player to disappear. I just to be able to lie down next to dead bodies and not move and have an enemy soldier or patrol not notice me until I shoot my gun or stand up.

Share this post


Link to post
Share on other sites

I'm really at a loss since there is no "detect movement" command I know of.

Maybe an addaction "Play Dead" that disables animation, and an addAction "React" that enables animation; and using "canMove Player" to detect?

Edited by OpusFmSPol

Share this post


Link to post
Share on other sites

You want to use the SetCaptive commands.

Setcaptive true if the conditions are met, such as - being prone, speed being 0, close to a body.

Perhaps an event handler to detect when you're firing and forcing setcaptive false again. In addition to that, setcaptive false when moving away from the body or standing up.

Setcaptive will make sure the AI will disregard you, they will not fire at you.

Kind regards,

Sanchez

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  

×