Home   Help Search Login Register  

Author Topic: Give AI night vision capabilities without NVGoggles  (Read 4331 times)

0 Members and 1 Guest are viewing this topic.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Give AI night vision capabilities without NVGoggles
« on: 01 Jan 2011, 15:13:19 »
Hello guys, I wish you a happy new year!

Situation:

The AI of Arma 2 in the night is blind as a mole. It won't recognize me as an enemy, even I use things like reveal, knowsabout, dofire, FULL moon, skill to 100%, etc. I even tried Zeus AI, but no success.

What the AI will do: It will say to the group members: "2 o'clock, Unknown, 50 meters.". But that's it, they won't recognize my as enemy, even if I sprint 2 meters in front of them.

They will recognize me if I fire and kill one of the group members. But I want them to "take the initiative", I want them to fire me on sight, not after I kill one of them!

The AI will also recognize me as an enemy if they use NVGoggles! So what I can do is: To give the AI group leaders an NVG, then all will work as I want.

But in the scenario which I'm making, there should not exist any NVG, because I want the player to experience a mission without the possibility to use technology such as NVGs.

So my question is:
Is it possible to make an AI without NVGoggles to see as good as with NVGoggles? If yes, can you help me with that?
« Last Edit: 01 Jan 2011, 15:17:26 by Undeceived »
Current project: Black Lands (Arma 3)

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Give AI night vision capabilities without NVGoggles
« Reply #1 on: 02 Jan 2011, 12:29:16 »
I suspect to do this properly would involve tweaking the config of the units in question, however there's an easier way - if slightly cheaty: give the AI the NV goggles so they behave as you want them to, and use an onkilled eventhandler script to remove the NV goggles if/when the AI unit no longer has use for them.

That will achieve the same effect, even if it's slightly unrealistic to have Incredible Vanishing NV Goggles.

Either way, good luck, and a happy new year to you too  :good:

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Give AI night vision capabilities without NVGoggles
« Reply #2 on: 02 Jan 2011, 12:43:48 »
You say the enemy knows about you but does not recognize you as the enemy. Perhaps you could take that knowsabout information and reveal yourself to the AI through a trigger?

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Re: Give AI night vision capabilities without NVGoggles
« Reply #3 on: 02 Jan 2011, 14:08:02 »
Hello bedges,

I also thought about something like that you suggested: I gave certain group leaders NVGs (not all, would be a bit too unfair) and when the player kills them, I instantly remove the goggles from then, so that the player doesn't find it if he searches the body.
But this is a "dirty" workaround, because if the player in certain situations sees that the AI uses NVGs and then wants to take them but they suddenly disappeared... Would be kinda unrealistic. This is why I asked if it is possible for the AI without having the goggles. But maybe the goggles really are the only way it works...


Hello savedbygrace,

I tried to use the reveal command as well but somehow the AI didn't recognize me at all. But maybe I didn't use it properly (?).
Do you mean that in this situation "reveal" works if "knowsabout" is bigger than a certain ammount? I have no idea...


Thank you both for your answers!
« Last Edit: 02 Jan 2011, 14:11:23 by Undeceived »
Current project: Black Lands (Arma 3)

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Give AI night vision capabilities without NVGoggles
« Reply #4 on: 02 Jan 2011, 22:09:27 »
Try using the knowsabout check on groups and if the level rises above aware status, which I think is 0.20 -1.00, have them change behavior. If it rises above that, add nvg's to the unit for 2 seconds(may take some experimenting with time) and then remove them. That should help them see the player as enemy and also prevent the night vision goggles from being visible the whole time. If the player has no NVGs himself, it shouldn't be that noticeable.

I created a script for my OFP mission that controls the reaction state of a patrolling group that has waypoints set as limited and safe. The waypoints never change but I ran the script in a continuous 2 second loop. Once the player came within 50 meters of the group, the group would stop, go prone and enter combat behavior while watching the player position. I would then do continuous checks of their knowsabout levels to change that status. If the level rose above a set limit, they would engage, if it dropped, they would switch back to safe, limited and continue on their way. You may be able to use it for this situation but simply add and remove NVG accordingly. The only problem is that it is written in SQS code. It's attached below anyhow. Hope its useful.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Re: Give AI night vision capabilities without NVGoggles
« Reply #5 on: 03 Jan 2011, 04:32:05 »
Hey, this will help a lot! Not only the idea with the NVGs for 2 seconds is great, I'll check your scripts and report back here. Thank you very much, saved!




Edit:

Hm, I tried my best to implement this but I couldn't... :confused:

I have approx. 10 groups running around looking for the player. I managed to make it work for one single group leader, but I don't know how to do this for everyone, sorry... ::)


What I want to reach is:

- I want to set a trigger that covers all 10 groups
- Everyone that knowsabout player > 0.7 launches the script "add_NVGs_for_2_seconds.sqf"


So the questions that arise out of my amateurish logical thinking are:

1. How should the condition in the trigger look like so that it says:
Everyone in the trigger that knowsabout the player > 0.7 activates it

2. How should the adNVGfor2seconds.sqf look like so that it is valid for every single unit that can call it?


Thank you very much for your time!
« Last Edit: 05 Jan 2011, 15:07:31 by Undeceived »
Current project: Black Lands (Arma 3)

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Give AI night vision capabilities without NVGoggles
« Reply #6 on: 07 Jan 2011, 23:22:15 »
Have each leader and the potential enemies running a looping script that checks the knowsabout.

Lets say the script name is check_knowledge.sqf and the potential enemies are the units in the player's group.

In the init feild of each group leader put: [this, units group player] exec "check_knowledge.sqf"

Then check_knowledge.sqf script will trigger the addition of NV goggles if the knowledge goes above a certain level. Make the script have a delay in the looping so that it will not cause lag. I will give you a code example after I test it myself (it will be my first time playing with the ARMA2 editor - Yes I finally broke down and got ARMA2).


Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Give AI night vision capabilities without NVGoggles
« Reply #7 on: 13 Jan 2011, 19:30:38 »
Hi,

A different but also working solution would be something I used when I encountered this problem, designing an ArmA mission years ago. Same situation: AI don't fire at you at night, even though they know about you.

My solution was the "doFire" command. A unit that had spotted you got the doFire order (no radio or voice sound). They would then react as I wanted them to.

This engine issue is quite annoying and I'm surprised that it occurs in ArmA2 as well. But, this solution works (at least in Armed Assault). It takes some scripting or clever trigger stuff, but it's efficient.

Laggy

« Last Edit: 13 Jan 2011, 19:32:33 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Give AI night vision capabilities without NVGoggles
« Reply #8 on: 28 May 2011, 23:37:35 »
Hello guys!

I tried some things you suggested and I think that the AI will be a little better now in night combat. I tried a little mix with adding NVGs for half a second and revealing and commanding dofire xy.
The only problem now is that I don't know how to implement it. :-[


I built a little and cheap night-combat-improvement script, which should be launched via a trigger when my buddy's knowsAbout reaches 0.0002 ("buddy" is the one I want to get smarter in night combat).
In the condition line I have put this:


Condition: (buddy knowsabout enemy1) > 0.0002
On Activation: [] exec "nightcombat_improvement.sqs";


And it actually worked - he really became smarter.
But this condition line only works for one enemy ("enemy1"). How would a condition line look like so it is valid for every enemy inside a big trigger area that will cover all enemies?

I know how to formulate it with my words, but not in script language...

Condition: (buddy knowsabout what-ever-enemy-in-the-trigger-area-that-covers-all-possible-enemies) > 0.0002

The part in ittalic is the one I don't know how to spell.
Could you please help me with that? Thank you very very much!




EDIT:

A workaround I'm using right now (out of despair) is that I created triggers for every single enemy group (in total approximately 25 triggers :) ) that launch the night-combat-improvement script.
But if anyone has another idea for it, please teach me, ok?






EDIT 2:

Celery gave me this solution:


Trigger set to Repeat and size 0.

Condition line: true

Activation line: 0=[] spawn {while {alive Dude} do {{if (Dude knowsAbout _x > 0.0002) then {[_x] execVM "engage.sqf"}} forEach list triggername; sleep 1}};

-> The trigger that covers all units has to be set to Activate by Anybody.


This way every unit in the trigger area that is detected by "Dude" will launch the script "engage.sqf", which makes (blind) Dude recognize him as an enemy and thus fighting him finally.

Also see this thread here: How to identify the _x that activates a trigger?

« Last Edit: 02 Jun 2011, 17:19:33 by Undeceived »
Current project: Black Lands (Arma 3)