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
function stealth_shroud_init(e)
end
function stealth_shroud_main(e)
if g_KeyPressC == 1 then
g_Entity[e]['plrvisible'] = 0
end
end
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.
function stealth_shroud_init(e)
end
function stealth_shroud_main(e)
if g_KeyPressC == 1 then
plrstealthed = 1
else
plrstealthed = 0
end
end
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
-- Handle player ducking
if ( g_PlrKeyC == 1 ) then
SetGamePlayerStatePlayerDucking(1)
else
if ( GetGamePlayerStatePlayerDucking() == 1 ) then SetGamePlayerStatePlayerDucking(2) end
if ( GetCharacterControllerDucking() == 0 ) then
SetGamePlayerStatePlayerDucking(0)
end
end