Various modding questions

Discussion in 'Fallout General Modding' started by Cyrus, Sep 4, 2020.

  1. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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: Sep 19, 2020
  2. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015

    Thanks for that Zorcher. You're probably right.
     
  3. Risewild

    Risewild Venerable Relic of the Wastes
    Modder Orderite

    Jun 14, 2014
    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: Sep 19, 2020
  4. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    That's good feedback. Thanks for sharing. Your point about difference between kick and punch is a very good point often missed.
     
  5. .Pixote.

    .Pixote. Carbon Dated and Proud
    Modder

    Sep 14, 2009
    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.
     
  6. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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: Sep 22, 2020
  7. Zorchar

    Zorchar Still Mildly Glowing

    240
    Jun 18, 2018
    Nirran gave me a solution once.

     
  8. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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.
     
  9. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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:


    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: Oct 4, 2020
  10. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    417
    Oct 29, 2015
    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
     
  11. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

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

    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_*

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

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    Thanks for that Mr. Stalin.

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




    But what about:
    I thought these also modify the flags? don't they?


    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.
     
  13. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    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.
     
  14. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    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.
     
  15. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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:

    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.


    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: Oct 7, 2020
  16. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    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.
     
  17. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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:
     
  18. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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: Oct 7, 2020
  19. Cyrus

    Cyrus It Wandered In From the Wastes

    152
    Nov 5, 2015
    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?
     
  20. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    Yes.
    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.
    Check the defined constants in define_extra.h and the description of SubCombatDamage hook.
     
    Last edited: Oct 10, 2020