the wonders of hs_removeinvenobj

JimTheDinosaur

Vault Dweller
Modder
This hookscript does some really neat unexpected (to me at least) things, including firing when the steal inventory opens (means we can put an additional barrier to stealing), when dynamite is set and dropped (weirdly this is the same value as reading a book for some reason), and when a weapon or a set of armor is equiped. Most of these have unique "reasons" (the fourth sfall argument). I made a little list for those interested that they can copy into their define.h or whatever. I think I got all of them, but still might be some hidden gems.

Code:
#define consume_drug	4666772
#define drop_item	4831349
#define take_or_place_container	4683293
#define read_book	4666865
#define equip_armor	4658121
#define equip_weapon	4658675
#define unload_weapon	4667030
#define load_weapon	4831349
#define use_drug_on_someone	4834866
#define steal_view	4668206
#define use_or_drop_live_dynamite	4666865
#define item_destroyed	4543215
#define item_removed	4548572
#define armor_equiped	4651961
#define left_hand_equiped	4651899
#define right_hand_equiped	4651934


take_or_place_container includes when stealing something (I guess also planting, though haven't tested that), and item_destroyed and item_removed are the ones that get fired by scripts.
 
JimTheDinosaur said:
including firing when the steal inventory opens (means we can put an additional barrier to stealing)

Hmm... never mind this, just like with the regular inventory I have no idea how to force an exit from the steal inventory. Annoying.
 
this may solve an annoying feature of my book mod,ill test the theory tomorrow,thank you for your work Jim


Nirran
 
Found a couple more interesting ones:

Code:
#define armor_equiped	4651961
#define left_hand_equiped	4651899
#define right_hand_equiped	4651934

These fire every time you open the inventory, so if you have armor and two weapons equiped, hs_removeinvenobj get called three times with these reasons.

As far as I can tell this is the only way you can tell what's in the player's inactive hand, so that in itself is very interesting. Too bad there's almost nothing you can do scriptwise while in inventory...
 
JimTheDinosaur said:
Hmm... never mind this, just like with the regular inventory I have no idea how to force an exit from the steal inventory. Annoying.
tried tap_key(whatever the scancode of escape is)?
 
Not yet, and it works, thanks! Really awesome that you can force input (being an idiot I always just skimmed over tap key thinking it was something about multiple key taps, no clue why)!
 
Thank You,tested and it gets rid of the annoying feature

now motivation to fix and update the mods heh

Nirran
 
That's cool! Have anyone tried the consume_drug constant? Is it really working? Does it get called when you use drug on yourself via Use object On (context menu)?

I think it would be great if someone started some kind of repository for all kinds of sfall-related scripting libraries. Headers with constants for all stuff that is available with sfall (like get_proto_data database in another thread), and libraries with functions for different tasks like working with arrays, etc...
Right now you need to download every single mod with source code from different forums and try to understand how different stuff is done...
Such repository would also make all mods more compatible with each other.
 
Last edited:
Is there in fact even a .h file with sfall gvars numbers? I've been trying to modify rapid perks but I can't make heads or tails of it because I don't know what global vars are being called. Allthough the thread nirran made did help :)
 
Back
Top