Aller au contenu

Photo

Modifying Core_h, smart thing to do?


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
I am looking into modifying the Lethality ability to not only swap Damage from Strength to Cun but also swap Attack (rating).

The strength part in Core_h looks like this:
if (nAttribute == PROPERTY_ATTRIBUTE_STRENGTH && 
  HasAbility(oCreature, ABILITY_TALENT_LETHALITY) )
{
    if (GetAttributeModifier(oCreature,
      nAttribute) < GetAttributeModifier(oCreature, PROPERTY_ATTRIBUTE_INTELLIGENCE))
    {
        nAttribute = PROPERTY_ATTRIBUTE_INTELLIGENCE;
    }
}

The Attack modifier is also set in core_h:

float GetCreatureAttackRating(object oCreature)
{
    return GetCreatureProperty(oCreature, PROPERTY_ATTRIBUTE_ATTACK);
}

It would be very easy to modify this. However, the Core_h header file is included in like every script in this game which makes me hesitant to modifying this header.

How would I go about tackling this problem? Changing the header and recompiling all scripts and placing them in the override directory hardly seems like an option.

The function GetCreatureAttackRating is only called in combat_h in the function Combat_GetAttackResult, which in turn is called in 5 or 6 (as far as I've found) scripts like *_single_target and other scripts that include player/creature attacks.

Would I have to modify core_h, export all the script(s) that calls the GetCreatureAttackRating function and leave it at that? Or is there a more elegant way to do this?

Modifié par Joshua Raven, 03 décembre 2009 - 10:33 .


#2
Axe_Murderer

Axe_Murderer
  • Members
  • 279 messages
Just a suggestion as you could really do it either way...editing core headers should be avoided IMO just due to maintenance issues (i.e. what you'd have to do when Bioware patches and changes that header you are overriding or any of the scripts that use it). I'd create a new header with a customized version of the function you want to modify, then track down those scripts which call the original and affect adversely what you're trying to accomplish due to their use of the original, and replace all those calls with ones to your new function.


#3
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
But doesn't that mean that instead of editing a single header file, i'd be editing all the files that call this specific function? I realize I'd have to recompile those scripts anyway before the changes in the header file take effect but that means your solution requires the same amount of work.



I don't know, I'm not a professional programmer but this header thing in which a lot of game mechanics are placed seems not like the best choice for a moddable game like DA:O. To edit a single function I'd have to recompile all the scripts that call this function, seems like a lot of overhead.



Anyway, thanks. I guess your solution is the proper one, even if it doesn't really save me any work or time, at least changes in that particular header file won't affect my script this way.

#4
Nodrak

Nodrak
  • Members
  • 144 messages
Perhaps a better route would be to point out what is 'wrong' with overriding the header. Say you want to change something relevent to a creature that is listed in a header, say core_h. So long as you don't modify the database version of core_h, I see no issues with making changes. Your modified core_h header will only be used in whatever script you compile that includes it. So you can include your modified core_h into say a custom creature_core script. All the other game scripts that include core_h will still use the one from their compile time (aka game release).

In this case you will have to make changes in core_h, then compile both module_core and rules_core. This will spawn a ton of extra files, but you have no need to keep them only module_core.ncs and rules_core.ncs. Unfortunatley, it seems like the creature property PROPERTY_ATTRIBUTE_ATTACK is derived in the engine level (as per properties.xls and lacking definition in code). You could come to your own coding solution to circumvent this, but it was likley moved to the engine for performace issues in the first place. Just take the value and subract a value derived from STR and add a value derrived from INT (the lethality resitriction will ease any performance issues).

If you do all this with local copies of the scripts, they will leave all other things functioning how they were at release. For example, we did not compile creature_core, so unless you keep the compiled creature_core (which you dont need to), it will use the header it had at compile time (game release).

Rules_core will handle the attack rating changes logically, but module_core calls the character sheet display, which will show erronous attack ratings unless you compile module_core as well.

I hope that was clear >.<

Modifié par Nodrak, 04 décembre 2009 - 06:59 .


#5
Georg Zoeller

Georg Zoeller
  • Members
  • 188 messages
Two answers:

No

Here's why:

You'd have to recompile almost every single script in the game and that would make your mod incompatible with any other mod that changes any script (along with the logistics nightmare that follows).


Yes, well, perhaps

It's true that for a specific purpose, like lethality, you only have to recompile certain entry points

creature_core.
player_core.
rules_core.
module_core.
all talent scripts that use weapon damage.

to capture 99% of all use cases - but this is only true in this specific case - there is no telling how many scripts will be affected by a specific change in core_h unless you do an extensive search through the entire script tree to identify all possible entry points

Modifié par Georg Zoeller, 04 décembre 2009 - 08:09 .


#6
Demeter78

Demeter78
  • Members
  • 4 messages
I highly opt for a mod that fixes attack rating for Lethality and ArcaneWarrior's Combat Magic.

...cause my cunning rogue sucks a big deal and my arcane warrior does not use sword either.



Btw is there any way to set PROPERTY_ATTRIBUTE_ATTACK from the script code?

#7
Demeter78

Demeter78
  • Members
  • 4 messages
Hmm there may be another dirty solution based on the function



SetCreatureProperty(oChar, PROPERTY_ATTRIBUTE_ATTACK, 0.0f, PROPERTY_VALUE_BASE);



Make a script that calculates attack rate and sets into base attack value.

The only problem is to find a correct trigger for this script.

And base attack value shall be calculated carefully.



Some info is taken from http://www.giantbomb...ints/35-270526/