mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added new HOOK_SNEAK (from Mr.Stalin)
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Example implementation of the algorithm of how the game engine checks the Sneak skill
|
||||
*/
|
||||
|
||||
#include "..\headers\define.h"
|
||||
#include "..\headers\command.h"
|
||||
#include "..\headers\sfall\sfall.h"
|
||||
|
||||
procedure start;
|
||||
|
||||
procedure start begin
|
||||
if game_loaded then begin
|
||||
register_hook(HOOK_SNEAK);
|
||||
end else begin
|
||||
variable sneakIsSuccess, time, level;
|
||||
|
||||
level := critter_skill_level(dude_obj, SKILL_SNEAK);
|
||||
if (roll_vs_skill(dude_obj, SKILL_SNEAK, 0) < ROLL_SUCCESS) then begin
|
||||
sneakIsSuccess := false;
|
||||
time := ONE_GAME_MINUTE;
|
||||
if (level <= 250) then
|
||||
if (level <= 200) then
|
||||
if (level <= 170) then
|
||||
if (level <= 135) then
|
||||
if (level <= 100) then
|
||||
if (level > 80) then
|
||||
time := 400; // 40 secs
|
||||
else
|
||||
time := 300; // 30 secs
|
||||
else
|
||||
time := 200; // 20 secs
|
||||
else
|
||||
time := 150; // 15 secs
|
||||
else
|
||||
time := 120; // 12 secs
|
||||
else
|
||||
time := 100; // 10 secs for skill level > 250
|
||||
end
|
||||
else begin
|
||||
sneakIsSuccess := true;
|
||||
time := ONE_GAME_MINUTE;
|
||||
end
|
||||
set_sfall_return(sneakIsSuccess);
|
||||
set_sfall_return(time);
|
||||
end
|
||||
end
|
||||
@@ -60,6 +60,7 @@
|
||||
#define HOOK_ONEXPLOSION (36)
|
||||
#define HOOK_SUBCOMBATDAMAGE (37)
|
||||
#define HOOK_SETLIGHTING (38)
|
||||
#define HOOK_SNEAK (39)
|
||||
|
||||
//Valid arguments to list_begin
|
||||
#define LIST_CRITTERS (0)
|
||||
|
||||
@@ -617,3 +617,17 @@ int arg3 - the light radius, or -1 when setting the light level for a map
|
||||
|
||||
int ret1 - overrides the light intensity. Intensity range is from 0 to 65536
|
||||
int ret2 - overrides the light radius. Radius range is from 0 to 8 (works only for the object)
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
HOOK_SNEAK (hs_sneak.int)
|
||||
|
||||
Runs when the Sneak skill is activated, or when the game rolls another Sneak check after the duration for the current one is over.
|
||||
You can override the result of a random Sneak check or the duration time for the current result.
|
||||
|
||||
int arg1 - Sneak check result: 1 - success, 0 - failure
|
||||
int arg2 - the duration in ticks for the current Sneak check (time is based on the Sneak skill level)
|
||||
Critter arg3 - the critter (usually dude_obj)
|
||||
|
||||
int ret1 - overrides the Sneak check result
|
||||
int ret2 - overrides the duration time for the current result
|
||||
|
||||
Reference in New Issue
Block a user