Jump to content

Recommended Posts

I'd like to create a little script that'd spawn 6 -->M119 with men inside it seems simple but I can not do it alone.

Thank you in advance !

Any Helps is welcome !

Share this post


Link to post
Share on other sites

if you want them to start in the m119 then name the m119 for example, test1. Then put this in each unit's init field:

this moveInGunner test1

Share this post


Link to post
Share on other sites

Thanks it's work ! /bow

Share this post


Link to post
Share on other sites

Try this mate. A demo mission is here.

This creates 6 M119's with crew 10m apart starting at the position of an "H" pad.

To execute the script:-

nul = [] execVM "spawn_guns.sqf";

spawn_guns.sqf:-

private ["_xcoord","_crew","_pos","_veh","_unit"];

_xcoord = getpos hpad1 select 0;
_crew = creategroup WEST;
for "_x" from 1 to 6 step 1 do {
_pos = [_xcoord,getpos hpad1 select 1,0];
_veh = "M119" createVehicle _pos;
_unit = _crew createUnit ["USMC_Soldier",[0,0,30], [], 0, "NONE"];
_unit assignasgunner _veh;
_unit moveingunner _veh;
_xcoord = _xcoord + 10;
};


Share this post


Link to post
Share on other sites

nice ! thanks a lot you saved me a lot of time & script line!

Share this post


Link to post
Share on other sites

No worries... but I think it might create other questions! This answers one of them :)

That code just creates them in a fixed direction hard coded in the script. You are going to want to specify the direction of the guns. Here's some new code with some variables and math added that allows you to do that.

The guns will be oriented according to the direction of the "H".

spawn_guns.sqf:-

private ["_xcoord","_ycoord","_paddir","_crew","_pos","_veh","_unit","_dx","_dy"];

_xcoord = getpos hpad1 select 0;
_ycoord = getpos hpad1 select 1;

_paddir = getdir hpad1;

_crew = creategroup WEST;

for "_x" from 1 to 6 step 1 do {
_pos = [_xcoord,_ycoord,0];
_veh = "M119" createVehicle _pos;
_unit = _crew createUnit ["USMC_Soldier",[0,0,30], [], 0, "NONE"];
_unit assignasgunner _veh;
_unit moveingunner _veh;

_dx = sin(_paddir)*10;
_dy = cos(_paddir)*10;

_xcoord = _xcoord + _dx;
_ycoord = _ycoord + _dy;
};


Share this post


Link to post
Share on other sites

Great ! i update right now

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  

×