Jump to content
Sign in to follow this  
farix

Few More Questions

Recommended Posts

Got 2 new questions for you guys. Both i have looked up and down these forums and haven't found the exact one

1. - Is it possible to use a Action to spawn a Vechile fully loaded with Crew and all . ( I have found a code to spawn 1 , but i need to be able to do it unlimted times )

2 - The entire squad structure in ARMA 2 kind of disappoints me is it possible to divide your team that you are leading into a sub team so they would have a independent formation but still be under your command (possibly breaking off into another AI Team leader under your command , but not transfering to another human player)

Thanks ~

Farix

Share this post


Link to post
Share on other sites

1. Yes. Look into BIS_fnc_spawnVehicle

2. You can split your squad into teams, Red, Green, Blue, Yellow, White. Do this from F2 to select your second soldier than Spacebar -> Team from the Action Menu and pick Assign <color> to make that soldier part of that team. You can then issue commands via Spacebar -> Team -> <color> -> then the commands you want.

Share this post


Link to post
Share on other sites

On entering the forum there should be a big fat total-screen overlay "USE DESCRIPTIVE TITLES". Probably in ten languages.

Share this post


Link to post
Share on other sites

@Ky - The BIS Spawn Veh Function only works for Tanks and Cars (Things that defaultly come with crewmembers) . But if i wanted to spawn a C-47 loaded with a airbourne squad would that be possible ?

Share this post


Link to post
Share on other sites

Possible sure, but as you said not with the spawnVehicle function. If the addOn maker didn't assign the C-47 a default crew you'll need to go through the whole process of creating all the units on their own (well, the squad you could do via BIS_fnc_spawnGroup) then moving them into the plane.

So you'd createVehicle array the plane, then createUnit array the pilot and moveInDriver it, then you'd BIS_fnc_spawnGroup the Airborne squad and assignAsCargo and moveInCargo them into the back using a forEach units group block.

Share this post


Link to post
Share on other sites

How do i turn BIS's fnc spawnVechile into a action

Share this post


Link to post
Share on other sites

You'd have the action call a script with all of the information in that.

Share this post


Link to post
Share on other sites

I can't even get the example script to work when i paste it in a units init line.

What am i doing wrong

(I have very little scripting experience)

Share this post


Link to post
Share on other sites

Erm, what example script? :)

Here's an example mission to check out. I assume you're talking about I44 too, hope so!

Place a marker called mkplanestart somewhere you want the plane to spawn from. Then add this to your init field:

this addAction ["Airborne!","spawnAirborne.sqf"];

Also make sure you have your Functions Module on the map.

Let me know if you have questions about how this all works.

Here's the spawnAirborne.sqf script:

// Make sure the Functions module is working.
waituntil {!isnil "bis_fnc_init"};

// Get a spot 200m above the spawn marker.
_spawnHeight = [getMarkerPos "mkPlaneStart" select 0, getMarkerPos "mkPlaneStart" select 1, 200];

// spawn the plane, facing south.
_va = [_spawnHeight, 180, "I44_Plane_A_C47A_AAF", west] call BIS_fnc_spawnVehicle;
_pln = _va select 0;
_grp = _va select 2;

// keep it flying high
_pln flyInHeight 200;

// Give it a waypoint over the player.
_wp = _grp addWaypoint [getPos player, 0];
[_grp, 0] setWaypointType "MOVE";

// Spawn the group
_grpA = [_spawnHeight, side player, (configFile >> "CfgGroups" >> "I44_A" >> "I44_A_ARMY" >> "I44_A_Army_Men" >> "I44_A_Assault")] call BIS_fnc_spawnGroup;

// Move the group into the plane.
{_x moveInCargo _pln} forEach units _grpA;

// Wait till the plane is near the player.
waitUntil{_pln distance player < 300};

// Paradrop!
{
   unassignVehicle (_x);
   (_x) action ["EJECT", vehicle _x];
   sleep 0.4;
} foreach units _grpA;

Share this post


Link to post
Share on other sites

Script works for airbourne.

Somthing a hell of a lot simplar tho -

I just want to spawn say a Sherman at a given marker

I'm using this

this addAction ["Sherman","Spawner.sqf",["I44_Veh_A_Army_M4A3_Sherman_Army","USAIR"]call BIS_fnc_spawnVehicle]

Orginally that would spawn a Empty Sherman at the USAIR marker which was at a postion on an airfield. But now with the BIS FNC at the end the script stops functioning

Share this post


Link to post
Share on other sites

this addAction ["Sherman","Spawner.sqf",["I44_Veh_A_Army_M4A3_Sherman_Army","USAIR"]]; 

spawner.sqf:

_vehicle = _this select 3 select 0;
_marker = _this select 3 select 1;

// spawn the tank, facing north.
_va = [getMarkerPos _marker, 0, _vehicle, west] call BIS_fnc_spawnVehicle; // might need I44_A instead of west, not sure.
_tank = _va select 0;
_tankGroup = _va select 2;

units _tankGroup joinSilent group player;

Edited by kylania

Share this post


Link to post
Share on other sites

Standby.

---------- Post added at 04:37 PM ---------- Previous post was at 04:33 PM ----------

West seems to work. But The Tank is static , i'm not 100% sure if there is actually crew inside it and it dose not join the players team. It just sits their and dosen't do anything

---------- Post added at 04:39 PM ---------- Previous post was at 04:37 PM ----------

Yeah theirs def Crew in it. Just isn't joining the players Team , so it dosen't do anything execpt sit their =P

Share this post


Link to post
Share on other sites

Ah, you never said anything about making it do something or joining your group! :)

I added the [_tank] joinSilent group player; line which should do it to the above example.

Share this post


Link to post
Share on other sites

arghh this is going to go on forever

+rep for you kylania

But...

The Sherman Joining the players group only promots 1 man out of the entire tank group to join ( I belive it is the Comander slot?) So the tank cannot recivie commands

Share this post


Link to post
Share on other sites

Oops, fixed the code again, for the whole crew you could use this:

units _tankGroup joinSilent group player;

or

crew _tank joinSilent group player;

if you didn't already know the group we captured as _tankGroup when we spawned it.

Share this post


Link to post
Share on other sites

I'm just getting into a habbit of bumping old posts , kind another random question. I'm trying to spawn a cargo helio (MV-22 etc) with a full squad of marines inside it + having the entire squad plus the crew join the players squad

is that possible ?

+ limiting the action to say... once every 5 minutes

Edited by farix

Share this post


Link to post
Share on other sites
I'm just getting into a habbit of bumping old posts , kind another random question. I'm trying to spawn a cargo helio (MV-22 etc) with a full squad of marines inside it + having the entire squad plus the crew join the players squad

is that possible ?

+ limiting the action to say... once every 5 minutes

all is possible, this is pretty much the same principles as the c-47 spawning

I suggest (really I recommend) you to look at this:

http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

I know this isnt the most userfriendly link, but every single command, function, module, and extra documentation is here. Some special commands have limited documentation, but definitly have no use to you right now as your starting out with the basics.

I strongly urge you and others to have this open at all times when scripting, because it is your bible.

Share this post


Link to post
Share on other sites

Well, you already have the code for most of that. You know how to spawn a group. You know how to spawn a vehicle with crew. You know how to get them to join the player.

To limit it to every 5 minutes you'd keep track of a variable that will display the spawning ability or not. You'd set the variable to true in the init.sqf of your mission. You'd set it to false in the spawn script and record what time it was. Then the same script would set it to true 5 minutes later, turning the option back on.

init.sqf:

actionCanSpawn = true;

player addAction ["Spawn Stuff","spawn.sqf",["stuff","to","spawn"],1,false,true,"","actionCanSpawn"];

spawn.sqf:

// Mark that we've spawned things by turning off the variable
actionCanSpawn = false;

// Spawn stuff.

// We'll spawn our group and vehicle here
hintSilent "I'm spawning our group and vehicle here";
sleep 2;

// Join them to the player
player groupChat "I have new friends but I can't spawn more!";



// Sleep 600 seconds or 5 minutes.
//sleep 600;
sleep 8; // For testing we'll use 8 seconds.

// Turn the action back on.
actionCanSpawn = true;

hintSilent "I can use my spawn again!";

Share this post


Link to post
Share on other sites

hmmm well i am not amazing at coding , i just want a simple script to spawn say a LAV-25 with full crew + a group. All the attempts i have done by modifiying the C-47 script havefailed

Share this post


Link to post
Share on other sites

well i love how your a god at scripting kylania. But i think i'm over complicating things. i am just trying to recreate this script w/o the move to and the eject functions of the script. It seems to freeze when the vechile spawns at the marker , it odsen't join the player sgroup. I also need a parameter for a set pos , beucase you know everything i do is usally on a boat =P

Edited by farix

Share this post


Link to post
Share on other sites

? So you want to spawn a LAV-25 and soldiers on a carrier deck and join it to the player?

Can you write out exactly what you're wanting to happen? Don't worry about syntax or details, just something like "While on an LHD carrier deck I want to be able to use an action on a flag pole that will create a group of soldiers and a helicopter that I can control to fly to the mainland" or something similar please?

Share this post


Link to post
Share on other sites

---------- Post added at 09:08 PM ---------- Previous post was at 08:43 PM ----------

[/color]

_vehicle = _this select 3 select 0;

_marker = _this select 3 select 1;

// spawn the tank, facing north.

_va = [getMarkerPos _marker, 0, _vehicle, west] call BIS_fnc_spawnVehicle; // might need I44_A instead of west, not sure.

_tank = _va select 0;

_tankGroup = _va select 2;

_grpA = [_spawnHeight, side player, (configFile >> "CfgGroups" >> "WEST" >> "USMC" >> "Infantry" >> "USMC_FireTeam")] call BIS_fnc_spawnGroup;

{_x moveInCargo _tank} forEach units _grpA;

units _tankGroup joinSilent group player;

units _grpA joinSilent group player;

That is the code i am using . i need somthing to allign the degree on which the vechile is placed ant the height of the vehcile

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  

×