[RMMV] Potion/Elixir effect help

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hello there.

Am trying to implement potion/elixir system in the game, which does exactly what it needs to - various potions grant various effects.
Though I've encountered a problem - let's say player can buy a very strong potion that grants them +1000 HP (a lot). Well now, player can just keep using it to (virtually) infinitely increase their MHP.

So is there a way (through states, I believe, but I haven't figured it out) to limit the number of a certain potion type effects that can be active at once.

Example: If player uses this "Potion of +1000HP" (which wears off in 10 turns), they can't get this buff again if they use another "Potion of +1000HP". So that they can't stack up HP infinitely. And so on for various effects, just so that 1 certain potion effect could be active at one time.

Would appreciate any help, thanks in advance.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
555
Reaction score
230
First Language
english
Primarily Uses
RMMV
how are you having this potion increase MaxHP by flat value? event? whats removing this flat increase?
why cant it be state with MHP % increase? same state doesn't stack on itself (normally) just overwrites.
 

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
how are you having this potion increase MaxHP by flat value? event? whats removing this flat increase?
why cant it be state with MHP % increase? same state doesn't stack on itself (normally) just overwrites.
1) Well, I'm yet to figure it out, how to make a potion increase MHP of the user. I don't know which way it is better, I'm currently looking through YEP Buff&States Core for some help in the notetags
2)Potion state gets removed after a certain amount of turns, as it is in the state removal conditions.
3) I really need this HP buff to be a certain number, rather then MHP% increase
 

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
1596365069360.png
This is a perfect example of the effect I am trying to achieve
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
555
Reaction score
230
First Language
english
Primarily Uses
RMMV
i think the custom apply and custom leave tags could do this but in clueless with those "code" scriptings.

(im using absorption barrier for a different temp MHP system)
 

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
i think the custom apply and custom leave tags could do this but in clueless with those "code" scriptings.

(im using absorption barrier for a different temp MHP system)
Thanks for the reply.
But I couldn't make "user.maxhp" work. I am not that familiar with JS. Any suggestions?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,960
First Language
English
Primarily Uses
RMMV
Code:
<Custom Apply Effect>
if (!user._flaskEffectActive) {
  user.addParam(0, 1000);
  user._flaskEffectActive = true;
}
</Custom Apply Effect>
<Custom Remove Effect>
  user.addParam(0, -1000);
  delete user._flaskEffectActive;
</Custom Remove Effect>
The good thing with this is you can use the same _flaskEffectActive flag in other flask items and only one will be able to be active at a time.
 

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
Code:
<Custom Apply Effect>
if (!user._flaskEffectActive) {
  user.addParam(0, 1000);
  user._flaskEffectActive = true;
}
</Custom Apply Effect>
<Custom Remove Effect>
  user.addParam(0, -1000);
  delete user._flaskEffectActive;
</Custom Remove Effect>
The good thing with this is you can use the same _flaskEffectActive flag in other flask items and only one will be able to be active at a time.
Wow, thank you so much! It works beautifully. Really great.

From what i could gather, if I add this:
Code:
var ACTORID = 1;
var rhp = 100;
var recoverhp = Math.round($gameActors.actor(ACTORID).mhp * rhp / 100);
$gameParty.leader().gainHp(recoverhp);
when the flask is being applied, then it will also heal the user to 100%HP, correct?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,960
First Language
English
Primarily Uses
RMMV
You could just do

Code:
var actor = $gameParty.leader();
actor.gainHp(actor.mhp);
 

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
16
Reaction score
0
First Language
English
Primarily Uses
RMMV
You could just do

Code:
var actor = $gameParty.leader();
actor.gainHp(actor.mhp);
Thank you very much.
One more question - is there a way to get the "var" value of other members in party, besides the leader?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,960
First Language
English
Primarily Uses
RMMV
$gameParty.members()[index] or $gameParty.aliveMembers()[index]
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,236
Members
137,608
Latest member
Arm9
Top