Teach Me How to Fish

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Chimera245
Cave Troll
Posts: 29
Joined: Thu Oct 09, 2014 6:39 pm

Re: Teach Me How to Fish

Post by Chimera245 »

Nevermind about Bar Visibility, I overlooked it the first time I read the wiki page...found it now.

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Teach Me How to Fish

Post by Irrlicht »

Putting it your way, I handle it like this (I'm not adding code about bars, since you said you got it):

MaxHP:20 (or whatever number, of course)
HP:{MaxHP} (it's the current HP, and defaults to the same as the maximum HP)
NLdamage:0

You can also show these in the quick statsheet on the same line adding a token property like this:
*HP:{HP} / {MaxHP} - ({NLdamage + " NL dmg"})

Damage:

Code: Select all

<!-- DMG is still the variable asked for by prompt/input -->
[h: HP = min(MaxHP, HP - DMG)]
 
Non Lethal:

Code: Select all

<!-- As above, but for for NLdmg -->
[h: NLdamage = max(0, NLdamage + NLdmg)]
<!-- For the following, you have to create the "Staggered" and "Unconscious" states in Campaign Properties -->
[h, if(NLdamage >= HP): setState("Staggered", 1); setState("Staggered", 0)]
[h, if(NLdamage > HP): setState("Unconscious", 1); setState("Unconscious", 0)]
 
Healing:

Code: Select all

<!-- As above, but for Cure -->
[h: HP = max(MaxHP, HP + Cure)]
[h: NLdamage = max(0, NLdamage - Cure)]
 
Last edited by Irrlicht on Wed Oct 15, 2014 12:02 pm, edited 1 time in total.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

Chimera245
Cave Troll
Posts: 29
Joined: Thu Oct 09, 2014 6:39 pm

Re: Teach Me How to Fish

Post by Chimera245 »

Ok, I fiddled around with "if", but for some reason it's not working...

[h:Heal=Healing]
[h:Damage=Damage-Heal]
[h:if(Damage<0,Damage=0, )]
[h:NLdamage=NLdamage-Heal]
[h:if(NLdamage<0,NLdamage=0, )]
[h:bar.HealthBar=HP/MaxHP]

Not only is it not capping my Current HP, it's ignoring everything after the first if line. No healing to Nonlethal damage, and no change in Health bar...What am I doing wrong with the if statement?

Chimera245
Cave Troll
Posts: 29
Joined: Thu Oct 09, 2014 6:39 pm

Re: Teach Me How to Fish

Post by Chimera245 »

Ninja'd!

I think I get what you're saying, but this "min" and "max" thing isn't a command I've read about yet. Also, is it supposed to be "[h," instead of "[h:" in those lines of code?

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Teach Me How to Fish

Post by Irrlicht »

Chimera245 wrote: I think I get what you're saying, but this "min" and "max" thing isn't a command I've read about yet. Also, is it supposed to be "[h," instead of "[h:" in those lines of code?
min() and max() are easy, they just get respectively the lowest or highest of the values you feed them. For example, using max(5, -5) you get 5, which is the highest of the two.
This way, if you set that [HP = min(MaxHP, HP + cure)], as long as HP is below HPmax, you'll get it at its proper value, and if it goes above HPmax, it will be dragged down to being the same as HPmax and won't go higher.

For the other part you ask:
Chimera245 wrote:Ok, I fiddled around with "if", but for some reason it's not working...

[h:Heal=Healing]
[h:Damage=Damage-Heal]
[h:if(Damage<0,Damage=0, )]
[h:NLdamage=NLdamage-Heal]
[h:if(NLdamage<0,NLdamage=0, )]
[h:bar.HealthBar=HP/MaxHP]

Not only is it not capping my Current HP, it's ignoring everything after the first if line. No healing to Nonlethal damage, and no change in Health bar...What am I doing wrong with the if statement?
There are two kind of IFs, one is the roll option, the other is the function. Up here you used the function, but with the function you can't define new variables (also, you didn't define the "else" case in them, I don't know if that can be done for the function).
Change those IFs to the roll option variant:
[h, if(Damage < 0): Damage = 0]

EDIT
Also, I didn't mention it in the other post, but you can add Dying and Dead states to use in the damage macro in the same way as Staggered and Unconscious for the NL Dmg one.
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

Chimera245
Cave Troll
Posts: 29
Joined: Thu Oct 09, 2014 6:39 pm

Re: Teach Me How to Fish

Post by Chimera245 »

That did it! Thank you!

Post Reply

Return to “Macros”