Forum Jump :

Author Message


Posts: 11
Rank:


Level: Member

Country: us
Location: Nebraska
Occupation: Faulken
Age:
In-game name:

 
#1 Posted at 2009-07-12 20:47        
     
Need help spawning any number of vehicles or units at any desired location?
Realizing (like I did) that setPos does not seem to move a unit after it is spawned?
Saw ( http://www.armaholic.com/forums.php?m=posts&p=7026#7026 ) but not quite what you're after?
Faulken Wulf here, and boy do I have a deal for you then: INDIA.sqs

(We'll start with my variables, and then I'll do a variable free one in a code block at the end)

TRIGGER--
CONDITION: {alive _x} count units INDIA_a < 1;
ON ACT: this exec "INDIA.sqs";
MARKER--
NAME: INDIA_WEST
SQS (IN MISSION FOLDER)--
;HELO
INDIA_helo = "GNT_V22" createVehicle (getMarkerPos "INDIA_WEST");
INDIA_helo setVehicleInit "INDIA_a = group this";
;PILOT
"SoldierEPilot" createUnit [getMarkerPos "INDIA_WEST", INDIA_a, "INDIA_pilot = name this; this moveInDriver INDIA_helo", 0.5, "private"];

What this does is when group INDIA_a dies, it will respawn a helicopter (in my case a V22 Osprey) at marker INDIA_WEST and set it to part of INDIA_a group with the name INDIA_helo. It will then spawn a pilot at INDIA_WEST, as part of INDIA_a with the name INDIA_pilot, and instantly move it into the pilot's seat of INDIA_helo.

(This is a cut down version of my script also goes on to repopulate all of INDIA_b and INDIA_c fire teams and loads them into the chopper with moveInCargo.)

What can you do with this? Well... you can respawn empty vehicles with a !alive (vehicle name) check respawn whole groups. Really you can do anything. One thing though-- the group MUST MUST MUST have a placeholder as far as I can figure if you're going to spawn a group with no one in the group yet. So drop a Game Logic -> Object -> Game Logic. Name it... whatever you want. In its Initialization put: INDIA_a = group this; west = side INDIA_a. Please note my respawn is instant. If you want there to be a delay just mark COUNTDOWN fill in the boxes for the time to wait in seconds.

Ok so here it is without my own variables in. I'm going to use the format @VarName to mark a place for your variable.

TRIGGER--
1) In the Mission Editor: Create your trigger. Configure it anyway you want.
CONDITION: (Whatever you put here is what will trigger the script.)[/b]
ON ACT: this exec "@NameOfYourScript.sqs"; [b](Anything else you want the trigger to do.)

MARKER--
2) In the Mission Editor: Create a marker. Configure it anyway you want.
NAME: @MarkerName (This is the spawn point!)

GAME LOGIC--
X) If no one is going to be in the group that your spawned units are going to be in before they are spawned, YOU NEED TO PUT ONE OF THESE DOWN!
INITIALIZATION: @GroupName = group this; @Side = side @GroupName; @GroupName selectLeader @OneOfTheSpawnedUnits; 
@Side can be: "WEST", "EAST", "GUER", "CIV", "LOGIC" or "UNKNOWN"

3) Save the Mission. (You'll see why in 2 seconds.)

SQS--
THIS GOES IN MISSION FOLDER
Example: C:\Documents and Settings\___\My Documents\ArmA\MPMissions\@MissionSaveName.@MapName
4) Either open Arma Edit ( http://www.armaholic.com/page.php?id=1455 ) or Notepad, and use the following template:
;@ExampleNonManVehicle (;@Whatever is a comment in SQS format. Comments help, especially in longer scripts, so that you know what is doing what and where.)
@VehicleName = "@VehicleClass" createVehicle (getMarkerPos "@MarkerName");
@VehicleName setVehicleInit "@GroupName = group this";

;@ExampleManVehicle (Between the " " after the VehicleManName is its Initialization String, this example assumes you want the unit to drive the vehicle you just made, but you can put anything obviously. The 0.5 is unit skill. (0 - 1, Set to default level.) Rank is rank written out in its entirety, any listed in the editor.)
"@VehicleManClass" createUnit [getMarkerPos "@MarkerName", @GroupName, "@VehicleManName = name this; this moveInDriver @VehicleName", 0.5, "@rank"];

And for a limited time, if you act now, you'll not only get this tutorial AND example code, but you'll also get this LIST OF ARMA CLASSNAMES ( http://community.bistudio.com/wiki/ArmA:_CfgVehicles ) for FREE! That's 3 excellent mission resources for the low low price of 15rnd_9x19! Unbelievable! We're practically giving THIS code away! Act now! Don't delay! Your troops need your support.

This post was edited by Faulken (2009-07-12 23:30, ago)

-- Faulken S. Wulf
"Under the Willow, he sleeps and dreams, of Heaven."