Scripts / ai_view range

Author
Message
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 7th Apr 2020 20:11
HI all .
Quick question.
Is there a way to make a new function something like: SetEntityviewrange(e,2000)
and put it into global lua so that we can script the view range of the AI
If so please let me know.
Thanks
Pcs
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 7th Apr 2020 21:26
Sounds like a feasible request-- certainly not impossible-
if you're asking for a general opinion.
Sounds like a single variable assignment (via a search for enemy entities system.)

smallg's thread would be the place to look. For instance radar...
Yeah, I'm gonna insert a radar type system into the game at some point.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Apr 2020 22:12
Add the request to GitHub.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Apr 2020 23:45 Edited at: 7th Apr 2020 23:46
not really, you would need it to be exposed to lua but you can modify the ai script yourself as a temporary fix
in module_combatcore.lua you will find the 'detectplayer' function
function module_combatcore.detectplayer(e,AIObjNo,PlayerDist,CanFire,detectstate)
where you could add some modification to the check
if (PlayerDist < AIGetEntityViewRange(AIObjNo)
like
if (PlayerDist < AIGetEntityViewRange(AIObjNo) * visibility[e]
so if you set visibility[e] to 1 the AI has full view range but 0.5 is half view range etc

note; due to the ai having a lot of behaviors and other areas that check for the player it may not always works as expected
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 8th Apr 2020 08:29
@smallg, thanks for the info, will try it and see how it works.

Ps :.. one more Question . if i leave the view range and cone angle empty in the ai properties what is the default value
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Apr 2020 10:14
You can see the view as a red cone if you slide the ai slider up in tab tab mode but I believe it is 3k distance and 90 degrees (or 180 )
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 8th Apr 2020 12:16
Thanks Smallg
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-04-26 02:18:23
Your offset time is: 2024-04-26 02:18:23