• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Mutagen ability adjustments

scibat

Well-known member
I apologize if I missed something while looking for an answer in the editor, but how are the ability bonuses from the various mutagen types calculated or stored in the editor? Looking at the abilities and the mutagen items, all I can find is several calls, but no place yet where the actual abilities are calculated.

I'm working on an alchemist archetype that has a new type of mutagen that alters some of the base mutagen bonuses for others. I believe I could find a somewhat brute force solution by copying the base mutagens and adding an additional modifier, but I was wondering if there was a better way to go about it.
 
Calling a procedure allows us to reuse common code but only store it and modify it in one place. Unfortunately, it also makes it hard for users to see what is being done. This is the contents of the MutAttr procedure:

Code:
    ~if we're not activated, just get out now
    doneif (field[abilActive].value = 0)

    var armorbonus as number
    var attrbonus as number
    var ragebonus as number
    var ragetotal as number

    if (tagis[Custom.ExpMutagen] <> 0) then
      armorbonus = 1
      attrbonus = 2
      ragebonus = 1
    else
      armorbonus = 2
      attrbonus = 4
      ragebonus = 2
      endif

    armorbonus += hero.tagcount[Hero.MutExArmor]

    ragetotal = attrbonus + ragebonus

    ~apply a +2 natural armor bonus
    hero.child[ArmorClass].field[tACNatural].value += armorbonus

    ~if the user hasn't selected an attribute, there's nothing more we can do
    doneif (field[usrChosen1].ischosen = 0)

    ~set our focus to the chosen attribute. This saves typing later
    perform field[usrChosen1].chosen.setfocus

    ~the chosen attribute gets a +4 alchemical bonus
    #applybonus[BonAlch, focus, attrbonus]

    ~now, we look up the attribute that was chosen, and get its Id
    ~we compare that Id to each of the three physical attributes in turn
    ~and once we figure out which one it is, apply a penalty to the ~corresponding mental attribute

    ~+STR, -INT
    if (focus.tagis[thingid.aSTR] <> 0) then
      ~Modification for Vest of Stable Mutation: If you're wearing the vest, you don't suffer penalties to mental attributes for mutagens.
      if (hero.tagis[Hero.NoMutPen] = 0) then
        #applypenalty[BonAlch, hero.child[aINT], -2]
        endif

      ~ If we have Sturdy Rage, then our natural armor bonus is 2 higher.
      if (hero.tagis[Custom.SturdyRage] <> 0) then
        hero.child[ArmorClass].field[tACNatural].value += ragebonus
        endif

      ~ If we have Rage Mutagen, then our strength bonus is 2 higher.
      if (hero.tagis[Custom.MutageRage] <> 0) then
        #applybonus[BonAlch, focus, ragetotal]
        endif

      ~ If we have Lumbering Rage, then we gain a +2 morale bonus to constitution.
      if (hero.tagis[Custom.LumberRage] <> 0) then
        #applybonus[BonMorale, hero.child[aCON], ragebonus]
        endif

    ~+DEX, -WIS
    elseif (focus.tagis[thingid.aDEX] <> 0) then
      ~Modification for Vest of Stable Mutation: If you're wearing the vest, you don't suffer penalties to mental attributes for mutagens.
      if (hero.tagis[Hero.NoMutPen] = 0) then
        #applypenalty[BonAlch, hero.child[aWIS], -2]
        endif

    ~+CON, -CHA
    elseif (focus.tagis[thingid.aCON] <> 0) then
      ~Modification for Vest of Stable Mutation: If you're wearing the vest, you don't suffer penalties to mental attributes for mutagens.
      if (hero.tagis[Hero.NoMutPen] = 0) then
        #applypenalty[BonAlch, hero.child[aCHA], -2]
        endif

    ~+INT, -STR
    elseif (focus.tagis[thingid.aINT] <> 0) then
      #applypenalty[BonAlch, hero.child[aSTR], -2]

    ~+WIS, -DEX
    elseif (focus.tagis[thingid.aWIS] <> 0) then
      #applypenalty[BonAlch, hero.child[aDEX], -2]

    ~+CHA, -CON
    elseif (focus.tagis[thingid.aCHA] <> 0) then
      #applypenalty[BonAlch, hero.child[aCON], -2]
      endif

Unfortunately, since it mostly uses variables it's not very accepting of outside scripts. What precisely did you want to do with it? I could probably switch it over to using field values (which you could get at to modify).
 
When this new mutagen type is used, it follows most of the normal mutagen effects, but reduces whatever the natural armor bonus is in half to allow certain other abilities. The other abilities aspect is easy to code using the doneif (hero.tagis[Custom.Mutate] = 0) statement/condition, so really the armor bonus is the rub.

I *could* code it as a long serious of if/then's to account for all the permutations, but that leaves it unable to adapt to new content or altered rules, so I'm trying to avoid that.
 
Ack. Halving would require me to split the procedure into two different procedures so your script can halve things after they are set but before they are used. I'll see what I can do.
 
So call me crazy but doesn't any variable defined both in the calling script and the procedure mean the value is passed back to the calling script? I mean I have custom procedures that pass values in/out.

I am 99% sure the above is true which means we can access the "bonus" that was applied to the AC. Then simply remove half of the value.
Code:
var armorbonus as number
call MutAttr

~ Remove half of the armor bonus given
hero.child[ArmorClass].field[tACNatural].value -= round(armorbonus/2,0,-1)

I am a little tired so maybe the above is all a delusion but I think that will work? :D
 
I'll give it a shot and tell you what happens!

EDIT: It does, indeed, seem to work just fine! Mission success! Thanks for the help!
 
Last edited:
Question, Aaron: Do Greater and Grand Mutagens use the same variables? Shadow's script worked fine for adjusting base mutagens, but now it is not working for Greater Mutagens, which would make me think the variables are named differently.
 
Wait ... I was being dumb. I forgot I set the Greater Mutagen to Dex before turning it on, so I forgot to count out the +2 DEX bonus to AC. My apologies!
 
Back
Top