Jump to content

Recommended Posts

I am making a SP game and i want to delete some vehicles when i don't need them anymore like heli, trucks and planes.

{deleteVehicle _x} forEach crew (dropoff) + [dropoff]

this i have in ACT in trigger but i only delete the truck when it drives inside the trigger 

if i put {deleteVehicle _x} forEach crew (plane) + [plane] inside the trigger also it delete the plane before it have been used in the game

 

My trigger :

type : NONE

activation : BLUFOR

activation type : PRESENT

repeatabel :ticked off

Condition : THIS

on ACT : {deleteVehicle _x} forEach crew (dropoff) + [dropoff] (only delete the dropoff vehicle )

 

i want the trigger to delete any one and any vehicle who get inside the trigger from BLUFOR and one for OPFOR.

anyone got some guides lines on how to do it..

 

 

 

Share this post


Link to post
Share on other sites

{_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreach dropOff;

 

where dropOff is an array of vehicles you want to delete. Example, replace dropOff by:  (vehicles select {_x inArea thisTrigger && side _x == WEST})

Share this post


Link to post
Share on other sites

@pierre MGI do you  mean that i have to make a Array in my INIT.sqf with the Variable names that i want to delete :

 

Bluforce = ( "truck0", "truck1", "drophelo", "redjet1")  <- just an  example  of the array..

and this in trigger ACT : {_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreachBluforce;

 

or can i just use this in the trigger ACT

 

{_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreach  (vehicles select {_x inArea thisTrigger && side _x == WEST})

if so i can't get it to work

 

 

Share this post


Link to post
Share on other sites

This what you're looking for?

 

{deleteVehicle _x} foreach (crew flyby1); deleteVehicle flyby1; //Where flyby1 is the variable name of the vehicle. Name can be anything.

Deletes vehicle and crew.

Share this post


Link to post
Share on other sites
1 hour ago, Play3r said:

@pierre MGI do you  mean that i have to make a Array in my INIT.sqf with the Variable names that i want to delete :

 

Bluforce = ( "truck0", "truck1", "drophelo", "redjet1")  <- just an  example  of the array..

and this in trigger ACT : {_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreachBluforce;

 

or can i just use this in the trigger ACT

 

{_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreach  (vehicles select {_x inArea thisTrigger && side _x == WEST})

if so i can't get it to work

 

 

 

I'm trying to help with a standard working code. First an array is something like [element1,element2,..] with square bracket,

or a command returning an array like units or vehicles. See BIKI and follow links if you intent to understand a little thing.

So bluForce = [ "truck0", "truck1", "drophelo", "redjet1"]; 

why not?,  and

{_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreach Bluforce; 

with a space between forEach and bluforce.

 

If you have just one vehicle, that works also bluForce = ["truck0"];

or you can follow the example of stiffy.

 

If your list of vehicles can vary during the mission, you need something more adaptable like  (vehicles select {_x inArea thisTrigger && side _x == WEST}) It's an example which literally means:

all vehicles like car, plane, ship,tank.. belonging to west (so manned by blue units, not empty), and  inside the trigger area.

 

Check all conditions you like and check the trigger works by adding: hint "ok";  at beginning of the on act field.

Share this post


Link to post
Share on other sites

@pierre MGI i did follow the link to array, the ( ) i used was a typo i did read it was [] that i have to use.

i did not understand where to put the code since i have never used that type of code before, the closest i get to code is !alive and deletevehicle, not something complex.

i am used to delete all type of vehicles in there own WP by the command deletevehicle truck && deletevehicle truckD && deletevehicle truckG.
but this time i wanted to see if i just can put a trigger on the map and then make all planes and heli to fly thru a trigger area and then be deleted with out have to make it for every plane and helo.
 

The code you gave i did not understand where to put and when you wrote :  Example, replace dropOff by:  (vehicles select {_x inArea thisTrigger && side _x == WEST}) 
i was thinking that i have to replace it dropoff with the  linie (vehicles select {_x inArea thisTrigger && side _x == WEST})  but now i understand that it has to be in the COND of the  trigger, that i did not know before.
Thanks for helping me understand a little more about codelines.

 

Guess i didn't understand it since i can't get it to work. It just to complex for me to understand..

But thanks for the help pierre MGI..
 

Edited by Play3r

Share this post


Link to post
Share on other sites

Well, step by step.

 

1 - your trigger must have an area if you want to delete some objects inside it.

2 - a trigger can have a "pre-set" condition. By default, you can see type: none, activation:none . That means no pre-set condition, just check the condition field.

If you choose BLUFOR PRESENT, then the pre-set is: the trigger is waiting for any blue unit (vehicle or man) entering the area. (check occurs every 0.5 sec.)

 

- But also in the condition field, you can see by default :   this   . That means: check the pre-set condition.

   As for examples:

       If none,none, the trigger will never fire.

       if BLUFOR PRESENT the trigger will check the blue force entering in its area.

 

- Now, you can override this condition:

        Write true instead of this in the condition field and the trigger will fire at once (at start of the mission). No matter the pre-set condition. The activation code is a running code at start.

        write count allPlayers > 2 instead of this (just an example). No matter the pre-set condition (and the area btw), the trigger will fire if there are at least 3 players in game.

 

- Furthermore, you can mix pre-set and extra condition. Let your trigger BLUFOR PRESENT, then:

in condition field:

       this && count allPlayers > 2. Now you need 3 players or more in game, and (&&) at least one blufor unit in the trigger's area (no matter if it's a player)

 

 

Now, the "on activation" field. That's the code which run when your trigger is activated.  Here, you can decide to do some actions, hints or anything else on some players or objects/units, regardless of the conditions of the trigger. You can use the thisList special variable to get the array which fired the trigger (usually the first unit entering the trigger if some condition like BLUFOR PRESENT), but you can also blow up a town at the opposite side of the map. The code is related or not, as you want, to the conditions of activation.

 

Referring to your code:

type : NONE

activation : BLUFOR

activation type : PRESENT

repeatabel :ticked off

Condition : THIS

on ACT : {deleteVehicle _x} forEach crew (dropoff) + [dropoff]

 

Your code works on a vehicle called dropoff.

I showed you how to apply the code to an array of vehicles. Roughly: {_veh = _x; {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh} foreach  YOUR_ARRAY_HERE

I gave you some examples of arrays.

 

Now, if you want to delete the VERY FIRST ENTITIES entering the trigger (why entitieS? because thisList will return all matching entities passing the border during a 0.5 sec slot max. Becaise when the trigger is activated, your code runs with the actual list. The other following entities who could match (they are also BLUFOR entering the  area) are not taken into account in your code (already fired).

For example, little scenario: make your blufor group enter your trigger (BLUFOR PRESENT) and just activate the code: hint str (thislist). You can read in the hint, one or two units, but not the whole group).

 

Remember, your trigger is not repeatable....

Now, let it do repeatable.  Well you will see the same result.... Because your trigger is activated then the code will not run again, until you deact the trigger (all blue units must evac the area), and re-do the process of activation.

This problem can be solved by making your trigger "toggling" between act and deact states.

 

BLUFOR PRESENT , repeatable

condition field: this && isNil "yourVariableName"

in activation field: hint str thisList; yourVariableName = true;

in deact field : 0= [] spawn { sleep 0.5; yourVariableName = nil};

 

Check the little scenario above.

 

So, now, deleting all BLU aircraft entering the trigger:

BLUFOR PRESENT , repeatable

condition field: this && isNil "yourVariableName"

in activation field:  { _veh = _x; { if (_veh isKindOf "air") then {deleteVehicle _x} } forEach (crew (_veh) + [_veh]) } forEach thisList ; yourVariableName = true;  (EDITED)

in deact field : 0= [] spawn { sleep 0.5; yourVariableName = nil};

 

NOTE 1: this way, you can have ground units matching the trigger condition (BLUFOR car or men inside the area) but as you toggle the act/deact condition via the variable yourVariableName, the code runs every 0.5 sec. (the sleep in deact field) and thisList contains all present BLUFOR (air or ground).

 

NOTE 2: There is a very specific case you can simplify that, removing the variable stuff and even the deact field at all : If you delete/teleport outside the area all matching units at once. Example:

BLUFOR PRESENT , repeatable

condition field: this

in activation field: {_veh = _x; { deleteVehicle _x } forEach (crew (_veh) + [_veh]) } forEach thisList;

in deact field : (let it blank, the BLUFOR disappearance is sufficient)

As you empty the area of any BLUFOR, the trigger rearms and waits for new BLUFOR entrance.

 

Hope this help.

 

 

 

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites
23 hours ago, pierremgi said:

Hope this help.

20 hours ago, major-stiffy said:

:icon14:

 

Indeed ! :respekt:   :thumb:

Share this post


Link to post
Share on other sites

@pierre MGI

 Thank you so much for taking the time to make it simple for me and explain it to me so an old man in his forties can make a simple thing in A3 work.

i own you a lot of gratitude..

 

 

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

×