Page 1 of 1

Knockback not working correctly

Posted: Mon Nov 09, 2020 3:28 am
by Cyrus
Today I was testing knockback and noticed that despite me setting max_knockback value to -1 in fo2tweaks.ini nothing was causing knockback. I did a bunch of test, but finally I decided to completely remove fo2tweaks.dat from the mods folder. Suddenly the problem was fixed.


I looked at the code. On line 14 of gl_g_knockback.ssl it says:

    if max_knockback then begin
      register_hook_proc(HOOK_COMBATDAMAGE, combat_damage_hook);
      ndebug("initialized");
    end



Seems like -1 is considered a TRUE value and therefore the hook is being registered and -1 is being passed as maximum knockback, which disables all knockback.

You need to write the check different. Ex:

if max_knockback > -1 then...



 

Re: Knockback not working correctly

Posted: Mon Nov 09, 2020 3:47 am
by Cyrus
I just set max_knockback to 10, and its still not working.

There seems to be some other problem as well.

Anyway, the script seems to be stuck on 0 knockback. needs fixin.


To test just give your character some extra melee damage and start swinging. No knockback

Re: Knockback not working correctly

Posted: Mon Nov 09, 2020 3:52 am
by Cyrus
Ok the problem is

fo2tweaks_setting(sec_main, set_max_knockback)

The actual setting is called max_knockback, not set_max_knockback.


***** EDIT

NOPE. That's not fixed it either. I don't know where the problem comes from but when I removed the scripts dat everything starts to work.

 

Re: Knockback not working correctly

Posted: Mon Nov 09, 2020 4:41 am
by Magus
do you have a save?
(also, fo2tweaks.ini and debug.log)

Re: Knockback not working correctly

Posted: Mon Nov 09, 2020 6:17 am
by Cyrus
Its the same save I posted last time. But here it is again. I didn't provide any more data because honestly there was nothing special to report on. I am using

V12.2 with sfall 4.2.8.1 with RPU16.

I tried increasing weapon damages, then I tried increasing melee, then I tried giving extra hth bonus perks. All the same.

When the script fottweaks.dat is present, knockback doesn't work. I did not isolate scripts one at a time, difficult with being packed in dat.

I turn all features fo2tweak features off except for inventory size. Changing ini settings didn't help. Only when I remove the dat file it gets fix.

I think the script is loading the wrong value somehow, but I cant say. Just try any weapon on unarmed and do more than 10 damage. Where there should be knockback there isn't any.

Have you tried this on your rig? does it work for you at all? Cause it doesnt work for me at all.

 

Re: Knockback not working correctly

Posted: Mon Nov 09, 2020 7:08 am
by Magus
OK, I found and fixed the issues.
One, as you noted, is a wrong setting check, the other was re-declaring a var.
I didn't notice it because I usually play with knockback disabled.

A new release is pushed.

(And for the future reference, you can disable scripts in dats surgically by creating empty files with the same names in "data/scripts").

Re: Knockback not working correctly

Posted: Mon Nov 09, 2020 7:40 am
by Cyrus
Magus wrote:
Mon Nov 09, 2020 7:08 am
I didn't notice it because I usually play with knockback disabled.

😏 I figured.
 
Magus wrote:
Mon Nov 09, 2020 7:08 am
creating empty files with the same names in "data/scriptos"

oh that's right. Only if all the tricks would stick to memory.