Home   Help Search Login Register  

Author Topic: Dumb(er) AI for stealth..?  (Read 1251 times)

0 Members and 2 Guests are viewing this topic.

DBR_ONIX

  • Guest
Dumb(er) AI for stealth..?
« on: 24 Nov 2004, 17:56:04 »
Hey
Seeing as there if a few melee weapons, like knifes, and black ops etc..
it would be fun to do stealth missions..
But you go with in 5 meters of an ai, he sees you.. Hmm :hmm:

So, how hard would it be? Easy y'say? Wanna try and make something? ;D
.. :P

Maybe, for a start, check if the player is behind the AI (Maybe with in 45*), and if not, make him ignore the player..
Then add speed checking, etc

Could be verry usefull :)
- Ben

Offline XCess

  • Former Staff
  • ****
Re:Dumb(er) AI for stealth..?
« Reply #1 on: 07 Dec 2004, 13:46:33 »
hmmm.... how about this idea... might take a decent system but it should work.
Set all guards to careless.

Create a low area trigger, this is where triangular shaped triggers would be very nice for line of sight, but we'll use what we got. Group this trigger to the player.

Using nearestObject and setPos you keep the trigger just ahead of the
nearest guard.

When the trigger is enter by the player entering it change the behaviour of all nearby guards to combat.

Should work.

Dubieman

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #2 on: 10 Dec 2004, 20:47:53 »
One problem is even in careless mode, if a guard sees you or "senses" you, the info may still be passed on to others. He may not shoot at you then, but his buddies in guard WPs may not be so nice. :D

But that can be fixed with some vigilant scripting and editing.

DBR_ONIX

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #3 on: 15 Dec 2004, 20:10:46 »
Is there a easy way to check if the AI is looking within x degrees of you?

That could be a good start, maybe..

this disableai radio on AI as well, perhaps?
- Ben

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #4 on: 15 Dec 2004, 21:44:23 »
yes you could, i can figure out the math stuff for you if you want

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #5 on: 16 Dec 2004, 01:12:37 »
here you go, not tested, and not garunteed, but i think this is correct:
Code: [Select]
_unit = _this select 0
_players = _this select 1
;change this for different field of vision (in degrees)
_FoV = 5

~5

#loop
_nearby = []
_dir = getdir _unit
"_x distance _unit < 15 && vehicle _x == _x" foreach _players:_nearby = _nearby + [_x]
_fovpos1 = [(getpos _unit select 0) + 15*sin(_dir + _FoV),(getpos _unit select 1) + 15*sin(_dir + _FoV)]
_fovpos2 = [(getpos _unit select 0) + 15*sin(_dir - _FoV),(getpos _unit select 1) + 15*sin(_dir - _FoV)]
"? (_fovpos1 select 0) >= (getpos _x select 0) >= (_fovpos2 select 0) && ? (_fovpos1 select 1 >= (getpos _x select 1) >=  (_fovpos2 select 1):(group _unit) reveal _x
~2
goto "loop"

it is exec'd with each unit, so you could use foreach with an array of ai's or you could edit this, but right now here is how you would use it:
each units init field [this,[*array of players*] ] exec "thisScript.sqs"
and it checks for each unit if they are 15 meters from the unit the script is running from, and within the FOV (field of view) which right now is set to 5 degrees on either side (10 total)

RedHouse

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #6 on: 16 Dec 2004, 01:30:09 »
@DBR_ONIX

theres an easy way thats not so accurate and a harder way that is very accurate

the easy way is to set a trigger by the guard and list all the vehicles in the trigger

the harder way is but most efficent and reliable is something like what Triggerhappy said

DBR_ONIX

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #7 on: 22 Dec 2004, 00:37:02 »
Thanks ;D
Will test tomorrow
- Ben

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #8 on: 23 Dec 2004, 02:46:09 »
well, its tomorrow... ;D
did it work?

DBR_ONIX

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #9 on: 23 Dec 2004, 13:35:02 »
Nope :(
Got an error a few seconds after stating the mission :
Something like this :
Code: [Select]
?(_fov select 0) >= (getpos _x select 0) >= (_fovpos2 select 0) && ? (_fov select 1 >= (getpos _x select 1) >= (fov_2 se
It got cut off too  :-\

I used, to call the script : [this,[player] ] exec "FOV.sqs"

I can script, but this is kinda over my head :P
- Ben

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #10 on: 23 Dec 2004, 18:36:52 »
ah, need to fix up my conditions
Code: [Select]
_unit = _this select 0
_players = _this select 1
;change this for different field of vision (in degrees)
_FoV = 5

~5

#loop
_nearby = []
_dir = getdir _unit
"_x distance _unit < 15 && vehicle _x == _x" foreach _players:_nearby = _nearby + [_x]
_fovpos1 = [(getpos _unit select 0) + 15*sin(_dir + _FoV),(getpos _unit select 1) + 15*sin(_dir + _FoV)]
_fovpos2 = [(getpos _unit select 0) + 15*sin(_dir - _FoV),(getpos _unit select 1) + 15*sin(_dir - _FoV)]
{? (_fovpos1 select 0) >= (getpos _x select 0) && (getpos _x select 0) >= (_fovpos2 select 0) && (_fovpos1 select 1 >= (getpos _x select 1) && (getpos _x select 1) >=  (_fovpos2 select 1)} foreach _nearby:(group _unit) reveal _x
~2
goto "loop"

I think thats right... hopefully.... :P
too many sins and cos's and selects but if this works, i'm definitely submitting it  :D

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #11 on: 24 Dec 2004, 04:28:07 »
is there any way to "hide" units like you can reveal them?

DBR_ONIX

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #12 on: 24 Dec 2004, 16:26:53 »
Don't think so  :-\
Got another big long error (same sorta thing) when I tested that to  :'(
But even still, good work :)
- Ben

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #13 on: 24 Dec 2004, 17:04:51 »
yeah i tested it, and i got the error line shortened up.
it was:
Code: [Select]
{? (_fovpos1 select 0) >= (getpos _x select 0) && (getpos _x select 0) >= (_fovpos2 select 0) && (_fovpos1 select 1 >= (getpos _x select 1) && (getpos _x select 1) >=  (_fovpos2 select 1)} foreach _nearby|#|:(group _unit) reveal _x    :error unknown operator
what?
everything in there is a real command, i even double checked then all in the comref...
does anyone know what its talking about?

DBR_ONIX

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #14 on: 27 Dec 2004, 21:51:44 »
foreach {"_x blah"}
no?
- Ben

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #15 on: 27 Dec 2004, 22:12:22 »
no, the syntax for foreach is:
{blah _x blah whatever} foreach someArray

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #16 on: 27 Dec 2004, 22:14:41 »
maybe the array needs to have something in it for the array to be used...
i'll try putting in a check

DBR_ONIX

  • Guest
Re:Dumb(er) AI for stealth..?
« Reply #17 on: 01 Jan 2005, 17:44:18 »
Lemme know when you've fixed it.. :P
- Ben

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Dumb(er) AI for stealth..?
« Reply #18 on: 01 Jan 2005, 19:46:01 »
ok