RPTools.net

Discussion and Support

Skip to content

It is currently Mon Oct 16, 2017 11:13 pm 




Forum rules


Discussion regarding lmarkus001's framework only. Other posts deleted without notice! :)



Reply to topic  [ 9 posts ] 

Previous topic | Next topic 

  Print view


Fading Arc Health Meter
Like 92%  92%  [ 11 ]
Dislike 8%  8%  [ 1 ]
Total votes : 12
Author Message
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7882
Location: Bay Area
 Post subject: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Fri Mar 18, 2011 1: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 :

Code:
@@ @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)]
}]

!!


Now for the hard part, which isn't all that hard. Adding the new health bars. Follow these steps precisely.
  • 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.
  • 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).

Here are a couple of preference tweaks you can do.
  • 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.

Image

_________________
Downloads:


Last edited by aliasmask on Fri Mar 18, 2011 7:52 pm, edited 1 time in total.

Top
 Profile  
 
 Offline
Great Wyrm
 
Joined: Tue May 26, 2009 7:51 pm
Posts: 2060
Location: Philadelphia, PA
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Fri Mar 18, 2011 4:37 pm 
Thank you! Works perfectly. I just added it to my rehash of Lindsay's FW for Pathfinder Society games.


Top
 Profile  
 
 Offline
Kobold
 
Joined: Mon Jan 11, 2010 11:15 am
Posts: 16
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Fri Mar 18, 2011 10:22 pm 
Thanks!


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Fri Mar 28, 2008 11:30 pm
Posts: 1866
Location: Layfayette Hill, PA
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Thu Jun 30, 2011 10:43 am 
Added the graphics to my core framework. If I get time I will put in a campaign setup option that lets the GM choose this bar vs. original bar.

_________________
D&D3.5 / Pathfinder Framework


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 358
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Mon Nov 28, 2011 12:30 pm 
I've been using the macro for these bars and I noticed 2 features that are missing. I'm not sure if it was intentional or if you were not aware of this. I figured I'd mention it in case you wanted to know.

1. When at full health, the NLD_HP meter does not appear when the token takes Non-Lethal Damage but has not taken any Lethal Damage yet.

2. When Non-Lethal Damage exceeds current hitpoints, the state only changes to prone, but it should also show the unconscious state (assuming it was meant to work like the D&D 3.5 rules).


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7882
Location: Bay Area
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Mon Nov 28, 2011 2:46 pm 
Thanks for finding that. Here's the new code as it should be used in the framework:

Code:
@@ @subUpdateHPStatesBarsAliasmask
@PROPS@ fontColor=black ; autoExecute=true ; fontSize=11pt ; sortBy=16 ; color=pink ; playerEditable=false ; applyToSelected=false ; group=Utility ; tooltip= ; minWidth=200 ;
[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, if(state.StableHP): state.Dying = 0]

[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, if(effectiveHP - HPNonLethalDMG > 0), code: {
   [H: state.Dying = 0]
   [H: state.Unconscious = 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, 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(HP == HPmax && effectiveHP == HP && HPNonLethalDMG == 0), code: {
   [H: "<!-- Turn off all the bars when at max HP with no HP mods -->"]
   [H: setBarVisible("TempHP",0)]
   [H: setBarVisible("HPdamage",0)]
   [H: setBarVisible("NLD_HP",0)]
}; {}]

[H, IF(gTokenUncImgChange), CODE: {
    [H: tImageID= if( ( state.Dead || state.Unconscious ), getTokenHandout(), tIAID ) ]
    [H, IF(tImageID != ""): setTokenImage(tImageID)]
};{}]

!!

_________________
Downloads:


Top
 Profile  
 
 Offline
Giant
 
Joined: Thu Jun 20, 2013 4:04 pm
Posts: 149
Location: NW Indiana
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Sat Mar 01, 2014 11:23 pm 
Wow, that is a lot of code. I was going to try to implement something like this into my HARP game but there are so many variables relating to the game this is based on (4ed D&D?) I wouldn't know where to start.
Aliasmask, Is it possible I could get some help in this?
Actually, what I want to do is probably much more simple that this code. I don't need the non-lethal, and other types of damage, just damage, which fades as it does in your description above. I would also like to have the token states that automatically show up when one is unconscious, then dying, then dead.

Also based on my recent reply to you in my topic "How do I import new health bars..." I am looking to add at least two more bars, experience and power point use (magic points). But one thing at a time.

Bruce


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7882
Location: Bay Area
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Mon Mar 10, 2014 5:29 am 
I think once you understand how bars work, it should be easy. I'm stacking several bars to get my various colors, so that's part of the complication. Setting the value from 0 to 1 (0 to 100%) sets how much of the top is shown. The is true for all but the multi-image bar. That will divide up the number of images and show the closest the next highest one.

So, if you set a bar at 0.5. The bar moves halfway. For one tone, two tone and two image it goes from right to left/top to bottom. The single image goes from left to right/bottom to top as the number decreases. For multi image, the who image switches. You need at least 2 images and you have to set your increment to match the number of images. Bottom image in list is top image with highest percent and Top image is always 0. Any number of images in between are divided up. So, if you have 5 images (full bar, empty bar, increment 1, increment 2, increment 3) then your increments are at 0.25 (1.00,0.75,0.50,0.25,0 - 5 values).

To keep the example simple, lets just create a solid bar that is green and call it Health.

Code:
[H: maxHP = 100]
[H: currentHP = 50]
[H: bar.Health = currentHP / maxHP]

[H: unconscious = 0]
[H: dead = -10]

[H, if(currentHP <= dead): state.Dead = 1; state.Dead = 0]
[H, if(currentHP <= unconscious && ! state.Dead): state.Unconscious = 1; state.Unconscious = 0]

I put the Dead check before unconscious because I don't want people to know I'm sleeping when dead. So, it turns off the unconscious state when dead. To remove a bar use Wiki: setBarVisible() to 0.

You would need to create states for "Unconscious" and "Dead" that you want. Just a note about adding bars and states. Be sure to click the correct "Update" button and then "Okay" to make sure it's saved when done.

I also use single state names because I can then use them in variables like state.stateName, not state.state name (which would be wrong).

_________________
Downloads:


Top
 Profile  
 
 Offline
Giant
 
Joined: Thu Jun 20, 2013 4:04 pm
Posts: 149
Location: NW Indiana
 Post subject: Re: [MOD] Fading Arc HP Meter (MT1.3b82 Campaign Macros r01)
PostPosted: Mon Mar 10, 2014 11:18 pm 
I was able to figure out how to do the power point and experience bars. It all works pretty good so far. I have a few questions. I will post those in a new thread.


Bruce


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 9 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman