OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: jaksa on 01 Oct 2005, 10:21:49

Title: Laying position for gun
Post by: jaksa on 01 Oct 2005, 10:21:49
Hi lads
Is it possible to force You or AI to do this:
if soldier get in hands specific weapon, imediately go prone, and use it only in lying position?
I was asking similar thread some time ago, but...
I would like to make a light portable mortar, usable for AI, as a main weapon, and one can't fire mortar, while running :)
Title: Re:Laying position for gun
Post by: THobson on 01 Oct 2005, 11:05:24
I know of no way to detect which weapon a guy has active - and I have tried hard to find out.  If you are okay with him going prone as soon as he picks up the weapon then try something like:

Trigger condition
"M16" in weapons unitname

Trigger Activation
unitname setUnitPos "Down"

Title: Re:Laying position for gun
Post by: jaksa on 02 Oct 2005, 16:22:05
The idea is to create portable mortar - very useful and powerful support weapon on platoon level (platoon artilery :) ). I thing, it schould be operated by AI, so player could play more "spectacular" role. In a defence is no problem - static object. But in attack, must be easily movable. As i know, there is 3 ways:

Made in rpg class, and
1. Change the anim for rpg with the special one for mortar. The best effect, but incompatybile with any rpg any more :( Acceptable for early ww2 times, but this weapon is used in present as well.
2. Leave the rpg anim. Effect will be awefull (wepon on a ground, and hands up), but it will work properly (i hope so) and with all stuff. Maybe in OFP 2...

And 3rd:
Create/delete object- in my opinion not good way.

What do you think about it? Do we need such addon, or no? If yes, how to do it?
Title: Re:Laying position for gun
Post by: Tyger on 02 Oct 2005, 20:29:59
Well, if the loon who's carrying the mortar has only the mortar in his weaponry, then you could use a simple script to detect what you're looking for:

Code: [Select]
goto "Init"

#Loop
? (_man hasWeapon "My_Mortar") && (speed _man > 1): goto "SwitchPos"
~1
goto "Loop"

#SwitchPos
_man switchMove "NameOfLayingDownAnim"
_man setUnitPos "DOWN"
_man doStop true
goto "Loop"

#Init
_man = _this select 0
goto "Loop"
Or something like that. :P
Title: Re:Laying position for gun
Post by: jaksa on 03 Oct 2005, 21:49:19
Thanks a lot!
I'll try it in next few days.
One more question: Can AI open fire, when behaviour is set on "careless" (or whatever) or engine has change it to "combat" before? How to detect what behaviour is set up?
Title: Re:Laying position for gun
Post by: macguba on 03 Oct 2005, 23:25:03
behaviour unit

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

Example:
behaviour player