Scripts / Stealth mode

Author
Message
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 25th Jul 2019 01:04
Hi all I've nearly finished my rogue sense script ( rogue, detect traps, hidden doors etc) and started to look around for info via the global and the forums for help with a stealth script e.g player isn't visible and found this in the global GetEntityPlayerVisibility(e) now is this going to be what I need or is there a way to do this e.g hide the player when crouched for example.
if that command is for this how is it used please?
Cheers guys
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
PCS
7
Years of Service
Recently Online
Joined: 7th Jul 2016
Playing:
Posted: 25th Jul 2019 06:57 Edited at: 25th Jul 2019 06:59
@Honkeyboy
Here you go ,, this link would help you. https://forum.game-guru.com/thread/220144#msg2606746
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
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 25th Jul 2019 11:00 Edited at: 25th Jul 2019 12:25
Cheers PCS going to take a look at that now

Edit: thanks PCS, Dvader had to manually edit my combatcore as they have changed now (just put in the same values) just a couple of things to sort out want to have it so the player is hidden when crouched and don't want the npc to face the player when hidden but a fantastic start which works well. Got something to work on now so thanks guys

Edit: slight adjustment to your script m8 so the player now has to crouch to be in stealth next will work on de-aggroing the npc on a timer lol hate timers and the zone didn't work behind the blocks so will add that into the script.

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 25th Jul 2019 22:19 Edited at: 25th Jul 2019 22:31
Sry to bump this but I'm a little stuck now I have the scripts working but not totally perfect firstly if you press w to move forward you drop out of stealth? all other directions are fine I suppose just to get away this will be fine but to actually assassinate an npc you'd need to move forward Ive tried GetinKey and scancodes using e.g if GetScancode()== 29 and GetScancode()== 17 then and a few others but no joy. Any pointers on this guys plz?
Also the npc when you are stealthed should just go about his business but doesn't any clues on that will help cheers guys my scripting is pants but the pants are getting bigger or maybe that's beer consumption

Here's a vid of how its working and the scripts (the ai script should work on any fantasy pack character) the stealth script on an always active entity.

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Jul 2019 20:01 Edited at: 26th Jul 2019 20:06
isn't there a g_KeyPressC or control variable? try that instead.

you briefly lost stealth in the video which is why the AI jumped around to face you, probably also linked to the scancode not returning true for a frame.

if you're asking why the AI doesn't do anything then you need to give him a path.

if you're asking how to make the AI "reset" if you stealth while visible then you need to change this
if PlayerDist >= viewrange[e] and ai_soldier_state[e]~="patrol" and (g_Entity[e]['plrvisible'] == 1 and g_hidden==0) then
as currently he won't reset unless you are stealthed AND outside of his view range AND not visible by the default AI view cone... for a stealth system it is probably better to only store the view range at start of the game and then deal with a modifiable value for these sorts of checks (as we can't change them yet) so you can reduce the view range when in stealth etc.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th Jul 2019 22:21 Edited at: 26th Jul 2019 22:51
Ok Thanks G yes it was resetting the npc when stealthed ( e.g like just walk away as he cannot see you) I have them all following paths now and in a dungeon which works a lot better as the player has little hiding spaces to lie in wait. How that will work on the city maps we'll have to see lol
Edit: tried g_KeyPressC got the same result only seems to happen when moving forward
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 27th Jul 2019 21:50
Find 'Q' press with ::: if g_Scancode == 16
Find 'A' press with ::: if g_Scancode == 30
Find 'Z' press with ::: if g_Scancode == 44

They increase in number to the right...
PM
Duchenkuke
GameGuru VBOTB Developer
7
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 27th Aug 2019 12:49

Login to post a reply

Server time is: 2024-04-26 18:41:53
Your offset time is: 2024-04-26 18:41:53