Jump to content
Sign in to follow this  
zovirl

"smart" base alarms?

Recommended Posts

Ok, I want to make a base with patrols walking around it and an alarm. However, I don't just want it to be a simple "west detected by east" alarm. Here's how I want it to work: If any east patrol sees either a west unit or a dead body, they will call to the base in about 5 seconds and the alarm will be set off. If they are killed before the 5 seconds then nothing happens (no alarm). This would let the black-ops guys actually quietly take down patrols and hide the bodies without being detected...

Ok, so here are a couple triggers that will show how this can be done with two east units (patrol1 & patrol2) and one west unit (west1):

Patrol1DetectTrigger:

Condition: Patrol1 knowsabout West1 > 0

Countdown: 5

On Activation: detectedByPatrol1 = true

Patrol1BodyOfPatrol2Trigger:

Condition: (Patrol1 knowsabout Patrol2 = 4) and !(alive Patrol2)

Countdown: 5

On Activation: detectedByPatrol1 = true

Patrol1AlarmTrigger:

Condition: detectedByPatrol1 and alive Patrol1

On Activation: alarm = true

There should be 3 other triggers for Patrol2, but this gives the idea at least. Basically, once the west unit is detected, it starts a 5 second timer. When the 5 seconds is up, if the patrol is still alive the alarm goes off. With the body one, if Patrol1 is looking at Patrol2 (knowsabout = 4) and patrol2 is dead, then the body has been found. Again, a 5 second delay until patrol1 sets off the alarm.

Now here is the problem: How do I do this with lots of guys? With only 3 units this takes 6 triggers. How do I do it for maybe 10 patrol units and 5 west units? There must be some way to make a clever script for this but I don't know how to get a list of all the units so I can do the checks...

Share this post


Link to post
Share on other sites

Sounds like a nice idea, and I might use it smile.gif

Anyways, quick thought on this one could yeild something quite easy and small for even lots of patrols.

You can make one trigger for the sync to the patrol waypoints for a "west detected by east" trigger, with NO COUNTDOWN. Set some var, like my_alarm = true when they are detected. Then, make a 2nd trigger that would detect if whoever knows about the secret ops is dead, the alarm is turned off (my_alarm = false). Use this for the check (you will have to sync all your groups with this trigger to, so 'list' works):

"_x knowsabout West_Patrol > 0" count list this > 0

Argh... I can't think right now, but the idea is sort of floating in my head. If the condition is my_alarm and that stuff above, then I assume that 'list' will return empty or something for a dead unit, which means that if that returns more than 0, a unit is ALIVE and KNOWS about you. You can put for the on DEACTIVATION: my_alarm = false (on deactivation I think is what happens if the condition fails).

Heh, work with what I have, I am sure you can come up with something. If not, I will give it a shot (definately like the idea) and if I get it working, I will tell you how.

Enjoy.

Share this post


Link to post
Share on other sites

Ok, I have a version that almost works, but I need one more thing. Does anyone know how to get a list of all the units on a certain side? Including vehicles? Here is what I am doing right now:

Make a trigger that is activated by "West, Present". Call it tWest. Then in the script I do this:

_WestUnits = + list tWest

The problem is empty west vehicles are not included in the list, and if several people are in a vehicle then it only makes one entry in the list.

Any idea how to easily get every unit & vehicle in a list?

Share this post


Link to post
Share on other sites

Can you use the key word 'west' to refer to everyone on the West side? I'm not sure if it will work, but it's all I can think of right now... been busy doing lots of other things, no time to do OFP stuff.

Share this post


Link to post
Share on other sites

No, keyword west doesn't work. Seems like that is only used to check what side a unit is on. Maybe I'll have to build the lists by hand or something.

Another question along the same lines, does anyone know exactly what happens when a player respawns? Does the player get a new unit or reuse the old one? If I am holding these lists in a multiplayer game, and a player dies and respawns, will his character then be in the list or will it be a new object that wasn't accounted for?

Share this post


Link to post
Share on other sites

I tampered with this idea awhile ago and found that you need an extra trigger.

Trig1: detect west units or whatever and wait to activate Trig2

Trig2: once this is activated turn alarm variable 1 to true on deactivation turn alarm 1 to false

Trig3: detect if patrol still alive and if alarm var 1 is activated , then make Alarm variable 2 true

Trig4: sound alarm if Alarm var 2 is satisfied

I tried this concept and found it goes off half of the time even if you nail the patrol. Also, it does make for ALOT of triggers if you have various patrols and groups, but the important fact is that once a trigger has satisfied it's condition, no amount of Countdown or Timeout will stop it from eventually goin off. Hence the need for the alarm variables.

I don't know, give it a shot, and if anyone comes up with a good working script or trigger framework, let me know. It frustrated me to the point of not wanting to work on it anymore.

Share this post


Link to post
Share on other sites

Oh, almost forgot....... the whole reason I was posting in the first place.

Have a trigger cover the whole area of the map and set to "West is present" and make it repeat. That can be a constantly updated list of ALL west units. (note: it also includes vehicles and other "static" west units like tents - I'm pretty sure on this)

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Quote: from CrashDome on 4:37 am on Nov. 24, 2001

Oh, almost forgot....... the whole reason I was posting in the first place.

Have a trigger cover the whole area of the map and set to "West is present" and make it repeat. That can be a constantly updated list of ALL west units. (note: it also includes vehicles and other "static" west units like tents - I'm pretty sure on this)<span id='postcolor'>

I was playing with that. I couldn't get it to detect passengers in jeeps or dead bodies. I really need a way to get to a list of all the dead people to check if the guards know about any bodies. Anyway, I had a couple of things I wanted to try with triggers that may open something up...

Share this post


Link to post
Share on other sites

Ahh.... ok...

Well if you want dead people and passengers, then maybe have the trigger build a listright from the get go, then don't repeat it. It won't count anybody already in vehicles, I think, but it will get you a list quick. The only other way would be to build it in the init file by hand.

Share this post


Link to post
Share on other sites

*sigh* well, I found out that since this is for MP lists won't work anyway. MP units are different once they die, and respawning messes up the whole list idea anyway

Share this post


Link to post
Share on other sites

Hey, today has been productive...

I now have a bunch of scripts that work together to make the AI act more like real guards. If they see you or a body, they will set off the alarm unless you kill them quickly. If they are off by themselves, you can kill them and hide their bodies and no one will ever know smile.gif I managed to get it down to a single trigger for each unit you want involved in the system. The trigger is not unit specific either, so you can just copy and paste it. There are a couple more bugs I have to work out and then I'll try to get some people to test it...

Share this post


Link to post
Share on other sites

Getting back to your initial post, about a tidier way to do it... I'm not very experience (and it's late - I'm tired) but I think you could use less triggers by using an array and the 'forEach' command (I think that's what it is).

No specifics, but the idea is, you put all the units you want to check into the array, then pass that array to a script, or use it in a different trigger, the 'forEach' command will then run the same checks on every item in the array. Or something like that... need sleep...

Share this post


Link to post
Share on other sites

Yeah, I tried using forEach. The problem is, some commands don't seem to work with it. This includes anything that requires quotes (nested quotes don't work).

Share this post


Link to post
Share on other sites

You can get quotes to work with it!

simply create a variable for that command

example: ejectguys=["eject",heli1]

then: "_x action ejectguys" foreach units mygroup

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Quote: from CrashDome on 8:39 am on Nov. 30, 2001

You can get quotes to work with it!

simply create a variable for that command

example:  ejectguys=["eject",heli1]

then:  "_x action ejectguys" foreach units mygroup

<span id='postcolor'>

Hmm, I swear I tried doing that and it didn't work. Oh well, doesn't matter because I got it working anyway. The forEach command isn't really required since a simple loop will do the same trick....

Share this post


Link to post
Share on other sites

I was looking for something similar to this...

Basically, I have a mission where a Black Ops team is trying to infiltrate the fort near Saint Pierre, take out some Shilkas, and kill a Colonel.

There are tanks everywhere, but the crews are outside them, sitting around campfires.

There are patrols outside the fence, inside it, and sentries at the entrances to the compound.

Basically, I wanted it so if the tankers, sentries, or patrols spot you, they rush for the compound, and 'speak' with the Colonel, which sounds the Alarm. Also, if the patrollers come across a dead body, they will rush to sound the Alarm.

I want it so if you shoot a tanker, the others will become alert, and attempt to 'speak' with the Colonel, but that the Alarm will not sound directly from you firing (the Black Ops have silenced weapons.)

Can anyone help with this, or is it too complicated?

Share this post


Link to post
Share on other sites

Just a quick one-

To get rund the nested quotes problem, use { curly brackets } inside the quotes. Works for me..

Share this post


Link to post
Share on other sites

You guys might want to look into this script I made. It won't do everything but it does alot.

http://www.ofpec.com/editors/resource_view.php?id=321

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">

Group Link Script

Overview:

This script enables AI controlled groups to call other groups for backup when they encounter enemies. Groups estimate their chances against enemy groups and only call for backup if they are over matched. Groups also adjust their behavior based on the strength of enemies they are facing. If an infantry squad happens upon a battery of tanks, they will retreat and call the nearest group that matches, or comes relatively close to matching the strength of the enemy tanks. If there is no suitable group to call, then the infantry squad would call nobody and simply retreat. If a group's rating is higher than the enemy, they will not call for any backup. You can tweak the response of the groups by changing how you initialize the script.<span id='postcolor'>

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  

×