how to regenerate(ability regenerate) by percentage with respect to hitpoints?
Moderator: Forum Moderators
how to regenerate(ability regenerate) by percentage with respect to hitpoints?
hi comunity!!
i'am noob and sorry my english is bad haha... this is my code,
clarification: percentage of current hitpoints, not total of the unit
thanks
i'am noob and sorry my english is bad haha... this is my code,
Code: Select all
#define ABILITY_REGENERACION_MENOR
[regenerate]
value=5%
id=regeneracion menor
name= _ "regeneracion menor"
description=_"
La unidad se regenera 5% del HP por turno."
affect_self=yes
poison=slowed
[/regenerate]
#enddef
thanks
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
you have to use formula that is enables by putting backets around the value, like for exampleultimatux wrote: ↑July 21st, 2018, 7:43 pm hi comunity!!
i'am noob and sorry my english is bad haha... this is my code,
clarification: percentage of current hitpoints, not total of the unitCode: Select all
#define ABILITY_REGENERACION_MENOR [regenerate] value=5% id=regeneracion menor name= _ "regeneracion menor" description=_" La unidad se regenera 5% del HP por turno." affect_self=yes poison=slowed [/regenerate] #enddef
thanks
Code: Select all
#define ABILITY_REGENERACION_MENOR
[regenerate]
value="(hitpoints * 0.05)"
id=regeneracion_menor
name= _ "regeneracion menor"
description=_"
La unidad se regenera 5% del HP por turno."
affect_self=yes
poison=slowed
[/regenerate]
#enddef
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
I'm sorry, the code does not work. I try without parenthesis and without quotes too, but nothing happens.
it only takes as value the first number, for example 10 * 0.5, in that case it only takes 10, in the case of (10 * 0.5) with parentheses, it does not take any value.
also does not take the word hitpoints as a variable.
I've been testing in many ways and nothing happens
it only takes as value the first number, for example 10 * 0.5, in that case it only takes 10, in the case of (10 * 0.5) with parentheses, it does not take any value.
also does not take the word hitpoints as a variable.
I've been testing in many ways and nothing happens
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
I'm sorry, the code does not work. I try without parenthesis and without quotes too, but nothing happens.
it only takes as value the first number, for example 10 * 0.5, in that case it only takes 10, in the case of (10 * 0.5) with parentheses, it does not take any value.
also does not take the word hitpoints as a variable.
I've been testing in many ways and nothing happens
it only takes as value the first number, for example 10 * 0.5, in that case it only takes 10, in the case of (10 * 0.5) with parentheses, it does not take any value.
also does not take the word hitpoints as a variable.
I've been testing in many ways and nothing happens
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
no the code is correct asis. There must be something else that you are doing wrong. Maybe your unit does not have enough hp left, if you unit has less than 20hp then 5% of that will be less than one so this code will not heal units with less than 20hp.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
lo cambie a 50% por las dudas .
value="(hitpoints * 0.5)" try this way and nothing happens
value="(10 * 0.5)" try this way and nothing happens too
value="10*0.5" it only takes the value of 10
value="hitpoints" try this way and nothing happens
note that the unit has enough hp. The code does not work
I have version 1.12.5
Code: Select all
#define ABILITY_REGENERACION_MENOR
[regenerate]
value="(hitpoints * 0.5)"
id=regeneracion menor
name= _ "regeneracion menor"
description=_"
La unidad se regenera 50% por turno."
affect_self=yes
poison=slowed
[/regenerate]
#enddef
value="(hitpoints * 0.5)" try this way and nothing happens
value="(10 * 0.5)" try this way and nothing happens too
value="10*0.5" it only takes the value of 10
value="hitpoints" try this way and nothing happens
note that the unit has enough hp. The code does not work
I have version 1.12.5
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
oh ok i was assuming you were using the current stable wesnoth version which is wesnoth 1.14, what i said before won't work on wesnoth 1.12
In wesnoth 1.12 you ahve to implement it manually with [event]s
In wesnoth 1.12 you ahve to implement it manually with [event]s
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
Is this code also good? for version 1.14
I will download it
I will download it
Code: Select all
#define ABILITY_REGENERACION_MENOR
[regenerate]
value="$( $ unit.hitpoints * 0.5)"
id=regeneracion menor
name= _ "regeneracion menor"
description=_"
La unidad se regenera 50% por turno."
affect_self=yes
poison=slowed
[/regenerate]
#enddef
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
No that code won't work in 1.14, At least it won't behve the same way beause the usualy '$' substitution is not used when calculating abilitites.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
There's a 1.12-compatible event-based regen in SXC https://github.com/TeamSurvivalXtreme/S ... s.cfg#L236 (note that it needs everything down to line 312, and the in SXC the units often have 700 hp so if it accidentally regens 8 extra hp then we wouldn't notice).
However, if 1.14 now supports percentage-based regen then all of that code can be cleaned up, thanks gfgtdf.
However, if 1.14 now supports percentage-based regen then all of that code can be cleaned up, thanks gfgtdf.
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
The space between
$ unit.hitpoints
would also cause issues, I assume?99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
You dont have wml variables access in that context, so using $ in the first place would be useless.
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
thank you all, download and install version 1.14.3
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
I do not know if it is okay to ask another question in the same thread, I already try the code in version 1.14 and it works, but since you work with a percentage I want that when you reach a certain amount of hp the percentage value changes to a fixed value.
for example
normally 50% is regenerated per shift
but if the unit reaches 20 hp that only regenerates 3hp per turn.
it happens that logically I would use conditions with "if" but I would not know how to write in the wml code ..
I hope you understand by my English
for example
normally 50% is regenerated per shift
but if the unit reaches 20 hp that only regenerates 3hp per turn.
it happens that logically I would use conditions with "if" but I would not know how to write in the wml code ..
I hope you understand by my English
Re: how to regenerate(ability regenerate) by percentage with respect to hitpoints?
You have formula expression there https://wiki.wesnoth.org/Wesnoth_Formula_Language#if