[semi-solved]how to add element to a.gainHP(value)?

Janusz

Veteran
Veteran
Joined
Jul 4, 2015
Messages
26
Reaction score
4
Primarily Uses
I'm trying create "Burn" state which says:

"Increase Fire elemental damage(x3), at the end of each turn infected battler recive damage depends of its weakness on fire."
How can i get it, how add element Id to target value damage or damage formula?


Or simply how to make "target.gainHp(-value);" fire damage?


I have for now:


<Custom Regenerate Effect>
//this.item().damage.elementId = 2;

//if (user.elementRate(2) > 0 && !user.isDead()) {
// need add elemental ID to damage formula
// value = user.atk * user.elementRate(2);
user.gainHp(-user.atk * user.elementRate(2));

//}
</Custom Regenerate Effect>


(using Yanfly Buffs&States along with Yanfly Elemental Script.)


But it didn't work. Always recive same number even if i put various Traits(Element Rate: Fire*x) and/or notetags from Yanfly Elemental Script.


Edit:  Same damage values was caused by another state with notetag:


<Force Element Fire Rate: 300%>


Looks like my problem with damage formula is solved, but if anyone knows other ways to making it elemental damage please write it, because it may be useful in the future.


Sorry for bad english, and thanks.
 
Last edited by a moderator:

Quickdraws

Veteran
Veteran
Joined
May 31, 2013
Messages
55
Reaction score
8
First Language
English
Primarily Uses
Try this first as per your description you need 3x damage if fire based. so you need a react effect tag. Basically it checks if the skill uses the element id you assigned an if so multiply by 3.


Next the damage tick with the regenerate tag. Now this block cannot access the enemy stats as far as I know. You have user.atk for the damage so that mean your using the afflicted characters own attack as the base damage. I kinda don't care for that so ill offer an alternative but you can use whatever you like.


I use 1% of the targets total hp as a base then add an additionally value based on the afflicted chars level. Next multiply the flat value by fire resist, then multiply by -1 to make it negative for the gainHP effect. Lastly, round the number to flat value and a burn state is finished.


<Custom React Effect>


if (this.item().damage.elementId == 2) {


value = Math.floor(value * 3);


}


<Custom React Effect>


<Custom Regenerate Effect>


var value = user.mhp * 0.01 + user.level * 1.75; 


value = Math.floor(user.element.Rate(2) * value * -1);


user.gainHp(value);


</Custom Regenerate Effect>


Hope this helps.


**Note** Remove user.level * 1.75 in the regen effect if not using enemy levels by YF or it may not work or crash.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Learning Action Sequences!
ANY FEEDBACK APPRECIATED!

Online Platformer TEST DEMO 0.1 - 4 simple Maps. Just jumping test. (I still have 2 minor problems to fix).
So ms store had an idea to nuke the the entire app when the file integrity is slightly broken.
Im on another months long scripting high. I wonder if I can go SSJS3?

Version Fille in english is now complete!
Download the game on itch.io:
Talk about it here: https://forums.rpgmakerweb.com/index.php?threads/120802/

Enjoy and share!

Forum statistics

Threads
98,037
Messages
948,736
Members
129,293
Latest member
ZeroR
Top