Home   Help Search Login Register  

Author Topic: How do I find a unit's stance?  (Read 949 times)

0 Members and 1 Guest are viewing this topic.

Tom Norman

  • Guest
How do I find a unit's stance?
« on: 19 Jan 2004, 01:34:22 »
Hiya, been a bit stumped while scripting recently.

For a script I'm working on, I need to be able to determine whether a unit is standing, kneeling or prone.  Now there are commands to set the unit's stance (SetUnitPos), and to determine whether or not a unit can stand at all (CanStand).  But as far as I can see, there is no means by which one may determine a unit's current stance.

Can anyone help with this?  Not neccessarily with a command I overlooked, but by some alternative manner of calculating it?   :-\

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How do I find a unit's stance?
« Reply #1 on: 19 Jan 2004, 03:12:02 »
   God I wish I knew of a way to do this. I think anybody who has worked with animations (perhaps when using actions) has wished this. As far as I know, there is no way of knowing this. I've tried getting the units height (getpos player select 2), but there seems to be no relationship btwn that and whether he is standing or laying. Even if that worked, you wouldn't be able to tell if he is laying with a rifle, or laying with a pistol, etc.

  The only thing I could think that may work would be by making a custom animation. Then you could determine what position he is by checking its animation phase. However, that method would only work for very specific situations.

  Sorry, but I think we're all outta luck on this one.  :'(
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #2 on: 19 Jan 2004, 03:18:33 »
Yeah, VERY specific animations.  I already tried the altitude thing too.  To find the weapon he is using is no drama though.  I only ask because I am working on a script for Project UKF to simulate weapon stoppages.  Well cheers anyway, perhaps I'll have to wait for a patch to come out that addresses it.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How do I find a unit's stance?
« Reply #3 on: 19 Jan 2004, 03:23:29 »
I don't see why you would need to find the position to simulate jamming weapons--unless you want to animate the unit fixing the jam (which would look different depending on the weapon used anyway). I suppose an easy way to do this would be to just remove the units weapon, then give it back to him, thus emptying the magazine and forcing him to reload (to simulate him fixing the jam).

I wouldn't hold your breath for a patch though. BIS is only going to fix major issues with any new patches they release (I doubt there will be many more). I'm almost certain they won't add any more scripting commands. For that you'll have to wait for OFP2.  :(
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #4 on: 19 Jan 2004, 03:30:39 »
It's just for the SA80, so the animation is going to look right for the weapon type.  We would also like to build our own stoppage drills anims too, but we're using the magazine reload animation at the moment, which serves our purposes nicely...problem is, the unit has to get himself into the right stance before carrying out the animation.  If he is standing then it's fine, but otherwise, he draws himself to his feet first.

Interesting idea about removing the weapon though, that way the player could clear the stoppage in his own time and from any position.  I do like that.  And even if it doesn't work, then it can easily be worked around by manipulating his ammuniton.  Cheers mate, that's some real creative thinking.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How do I find a unit's stance?
« Reply #5 on: 19 Jan 2004, 03:38:21 »
Lemme know if it works  8)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #6 on: 19 Jan 2004, 04:14:15 »
Gah.  No it doesn't.

When I remove the weapon, it automatically defaults to the next weapon...a hand grenade.  Even without hand grenades, it doesn't return the weapon unloaded.  I'll have to strip ALL the players weapons (and mags) and give them all back again, weapons first if I want the desired effect...which I think I can do, but I need to find a way to set the unit's ammo in the weapon back to it's former value.  Even if I manage that, there's still the problem of the other magazines...they'll all be returned full.  So player would be able to fire all but one round from every magazine, then have a stoppage and be back up to full ammo in all those mags.  Perhaps I can find a command to force the player to drop the said mags (without the accoumpanying animation) and then pick them all up again in a split second?

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How do I find a unit's stance?
« Reply #7 on: 19 Jan 2004, 04:31:50 »
I just tried it myself, and you are right about removing the weapon.

However, when I removed one magazine of the type used by the player's weapon, then added it back right away (next line of code), I got the desired effect: the player's ammo went to 0. I'm not sure why you had to remove EVERTYTHING. It does add a full magazine back into the player's inventory, though. I'm not sure if you can force the player to "drop" an item, but you could check under the thread sticky thread in this board.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #8 on: 19 Jan 2004, 04:46:03 »
I never actually removed everything, havn't tried it yet.  But removing a single mag and then replacing it works does it?  I guess it removes the fitted magazine.  This has potential, I can count the number of in the said mag before removing it and then perhaps I can set it back to this level when I replace it?  I'll have a look a bit later, I'm working on a SAM script at the moment which has captured my facination.  Thanks for all your help.

Unnamed

  • Guest
Re:How do I find a unit's stance?
« Reply #9 on: 19 Jan 2004, 13:35:20 »
Quote
It's just for the SA80, so the animation is going to look right for the weapon type.  We would also like to build our own stoppage drills anims too, but we're using the magazine reload animation at the moment, which serves our purposes nicely...problem is, the unit has to get himself into the right stance before carrying out the animation.  If he is standing then it's fine, but otherwise, he draws himself to his feet first.

If I got this right you want to play a specific reload animation depending on the units stance?

What if you pick your reload animation based on the guys behaviour? For safe\carless you would force him to stand and reload, Combat\aware use crouch and reload, injured\stealth would just use prone and reload e.t.c

behaviour unit
Operand types:
    unit: Object
Type of returned value:
    String
Description:
    Behaviour mode of given unit ("CARELESS","SAFE","AWARE","COMBAT","STEALTH")

I'm not sure but you may be able to do this at the anim level in the config.cpp, trouble is there is very little info about anims around.

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #10 on: 19 Jan 2004, 19:38:31 »
Ta, thanks for the brainstorming, but it doesn't really get me much further than I was before.  If you think about it, the soldier's only going to get a stoppage when he fires his weapon...and what behaviour is the soldier going to be in when firing his weapon?  Combat.  Besides in SAFE/CARELESS mode, the soldier will have his weapon slung and can't fire it anyway.  Nice thought with the injured thing though.  I can check to see if a soldier is capable of standing, if not then I can play the prone reload anim, because I can be sure he is prone.  Cheers for the suggestions.

Unnamed

  • Guest
Re:How do I find a unit's stance?
« Reply #11 on: 19 Jan 2004, 21:19:54 »
It can take a little while for the behaviour to change, so if you know what the previous behaviour was, you can kind of get an idea what stance they would be in when they started firing.

Shame it wont work for your situation, AFAIK ths is as close as you can get to finding the stance?
« Last Edit: 19 Jan 2004, 21:21:00 by Unnamed »

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #12 on: 19 Jan 2004, 21:23:01 »
Kinda helps I suppose, but when a unit is fighting it may be either prone or standing, really need to be able to identify which a little more precisely.  Cheers for you help.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:How do I find a unit's stance?
« Reply #13 on: 20 Jan 2004, 12:20:15 »
I tried once to determine wether a unit is upright or down
in the mud.

getpos unit select 2 was what i've been using for that

unfortunately it doesn't return a different value, wether the
unit is standing or kneeing, but it does if the unit is
prone.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Tom Norman

  • Guest
Re:How do I find a unit's stance?
« Reply #14 on: 23 Jan 2004, 21:12:20 »
Tried that myself, as I already said, but it doesn't return any alternative altitude in mine...