Various modding questions

Anybody know how I can read script-wide variable A in script A, from script B?

I understand that a global var can be used, but I am also of the understanding that the global var will be saved in save file, and I do not want that. So I am looking for another option.

The data put in var_A is an array pointer, so no reason to save it in save file. Is there a proper solution?
 
You can use map variables if all happens in the same map, but that is also saved. You can also export temporary variables from the map script and import them into other scripts, but again, same map only.

What makes the difference that it gets cleared on every map change / game load? You could just override it the next time or reset it to 0 when you're done with it.

Aren't arrays by default not saved anyways? I remember there was something about that in the array doc.
 
Thanks @Lexx , @burn , @Mr.Stalin .


Aren't arrays by default not saved anyways?
Yes, but then I am using a permanent array (not saved, but permanent). And I need access to the same array from multiple scripts. else I would have to make all the scripts into one script.
 
Last edited:
Hi, I have a few questions about modding.

1. How to call standart USE item function from inventory via script?
I have hunger system. And I need to consume foods automaticly. I have function that increase satisfaction points, then increase hp according to proto, and finally remove it from inventory. Problem is that i need to keep script hp value with value from proto. Also if I would have some drug effect with time duration that would be hard to do via script.

2. How to make a durability system to weapons and armor?
At the start I had idea to use sfall save_array function, to save as a associatve map, where key is object instance id and value is object durability, let's say from 0 to 100. But I've got a problem, when I load the game, the tracking object gets all the time different instance id.
Then I had looked at SAVE.DAT. I had found a place to store item durability, but I had not found the way to save and load this data.

3. How to setup option "use on" on weapon?
I am trying to implement cut fruit from plants by using knife. I implemented via use from inventory, but I want to use from hand, like a shovel. I've tried to setup option "use on" in proto editor to a knife, but it doesn't work. I think because knife has a weapon type, but shovel has a misc type.

4. Is there the way to modify engine, for implement new mechanics without headache with scripts?
 
Hi, I have a few questions about modding.

1. How to call standart USE item function from inventory via script?
I have hunger system. And I need to consume foods automaticly. I have function that increase satisfaction points, then increase hp according to proto, and finally remove it from inventory. Problem is that i need to keep script hp value with value from proto. Also if I would have some drug effect with time duration that would be hard to do via script.
use_obj_on_obj

2. How to make a durability system to weapons and armor?
At the start I had idea to use sfall save_array function, to save as a associatve map, where key is object instance id and value is object durability, let's say from 0 to 100. But I've got a problem, when I load the game, the tracking object gets all the time different instance id.
Then I had looked at SAVE.DAT. I had found a place to store item durability, but I had not found the way to save and load this data.
https://fakelshub.github.io/sfall-documentation/funcx-macros/#set_unique_id

3. How to setup option "use on" on weapon?
I am trying to implement cut fruit from plants by using knife. I implemented via use from inventory, but I want to use from hand, like a shovel. I've tried to setup option "use on" in proto editor to a knife, but it doesn't work. I think because knife has a weapon type, but shovel has a misc type.
Use the "Use On" interface (as well as charge the car).
 
4. Is there the way to modify engine, for implement new mechanics without headache with scripts?

Maybe, by making your own version of sfall. You could make your own branch and write whatever you want in C, the way sfall does.
Is it really worth it though?
 
Thanks Mr.Stalin for reply.

use_obj_on_obj works great! I'm using global script so i need to prepend each call with set_self(dude_obj) twice.

set_unique_id works fine and i'm implemented some basic functions.

With third question you probably misunderstand me. I already implemented use on via inventory. But I wanted use via hand, like shovel. Or so there's no way to implement this and it's the game engine limitation?

Cyrus
Yes, you probably right, it might be more harder than using scripts.


5. HOOK_DESCRIPTIONOBJ doesn't work in barter mode on weapons with ammo. It's display ammo count in weapon. Actaully I see a blink where the original text overrides by this ammo info. Is there a way to fix this?
 
I have a problem with compiler. When I try to compile export procedure with arguments I get a few second freezing and then sound of error, but error doesn't show up. The fact is file is not compiled.

Code:
export procedure aa(variable arg0);
procedure aa(variable arg0) begin end
 
I'm pretty sure you can't export procedures. Don't really remember the details, but I think we fiddled with it for a while some year or so ago.
 
you can't export procedures with arguments.
I implemented it by a header file.

Acctualy I have a new couple of questions :)

1. How to add new critters on map at runtime by script?

2. How to call standart function of destroying a weapon in arms? Like when you crittical miss.
I did by using destroy_object(weapon) in HOOK_ITEMDAMAGE. I was looking for some hook, where I can override the result with crittical miss, but I didn't find. There is HOOK_AFTERHITROLL where I can override the result but it doesn't fit for my case, because there's no reference to weapon, there's no reference to type of attack.
The problem is, when I'm using HOOK_ITEMDAMAGE which destroy a weapon, dude continues attacking without weapon. There is punch attack with corresponding sound.
Edit: Actually ITEMDAMAGE also doesn't fit, because it only executes, when attack is succesful (hit). I have script which should destroy a gun at use. Also arg5 the type of attack works not as I expected, it works like the next argument, if melee or not. Rocket launcher fires with 0 value, but I expected as value WPN_ANIM_ROCKET_LAUNCHER (0x0A)

3. Is there a guide for making your own sfall?
I found sources in Github, but I don't have any clue how to generate ddraw.dll, and more important question, how can I reverse engineer fallout2.exe to find out what an opcode uses for?
I have olydbg, but I don't know how to setup breakpoints on specific game calls, like when player shooting.
I mean, I want to modify engine to add use on option on a weapon, like a shovel. Currently this option works on misc type, but doesn't work on weapons. So, what steps might be to do that?
 
Last edited:
1. create_object_sid(pid, tilen_num, elev, sid) - check vanilla scripts like rnddsrt.ssl for examples.
2. Use get_object_data(combat_data, C_ATTACK_*) in those combat hooks to get what you need.
3. You need a copy of Visual Studio (preferably 2015) and DirectX SDK to compile the source code.
 
Last edited:
With third question you probably misunderstand me. I already implemented use on via inventory. But I wanted use via hand, like shovel. Or so there's no way to implement this and it's the game engine limitation?
Obviously, this can't be done for weapons.

5. HOOK_DESCRIPTIONOBJ doesn't work in barter mode on weapons with ammo. It's display ammo count in weapon. Actaully I see a blink where the original text overrides by this ammo info. Is there a way to fix this?
Read the description of the hook carefully.
 
Read the description of the hook carefully.

Description:
Runs when using the examine action icon to display item description. You can override the description of the item. An example usage would be to add an additional description to the item based on player’s stats/skills.
I:
That's correct. When I use examine action icon in barter mode, I get item(armor) description which includes my new information, but if I examine weapon with rounds, I get overriden info, that shows only info about rounds.
 
3. Is there a guide for making your own sfall?
I found sources in Github, but I don't have any clue how to generate ddraw.dll, and more important question, how can I reverse engineer fallout2.exe to find out what an opcode uses for?
I have olydbg, but I don't know how to setup breakpoints on specific game calls, like when player shooting.
I mean, I want to modify engine to add use on option on a weapon, like a shovel. Currently this option works on misc type, but doesn't work on weapons. So, what steps might be to do that?
if you can't figure out how to program game scripts correctly, then you have nothing to do in the sfall code, and you need knowledge of C++ and Assembler language.
To make the use for weapons option, you'll have to rewrite a hell of a lot of code in the engine.
 
Last edited:
Back
Top