Hero Lab 4e

Herolab D&D 4e Development => Herolab 4e Development => Script Repository => Topic started by: Fox Lee on March 23, 2013, 01:13:38 AM

Title: Script to replace key attribute for certain powers
Post by: Fox Lee on March 23, 2013, 01:13:38 AM
Priority: 4000
Phase: Final
(I don't understand timing very well, so the above may not be optimal - however, they do work in my HL).

Somewhat borrowed from Cryptoknight's script to assign highest attribute, but I needed something that would work on powers that already had an attribute, such as might ne modified by a feat or build option.

Example is for a homebrew feat that allows a certain race to convert strength-based Warlord powers into Wisdom-based instead.


foreach pick in hero from Attack where "PowerClass.clsWarlord"
    if (eachpick.tagis[Attack.attrStr] <> 0) then
      perform eachpick.deletestr["DamageAttr.attrStr"]
      perform eachpick.deletestr["Attack.attrStr"]
      perform eachpick.assignstr["DamageAttr.attrWis"]
      perform eachpick.assignstr["Attack.attrWis"]
      endif
   nexteach


Better scripters might know of a "replace" action that could tidy up the delete/assign pattern, but this is still functional.

Obviously you can check for other situations by replacing "PowerClass.clsWarlord" and "Attack.attrStr" with your desired conditions, and changing the deleted/assigned attributes appropriately. Official (and less ablative) in-game uses would be for things like Skald's Deceptive Duelist feature, Half-Elf's Adept Dilettante feat, which I am working on adapting it to now.