Jump to content
Sign in to follow this  
0verlord-actual

Auto AA Area on the map that's side dependent?

Recommended Posts

Hey guys,

so heres my issue, I can't place loads of AA tanks on the map ALTIS in the areas controlled by each side as it causes our server to slow down loads. I want to create an area/trigger that will cause any aircraft OF A PARTICULAR SIDE that enters it to get a 10 second warning that AA systems are locking onto their aircraft and then after the ten seconds if their still within the trigger destroy the Aircraft.

I have achieved this with named aircraft, but I really wish to achieve it with any aircraft regardless of names and only dependent on the side of the aircraft. Therefor opfor can fly within their own zone with any aircraft but Bluefor can not fly in that zone. I use a helicopter crash script I got off here to do it previously but it means all aircraft have to be named and within the parameters of the script.

Any help would be amazing. I am very new to the whole scripting gig so this may seem pretty simple but its not for me.

thanks again.

Share this post


Link to post
Share on other sites

I hope I understand you correctly and this fits your needs:

[color=#FF8040][color=#1874CD]_triggerBlufor[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createTrigger[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"EmptyDetector"[/color][color=#8B3E2F][b],[/b][/color] [color=#191970][b]getPosATL[/b][/color] [color=#000000]player[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_triggerBlufor[/color] [color=#191970][b]setTriggerArea[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#FF0000]3000[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]3000[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_triggerBlufor[/color] [color=#191970][b]setTriggerActivation[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"ANY"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"PRESENT"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]true[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_triggerBlufor[/color] [color=#191970][b]setTriggerStatements[/b][/color]
[color=#8B3E2F][b][[/b][/color]
   [color=#7A7A7A]"this && {vehicle player in thisList} && {playerSide != blufor} && {vehicle player isKindOf 'Air'}"[/color][color=#8B3E2F][b],[/b][/color]
   [color=#7A7A7A]"
       _handle = [] spawn
       {
           for '_i' from 10 to 1 step -1 do
           {
               hint format ["[/color][color=#7A7A7A]"Leave this area or you will be destroyed!\nYou've got %1 seconds."[/color][color=#7A7A7A]", _i];
               uiSleep 1;
           };
           (vehicle player) call BIS_fnc_neutralizeUnit;
       };

       player setVariable ['bluforTrigger', _handle];
   "[/color][color=#8B3E2F][b],[/b][/color]
   [color=#7A7A7A]"terminate (player getVariable 'bluforTrigger'); player setVariable ['bluforTrigger', nil]; hint '';"[/color]
[color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color][/color]

Kudos to Killzone_Kid for his SQF to BBCode Converter.

Replace "getPosATL player" with any desired position. In triggers for other sides it's just the same. Just replace the if(playerSide ...) statement.

EDIT:

Code updated (if-statement from activation part moved to trigger condition, suggestion by "Grumpy Old Man" included)

Edited by Heeeere's Johnny!
code corrections

Share this post


Link to post
Share on other sites

wow thanks so much! So will that only kill them if they are in an aircraft or will kill the unit even when they are on foot?

Share this post


Link to post
Share on other sites

As it is, it will kill the unit either by destroying its vehicle or - if on foot - simply killing the unit. But it's just one line to add if you want this to apply for aircraft only.

Share this post


Link to post
Share on other sites

sweet, sorry for the million questions but whats the once line and will it allow the player to be in a ground vehicle? or will it kill all player vehicles? because I am going to use it so that once some radars are destroyed then the airspace is free to fly in again. so the player needs to be able to get in the zone in a ground vehicle?

thanks again, you have no idea how helpful you are!

Share this post


Link to post
Share on other sites

You simply change this line:

if(playerSide != blufor) then

to this line:

if(playerSide != blufor && {vehicle player isKindOf 'Air'}) then

That way, only air vehicles will be affected by that trigger.

You're welcome!

PS: As I just realized, this whole check thing can also go into the trigger condition. I changed the code above respectively.

Share this post


Link to post
Share on other sites
You simply change this line:

if(playerSide != blufor) then

to this line:

if(playerSide != blufor && {vehicle player isKindOf 'Air'}) then

That way' date=' only air vehicles will be affected by that trigger.

You're welcome!

PS: As I just realized, this whole check thing can also go into the trigger condition. I changed the code above respectively.[/quote']

hey man, it doesn't seem to work? have i set it up wrong?

This is what i have got.

_trigblueforAA1 = createTrigger ["EmptyDetector", getmarkerpos bluefor_AA1];

_trigblueforAA1 setTriggerArea [3400, 3400, 0, false];

_trigblueforAA1 setTriggerActivation ["ANY", "PRESENT", true];

_trigblueforAA1 setTriggerStatements

["this && {player in thisList} && {playerSide != bluefor} && {vehicle player isKindOf 'Air'}",

"_handle = [] spawn

{ for '_i' from 10 to 1 step -1 do

{

hint format [""Anti Air system is locking onto your Aircraft!\nYou've got %1 seconds."", _i];

uiSleep 1;

};

(vehicle player) call BIS_fnc_neutralizeUnit;

};

player setVariable ['blueforAA1target', _handle];

",

"terminate (player getVariable 'blueforAA1target'); player setVariable ['blueforAA1target', nil];"

];

Share this post


Link to post
Share on other sites

Your first line is wrong. getMarkerPos requires the marker name (string), not the marker object. So correct would be:

getMarkerPos "bluefor_AA1"; //if that's the name you gave it

---------- Post added at 15:46 ---------- Previous post was at 15:33 ----------

I just realized that I made a slight but crucial mistake. Instead of {player in thisList} it has to be {vehicle player in thisList} as "player" will not be in "thisList" if he's in a vehicle.

So here's the corrected code (so you don't have to scroll all the way up again):

[color=#FF8040][color=#1874CD]_trigblueforAA1[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createTrigger[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"EmptyDetector"[/color][color=#8B3E2F][b],[/b][/color] [color=#191970][b]getMarkerPos[/b][/color] [color=#7A7A7A]"bluefor_AA1"[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_trigblueforAA1[/color] [color=#191970][b]setTriggerArea[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#FF0000]3400[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]3400[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_trigblueforAA1[/color] [color=#191970][b]setTriggerActivation[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"ANY"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"PRESENT"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]true[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_trigblueforAA1[/color] [color=#191970][b]setTriggerStatements[/b][/color]
[color=#8B3E2F][b][[/b][/color]
   [color=#7A7A7A]"this && {vehicle player in thisList} && {playerSide != blufor} && {vehicle player isKindOf 'Air'}"[/color][color=#8B3E2F][b],[/b][/color]
   [color=#7A7A7A]"
       _handle = [] spawn
       {
           for '_i' from 10 to 1 step -1 do
           {
               hint format ["[/color][color=#7A7A7A]"Anti Air system is locking onto your Aircraft!\nYou've got %1 seconds."[/color][color=#7A7A7A]", _i];
               uiSleep 1;
           };
           (vehicle player) call BIS_fnc_neutralizeUnit;
       };
       player setVariable ['blueforAA1target', _handle];
   "[/color][color=#8B3E2F][b],[/b][/color]
   [color=#7A7A7A]"terminate (player getVariable 'blueforAA1target'); player setVariable ['blueforAA1target', nil]; hint '';"[/color]
[color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color][/color]

Edited by Heeeere's Johnny!

Share this post


Link to post
Share on other sites
Your first line is wrong. getMarkerPos requires the marker name (string)' date=' not the marker object. So correct would be:

getMarkerPos "bluefor_AA1"; //if that's the name you gave it

---------- Post added at 15:46 ---------- Previous post was at 15:33 ----------

I just realized that I made a slight but crucial mistake. Instead of {player in thisList} it has to be {vehicle player in thisList} as "player" will not be in "thisList" if he's in a vehicle.

So here's the corrected code (so you don't have to scroll all the way up again):

[color=#FF8040][color=#1874CD]_trigblueforAA1[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createTrigger[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"EmptyDetector"[/color][color=#8B3E2F][b],[/b][/color] [color=#191970][b]getMarkerPos[/b][/color] [color=#7A7A7A]"bluefor_AA1"[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_trigblueforAA1[/color] [color=#191970][b]setTriggerArea[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#FF0000]3400[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]3400[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_trigblueforAA1[/color] [color=#191970][b]setTriggerActivation[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"ANY"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"PRESENT"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]true[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#1874CD]_trigblueforAA1[/color] [color=#191970][b]setTriggerStatements[/b][/color]
[color=#8B3E2F][b][[/b][/color]
   [color=#7A7A7A]"this && {vehicle player in thisList} && {playerSide != bluefor} && {vehicle player isKindOf 'Air'}"[/color][color=#8B3E2F][b],[/b][/color]
   [color=#7A7A7A]"
       _handle = [] spawn
       {
           for '_i' from 10 to 1 step -1 do
           {
               hint format ["[/color][color=#7A7A7A]"Anti Air system is locking onto your Aircraft!\nYou've got %1 seconds."[/color][color=#7A7A7A]", _i];
               uiSleep 1;
           };
           (vehicle player) call BIS_fnc_neutralizeUnit;
       };
       player setVariable ['blueforAA1target', _handle];
   "[/color][color=#8B3E2F][b],[/b][/color]
   [color=#7A7A7A]"terminate (player getVariable 'blueforAA1target'); player setVariable ['blueforAA1target', nil]; hint '';"[/color]
[color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color][/color]

Hey Johny

I still cant get this script to work? how exactly do you have it setup?

i have it inside a SQF and that SQF is called during the init SQF.

thanks again. :)

Share this post


Link to post
Share on other sites
Hey Johny

I still cant get this script to work? how exactly do you have it setup?

i have it inside a SQF and that SQF is called during the init SQF.

thanks again. :)

Wow, what a difference an "e" makes. In the trigger condition, it has to be "blufor", not "bluefor". That finally fixes it.

Share this post


Link to post
Share on other sites

epic stuff man, works like a charm!!! I didn't know you could actually make a rocket lock onto them. thank you very much!!!

Another question, how do i go about deleting the trigger mid game?

is there a triggerdelete command ?

Share this post


Link to post
Share on other sites
epic stuff man, works like a charm!!! I didn't know you could actually make a rocket lock onto them. thank you very much!!!

The lock on missile is from the BIS function, pretty fancy indeed.

You could also take a look at my aerial denial script in my sig if you want those pilots to shit bricks. Reminds me that I got an updated version of this script making usage of missiles and other stuff somewhere on my drives.

Share this post


Link to post
Share on other sites
The lock on missile is from the BIS function, pretty fancy indeed.

You could also take a look at my aerial denial script in my sig if you want those pilots to shit bricks. Reminds me that I got an updated version of this script making usage of missiles and other stuff somewhere on my drives.

yeah I have used your script grumpy, Its pretty epic also. also thats for that deletevehicle command. :)

love the help. saved me hours and hours of my life!

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  

×