Jump to content
Sign in to follow this  
Big Ben

AI Zone Restriction

Recommended Posts

Using the key words "Zone" and "Restriction" there were only 11 threads. I read all of them and I did not find the answer to my question which is this:

How can I make a trigger, or set of triggers protect a base from one side that is controlled by the AI, or would it be better to use a marker?

I am using BLUFOR, OPFOR, and the Civilians, but I do not want the AI Independants to enter the base ever. This is being made as an SP and MP mission.

http://forums.bistudio.com/showthread.php?148362-Zone-restriction&highlight=Zone+Restriction

When the Independant side enters the trigger area, this code kills the player.

Condition Field: !(player in thislist)

On Activation: player setDamage 1

----------------

http://forums.bistudio.com/showthread.php?115300-Using-markers-areas-as-zone-restriction&highlight=Zone+Restriction

This code used in a trigger's condition field creates an error. It doesn't show what it is either.

th_202152283_error_122_164lo.jpg

[] call {{_x setDammage1;} forEach thislist; false;};

Share this post


Link to post
Share on other sites

Place a trigger into the middle of your base and set the radius to encircle it.

The following configuration of the trigger will kill every Independent player within that radius.

122yqs7.jpg

If, however, you don't want to die whenever you are an "Independent" or want to exclude some AI's from this rule, the condition and activation field needs to be altered a bit.

Share this post


Link to post
Share on other sites

XxAnimusxX...Thank you for your help, and quick response. The change you mentioned, if I wanted to allow named Independents....Would the code look like this as mentioned in this thread by Riouken?

http://forums.bistudio.com/newreply.php?do=newreply&p=1930921

Create an array in your init.sqf with the names of the allowed memebers.

zrgrp = [guys,that,are,allowed];

Set up the trigger to activated repeatedly for everyone. that covers the area you want to restrict.

In the on activation of the trigger:

{if (_x !(in zrgrp)) then {_x setpos [pos,where,they should go];};} forEach thisList;

This is not tested but should work.

Or if it is different I'll try to find it. Again thank you for your help....Cheers!

Share this post


Link to post
Share on other sites

It's as he wrote, we already have a forEach so we just have to check the _x.

The resulting activation field for your trigger would look like this:

{ if (_x !(in zrgroup)) then {_x setDamage 1;}; } forEach thisList;

Don't forget to define zrgroup in your init.sqf and initialize it with the variables holding the units you want to spare.

Share this post


Link to post
Share on other sites

Thank you for your help again :) Everything works very well, but I do have one last issue....The base/bases that are protected with the trigger....it seems if there are too many Independents entering the trigger area some get by without being killed. Is this a engine issue of the trigger not having time to reset for the next enemy entering the trigger area?

This is what I did for my problem, but I'm not sure if it will cause lag or not....Do you know if it will or not? Here is the code from the mission SQM. This is just a small portion to give you an idea of my method of making sure the area/base is fully protected. Where a=100 and b=100, and Where a=95 and b=95....the rest of the code continues on to 40. This way each trigger has at least 5 meters between each one. So if there are too many Independents that hit the first trigger by the last one of a=40 and b=40 Every Independent has been taken care of. I'm not sure of how many bases (Safe Zones) I will have, but it will be very limited...2 or 3 at most, but I don't want to create a lag demon by this method. I'd tell you more about it in a PM if you are interested in knowing more about it. Again....Thank you for your time.

class Item15

{

position[]={2945.1575,39,4515.126};

a=100;

b=100;

angle=112;

activationBy="GUER";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="80";

expActiv="{_x setDamage 1;} forEach thislist";

class Effects

{

};

};

class Item16

{

position[]={2945.1575,39,4515.126};

a=95;

b=95;

angle=112;

activationBy="GUER";

repeating=1;

interruptable=1;

age="UNKNOWN";

text="80";

expActiv="{_x setDamage 1;} forEach thislist";

class Effects

{

};

}

Share this post


Link to post
Share on other sites

had the same problem - in the end i just wrote a script and called it for each of the AI. Not sure whats happening, but it would appear to me that the triggers would affect the player, and one AI, after that AI would walk through unharmed.

Share this post


Link to post
Share on other sites

I would name each ai, but I'm using a spawn module. I have the basic concept of how to use most of the scripts, but I'm not sure if I could write one that could be used for each Independent or not. I'm not saying it can't be done, but how to write it so it would work with no limit on how many times it will have to run for the Independent side or not.

The forums have given so much information on doing the same thing different ways for a variety of different reasons. Most of the time I find a code sample and I'll try using it, and if I can't I'll read more on it and most of the time I can get it to work. If I like the result or if it does something I like even more than what I expected I'll log it in to my "In Game Code Book" that I've been working on since Operation Flashpoint. I can't even think of where to begin thanking the many talented programmers that enjoy making scripts and tutorials for these games, not to mention the folks who made the games we all enjoy. Is any game perfect...no, but most of the things that a lot of people call a bug are overlooked by me simply because there are plenty of other things that are fine and work well.

Thanks to all who responded and offered thier time in my problem...Everything as of now is working well. Be safe in the field....It can be a little rough out there.....

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  

×