turning sneaking on and off through a script

Ivica Ivašković

First time out of the vault
As per the title, is it possible and if it is, how to achive that?
A seemingly simple task for which I could not find a solution even after a week of digging through all available scripts. Tap_key(DIK_ESCAPE) (should be 1, right?) , doesn't work on my Fallout instalation.
I'm sure there's a completely simple solution and I'm going to sound stupid, but here it goes...
 
tap_key(DIK_1);

That should do it. Double-check if your global script is running, the int file might be in a wrong folder. Try adding it to data/Scripts
 
tap_key(DIK_1);

That should do it. Double-check if your global script is running, the int file might be in a wrong folder. Try adding it to data/Scripts

Sadly, it still doesn't work. The script is definitely running because everything else works as it should (HOOK_COMBATDAMAGE, HOOK_COMBATTURN, HOOK_SNEAK) and the debug messages confirm that button 1 is pressed, however, sneaking does not turn off. I'm running the latest version of 5.x sfall on a Fallout Nevada (root directory install version of Nevada) and have absolutely no problems with the rest of the game or scripts.
Does sneaking perhaps have a flag or global variable that could be modified?
 
Tried it, works fine. You are doing something wrong.

That said, latest Sfall is 4.something. Nobody here can help you with the inofficial and closed source Sfall "5".
 
To eliminate all the aggravating factors, I reinstalled the vanilla version of the game, downloaded the latest "official" sfall 4.4.3.1 (and also some older versions) from the sfall team git hub and pasted it into the game directory. I set up ddraw.ini and then pasted my script into the data/script directory.
The script is executed and the expected effects occur, which is also confirmed by countless debug log messages.

Turning stealth on/off via tap_key still DOESN'T WORK.

If I physically press button 1, sneaking is turned on or off, which was verified through:
procedure keypress_handler begin
variable event, dx_scancode, vk_scancode;
event := get_sfall_arg;
dx_scancode := get_fall_arg;
vk_scancode := get_sfall_arg;
debug_msg("key pressed " + dx_scancode + " vk scancode " + vk_scancode);
end
which returns 2 for dx scancode or 49 for vk scancode when 1 is pressed, neither of which works through the tap_key function no matter where I place it in the code (HOOK_COMBATDAMAGE, HOOK_GAMEMODECHANGE, HOOK_SNEAK). Also tried with DIK_ESCAPE and integers 1 and 2 as arguments.

Remaining options:
Keyboard layout (Croatia), although of course I tried it with the default US English layout as well.
DX 9 not installed - I'll install it, although I'm not sure how much effect it will have since I'm on Win 11.
Seemingly a small problem, but after 7 days of frantic research, I am no closer to a solution.
At this moment, I'm thinking about firing up Ida and detecting the correct flag to indicate that stealth is active on dude. I'd rather not, but in desperation... :)

Not directly related to this issue, doesn't the official version of sfall have an "AutoMoveToAttack" for the melee option? (you just press the mouse on the target, regardless of the distance, and the game calculates whether you have enough AP and if so, it automatically perform attack). Is it only in the extended "unofficial" version?
 
To eliminate all the aggravating factors, I reinstalled the vanilla version of the game, downloaded the latest "official" sfall 4.4.3.1 (and also some older versions) from the sfall team git hub and pasted it into the game directory. I set up ddraw.ini and then pasted my script into the data/script directory.
The script is executed and the expected effects occur, which is also confirmed by countless debug log messages.

Turning stealth on/off via tap_key still DOESN'T WORK.

If I physically press button 1, sneaking is turned on or off, which was verified through:
procedure keypress_handler begin
variable event, dx_scancode, vk_scancode;
event := get_sfall_arg;
dx_scancode := get_fall_arg;
vk_scancode := get_sfall_arg;
debug_msg("key pressed " + dx_scancode + " vk scancode " + vk_scancode);
end
which returns 2 for dx scancode or 49 for vk scancode when 1 is pressed, neither of which works through the tap_key function no matter where I place it in the code (HOOK_COMBATDAMAGE, HOOK_GAMEMODECHANGE, HOOK_SNEAK). Also tried with DIK_ESCAPE and integers 1 and 2 as arguments.

Remaining options:
Keyboard layout (Croatia), although of course I tried it with the default US English layout as well.
DX 9 not installed - I'll install it, although I'm not sure how much effect it will have since I'm on Win 11.
Seemingly a small problem, but after 7 days of frantic research, I am no closer to a solution.
At this moment, I'm thinking about firing up Ida and detecting the correct flag to indicate that stealth is active on dude. I'd rather not, but in desperation... :)

Not directly related to this issue, doesn't the official version of sfall have an "AutoMoveToAttack" for the melee option? (you just press the mouse on the target, regardless of the distance, and the game calculates whether you have enough AP and if so, it automatically perform attack). Is it only in the extended "unofficial" version?


"AutoMoveToAttack" sadly not in vanilla sfall branch (yet), this is MrStalin's sfall5 feature.

DX 9 not installed - I'll install it, although I'm not sure how much effect it will have since I'm on Win 11. --- the fact that you have dx12 preinstalled doesn't mean you have all previous Dx installed as well. Though it shouldn't be a problem for Fo2+sfall & mods, since sfall usually comes with the nessecary dx9 libraries in the game folder, which would overwrite the installed libraries anyways. Long story short, if the game runs in Dx9 mode You don't need to install Dx9 despite it not beeing installed in the system.
although it never hurts to have them installed.
 
May 20 at 3:36 PM

And who would know, call_offset_xxx can call the function directly from fallout with offset as a parameter. So call_offset_v0(0x42E3E4) runs the "critter_sneak_clear_" function and, lo and behold, the thing finally works.
For now, I have no idea if that function receives or asks for any arguments, because I haven't located it within the sfall source yet, but sneaking is turned off even without any arguments. Yay.
 
Back
Top