Home   Help Search Login Register  

Author Topic: Crouching...  (Read 1842 times)

0 Members and 1 Guest are viewing this topic.

ProudPotter2490

  • Guest
Crouching...
« on: 21 Apr 2005, 18:20:29 »
Hey everyone!
This is just a follow up from my previous thread: http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=23310. A helpful bloke called macguba told me to use animations. Sure enough it worked! But almost instantly the soldier decides to stand back up. Any way I can prevent this from happening? Thanks guys!
ProudPotter2490 :afro:

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Crouching...
« Reply #1 on: 21 Apr 2005, 18:22:55 »
You need to use a looping script (or other loop) to issue the command continually.

#loop
? not alive loon1 : exit
? someCondition : exit
loon1 switchmove "whatever"
~1.7
goto "loop"

Not guaranteed.  Experiment to get the right time delay.

Plenty of reviewed ArmA missions for you to play

ProudPotter2490

  • Guest
Re:Crouching...
« Reply #2 on: 21 Apr 2005, 18:33:15 »
Hey.
Thanks macguba... It worked with this syntax:-
Quote
#loop
? not (alive squadDelta1) : exit
squadDelta1 switchMove "CROUCH"
~0
goto "loop"

However the unit simply wouldn't fire when he saw an enemy. I'm pretty sure this is because he is stuck in an animation he can't get out of. Thanks.
ProudPotter2490 :afro:

Offline Blanco

  • Former Staff
  • ****
Re:Crouching...
« Reply #3 on: 21 Apr 2005, 18:48:59 »
He will always stand up again. and when you use a fast loop (not recommended) he won't fire.
The only way I know to have a unit crouch without standing is my fixedpos script, it uses custom anims to that.(see my sig)


WIth the script below (addonfree) the unit will crouch-popup.
Code: [Select]
_unit = _this select 0

#loop
?alive _unit :exit
dostop _unit
_unit setbehaviour "combat"
_unit setcombatmode "yellow"
dostop _unit
~1
#getdown
~1
_unit setbehaviour "combat"
~0.1
_unit setunitpos "up"
~2
_unit playmove "combattocrouch"
_unit playmove ""
~ (random 5) + 5
goto "loop"


« Last Edit: 21 Apr 2005, 19:45:17 by Blanco »
Search or search or search before you ask.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Crouching...
« Reply #4 on: 21 Apr 2005, 19:30:18 »
If you disable their "move" and "target" AI, and put them in combat mode, they will stay down. However, once the shooting starts, they tend to pop back up eventually.

unit disableAI "move"
unit disableAI "target"
unit setcombatmode "combat"
unit setunitpos "up"
unit switchmove "crouch"

Only problem is that they can never move again, of course. But this works great for units in a fixed position.
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!

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Crouching...
« Reply #5 on: 21 Apr 2005, 19:49:37 »
Hey ProudPotter2490!

From the OFPEC Knowlegebase:

Quote
GENERAL SP EDITING: How to lock an AI soldier in crouch position (Beginner)

Submitted by: SFG
Credits: TailEndCharlie

Making units crouch.
--------------------------------------------------------------------------------
put in soldier's init field - this setbehaviour "combat"; this switchmove "combattocrouch"; this setunitpos "up" - making sure they have no grenades which causes them to stand and throw which resets their stance to standing.
--------------------------------------------------------------------------------
Submitted on: May 12, 2002, 15:00

And from the Sticky FAQ on the official forums from Sanctuary:

Quote
How to make an AI soldier to stay crouched
With him being able to open fire , then stay crouched instead of standing up

-First create a soldier , name it BOB by example
-Make for him a MOVE waypoint, edit the MOVE waypoint properties and at the line On Activation of this waypoint put
 
BOB setbehaviour "COMBAT"; BOB setunitpos "UP"; BOB switchmove "crouch"; FIRST=true  


-Now create a trigger (do not put a side at the line ACTIVATION of the trigger) , set it to Repeated
In the Min, Max, Average put 1 for each case (with 0 sometime it skip the trigger activation , but you can try for a better but not 100% sure result)
At the line Condition, replace the word "this" by FIRST (following my example)
At the line On Activation, put
 
BOB setunitpos "UP"; BOB switchmove "crouch"; FIRST=false; SECOND=true


-Create a second trigger (do not put a side at the line ACTIVATION of the trigger), set it to Repeated
In the Min, Max, Average put 1 for each case
At the line Condition, replace the word "this" by SECOND (following my example)
At the line On Activation, put
 
BOB setunitpos "UP"; BOB switchmove "crouch"; SECOND=false; FIRST=true  


Ingame , with the loop created by the 2 triggers , as soon as the AI soldier will arrive to the mentionned MOVE waypoint , he will stay in crouch position, and engage any enemy
If he want to stand up , the loop of the triggers will force him to come back in crouch position.

I cant translate my triggers usage into scripting as i am not experienced in scripts creation , so if someone can, feel free to do it

and

Quote
How to force an entire squad to stay crouched
and engage any enemy while staying crouched

-Create your group
in the init line of the officer put this
 
BOB=group this; BOB allowfleeing 0

this will create the group named BOB , and they will not flee.

-Create a MOVE waypoint, in the line On Activation of this MOVE waypoint , put
 
WHAT="move"; BEHAVE="COMBAT"; STATUS="UP"; STANCE="crouch"; "_x setbehaviour BEHAVE" foreach units BOB; "_x setunitpos STATUS" foreach units BOB; "_x switchmove STANCE" foreach units BOB; "_x disableAI WHAT" foreach units BOB; FIRST=true


This way i force the whole group BOB to stay crouched
Note : i disable the whole group -MOVE- capacity only because i noticed with my test that several soldier will break formations to run to the enemy (due to combat behaviour) and so there will be a strange animation run/crouch/run/crouch/etc.... for them

-Now exactly as for an individual i create a trigger (do not put a side at ACTIVATION)
Min, Max, Average i put 1 in each case
at the line Condition i replace the "this" by the word FIRST
at the line On Activation , i put
 
STATUS="UP"; STANCE="crouch"; "_x setunitpos STATUS" foreach units BOB; "_x switchmove STANCE" foreach units BOB; FIRST=false; SECOND=true


And finally , as i done in the individual AI example, i create a second trigger (do not put a side at ACTIVATION)
Min, Max, Average i put 1 in each case
at the line Condition i replace the "this" by the word SECOND
at the line On Activation, i put
 
STATUS="UP"; STANCE="crouch"; "_x setunitpos STATUS" foreach units BOB; "_x switchmove STANCE" foreach units BOB; SECOND=FALSE; FIRST=true


That is all, you have a whole group that will crouch in the location you want.

But unfortunately , they will not be able to move again, due to the disableAI "move" for group i used to prevent some units to break the formation randomly.
Too bad that there is no way in OFP to enable again a disabled AI sorry

As you can see there are many ways to do one thing in OFP! ;D

As you appear to have some scripting knowlege, you could hack out the relevant stuff from Sanctuary and use that in a script (although Blanco was kind enough to provide a working one), but I posted this more so for informational and reference value.

Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

ProudPotter2490

  • Guest
Re:Crouching...
« Reply #6 on: 21 Apr 2005, 20:08:18 »
Hey everyone!
Ah! More than enough information! Thanks everyone ;)!
ProudPotter2490.