Damage formula

Unlimited party, improved damage formula, better healing system, comprehensive highlighting and more.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Re: Damage formula

Post by Cyrus »

Magus wrote: Thu Nov 22, 2018 11:37 am No, it's not C++, it's Star-Trek Scripting Language, or SSL. It does bear slight resemblance to C++ in that it also uses macro preprocessing.
Currently the best way to work with it is extended sfall script editor.
You're correct, the script plus the 4 files should be enough. But you'll probably want to download all headers anyway, they are in sfall modderspack.
Burn there is no editor in the above link that you pointed me to. I did however find an editor in the sfall modders pack. So am I suppose to do something with these extended editor files? how should I use them?

They're just files, I don't know what to do with them.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Re: Damage formula

Post by Cyrus »

Burn I also noticed this:

Code: Select all

procedure get_critical_level(variable who) begin
  variable level := random(0, 5);
  if has_trait(TRAIT_PERK, who, PERK_better_criticals) then level := level + 1;
  return level;
end
Now again I might be mistaken, but from what I understand the critical levels are a maximum of 6 states. Refer to this page. The 6th level reached only with the better criticals perk.

Note that in the above code, "level" is a random number between 0 to 5. This means that it has 6 states, (0, 1, 2, 3, 4, 5). With the addition of +1 for better criticals it makes it 7 states. This is probably a mistake.

I don't know what numbers the game engine prefers, whether its from 0 to 5, or from 1 to 6. But its important to get that right, otherwise the level value will not match in the critical table if I understand this right.



Also:

Code: Select all

[186]  mult := get_critical_table(critter_kill_type(target), BODYPART_TORSO_UNCALLED, crit_level, CRITICAL_VALUE_TYPE_MULT);
[187]  flags := get_critical_table(critter_kill_type(target), BODYPART_TORSO_UNCALLED, crit_level, CRITICAL_VALUE_TYPE_EFFECTS);
The get_critical_table seems to be always calling for "BODYPART_TORSO_UNCALLED" instead of acquiring the related body part to get the multiplier and effect flags. Is this supposed to be this way?
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Damage formula

Post by Magus »

Cyrus wrote: Sat Nov 24, 2018 5:32 pm Burn there is no editor in the above link that you pointed me to. I did however find an editor in the sfall modders pack. So am I suppose to do something with these extended editor files? how should I use them?

They're just files, I don't know what to do with them.
I think the extended one is published somewhere on NMA. Or you can bug Stalin to add binaries to releases on Gihthub.
Or you can use the one that's coming with modderspack, they are not too different.

As a matter of fact, I'm developing a VScode extension for SSL, will probably release it soon. That will add yet another alternative.

Cyrus wrote: Sat Nov 24, 2018 6:24 pm Note that in the above code, "level" is a random number between 0 to 5. This means that it has 6 states, (0, 1, 2, 3, 4, 5). With the addition of +1 for better criticals it makes it 7 states. This is probably a mistake.

I don't know what numbers the game engine prefers, whether its from 0 to 5, or from 1 to 6. But its important to get that right, otherwise the level value will not match in the critical table if I understand this right.
You are right again, it should be (0,4)+1.

Cyrus wrote: Sat Nov 24, 2018 6:24 pm The get_critical_table seems to be always calling for "BODYPART_TORSO_UNCALLED" instead of acquiring the related body part to get the multiplier and effect flags. Is this supposed to be this way?
Yes, it is. This code is only used for second and consecutive bullets in a burst, and burst always goes to torso uncalled.

Initially I had an idea to allow uncalled shots to hit specific bodyparts - after all, why wouldn't they? But hitting a body part is considered "critical" in F2 combat, so just randomly redirecting bullets will result in dramatic critical chance increase. And if only already critical bullets are redirected, then we're gimping the criticals, because torso (and head) have the most powerful effects such as knockout and instakill.
And you can't do this "honestly" anyway, because with Sniper and 10 Luck a point blank burst from a minigun will leave any enemy with all their limbs broken.
An attempt to implement this would've resulted in a bunch of arbitrary decisions "for balance", the result would've been questionable and too far from vanilla combat mechanics in any case, so I scrapped the idea.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Damage formula

Post by Cyrus »

Regarding your last paragraph, I totally get your logic. I actually had thought about why you might have done it and I already figured this the probably the reason why you did it, but I wanted to make sure its not a forgotten temp code.


2 questions:

1. In SSL scripting, if I create a procedure (procedure A) and inside this procedure I create a var (var x) and then I call another procedure (procedure B) inside of procedure A, will I be able to assign new values to var x from inside procedure B? x has only been declared in procedure A.

2. I have created 2 variables in the main body up top and initialized them. Then at 2 different points inside 2 different procedures I am changing their values. I did not recreate (redeclare) these variables inside those procedures. Is this fine?

3. I have used a Max function: max(0, variable). Is this a real function in ssl scripting? does it work?



Yesterday I finished my modding of your damage file. I wasn't familiar with the editor, so I wrote by hand :lol: .

Would it be possible for you to review it and make sure I haven't made any errors? or perhaps run it on your rig for errors? I haven't been able to setup a compiler yet nor do I know how to test with the debugger, so I can't test it. I would appreciate it.

I also have a number of ideas/suggestions for your damage mod as well which you might like. Well you'll see some of them in my modded version.
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Damage formula

Post by Magus »

1. No. You should return the value from B and assign it in A.
2. Fine. You need not and must not re-declare script-wide vars.
3. max is somewhere in the headers, you need to include it. Or write it yourself, it's 3 lines of code.

I don't mind taking a look, but you really should try to at least compile it. The compiler can even be used manually, from command line.
You're going to have to do this anyway if you want to mod, and spending human time on what a machine can do is a waste.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Damage formula

Post by Cyrus »

You're right. But my point is that even if it compiles, I may have made other errors that compiler doesn't catch. So that's what I meant. But absolutely, I will first try to compile it myself.


Burn a question about if statements in SSL. given the following:

Code: Select all

procedure test()
if condition_A then Action_A;
if condition_B then Action_B;
if condition_C then Action_C;
end
none of these if statements have "end" syntax. I've seen this kind of usage in your code (example: procedure get_dr_dt).
in the above case, when the first line is true then it will execute and go to next line. But if it fails, how does it know where to jump? wouldn't it then look for the next "end" that it finds and skip everything in between?
I'm afraid to write like this because I'm worries that if the first line fails then it will skip all the next if statements, as if they were nested if statements. So wouldn't it treat them like this:

Code: Select all

procedure test()
if condition_A then Action_A;
    if condition_B then Action_B;
        if condition_C then Action_C;
end
I just wanna make sure my own writing is correct. So I was thinking of putting an "end" at the end of each line or below it. But If these one line statements don't need "end"s then I'm afraid that by putting "end"s at the ends of them I would actually break the code by ending the procedure early.

Can you clarify?
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Damage formula

Post by Magus »

There's no jump. The script is executed line by line, like in any other programming language. "end" denotes an end of a begin block. The compliler will tell you if you break the code.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Damage formula

Post by Cyrus »

So then I should keep the action on the same line if I want the if to apply to it and I don't want to use begin/end?
Last edited by Cyrus on Sun Nov 25, 2018 1:14 pm, edited 2 times in total.
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Damage formula

Post by Magus »

No, whitespace doesn't really matter. Except in defines, I think.
But then again, you can easily test for these things yourself.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Damage formula

Post by Cyrus »

Burn, I need the 4 header files that are referenced in your damage_mod file.

I downloaded the latest script editor here: http://www.nma-fallout.com/resources/sf ... editor.77/

I found define_extra.h in the editor's headers folder.
I also know where the fo2tweaks.h is (in your source files).

But for the life of me, I can't fine "define.h" and "command.h" anywhere! Theey aren't in your files either. I downloaded the sfall user usable version, not there. I looked at sfall source code, not there. I looked at sfall modder's pack (latest version) and its not there either!

I'm really perplexed! I can't find these 2 files! where did you get them from?
Post Reply