Jump to content
Sign in to follow this  
GunnDawg09

How would I do this?

Recommended Posts

So I am new to the ArmA series and have never used this editor. Was wondering how I could just make it so I spawn on a USMC base with other soldiers around just going about their business so I can pick them up and drive them to another base with the possibility of getting ambushed along the way?

I have read about the Ambient Module but woudl like some step by steps on how to get it to work properly.

Share this post


Link to post
Share on other sites

hmmm Well I placed the civilians, civilian vehicles, and combat modules next to where my player starts, then used the synchronize button and drew a line from each of the modules to my players starting area.

After about 15 - 20 mins of testing the only thing I saw were civilians(very few but at least they were there), and civilian cars. I even drove out to an airbase and it was empty. Never saw any enemy or combat going on.

:(

Share this post


Link to post
Share on other sites

Spawn bases with soldiers inside is not as easy as plopping a module out im afraid. You can get patrols randomly come and the civilian module ofcourse adds civilians to villages/cities etc. Not out in the open. They will however walk/cycle around. But for getting a base you have to set it up the old fashion way. Add a base and add units there and give them waypoints etc. Maybe the ACM module (Ambient Combat Module) will help us soon though when we learn how to set it to areas instead of as it is now - random.

Or you can for now use Kronzky's UPS script (Urban Patrol Script). That one you can set a marker to tell where the units should patrol around. So plop out some bases, units and then use the script to make them patrol around the bases.

Alex

Share this post


Link to post
Share on other sites

If you want sort of off-duty behaviour from your AI, try out the DISMISSED waypoint and see what happens.

Share this post


Link to post
Share on other sites

Still no luck with the ACM. After approx. 20 mins of just driving around I havent once came across some combat.

Share this post


Link to post
Share on other sites

From reading the massive thread about ACM it's not something you can base a mission on without extremely specific scripting and knowing exactly what you're doing.

As a first timer you're really better off just using the vanilla editor to make a simple mission. Once you have that down and understand how you did everything and why it all worked the way it did, THEN move on to adding in small bits of scripting. Once you understand that, then start moving into the configurable module/user scripts out there that will do what you want at the complexity level you want.

Since I'm bored waiting for a pizza I'll try to make up a quick mission so you can see at least the steps in making one using just the editor and perhaps some slight scripting. :)

Share this post


Link to post
Share on other sites

That would be great, I wanna be able to play as some insurgents and just randomly come across some US Marines as I am out and about doing whatever it is insurgents do :)

If I have to pick where the USMC guys spawn manually then that doesnt add much fun to it, as I know where they will be all the time, every time.

Share this post


Link to post
Share on other sites

Oops, didn't see you wanted to be insurgents, but you can do this idea either way. I set it up as you being a Marine Squad leader sent to relieve an officer and drive his men to some R&R in a nearby city. This mission could be made entirely dynamic as well, instead of preplacing what I did you could create the units/waypoints/triggers on the fly, but that would involve a lot more scripting.

First some of the things I did with just the editor. First I placed some random "camp" building around, preplaced a Truck for the player to use, and placed an enemy squad near my ambush site and a friendly squad in my camp.

You can download this sample mission from my website.

Unit Objects:

First thing to place is your player. I did a standard Squad Leader Marine. Two things I did on the Edit Unit page were to set it's Name: to player. This allows me to refer to my player object as "player" in other scripts. I also put the following in the Initialization: field myPlayerIsLeader = 0; This sets a global variable that a waypoint I'll place later will be triggered by.

Next I set a few things on my friendly squad. First thing I did was change the Squad Leader's Unit: from Squad Leader to Officer. This was so he was easier to identify! Second I set his Name: to boss. Again this is so I can refer to his object in scripts. Then I put the following in his Initialization: field:

_genAct = boss addAction ["Assume command of squad.", "takeover.sqf"];

This is probably a little confusing, so lets break it down a bit. The _genAct = is used to create a handle for the action creation. You could have used pretty much anything for _genAct. For throwaway handles like this I often use _null, but apparently forgot to change it from the example I copied from! The next part, "boss addAction...", adds an action to the boss object (remember, how we named him?) that will appear on the Officer's action menu. The player will see "Assume command of squad." and when it's clicked it will trigger "takeover.sqf", a script function file I'll create with a text editor.

Next I Name:'d two random units in the squad unit1 and unit2. They'll be used to make witty banter later.

For the MTVR I set it's Name: to truck since we'll be referring to that later in a script as well.

For the enemy all I did was set the enemy Squad Leader's Name: to badguy, for referring to in waypoints.

Waypoints:

Orginally I'd intended to do most of the work in this mission via waypoints and triggers, but I had to rely on some scripts as well. All the same there's quite a few waypoints and some of these are a little tricky. First, the player's waypoints.

The player gets a single waypoint. It was placed about 15m in front of the starting position and is a JOIN AND LEAD type waypoint. Nothing really special about this, and it won't even really do anything, it's just guidence for the player to know what to do and where to go. It'll switch to a WAIT waypoint until the Officer comes around the HQ building.

Most of the waypoints are actually assigned to the Officer since he starts with control of the squad. The first waypoint is a simple MOVE waypoint to bring the squad closer to the player. A few meters in front of this waypoint I put a DISMISSED waypoint. This will scatter the squad, make them mill about aimlessly, sit down, whatever. They will remain this way until the player takes over because of the condition I'll put on the next waypoint.

The third waypoint is put directly ON the MTVR and is a GET IN style waypoint. Since this waypoint is now locked to the MTVR, simply hold Shift to select the Truck instead of the Waypoint in the editor. In it's Condition: I put myPlayerIsLeader == 1; and in it's On Act.: field I put the following:

hint "You can have your squad board the truck by pressing ~ to select all units, then issue the Get In command by pressing ENTER."

This will do two neat things for us. First off, the Condition prevents this waypoint from showing up at all until the variable myPlayerIsLeader is set to 1. Since this variable starts as 0 (remember, the player's init field?) and isn't set till the takeover.sqf script is complete, the squad stays at it's previous waypoint (Dismissed) till the player takes over the squad. When the player takes over for the squad he'll inherit the waypoints from boss and the next one will be GET IN, directing the player to board the truck. The On Act hint displays a little help window for the player once he boards the truck (completing the waypoint) and explains how to get his squad to board.

The next MOVE waypoint is NE in the little cluster of buildings north of Strelka. Basically this is just to get the player on the correct road for the ambush. Once he reaches this waypoint the final MOVE waypoint in Kamenyy will display, but we won't get that far, just lets the player know which direction to go. There's also a TRANSPORT UNLOAD one as well, which should trigger the AI to get out of the truck if nothing bad happens along the way... which it will. :)

The most complicated waypoints will be for the enemy since we want them to do some pretty specific things. First is a MOVE waypoint a few meters in front of the squad. In this one we set the On Act.: (which fires when the waypoint is activated) to {_x setUnitPos "DOWN"} forEach units group badguy This causes the group to run forward to the waypoint, then all of them go prone. The next waypoint is also a MOVE but this set we set some behavior for the squad. Combat Mode: is set to Never Fire, Formation: is set to Line, and Behavior: is set to Careless. This will make the squad crawl towards the wall they'll be hiding behind and be completely oblivious to everything. Don't want them springing the trap before it's sprung! In the On Act.: of this waypoint I put {_x setUnitPos "AUTO"} forEach units group badguy This will make them all stand back up once this waypoint completes. We'll be synchronizing it to a trigger though, and I'll explain that later. Finally we set up a SEARCH AND DESTROY waypoint at the place of ambush. In this one we get Combat mode: to Open Fire, Engage at will and Behavior: to Combat.

Triggers:

Now the real fun! Triggers! We only use two, but they'll do a lot for us, especially since one will trigger the function script, "bailout.sqf" we'll write. The first one is placed ahead of the actual ambush site. This trigger will do three things, hint that something bad is going to happen, show that the squad noticed something and start playing some battle music to raise the tension.

This trigger is set for Axis a of 30 and Axis b of 30, so a 30m circle centered around the road. Activation is set to BLUFOR, ONCE and PRESENT meaning it'll trigger once anyone from the good guys enters the trigger zone. The On Act. gets unit1 groupChat "Did you see that?"; This will have the unit1 we named eariler say "Did you see that?" in group chat. Next we'll click the Effects button in the bottom left corner of the Edit trigger window.

From the Edit effects window we'll choose 14: Close Quarter Combat from the Track: drop down and TEXT from the Type: dropdown. That will open up a new field under the dropdowns where we'll type in Ambush! This will display the word Ambush! in white letters across the screen when this trigger is activated. Click OK and OK to finish the trigger.

The second trigger, placed a short distance down the road near the enemy squad will be seemingly less complicated, but will call our bailout script for us. Again we use the same settings as before Axis set to 30, Activation set to BLUFOR, ONCE, PRESENT. This time we'll put the follwing in On Act:

unit2 groupChat "Yeah! Someone behind those rocks??"; _null = execVM "bailout.sqf";

When this trigger is.. triggered, unit2 will say his bit then the script "bailout.sqf" will be called. Again the _null = is simply used as a throwaway handle that will execVM (a fancy keyword for "please compile and execute the script I've written") the script.

Synchronize:

The last thing we'll do is Synchronize the ambush trigger with the second MOVE waypoint of the enemies. This will prevent that waypoint from completing (and allowing the bad guys to stand up and move to the SEARCH AND DESTROY waypoint) until this trigger goes off. Just enter Synchronize mode and drag a line from the trigger to the MOVE waypoint.

As far as in Editor things, that's all we need. Next up will be the two scripts. Once for the Group Leadership handover and one for the fireworks!

Scripts:

These scripts are simply text files with an .sqf extension. You can write them in Notepad or use the superb ArmAEdit program which will auto-fill for you and color code things which is really nice for catching simple syntax mistakes. Since I've commented the script code I'll just post them and you can read the code for line by line explanations. These scripts are placed in the mission build folder (for example C:\Documents and Settings\<yourusername>\My Documents\ArmA 2 Other Profiles\<yourprofilename>\missions\Ambush!.utes) Once everything is ready and you're happy with the Preview of the mission, choose Save then Export to Single Missions.

takeover.sqf:

// This is the script that gives the player command of the squad.
// Step 1:  Record the actionID we used to call this script.
// Step 2:  Some dialog from the officer thanking the player.
// Step 3:  Join the player to the group.
// Step 4:  Make the player leader of the group.
// Step 5:  Have the old leader leave the group and keep himself busy.
// Step 6:  Remove the action from the old leader, so we can only do this once.
// Step 7:  Record a variable that says we've completed this task.  We'll use this for waypoint control.

// This line just records which 'action' we used to take over for the old SL so we can delete it later.
_bossaction = _this select 0; 

// Have the boss thank you for taking over
titletext ["Thanks for taking over, I needed a break!", "PLAIN"];

// Join the player to the current group.  Note that player in this case is an Array.
[player] join group boss;

//  Make the player the leader of the group.
group player selectLeader player;

//  Have the old leader leave the group and do some exercise. :)
[boss] join group objNull;
boss playMove "AmovPercMstpSnonWnonDnon_exercisePushup";

// remove the action once it is activated 
_bossaction removeAction _id;

//  Mark that our player is leader so the rest of the waypoints show up for them.
myPlayerIsLeader = 1;

// Get the rest of the group to follow the player instead of being dismissed.
{_x doFollow player} forEach units group player;

bailout.sqf:

// This is the script which will replicate an IED attack, or otherwise a Very Bad Day for poor Truck.
// Step 1:  Create an explosion and big boom.
// Step 2:  Stop the truck in it's tracks, simulating damage.
// Step 3:  Safely disembark the squad, since they are about to enter combat.

// This is some code to make a big explosion.  It should be well behind us, but the sound + falling debris is neat!
_pos = getPosASL truck;
_bomb = "Bomb" createVehicle _pos;
_bomb setPos _pos;
_ammo = "M_TOW_AT" createVehicle _pos;
sleep .05;
deleteVehicle _bomb;

// Here's the 'damage' to the truck, first stop it, then take it's fuel, then set it almost dead.
truck setVelocity [0, 0, 0]; 
truck setFuel 0;
truck setdamage 0.8;

// Give the truck time to slow down, and the player to realize something bad just happened.
sleep 4; 

// Get everyone out of the truck, combat is about to begin!
{_x action ["GetOut", vehicle _x]} foreach units group player;

Again the sample mission (both in BPO and Editor files inside a zip) is available here.

Edited by kylania
Forgot Synchronizing and where to put the scripts!

Share this post


Link to post
Share on other sites

Any reason you've named the player, player, seeing as that's technically the worse decision you can make. ;)

Player == player. You don't have to name it.

Share this post


Link to post
Share on other sites

Starting off with a horrible decision is always a great way to start! :) I'm sleepy, sorry heh.

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  

×