OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 10 Apr 2008, 01:02:45
-
Ok, How do I delete every single badguy outside of a distance of 1500m from the player?
-
I think vehicles command returns also soldiers so:
{
if ((vehicle _x == _x) && (side _x == badsideguys)) then
{
deleteVehicle _x;
};
} forEach vehicles;
-
This is most likely not the best approach, but it is an approach.
You could create a trigger that covers the whole map, get a list of all the units within the area of the trigger (the whole map); then create a trigger that covers a 1500 m radius around the player and get a list of all the units within this area. Then, subtract the units near the player from the list of units on the map and and delete all the units in the resulting array.
Alternatively, if you're using BAS-f (which I highly recommend at least for single player missions) and have been maintaining the list of EAST units when you create new units (as instructed in the manual), then all you need to do is determine what units are close and subtract them from the total list to have a list of units to delete.
-
Mandoble where is the distance part of your code?
What about something along the lines of countnits east side, if they are +1500 delete those units.
How would I write that?
-
Try this modification to what Mandoble posted:
{
if ( (vehicle _x == _x) && (side _x == badsideguys) && ( (player distance _x) >= 1500 ) ) then {
deleteVehicle _x;
};
} forEach vehicles;
-
getting an error message. missing ]
Can I just paste it into my script as is?
-
Make sure you've changed "badguyside" to a value that actually indicates the bad guy side, such as "east" (without quotation marks I think).
There's no '[' so I'm not sure how it could be missing a ']'; are you sure that you've not an error somewhere else in your script? Or, it's possible the syntax I've used for distance is not correct.
You could try this variation ...
(player distance getpos _x)
-
Still getting the error. It's a {
Here's my full script.
setacctime 1.0
#Start
~5
TitleCut ["\nLt. Aylwyn ~ This is Pagan. We're at the evac point. Charlie is everywhere. Come get us. Over.","plain Down"]
~5
soho6 sidechat "Roger Pagan. Angel 1 is inbound. He'll come up on your push when he's close to the LZ. Soho out."
~10
savegame
~1
evac1 = true
{
if ( (vehicle _x == _x) && (side _x == east) && ( (player distance _x) >= 1500 ) ) then {
deleteVehicle _x;
};
} forEach vehicles
goto "Exit"
#exit
exit
-
You lost me when you posted an SQS script; I'm only familiar with SQF syntax. Someone else will have to help.
-
Couldn't I do it by launching a sqf from my sqs?
-
Hi Architect, what about Chris's editor? Helps in the' { [ ( 'kinda thingos! There is a little dif in ofp and arma.
Cheers Schuler. Chris has a new one for ArmA,,,, but you more then likly knew that,
Ps I am not a good scripter by any means :P
You lost me when you posted an SQS script; I'm only familiar with SQF syntax
?????
-
setacctime 1.0;
sleep 5.0;
TitleCut ["\nLt. Aylwyn ~ This is Pagan. We're at the evac point. Charlie is everywhere. Come get us. Over.","plain Down"];
sleep 5.0;
soho6 sidechat "Roger Pagan. Angel 1 is inbound. He'll come up on your push when he's close to the LZ. Soho out.";
sleep 5.0;
savegame;
sleep 1.0;
evac1 = true;
trigger1 = true;
setacctime 1.0;
~5
TitleCut ["\nLt. Aylwyn ~ This is Pagan. We're at the evac point. Charlie is everywhere. Come get us. Over.","plain Down"];
~5
soho6 sidechat "Roger Pagan. Angel 1 is inbound. He'll come up on your push when he's close to the LZ. Soho out.";
~5
savegame;
~1
evac1 = true;
TRIGGER1 = true;
exit
Make sure you define trigger1 in the init.sqs/sqf as false.
Then in a trigger "EAST PRESENT":
Activation: {?((vehicle _x == _x) && (side _x == east) && ( (player distance _x) >= 1500 ) ): deleteVehicle _x;} forEach thisList;
-
Ah, this whole thread operates under the assumption that the vehicles command also returns units : not so however! It only returns, as the name would suggest, vehicles (unless something has changed in the latest betas).
I would suggest for this to use a trigger that's very very large and covers the whole island/area of operations, activated by OPFOR present (repeatedly if you want, I don't think it makes a difference). Name the trigger (in example "AllEnemy") and then do something like this (in .sqs, I hope):
AllEnemy setPos getpos Player
_allenemyList = list AllEnemy
~0.1
{if ((_x distance Player) > 1500) then {deleteVehicle _x}} forEach _allenemyList
That -should- work, so try it out :)
Wolfrug out.