Jump to content
Sign in to follow this  
DanAK47

Detect unit stance

Recommended Posts

I need to detect the players stance (stand, crouch, or prone) to make my gun-raising script work. So far it seems impossible. I have tried placing a logic object at the players 2d position with an altitude of 0 and checking the distance between it and the player with no luck.

Has anyone succeeded in detecting weither a unit is standing up, crouching, or lying down?

Edit: I posted this in Mission Editing/Scripting but it got placed here somehow. It would be nice if a moderator could move it for me.

Share this post


Link to post
Share on other sites

AFAIK, noone has cracked this one yet. There doesn't seem to be any relation between the unit's Z coordinate and his stance, so the easy way is out. I've heard theories about camcreating bullets at different heights and seeing if they hit the unit, but damaging the unit obviously causes problems. Perhaps one could camcreate a small vehicle and "throw" it at the unit, then check what height it collides w/the unit at? It's a long shot I guess, but I'm not sure what else to do. If only there was a function to tell what anim a unit was in, like in VBS1...

BTW, what is this script about, anyway?

Share this post


Link to post
Share on other sites

I'm working on the gun-raising animation with the keyboard script and need to detect the unit stance, so that the correct animation is played.

I tried camcreating bullets but they cause some blood or an explosion to be shown even when the damage values are at 0. However I have had some success "dropping" an object on the player and checking the velocity (to see when it slows down) but this is far from perfect..

Another problem is that the keyboard script (or OFP in general) doesn't register the key press every time, which is a real PITA.

Share this post


Link to post
Share on other sites

I wonder how it's done in Tactevents (from Marineassaultpack) , how can they create smoke at the barrel when they don't know the unit's stance?

rock.gif

Or is the smoke attached to the bullet?

Share this post


Link to post
Share on other sites
Quote[/b] ]I wonder how it's done in Tactevents (from Marineassaultpack) , how can they create smoke at the barrel when they don't know the unit's stance?

Or is the smoke attached to the bullet?

Its attached to the bullet.

I've made a script to detect a unit's stance to some extent, it involved creating a camera cutscene for a split second a little bit behind the player (has to be a cutscene, cant be just the camera), then using _camera camsettarget player, which makes the camera always center on the players head no matter where it is.

Then create 2 invisible particles with the drop command, one behind the camera and one infront with 'relative' positions, so if the camera's facing downwards at the player, the frontwards particle would be down low in the ground and the backwards particle would be high up in the air.

And finally, compare the 2 particles Z positions to determine whether the player was standing, crouching, or crawling.

I never finished it because I usually couldnt get the timings right, and having a split second cutscene can be quite annoying. (especially in a loop)

Someone else is welcome to try and get this working right, I dont have the time to do it anymore

Share this post


Link to post
Share on other sites

I'll give it a try. I thought about using the camera thing but don't know to use the drop command.

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  

×