Jump to content
Sign in to follow this  
tracy_t

Camcreate m2 machine gun problems

Recommended Posts

Hi,

I am CamCreate'ing standard OFP M2 machine guns dynamically. Although the M2s appear correctly, for some strange reason soldiers cannot mount the gun. M2's placed in the mission editor work fine.

Can anyone tell me why this is so?

I enclose my CreateM2Gun.sqs script and my dynamic object creation script, so you can understand what I am doing at the moment. Any help appreciated!

CreateM2Gun.sqs

============================================

?i_numberofmachineguns== 0: exit

_obj = _this select 0

titlecut ["Place a machine gun nest here", "BLACK OUT", 1.5]

~1.5

[_obj, "Fence", 7,2] exec "Createobject.sqs"

[_obj, "M2StaticMG", 0,2, 1, false] exec "Createobject.sqs"

i_numberofmachineguns= i_numberofmachineguns-1

titlecut ["", "BLACK IN", 1.5]

~1.5

_hintmsg = format["You have %1 machine gun(s) left.", i_numberofmachineguns]

hint _hintmsg

; This is the reason why the script must be bound to action ID 1

? i_numberofmachineguns ==0: this removeAction 1

CreateObject.sqs

================================================

_pos = getPos (_this select 0)

_objtype = _this select 1

_degreestoadd = _this select 2

_dist = _this select 3

_y = 0.8

_locked = false

; If we've not specified the height of the object, we use 0.8 as default

? count _this > 4: _y = _this select 4

? count _this > 5: _locked = _this select 5

_x = _pos select 0

_z = _pos select 1

_dir = GetDir(_this select 0) + _degreestoadd

? _dir >360: _dir = _dir-360

_x1 = _x + (sin(_dir) * _dist)

_z1 = _z + (cos(_dir) * _dist)

_newobj = _objtype CamCreate [_x1,_z1,_y]

_newobj lock _locked

_hintmsg = format["Object is %1", locked _newobj]

hint _hintmsg

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×