OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: beefholishness on 08 Jan 2006, 07:19:28

Title: crouch action?
Post by: beefholishness on 08 Jan 2006, 07:19:28
With a search of the forums I found how to make a trigger that will make a specific unit crouch, but I need to make a large group crouch.  I only found one crouch action on the lists here, and it dosn't appear to work.  Is there an init line that will make a unit crouch? (hence easy to copy and paste)
Title: Re:crouch action?
Post by: penguinman on 08 Jan 2006, 08:04:00
I have created a script even though it is probably not exactly what your looking for it may help.

http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=24748
Title: Re:crouch action?
Post by: The-Architect on 08 Jan 2006, 09:35:38
I dunno what Penguinman's script looks like but usually it's done by a fast loop. I'd be wary of such a thing if I were you as a lot of guys crouching in a fast loop will eat up fps.

I reckon anyway.
Title: Re:crouch action?
Post by: THobson on 08 Jan 2006, 11:06:08
Playmove and switchmove do not always work if they are in the unit's init field.  It is better to have a small delay after the start of the mission before actioning them.  Also some of the moves only work for a limited time after which the unit goes back its default setting - you need to experiment with this.

To do something for a large number of units that you can do for one unit try this:

{instruction1 _x;_x instruction2;etc...} forEach (units group1name   + units group2name + etc)

This will result in the following being done
instruction1 unitname
unitname instruction2
etc...

for all units in group1name + group2name + etc.


instruction1 might be something like unassignVehicle
instruction2 might be something liek setPos ...
Title: Re:crouch action?
Post by: beefholishness on 11 Jan 2006, 21:16:28
So essentially, there is no 100% effective init line that will just make a unit crouch and keep him there.
Title: Re:crouch action?
Post by: 456820 on 11 Jan 2006, 21:20:18
i think this is in the FAQ cant remember but im sure it is
But what they said never 100% worked they will stay where they are but once they stand up they will stay stood up but still wont move but them standing only happens rarely
Title: Re:crouch action?
Post by: macguba on 11 Jan 2006, 23:32:12
Quote
there is no 100% effective init line that will just make a unit crouch and keep him there.
Correct.   Moreover, there is no 100% effective init line that will make him crouch at all.
Title: Re:crouch action?
Post by: penguinman on 12 Jan 2006, 01:04:25
no, my script dosent use a loop, and the units all stay crouched, and can shoot. you should check it out.
Title: Re:crouch action?
Post by: Tyger on 12 Jan 2006, 23:47:40
You can make a unit freeze in the crouching position by using the following code on him:

Code: [Select]
loon1 setUnitPos "UP"
loon1 setBehaviour "Combat"
loon1 switchMove "Crouch"
loon1 disableAI "Move"

He will not stand up if he is firing, etc, but be warned that he cannot move from that position. Otherwise, execute everything but the disableAI command on him. Unfortunatly, he will generally stand up when he sees the enemy, but he can move. You could also try a doStop command, which might prevent him from standing.
Title: Re:crouch action?
Post by: beefholishness on 13 Jan 2006, 05:47:10
Thanks guys, I'll try everything suggested... I just got done a complete reinstall of XP today so it may be a while before I'm back to editing anyway.  I'm making civil war engagements, so not being able to move is actually beneficial. ;)
Title: Re:crouch action?
Post by: Ding on 13 Jan 2006, 08:44:44
or you can use an Anim addon that has crouching and aiming addons in, ICP Orcs Anims or Wilco's anims are both good ones