Scripts / crouched?

Author
Message
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 13th Oct 2017 21:17 Edited at: 13th Oct 2017 22:58
I'm working on a steath shroud script for Dark Harbour whereas if the player is crouched he becomes invisible is there a way to do this e.g
If player crouched then g_Entity[e]['plrvisible'] ==0 what would be the scripting part to tell if the player was crouched? or would it be done via the keypress?
thanks guys. (need this one to work well as its the main player script) its mainly after killing someone or robbing someones house the guards are alerted so you need to hide

P.s i've checked out smallg's stealth kill and it wouldnt work in this instance as that script needs to be on the entities on the map and as there are two classes in the game i need this only to work on the thief/assassin player character although the stealth kill bit would be nice lol

Edit: just read through the global and no reference to crouch so looks like it's a keypress :/
ok i made a start on it and get a then expected near = line 8? (lol eats the missus, eats the children, eats his desk grr eats the house!!!) god im crap at scripting!!! rofl looks perfectly lodgical to me!!!! if you press that key dont see the player? *grumbles*

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
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Oct 2017 00:18 Edited at: 14th Oct 2017 11:45
if statements (or anything with a comparison) need double equals in lua (i assume this is because you can do <=, >= or ~= ) and variable changes just need the one equals, so


p.s. i believe control key also crouches?
might be worth taking a look at the gameplayerloop.lua file (right name?), which is the new lua file that holds all the player logic now, there might be a variable in there you can use.

however your current method most likely won't work, the g_Entity[e]['plrvisible'] command is not something you can set yourself, it is automatically updated by some internal logic, you would be better off setting a variable for an extra check in the AI script which is checked at the same time as the player detected logic, so it becomes something like this.

then in the AI code (in ai_combat_core.lua) find the part(s) that look for something like
Quote: "if GetPlayerDistance(e) <= AIEntityViewRange(EntObjNo) ....."

and add
Quote: "and plrstealthed == 0"


edit; had a quick look at the script (i meant to say gameplayercontrol.lua) and found this
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
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 15th Oct 2017 15:06 Edited at: 15th Oct 2017 18:00
Ahh ducking Thanks G I'm sure i did try it with double = and it still didnt work :/ hmm had beer so god knows lol thanks for those pointers m8 will have a play around and gameplayercontol.lua thanks m8 handy to know where it is

So would this mean i can use if PlayerDucked or if PlayerDucking or if CharacterControlDucked? what command/syntax would i use to let the engine know that the character is ducked or ducking?
this is in the global:

function CharacterControlDucked(e)
SendMessageI("charactercontrolducked",e);

Thanks
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

Login to post a reply

Server time is: 2024-12-23 00:12:59
Your offset time is: 2024-12-23 00:12:59