Various modding questions

Unarmed is for master players who want to play a finessed game, unlike those 'lowlifes' who walk around carrying cheap firearms making "pew - pew" noises every few minutes.
this guy...

hah. got a nice chuckle out of me.


@.Pixote. and @Gizmojunk and @Risewild :

Given you guys' experience with unarmed in FO2 I would like to know your thoughts on unarmed special attack AP costs. Is it well balanced by default?

My thinking has been "not" and my logic is a simple comparison with a typical gun in terms of Damage per AP ratio. On that basis, its obviously out of proportion. But I'm interested in your thoughts.
 
Last edited:
I personally don't, but I THINK that the execution time, and the amount of "work" the CPU will have to do is negligible. A script becomes CPU intensive in other cases, such as complicated mathematical calculation. A famous example is finding the root number of a very large number: The CPU has to make many (I'm guessing much much more than a billion, depending on the number itself) of operations to calculate this.
In your example, it looks totally negligible.

EDIT: Also I think most (if not all) critters in use in the game are level 1, and with varying skills and stats. Many attributes and functions can only be applied to dude_obj, such as add_trait or perk.


Thanks for that Zorcher. You're probably right.
 
I rarely use special attacks that cost more than the basic Punch attack. I also rarely use builds that specialize on unarmed criticals too (I like the Heavy Handed Trait).

I think the good advantages of unarmed Special Attacks are the ones that give high critical chance and armor piercing. But since I don't play relying on criticals, and I prefer to dish out more damage in normal attacks than rely on causing criticals, I rather use more normal or aimed attacks in a turn than only use one special attack and another normal attack.

For example, why would I want to use one Piecing Strike for 8 AP, when I can use 2 Haymakers for 3 AP and still have 2AP left compared to the PS. The benefits of the Piercing Strike are +10 damage, Armor Piercing (I don't know how much AP it has though) and 40% Critical, while the Haymaker is +7 damage, no AP and only 15% Critical. If you get the perk Bonus HtH Attacks, you can then use one PS for 7AP and can use 3 Haymakers for 2AP each, that means you can unleash 3 Haymakers in one turn and have one extra spare AP compared to the PS. If I have full AP (10) I can only use 1 PS and 1 other regular attack in one turn, but I can use five Haymakers in the same turn. I think that even without Armor Piercing, the total damage would be more for the Haymakers.
For me, I rather have more attacks per turn.

But I can see the benefit of PS, specially if your character is build for criticals. And if you're fighting only one enemy that is highly armored. But for my playstyle, having more attacks would be more useful.

But since I'm stubborn and usually keep to my fighting style, I have no idea if making a critical focused unarmed character would prove that using the higher AP attacks with the higher critical will be devastating or not.

One thing I never understood was the differences between the normal attacks Punch and Kick. I think they deal around the same damage, but Kick costs 1 more AP. I don't know if it has any benefits, does it have a higher chance to drop the enemy to the ground or something? I very rarely used the Kick, so I never noticed any difference from the normal Punch attack.
 
Last edited:
That's good feedback. Thanks for sharing. Your point about difference between kick and punch is a very good point often missed.
 
After you get the slayer perk (All hand-to-hand attacks cause critical hits), with a mega power fist you're literally a killing machine...add the fact you can still target body parts - eyes and legs - yeah baby. Just be careful of Enclave patrols and large packs of deathclaws... I like to grab both Bonus move perks, and all 3 Toughness perks, as well as Lifegiver.
 
Interesting insight, thanks pixote.


A question about get_proto_data,

I need to get the animation ID for the particular attack mode of a given weapon. For example the spear uses Thurst Anim for normal attack and Throw Anim for throwing the spear; also noting that this is different from PROTO_WP_ANIM.

I can not find the offset or macro for this value to use the get_proto_data for it.

The proto_data defines are on define_extra.h but do not include this particular item. I have looked through both Sfall and RPU header files but could not find it. I also tried to check the proto file with a hex editor to find the offset. However it seems the memory offsets are different from file offsets.

I need to check this value for a weapon to decide if the attack was a throwing attack or regular melee.

Anyone know what the value for this offset is or where to get info on this?

Thanks.
 
Last edited:
Anyone know what the value for this offset is or where to get info on this?

Nirran gave me a solution once.

in case u are looking for specific proto data that isnt included with sfall this code will spam and if u set

Code:
;Set this to a valid path to save a copy of the console contents
ConsoleOutputPath="console.txt"

in ddraw.ini and compile this in gl_test,int

Code:
procedure start;
procedure Check_Proto_Data;

procedure start
begin
      if (game_loaded) then begin
          call Check_Proto_Data;
      end
end

procedure Check_Proto_Data
begin
   variable LVar0 := 0;
   while(LVar0 < 500) do begin
      LVar0 := LVar0 + 1;
      display_msg(LVar0 + " " + get_proto_data(obj_pid(dude_obj), LVar0));
   end
end

then logg out and u can ,by elimination,find the data ur looking for in fo2\console.txt
 
Thanks for the above @Zorchar . Thats good advise. I actually did something similar already and found it. The offset is 24. Single byte. Although the get_proto_data function seems to return a minimum of 2 bytes, which "dirties" up the result. I figured how to sanitize it.

Thanks very much though. That's useful technique.
 
A problem with critical hits and the CombatDamage hook.


As you well know critical hits are integral part of damage calculations. So if you want to change the calculations you will have to deal with criticals too.

There is 2 ways to deal with this. One is to re-roll the whole critical phase, and the second is keep and use the roll created by game engine. It would be advantageous if we could re-roll the whole critical phase and recalculate as it would give more freedom of modding. However a few problems arise.

When combat_damage hook gets triggered the critical roll has already been made using default game engine calculations for critical chance, and the crit level, effects, and likely combat message, have all been decided. You then have access to change the effects, and the damage. However if you do this, you then need to update the combat message too but there is no way to do that with CombatDamage hook. If you don't update the message then there will be a mismatch between what happened and what the message says happened, and that's not good. For example:

If a hit was not originally a critical hit, and it becomes critical through your re-roll then the message will say "critter was hit for [large number of] hit points." Where as it should say: "critter was critically hit for [large number of] hit points, and had his insides blown out." Or it might say "critter was critically hit for 3 points of damage and died an agonizing death with his spine sticking out" while the critter still stands and is fine. So there would be a mismatch between the previously calculated message and the re-calculated event.


A solution is to keep the original game engine critical results, but then you are not able to alter critical chances nor the critical level.


Now I have a situation where I need to know the crit level. I could live with keeping the default engine generated crit results, however the crit level is not exposed, and I need it for some calculations that affect damage. The only solution I can think of is to reverse engineer the crit level based on "critical multiplier", "body part", and "target" arguments of combat damage hook. However this solution is not perfect and can not reverse engineer the exact crit level in many cases.



So my questions are, do any of you guys know or can think of:

1. how the combat message can be replaced for new event.

2. how to "get" the crit level calculated by game engine.




Another issue is the problem of altering critical chances. (example: to give extra critical chance for a weapon)

Crit chance calculations I think happen during the Attack Complex phase. So when you encounter "AfterHitRoll" or "CombatDamage" hooks its already too late. As far as I know there is no "hook" to alter it.

The only way I can think of is to alter the critter's native critical chance stat before its sent anywhere, and that's a problematic solution. I have thought of a way to do it, however its a dirty and cumbersome hack and I don't want to do it that way. (edit critter's stat during its turn, and then revert it back at end of turn, updated with weapon change during turn. Its cumbersome and might lead to problems.)


So,

3. I'm wondering if anyone knows a solution to alter critical chance calculations in attack complex or elsewhere. I'm not at all familiar with attack complex.
 
Last edited:
Thanks for the above @Zorchar . Thats good advise. I actually did something similar already and found it. The offset is 24. Single byte. Although the get_proto_data function seems to return a minimum of 2 bytes, which "dirties" up the result. I figured how to sanitize it.

Read the specification for the proto file. All values in the define files .h set correctly.
#define PROTO_FLAG_EXT (24) - Primary/Secondary Attack Type 0x000000SP
#define PROTO_WP_ANIM (36) - character animation
 
"AfterHitRoll" - this is what changes the result of the critical roll, nothing else affects critical result.

1. how the combat message can be replaced for new event.
use the flags to change the critical states.
#define C_ATTACK_FLAGS_SOURCE (0x14) // see DAM_* values in define.h
#define C_ATTACK_FLAGS_TARGET (0x30) // see DAM_*

2. how to "get" the crit level calculated by game engine.
What level of crit do you want to get?
stat_level(source, STAT_crit_chance); ???
 
Thanks for that Mr. Stalin.

Read the specification for the proto file. All values in the define files .h set correctly.
#define PROTO_FLAG_EXT (24) - Primary/Secondary Attack Type 0x000000SP
#define PROTO_WP_ANIM (36) - character animation

Ok I see, I didn't find it cause I didn't know it was called PROTO_FLAG_EXT. Rather ambiguous naming.




"AfterHitRoll" - this is what changes the result of the critical roll, nothing else affects critical result.

But what about:
HOOK_COMBATDAMAGE:

int ret4 - The special effect flags for the attacker
int ret3 - The special effect flags for the target
I thought these also modify the flags? don't they?


What level of crit do you want to get?
stat_level(source, STAT_crit_chance); ???

As you know once a critical roll happens and it is a critical, then a critical level is rolled and determines the level of the critical from 0 to 5 and it determines the flags and combat message from critical table. This is the "level" I'm talking about. I need to both "get" it and if possible "set" it. I'm hoping that replacing it would also change the combat message.

I think the code you mentioned ---> stat_level(source, STAT_crit_chance) <--- , gets a critter's critical chance. To clarify, that's not what I'm asking for.


To redo the critical roll I would need to be able "set" the "appropriate" offset as "crititcal" or "not critical" (which I think can be done in AFTEHITROLL) as well as "set" the "Critical LEVEL" which determines both the "critical flags" and "critical message" . Doing it in HOOK_COMBATDAMAGE doesn't work as its already too late, and, no access to Critical LEVEL.

AFTERHITROLL gives me:
Code:
int arg1 - If the attack will hit. (0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit)
critter arg2 - The attacker
critter arg3 - The target of the attack
int arg4 - The bodypart
int arg5 - The hit chance

int ret1 - Override the hit/miss
int ret2 - Override the targeted bodypart
critter ret3 - Override the target of the attack

So I could change if a hit is critical or not, but does not provide access to critical level information, to get or to set.
 
The process of calculating critical hit is after HOOK_AFTERHITROLL.
The roll result gets modified by checking player's stats/perks/weapons (upgrade to critical success/failure or not), then the combat data (C_ATTACK_*) is passed to attack_crit_failure/success engine functions for processing the critical level and effects depend on the roll result.
Not sure what you're trying to do but it sounds like you want to rewrite the whole compute_attack_ process, or at least to control most of it.
 
It requires:
- adding weapon critical chance to critter critical chance, and redoing the critical roll based on new number.
Why not just use HOOK_INVENTORYMOVE/INVENWIELD to temporarily increase user's critical chance stat (or critical table bonus) for wielding certain weapons, so one will have desired modified critical chance before any combat process/critical calculation.
 
Ah, damn it, I changed my mind on my post and decided to delete it before anyone responds, but I shouldn't have done it. reposting:

I would say I dont want to rewrite the compute_attack_process, and would prefer not to meddle with it if possible.


What I want:
- add critical chance to weapons.
- ability to modify the critical Hit "level" and consequent implications (flags and combat message).



It requires:
- adding weapon critical chance to critter critical chance, and redoing the critical roll based on new number.
- redoing the critical "level" roll to decide how good a critical it was.
- passing the new critical level back to the engine so flags and combat message can be decided correctly.
----- OR
- decide flags myself and pass the flags and combat message back to the engine.



What I already have:
- access to "get" and "set" flags (through COMBATDAMAGE hook)
- access to "critical or not" (through AFTERHITROLL. critical roll can be redone here and new decision sent back to engine using arg1 / ret1)


What I don't have and need:
- access to sending back the critical "level" to the engine,
----- OR
- setting the combat message (decided based on critical level).



PROBLEM:

As Stalin pointed out, I can redo critical roll calculations as I please and send the "critical decision" back to the engine in AFTERHITROLL using ret1 (0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit).

But then I need a new critical level roll. Calculating the roll and deciding the level is obviously easy, but how to supply it back to engine? I would either need to give the critical level roll (1-100) or the level (0-5) itself back to the engine so the engine can decide what affects to set and which combat message to display to player. OR, I would have to decide the flags and combat message myself, and then supply "THEM" back to the engine. THIS is the problem I need to resolve.

I can't find a solution, or maybe it exists and I'm not educated enough to know it. Hence this post.



Are you saying the only way I can affect the combat message and critical level is by modifying the compute attack?

to avoid redoing the compute attack I am willing to sacrificing some features and settle on "getting" the game calculated crit_level. If I could at least get this level it would be helpful. (getting the level helps me avoid redoing the critical table roll)

But if its as you say and its calculated in the compute attack, then I suppose there is no way to get it really or set new values. I would have to redo the compute attack. Is that what you're saying?

Actually, I just realized, from what you and stalin said before, If I am able to re-calculate critical chance and send a critical hit through AFTERHITROLL, and crit level has not been decided yet, then I kind of don't need to worry about critical level anymore do I?


Now the case with the critical level is I intend to use it in a different function. I am adding a feature that gives varying penetration levels based on critical level. So when you get a critical armor bypass, it wouldn't always be 80%. It would vary based on how good the critical was. But I would need to know the level. This is why I need to know it after it has rolled.

A second reason I would like to have access to critical level is to be able to upgrade the critical level on other circumstances. For example a weapon that adds 20 to critical table roll (just like better criticals) or say a trait or another perk that adds that. This is why I am looking to have access to it.


Why not just use HOOK_INVENTORYMOVE/INVENWIELD to temporarily increase user's critical chance stat (or critical table bonus) for wielding certain weapons, so one will have desired modified critical chance before any combat process/critical calculation.

Actually that's a GREAT solution and I was actually looking at doing it that way through apcost hook and combat turn hook, but I didn't think of the HOOK_INVENTORYMOVE/INVENWIELD. That's a really good suggestion and the correct way, thanks. This may be the better hook to use for easily adding crit chance and crit table bonus.

Although this still does not help with knowing the rolled crit level for purpose of calculating level of penetration.
 
Last edited:
I would do a separate roll for the penetration level during combat damage if the target has received DAM_BYPASS flag.
Or it would just make higher level of critical hits that are already powerful even more OP in my book.
 
I would do a separate roll for the penetration level during combat damage if the target has received DAM_BYPASS flag.

Well, yes actually that's what I thought I should do at first, but it produces an undesired effect.


Example:

Say the hit is critical and to TORSO and is BYPASS. This means that the level was from 2 to 6 (assuming a 1 to 6 numbering). The way I designed this was to match the crit level to penetration:

level 1 = 0
level 2 (bypass)= 35
level 3 (bypass)= 50
level 4 (bypass)= 65
level 5 (bypass)= 80
level 6 (bypass)= 80 (if insta death then don't matter. but matters when no insta death.)

I could do what you said which looks like:
Code:
pseudocode:

if BYPASS then
  penetration = random from list[35, 50, 65, 80]

The issue with this is that sometimes the crit level is 1 or 2 and CM is low, but then penetration would get 80%.
And other times you have a very high CM because of high crit level, but then with very low penetration.

It would become very random. And if there is one thing I hate about fallout is that its WAY too fucking random. So I was hoping to be able to get the crit level and do a more consistent association between crit level, and Penetration level.

That's the whole freakin story!



So then because I can't see how to "get" crit level, I thought of a way to reverse engineer it. But that wasn't always accurate.

And so here we are in this discussion of how to GET the freakin crit level! :lol:
 
Of course I thought if I can't get it, then I'll do the critical phase allover myself and do my own critical level roll, then I'll know the level. But then you are saying that's part of the attack_compute... and..... its like.. shiiit... who wants to touch attack compute! Not me!

If I don't find a better solution to this I will resort to the reverse engineering option, its between 30 to 90% accurate depending on situation.

I don't know, I might have a look at attack_compute, but honestly I think I would be going too far and above my pay grade.
 
Last edited:
then the combat data (C_ATTACK_*) is passed to attack_crit_failure/success engine functions for processing the critical level and effects

Ok just to clarify and sum up, are you saying the critical level roll happens in the success engine? which is part of the C_attack?

If yes,

would you suggest where I could learn more about C-attack phase?
 
are you saying the critical level roll happens in the success engine?
Yes.
which is part of the C_attack?
No, the rolled critical level is only for the function to get correct parameters from the critical table, do stat checks and pass results to the combat data for damage calculation. It's not part of combat data struct.
There's a new argument for CombatDamage which is the pointer to the combat data in next release. You can override the crit effect message from there.
would you suggest where I could learn more about C-attack phase?
Check the defined constants in define_extra.h and the description of SubCombatDamage hook.
 
Last edited:
Back
Top