Jump to content
Sign in to follow this  
5133p39

detect the weapon in hands?

Recommended Posts

I need to detect if unit has any weapon in hands.

Why? Because there is a situation in my mission, where the weapon IN HANDS or ON BACK makes a difference, so i need to know.

I know about "Weapons _unit" and "PrimaryWeapon _unit" and "SecondaryWeapon _unit", but they wont help me.

I have also tried "CanFire _unit" - but it wont help me also.

Any suggestions?

Share this post


Link to post
Share on other sites

Damm, I need to know aswell.

I supose that the players behaviour is not changed depending on if the weapon is at hand or if is wallking, running, crawling etc? cos if there was a detectable change in the players behaviour depending on the way he/she is playing that could sort it.

So the question being, is the behaviour of the player changed as the player change the input, or it don't work like with the AI?

The other thing is that the unit, as it is in "Safe" mode have the weapon on his back, so when it change behaviour to other that "careles" or "safe" is actually selecting a weapon, so lets say, if the player is estarting the mission in "safe" mod, he/she will have his/her weapon on the back, so when you get the weapon on hands by the action menu or by trying to fire it when is on your back, could that launch or activate a script or trigger?

Thanks.

Regards.

@CERO.

Share this post


Link to post
Share on other sites

u can alternative detect or set the units behaviour

combat behaviour will make the unit hold the weapon in its hands whilest save will make it keep on the back

additionally u can querry if the unit has a certain weapon

with "unit hasweapon wpnclassname"

i dotn remeber the commands right now though....

Share this post


Link to post
Share on other sites

So it is possible to triger a script depending if the unit have the weapon in his hand then.

All I'm interested is in the player, no the AI, and only in an area of the map, so I should be able to work it out by "unit hasweapon wpnclassname".

I'll search for better and clerer results in the comand reference and see if I can work out the script, but not now, I got to go to work, bloody afternoon shifts mad_o.gif

Thanks a lot nephilim.

Regards.

@CERO.

Share this post


Link to post
Share on other sites

no u cant detect with hasweapon if the uits has a gun is his hands but if it "has" it.

in combination with checking the behaviour u can do this.

cuz when combat behaviour (or idle) weapon in hands

safe (or careless) behavior weapon on back :P

cheers biggrin_o.gif

Share this post


Link to post
Share on other sites
no u cant detect with hasweapon if the uits has a gun is his hands but if it "has" it.

in combination with checking the behaviour u can do this.

cuz when combat behaviour (or idle) weapon in hands

safe (or careless) behavior weapon on back :P

cheers biggrin_o.gif

well, i knew this, but i forgot to mention, i need to check it for Player unit - and for Player the Behaviour or CombatMode is allways the same (i don't remember what is the exact result, but it is same all the time and won't change no matter what you do).

But thanks, and keep it comming smile_o.gif

Share this post


Link to post
Share on other sites

Thanks guys.

Dosn't OFP have a way to know what is the unit/s velocity? If so, We all know that human units only work in two speeds when they are in "Safe" mod, so if they going faster than that it meens that they are not in "Safe" mod, in other words, the unit have a weapon in his/her hands, so if we can have a value on what is the players speed, and this value excedes certain value, we can launch a script, right?

Is that possible?

Thanks.

@CERO.

Share this post


Link to post
Share on other sites

Just for the record...

You can use the weapons command aswell which returns the weapons of the unit in an array.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?count weapons _unit == 0 : hint "unit has no weapons"

Share this post


Link to post
Share on other sites

Thanks Blanco, but the way you sugest only let you know if the unit have any weapons in his/her possession, not necesarely in his/her hands. We need to know if the players unit have a weapon in his/her hands, don't need to know if the unit is actually carreing a weapon, because it may have the weapon on the sling on his shoulder and that's not good.

Basicly, we need to know the players change on behaviour, the AI is not important, that would be easy, but the players is not easy crazy_o.gif

So the only way I can sugest to do it is by cheking the players wallking speed( I'll have to make sure that the player don't jump into any vehicles biggrin_o.gif )

The problem I have right now is that I don't know how to implement the "Velocity" comand in a script to let you know the units speed.

Thanks.

@CERO.

@CERO.

Share this post


Link to post
Share on other sites

Why don't you use the speed command?

Something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(alive player && player == vehicle player && speed player < 7) : hint "player is running, alive and not in a vehicle"

Dunno if 7 is the right speed, but I think you got the point.

Share this post


Link to post
Share on other sites

thanks, right Blanco, but Player/AI can have weapon in hand, and move slowly - or not move at all

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  

×