A little help when trying to create a simple mod.

+
Hello!
I'm sorry if this isn't the correct place to post this. I'm trying to create a simple mod that changes the radius of Yarden based on sign intensity.
I'm trying to find what changes I should do to make it so. I was looking around in the game scripts.

I found the Yarden effect in gameplay\effects\effects\skill\yrdenHealthDrain.ws but this code only about the constant health drain Yarden does with some of the upgrades.

I also found in gameplay\items\spells\yrdenEntity.ws a function called GetSignStats():

C++:
    protected function GetSignStats()
    {
        var chargesAtt, trapDurationAtt : SAbilityAttributeValue;
   
        super.GetSignStats();
       
        chargesAtt = owner.GetSkillAttributeValue(skillEnum, 'charge_count', false, true);
        trapDurationAtt = owner.GetSkillAttributeValue(skillEnum, 'trap_duration', false, true);
        baseModeRange = CalculateAttributeValue( owner.GetSkillAttributeValue(skillEnum, 'range', false, true) );
       
        trapDurationAtt += owner.GetActor().GetTotalSignSpellPower(skillEnum);
        trapDurationAtt.valueMultiplicative -= 1;  
       
        charges = (int)CalculateAttributeValue(chargesAtt);
        trapDuration = CalculateAttributeValue(trapDurationAtt);
    }

It seems that the variable baseModeRange is of interest to me, and that owner.GetActor().GetTotalSignSpellPower(skillEnum); queries for the current spell power, so I could add:
C++:
    protected function GetSignStats()
    {
      var rangeBonus float;
      rangeBonus = owner.GetActor().GetTotalSignSpellPower(skillEnum)
      baseModeRange += rangeBonus
    }

However, I'm not sure in what units sign intensity and range are measured. Also, It seems that baseModeRange is afloat but I'm not sure what type the intensity is. For example here:
Code:
trapDurationAtt += owner.GetActor().GetTotalSignSpellPower(skillEnum);
trapDurationAtt is SAbilityAttributeValue

I'd really like some help figuring this out, thanks.
 
your overthinking this, I believe.

this is the location where the range is set (it gets the constant value from the xml in fact)
Code:
baseModeRange = CalculateAttributeValue( owner.GetSkillAttributeValue(skillEnum, 'range', false, true) );

BaseModeRange is a float, so really all you need to to is to multiply that base value (look it up in the xml) with a factor dependent on the sign power. You already found how to get the sign power stat, the rest is a bit convoluted but easy.
As you already said, "GetTotalSignSpellPower" returns a "SAbilityAttributeValue", which is defined like so: (types.ws)

Code:
import struct SAbilityAttributeValue
{
    import saved var valueAdditive : float;
    import saved var valueMultiplicative : float;
    import saved var valueBase : float;
}

The game often uses these structs and does math with those 3 properties, for example to get a float out of it this is used:
Code:
function CalculateAttributeValue(att : SAbilityAttributeValue, optional disallowNegativeMult : bool) : float
{

    if(disallowNegativeMult && att.valueMultiplicative < 0)
        att.valueMultiplicative = 0.001;
    
    return att.valueBase * att.valueMultiplicative + att.valueAdditive;
}

You see, it simply takes the base value as, well, base and adds the additive (times the multiplicative) value.

so in the end, your code could look like this: (in yrdenEntity.ws: GetSignStats() function )
Code:
var yrdenSignPower : float;
var customMultiplier : float;

...

baseModeRange = CalculateAttributeValue( owner.GetSkillAttributeValue(skillEnum, 'range', false, true) );
yrdenSignPower = CalculateAttributeValue(owner.GetActor().GetTotalSignSpellPower(skillEnum));

//COMMENT: change below to your liking and preferred math
customMultiplier = 1;
baseModeRange = baseModeRange * customMultiplier * yrdenSignPower;

how you calculate the scaling of your range is up to you (exponential, linear etc. ) Make sure you know what values yrdenSignPower can get too - I'm not sure off the top of my head. One easy method to display values in game is through a custom exec function (you can put them anywhere in global scope): for example:

Code:
exec function DisplayYrdenSignPower()
{
var yrdenSignPower : float;
var skillEnum : ESkill;

skillEnum = S_Magic_3;
yrdenSignPower = CalculateAttributeValue(GetWitcherPlayer().GetTotalSignSpellPower(skillEnum));
theGame.GetGuiManager().ShowNotification("yrdenSignPower: " + yrdenSignPower);
}

This function displays your sign power as a pop up in-game when you type in "DisplayYrdenSignPower" in the debug console.
Hope that helps :D
 
Last edited:
Top Bottom