Jump to content
Sign in to follow this  
craptakular

3x tank in a group, move to waypoint after X time.

Recommended Posts

Hi,

I have put 3x tanks down on the editor. What I am thinking I need to do is to get them to not move and not fire even if fired upon until the countdown reaches zero. Then they move to there way point and defend it.

Do I need to sync the tank group to a trigger based on countdown?

this > 3600

then on action??

I'm not sure how to proceed tbh, I'm new to editing missions.

Please help

Share this post


Link to post
Share on other sites

Init line of each tank:

tank disableAI "move";
tank disableAI "autotarget";
tank disableAI "target";

Change "tank" to your tanks' names.

Then, create a trigger with a countdown, On Act:

tank enableAI "move";
tank enableAI "autotarget";
tank enableAI "target";

And synchronize the trigger with the waypoint given for the tank group.

Should work, not tested though.

Share this post


Link to post
Share on other sites

In the trigger condition you would either use the built in time function(s). Or use time > 3600 as a condition. What you would do, is give the group of tanks 2 waypoints. One waypoint at the leaders nose, the other at your target destination. Set the first waypoint on never fire & careless. Set the second waypoint however you like for combat. Now sync the trigger with the first (careless) waypoint. The tank wont move unless the triggers condition has been met, in this case he wont move unless the time is greater than 3600 seconds.

time > 3600

Share this post


Link to post
Share on other sites
In the trigger condition you would either use the built in time function(s). Or use time > 3600 as a condition. What you would do, is give the group of tanks 2 waypoints. One waypoint at the leaders nose, the other at your target destination. Set the first waypoint on never fire & careless. Set the second waypoint however you like for combat. Now sync the trigger with the first (careless) waypoint. The tank wont move unless the triggers condition has been met, in this case he wont move unless the time is greater than 3600 seconds.

time > 3600

Thanks guys,

so if you got to the objective (blow the tanks before they move off) would they fire at you or would they not move or fire even if you danced in front of them?

Share this post


Link to post
Share on other sites

Well if they're set on careless and never fire they shouldn't. BUT... sometime AI do weird things. So you can do as try suggested if it isn't working. There's a number of possibilities/work arounds to achieve the effect you want. So if I understand you, you have a mission, where if you let the time go past 1hr (3600 seconds) then you want some tank reinforcements to roll in. But you want the tanks to remain harmless up until (if) they head out. Is this correct?

---------- Post added at 05:20 ---------- Previous post was at 05:05 ----------

You could always just create the tanks & crew when the time condition is met

Share this post


Link to post
Share on other sites

If what Iceman described is your case I strongly suggest you create the tanks and crew mid-mission using either createUnit array (which will include the crew) or createvehicle array (which does not include the crew since it creates an empty vehicle).

Waypoints etc can still be assigned to these units via addWaypoint and so on.

Share this post


Link to post
Share on other sites

What I am thinking is an objective that they have to destroy the tanks within an hour, or they will move in to defend the main objective, making the mission much harder.

So they will need to be spawned so that they can be destroyed.

---------- Post added at 16:52 ---------- Previous post was at 16:51 ----------

Well if they're set on careless and never fire they shouldn't. BUT... sometime AI do weird things. So you can do as try suggested if it isn't working. There's a number of possibilities/work arounds to achieve the effect you want. So if I understand you, you have a mission, where if you let the time go past 1hr (3600 seconds) then you want some tank reinforcements to roll in. But you want the tanks to remain harmless up until (if) they head out. Is this correct?

---------- Post added at 05:20 ---------- Previous post was at 05:05 ----------

You could always just create the tanks & crew when the time condition is met

Thats completely correct.

Share this post


Link to post
Share on other sites

One question. If its like a side objective to destroy the tanks, why would you want them to not engage? Do they break their ROE and leave the spot they're supposed to be at? You could simply just man each tank with a gunner and commander, and then add the driver later (when time > 3600) if that's the case. So they wont take off prematurely, because they feel the need to s&d a target LOL. That concept itself may need some adjusting, idk if the leader of a crew would order the other ai into driver pos. But I assume they wouldn't.

Or, you could create the tank/crew, when player passes through a trigger (ie; when you're close enough to the tanks "spot"). This way, you could still allow them to act naturally, but not be to far away, if at all, from where they're supposed to be.Or use a distance check and then spawn the units. player distance someObject < 200 as a condition to spawn the units

---------- Post added at 08:17 ---------- Previous post was at 08:08 ----------

Do you even know how to create units via script?

Edited by Iceman77

Share this post


Link to post
Share on other sites

Consider there is only 12 of us, my intention was to have them static for 1 hour, to give us time to blow them. The empty tanks would then roll out to there waypoints after 1 hour.

Prior to this, I don't want them to move, or fire at all even if I were to dance in front of them before the hour mark.

We are light infrantry with jackals, so I don;t want the T-55's to engage us unless its over the hour.

I do not know how to spawn via script.

EDIT: The objective will be to blow the "repairing/refuelling tanks"

Edited by craptakular

Share this post


Link to post
Share on other sites

Well honestly that doesn't sound like a challenge, but anyway, not my position to judge here. :P

I guess I can write up the basic concept of spawning units since my Arma doesn't want to work anyway.

First I suggest you read through createVehicle array & createUnit array (links provided above or just search on the BIKI)

I'll start off with createVehicle array.

Basic syntax for this:

Object = createVehicle [type, position, markers, placement, special]

Quick explanation of the stuff:

Object = Basically the array containing the vehicle (example: _hind)

type = The type of vehicle you want to spawn. Note this is an empty vehicle, so no crew within it. (Helpful links: Arma2 Library and =faction&options[sort_by]=vehicleclass&options[faction]=USMC&options[vehicleclass]=Air]SIX Config Browser (both include (nearly) all objects of Arma2 & OA)

position = Baasically this can be a fixed position (ex: position player) or a markerposition (ex: getmarkerpos "infspawn"). Look up position and getmarkerpos on the BIKI for more info.

markers = This is additional markers for randomized positioning. Note that this is within an array, so using [] is required. (ex: ["marker1","marker2"]) Using getmarkerpos is not necessary, only if oyu use a marker within the position.

placement = This is the placement radius (sorta like offset) of the marker / position. It checks in a circle as far as I know. (ex: you use position player & placement of 10, this causes the vehicle to spawn 10 m away from the players position)

special = This can be multiple things.

"Special properties can be: "NONE", "FLY" and "FORM". "CAN_COLLIDE" creates the vehicle exactly where asked, not checking if others objects can cross its 3D model." - Taken from the BIKI.

NONE = Nothing, no special stuff. Just like the special properties section in the regular editor when you spawn a unit and choose None.

FLY = Self explaining, just like "Flying" in editor. Only useful for Helos or Airplanes.

FORM = Again self explaining, just like "In Formation" in editor. Sets the vehicle to the predefined formation (if in a group) which was defined by setFormation (or just plain old Wedge if it's Arma doing the job)

CAN_COLLIDE = This one's special. regularly Arma checks whether an object could collide with for ex. a barrel which is in the way. This disables said check and lets you basically place objects within objects (I've never used it tho)

I hope this kind of makes sense. If it does, off to the next one:

createUnit array

Basic syntax:

Object = group createUnit [type, position, markers, placement, special]

Alot of this is just like createVehicle array, although there are some differences.

Object = Same as createVeh array, the array containing the object (ex: _pilot)

group = Now for this you either need a pre-defined group via editor or you need to create it via script. This defines which group the newly created unit will join (remember, this is a unit, so like a soldier for example).

Ex. via editor:

groupName = group this

in units init line in editor.

Ex. via script:

_group = createGroup WEST/EAST/INS

type = Same as createVehicle array, just that it's more towards single units here and not vehicles.

position = Same as createVeh array.

markers = Same as createVeh array.

placement = Same as createVeh array.

special = This is a bit different from createVeh array since this is focused on units.

"Special properties can be: "NONE" and "FORM"." - Taken from BIKI

The only special properties now are NONE and FORM, but are the exact same as we used in createVehicle array.

I hope this made some sense and if not just ask questions.

Share this post


Link to post
Share on other sites

LOL yet another way of doing things.Anyhow, I made a script aswell. I've Included instructions, so maybe you can learn also how indexes work along the way. In the instructions you would normally spawn this via radio trigger to see how it works. But you can run the script at anytime, in any condition. Maybe when you enter a trigger area a few hundred meters away, you can run this script

tankspawn.sqf

/* 
-Copy and paste this script into notepad and name it tankSpawn.sqf
-place a functions module on the map.Place a game logic (object) on the map and name it server
-place 2 invis hpads on the map. One for the spawn point of the tanks and the other for their destination.Give each one a unique name.For testing place a playable unit by the spawnHpad to see them spawn.
-place a non-playable infantry unit on the map far away and safe from the action (same side as the tanks), he will be used as a placeholder.Give him a unique name. In his init,assign him also a unique group name >> someGrpname=group this
-create a radio trigger and put this into the onAct (with your own values ofcourse) >> _handle=[hpadSpawnName,hpadDestinationName,azimut,"Veh_class_Name",grpName,amountToSpawn,TimerUntilTheyMove,placeHoldername]execVM "tankspawn.sqf"
- EXAMPLE: _handle=[tankPad,AO1,270,"M1A2_TUSK_MG",razor1,3,3600,Pman]execVM "tankspawn.sqf"
*/

//Only the server runs the rest of the script, clients exitout of the script. Only create vehicles on the server..and that's what we're gonna do here
if (!isServer) exitWith {};

//Always add this/these waitUntil(s) when using any BIS_FNC and/or the MP frameWork, aswell as placing a functions module on the map
waituntil {!isnil "bis_fnc_init"};
waitUntil{!isNil "BIS_MPF_InitDone"};

//Setup the indexes (below) - Notice the script is called like >> _handle=[tankPad,AO1,270,"M1A2_TUSK_MG",razor1,3,60,Pman]execVM "tankspawn.sqf" << take a look @ that and you can see how indexes work
_pos = _this select 0;
_des = _this select 1;
_dir = _this select 2;
_veh = _this select 3;
_grp = _this select 4;
_num = _this select 5;
_time = _this select 6;
_ph = _this select 7;

//Create _num vehicles, 1 every 5 seconds and then proceed with the rest of the script. Note: the tanks have to join an already existing group.Which is what the placeholder guy is for
_creating = parseText format["%1 %2 Are Being Created in group %3",_num,_veh,_grp];[nil,nil,rHint,_creating] call RE;
for "_t" from 1 to _num do {[Position _pos, _dir, _veh, _grp] call bis_fnc_spawnvehicle; sleep 5};
_created = parseText format["%1 %2 Have Been Created and placed into %3",_num,_veh,_grp];[nil,nil,rHint,_created] call RE;

//After the tanks have been created, delete the worthless placeholder leader (now one of the tank commanders will be leader) and wait for a condition to give the tanks a destination
deleteVehicle _ph;

//Add Eventhandler to the tank group so you can check if they're dead.
{_x addEventHandler ["killed",{if ({alive _x } count units _grp < 1) then {_Destroyed = parseText format["%1 %2  Crews from %3 Have Been Destroyed",_num,_veh,_grp];[nil,nil,rHint,_Destroyed] call RE;}}]} forEach units _grp; 

//waitUntil a specified time to have the tanks move      
waitUntil {(time > _time)}; 

if ({alive _x } count units _grp > 0) then {{_x doMove position _des} forEach units _grp;_moving = parseText format["%1 %2 from %3 are moving to %4",_num,_veh,_grp,_des];[nil,nil,rHint,_moving] call RE}

You could effectively use that script to create that scenario multiple times on a map, or use it to just spawn vehicles and have them go to a destination instantly, by setting the time to 0

---------- Post added at 12:14 ---------- Previous post was at 12:14 ----------

CreateUnit array is bugged with vehicles, so that sucks. Best to just use BIS_FNC for creating manned vehicles... IMO

Edited by Iceman77

Share this post


Link to post
Share on other sites

---------- Post added at 12:14 ---------- Previous post was at 12:14 ----------

CreateUnit array is bugged with vehicles, so that sucks. Best to just use BIS_FNC for creating manned vehicles... IMO

Its not bugged, its not made for creating vehicles. So it doesn't work. Thankfully they made another command that might :):

http://community.bistudio.com/wiki/createVehicle_array

But your right, I like using bis_fnc_spawngroup for vehicles as well.

Share this post


Link to post
Share on other sites
Its not bugged, its not made for creating vehicles. So it doesn't work. Thankfully they made another command that might :):

http://community.bistudio.com/wiki/createVehicle_array

But your right, I like using bis_fnc_spawngroup for vehicles as well.

Ahh okay, I thought it was also used as a way to create manned vehicles. While createvehicle was used for empty ones. Anyhow, I learn something new everyday :p

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  

×