OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Mr.Peanut on 16 Apr 2007, 01:15:23

Title: unit position and weapon in hand
Post by: Mr.Peanut on 16 Apr 2007, 01:15:23
Call me lazy, but as far as I can tell ArmA has neither commands to:
1) report an infantry unit's stance(prone/crounching/standing)
2) report which weapon an infantry unit has selected(in particular I would like to know whether a unit has selected binoculars or not)

Please prove this lazy old fart wrong....
Title: Re: unit position and weapon in hand
Post by: RaymondLu on 16 Apr 2007, 08:27:58
1) try unitPos

Description:
Return the unit position rules.

Syntax

Syntax:
unitPos person
Parameters:
person: Object
Return Value:
String


2) i'm still think about that.

#removed unnecessary quote of entire previous post - bedges
Title: Re: unit position and weapon in hand
Post by: h- on 16 Apr 2007, 09:33:03
RaymondLu, do not quote the entire previous post if you're replying to it.

Anyways, unitPos only returns what the stance rules are for the unit set with the setUnitPos (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=s#setUnitPos)/setUnitPosWeak (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=s#setUnitPosWeak)..
It has nothing to do with getting the unit's stance.. :(
Title: Re: unit position and weapon in hand
Post by: Mandoble on 16 Apr 2007, 11:53:32
Didnt test it, but i'm convinced modeltoWorld uses Z = 0 for the head. So, modeltoWorld [0,0,0] would return different Z for prone/crounching/standing.
Title: Re: unit position and weapon in hand
Post by: Cheetah on 16 Apr 2007, 16:51:04
Or use a command which returns the animationState (http://www.ofpec.com/COMREF/ArmAOnly/index.php?action=list&game=All&letter=a#animationState) of a soldier.
Title: Re: unit position and weapon in hand
Post by: Mr.Peanut on 16 Apr 2007, 18:36:24
Code: [Select]
unit modelToWorld [0,0,0]Returns a very small z height that varies slightly with the altitude of your location. On flat ground the z height does not change with stance. On sloped ground it changes even less with stance.

animationState would work but I need to search the returned string for the substring "BINDNON" if I want my script to work with different units.

edit: PositionCameraToWorld might work for the stance...

edit2: nope. no way to hook player's camera

edit3: BIS included a switchCamera command. Why did they not include a command to return which camera type a player is using or what cutResource for that matter?
Title: Re: unit position and weapon in hand
Post by: Mandoble on 16 Apr 2007, 21:26:41
Prone? Crouch? Standing up? (http://www.ofpec.com/forum/index.php?topic=29174.0)
Title: Re: unit position and weapon in hand
Post by: Mr.Peanut on 17 Apr 2007, 17:10:54
Found another solution here (http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=3e0d6dd2bbe0dae743a30af658f70769;act=ST;f=71;t=60261;st=0)
Title: Re: unit position and weapon in hand
Post by: Mandoble on 17 Apr 2007, 22:06:11
Do you mean looking for substrings into unit current anim phase or something like that?