[MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
Posted: Fri Mar 18, 2011 2:44 pm
I had a couple of requests for this, so here's how you implement it. First, replace subUpdateHPStatesBar under Utility (at the bottom) with the following code. I'm using the RPedit Notepad++ format, but you can just delete the first 2 lines and last line :
Now for the hard part, which isn't all that hard. Adding the new health bars. Follow these steps precisely.
||| subUpdateHPStatesBar |||
Code: Select all
@@ @subUpdateHPStatesBars
@PROPS@ fontColor=black;autoExecute=true;fontSize=1.00em;sortBy=31;color=pink;playerEditable=false;applyToSelected=true;group=Utility;tooltip=;minWidth=
<!-- Updates most states and health bars. Does not update StableHP. Does HP based updates to state Unconscious, can not update based on healing. -->
[H: gTok = "Lib:GlobalsSRDPF"]
[H: tToken = getStrProp(macro.args, "Token")]
[H: gTokenUncImgChange = getLibProperty("TokenUncImgChange", gTok)]
[H: switchToken(tToken)]
[H, IF(gTokenUncImgChange), CODE: {
[ tImageID = getTokenImage() ]
[ tImageHID = getTokenHandout() ]
[IF( tImageHID != tImageID ): Private = setStrProp(Private, "TokenImageAssetID", tImageID) ]
[ tIAID = getStrProp(Private, "TokenImageAssetID")]
}]
[H: deathpoint = eval( string( getLibProperty( "DeathPoint", gTok ) ) )]
[H: tType = json.get( Race, "type" )]
[H: tSubtype = json.get( Race, "subtype" )]
[H: variantRDP = table( "SysVars", json.get( table( "SysVars", 0 ), "variantRaceDeathPoint" ) ) ]
[H, FOREACH( dp, variantRDP ), CODE: {
[H: tDP = json.get( dp, "deathPoint" )]
[H: typeArray = json.get( dp, "typeArray" )]
[H: subtypeArray = json.get( dp, "subtypeArray" )]
[H, FOREACH( t, typeArray ): deathpoint = if( t == tType, tDP, deathpoint )]
[H, FOREACH( t, subtypeArray ): deathpoint = if( json.contains( tSubtype, t ), tDP, deathpoint )]
}]
[H: tDieHard = getStrProp(Feats, "DieHard")]
[H: tDieHard = if(tDieHard == "", 0, tDieHard)]
[H: disabledPoint = if( tDieHard, deathpoint, 0)]
[H: effectiveHP = HP + HPTemp]
[H: tMaxEffectiveHP = HPmax + HPtemp]
[H: state.Disabled = if((effectiveHP) == 0, 1, 0)]
[H: state.Staggered = if(HPNonLethalDMG == (effectiveHP) && HP > 0, 1, 0)]
[H: active = if( ((effectiveHP) >= HPNonLethalDMG) && ((effectiveHP) >= 0), 1, if( tDieHard, 1, 0) )]
[H: state.Unconscious = if( ( ( (effectiveHP) < 0 ) || ( HPNonLethalDMG > (effectiveHP) ) ) && !tDieHard, 1, state.Unconscious)]
[H: state.Prone = if( active && (state.Prone < 1), 0, 1)]
[H: state.Dying = if(((effectiveHP) > deathpoint) && ((effectiveHP) < 0), 1, 0)]
[H, IF( isNPC() && !tDieHard ): eval(if(state.Dying, 'setLayer("object")', '0'))]
[H: state.StableHP = if(((effectiveHP) >= 0), 0, state.StableHP)]
[H: state.Dead = if((effectiveHP) <= deathpoint, 1, 0)]
[H, IF(state.Dead), CODE: {
[H: if(isNPC(), setLayer("object"), '0')]
[H: state.Dying = 0]
[H: state.Unconscious = 0]
[H: state.Prone = 0]
[H: state.StableHP = 0]
}]
[H: eval(if(state.Dead, 'removeFromInitiative()', '0'))]
[H, IF( active ): setLayer("token")]
[H: setBarVisible("HP",0)]
[H: setBarVisible("HPM",0)]
[H: setBarVisible("HPNonLethalDMG",0)]
[H: setBarVisible("HPMNonLethalDMG",0)]
[H: setBarVisible("HP",0)]
[H: setBarVisible("HPM",0)]
[H, if( state.Dead ), code: {
[H: setBarVisible("HPdamage",0)]
[H: setBarVisible("EmptyHP",0)]
};{
[H, if( effectiveHP >= 0 ), code: {
[H: bar.HPdamage = (tMaxEffectiveHP - effectiveHP) / tMaxEffectiveHP]
[H: setBarVisible("EmptyHP",0)]
};{
[H: bar.HPdamage = max(0,(deathPoint - effectiveHP) / deathPoint) ]
[H: bar.EmptyHP = 1]
}]
}]
[H, if( effectiveHP < 0 || state.Dead), code: {
[H: setBarVisible("NLD_HP",0) ]
[H: setBarVisible("TempHP",0) ]
};{
[H: bar.TempHP = bar.HPdamage + (HPtemp / tMaxEffectiveHP) ]
[H: bar.NLD_HP = HPNonLethalDMG / tMaxEffectiveHP ]
}]
[H, IF(gTokenUncImgChange), CODE: {
[H: tImageID= if( ( state.Dead || state.Unconscious ), getTokenHandout(), tIAID ) ]
[H, IF(tImageID != ""): setTokenImage(tImageID)]
}]
!!
- Download and extract the Health Bar images: Fading Arc
- Open your campaign properties and go to the Bars tab.
- Set up the bars needed (Example)
- NLD_HP - Type "NLD_HP" under name.
- Set the type to Two Image
- Click Add (top half) and locate the extracted file Health100.png and click Open.
- Click Add, select NonLethal100.png and click Open
- Now click Add (bottom half) to add the bar to the list. You're not done yet, but clicking OK at bottom will save to Campaign Properties. You must do this after all the bars have been added or you'll have to do this again.
- TempHP - Type "TempHP" under name
- The next three bars are done the same way. All you need to do is enter a differnt bar name and file.
- Set the type to Single Image
- Click Add (top half) and locate the extracted file Temp100.png and click Open.
- Click Add (bottom half) to add the bar.
- Rinse and Repeat for "EmptyHP" (EmptyLife.png) and "HPdamage" (Damage100.png)
- Click OK to save work.
- NLD_HP - Type "NLD_HP" under name.
- You're done, congratulations. Click HPChange while selecting a token, click okay and you'll see the HP bar change (assuming your token is setup correctly with hitpoints).
- Non-detailed hp bar. Under each health bar, set the increment to the amount of detail you want to show for hp change. You can set Increment to 10, and the bar will only change every 10% of the total. Personally, I don't bother with this but other people may not want players eye-balling the effect of their damage in detail.
- Check Mouseover if you only want the bar to show when moused-over.
- Colors. You can download the original creation file at my Fading Arc thread and change border thickness, position, color or whatever.