Jump to content

Need help with fixing some abilities - Almost have it


mastermahidhar

Recommended Posts

Hey all,

 

I've gotten into modding this game recently. I've begun fixing some talents and spells with my limited knowledge and making some minor enhancements. I'd like to do the same with some of the other ignored talents and spells which were not fixed by any modders so far.

 

First is Shield Block. The issue mentioned in the Wikia is that it's coded so that the backstabs occur on the left side of the character(shield bearing side) but the reverse needs to happen i.e. backstabs only on the weapon side. The passive is found in the combat_h.nss which I extracted and made some modifications to:

 

#include "effects_h"
#include "items_h"
#include "combat_damage_h"
#include "ui_h"
#include "sys_soundset_h"
#include "ai_threat_h"
#include "2da_constants_h"


#include "stats_core_h"


void main()
{
    event  ev = GetCurrentEvent();
    object oTarget = GetEventCreator(ev);
    object oAttacker = OBJECT_SELF;    
  {
    float fAngle = GetAngleBetweenObjects(oTarget, oAttacker);
    float fFactor = 0.0;
    float fFlankingAngle = GetCreatureProperty(oAttacker, PROPERTY_ATTRIBUTE_FLANKING_ANGLE);


    if ( (fAngle>= (180.0 - fFlankingAngle) && fAngle<=(180.0 + fFlankingAngle )))
    {
        // Shield block negats flanking on the left.


        int bShieldBlock =  HasAbility(oTarget,ABILITY_TALENT_SHIELD_BLOCK);
        int bUsingShield = IsUsingShield(oTarget);


        if (!bShieldBlock || fAngle > 180.0 || (bShieldBlock && !bUsingShield) )
        {
            fFactor = (fFlankingAngle -  fabs( 180.0 - fAngle))/fFlankingAngle;
        }


    }


   }
}
In the Wikia, it states that the fAngle < 180 is the problem so I just replaced the < with the >. I was able to successfully compile the script but when I add it to overrides, nothing changes.
Then comes Stunning Blows. The description states that every hit should have a 50% chance to stun. So I looked at the code in combat_damage_h and just removed the part where it checks if the hit is a critical hit. This one also compiles but I don't see the effect being applied in game.
#include "core_h"
#include "2da_constants_h"
#include "effects_h"


void main()
{
    event  ev = GetCurrentEvent();
    int    nAbility  = GetEventInteger(ev, 1);
    object oAttacker = GetEventCreator(ev);
    object oTarget = OBJECT_SELF;
    




    if (HasAbility(oAttacker, ABILITY_TALENT_STUNNING_BLOWS) && IsMeleeWeapon2Handed(GetItemInEquipSlot(INVENTORY_SLOT_MAIN, oAttacker)))
            {
                // ~50%
                if(RandomFloat()<0.5)
                {
                   if (!GetHasEffects(oTarget, EFFECT_TYPE_STUN))
                    {
                        Engine_ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, EffectStun(),oTarget,1.5f + (RandomFloat()*2.5),oAttacker,ABILITY_TALENT_STUNNING_BLOWS);
                        #ifdef DEBUG
                        _LogDamage("DAMAGE-Combat-Efffect: STUNNING_BLOWS");
                        #endif


                     }
                }
            }  
        
}
For both of these talents, I've included my scripts in the GDA. I'm not sure if that's enough so I'm wondering where I might have gone wrong. I'd appreciate any help that can be provided. Thanks in advance.
Edited by mastermahidhar
Link to comment
Share on other sites

Okay - a couple of things (starting with a disclaimer that I've never actually mucked around with existing skills, talents, spells, though I have been working on a huge mod that I may upload someday...)

RE Shield Block - note that it is not an activated talent/spell, but a passive. You found the code in the Combat_GetFlankingBonus function in combat_h.nss, which is an include file (as designated by the _h). You can't just drop the code related to Shield Block into a separate script with a main and expect the engine to run it; that's not how passives work. In the case of Shield Block, it would be used to mitigate potential damage inflicted by an enemy attacking the character who has the passive Shield Block.

Long story short: in order to modify Shield Block, you'll need to apply your code changes to the actual combat_h.nss file and then recompile every script that includes it. You can find all of the files that reference it by right-clicking combat_h.nss, then select properties, then select the Referenced By tab.

RE Stunning Blows - again, this is a passive but in this case it's used by the attacker (rather than the defender/target), so it's code would be used when the character who has the passive attacks another. As a passive, the process of implementing your changes would be the same as I described above: make the actual change to the header file, then recompile everything that includes that header file.

Now for a little extra advice:
-- I suggest keeping copies of the original vanilla code. You might, for example, copy them into files prefixed with original_ (example: original_combat_h.nss).
-- You can find out whether your code is being executed by inserting print statements in your new code. Here is an example:

PrintToLog("Executing Modified " + GetCurrentScriptName() + " for attacker: " + GetName(oAttacker) + ", defender: " + GetName(oTarget));
// The code you changed in the Combat_GetFlankingBonus function of combat_h.nss would be here.

In order to see your printed statements in the log (documents -> BioWare -> DragonAge -> Logs), you will need to create a text only file to configure it. Name the file ECLog.ini and store it in the bin_ship subdirectory where your game is installed. Here is what it should contain:

[LogTypes]
Script=1


Once you do that, you'll see a lot more entries in your log. You can turn it off by either deleting the file or setting Script=0.

Hope that helps.

Link to comment
Share on other sites

The only way to avoid changing vanilla code is to create a lot of new files. Here are the options:

 

Change the vanilla include file and recompile everything that uses it.

Create a modified vanilla include file and change all of the files that use it to include the modified one instead of the vanilla header file.

Create a modified vanilla include file AND modified versions of all of the files that include the header file you modified, changing them to include your modified include file instead of the vanilla one. If you do this, you'll need to change the GDA to use your modified compiled talent/spell files instead of the vanilla ones.

 

Good luck.

Link to comment
Share on other sites

Yep, so I got this working for Stunning Blows. I used Dain's method and just created an eventmanager GDA which mentions my script and it works. Stunning Blows works on the same principle as Destroyer(which Dain fixed) so I was able to do that. Now I need to figure out what Event Shield Block uses. I'm thinking the ATTACKED event type but I can't be sure. I tried with it and it doesn't work.

 

Edit: I was able to fix the abilities that I set out to. Thanks, thread can be closed.

Edited by mastermahidhar
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...