[RMMV] Potion/Elixir effect help

bonanzaa

Just swinging by
Member
Joined
Jul 1, 2020
Messages
11
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
374
Reaction score
145
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
11
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
11
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
374
Reaction score
145
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
11
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,355
Reaction score
1,512
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
11
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,355
Reaction score
1,512
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
11
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,355
Reaction score
1,512
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 Profile Posts

When you're lost out therrrrre and you're alllll alone, ahwahwah waitin, to carry you hooooommmme, uhhheverywhere you look! (someone hit me with those backing vocals)
X.X cant focus... too many thing want do... help!
Day 2 of teaching MV, student can move cat across the map.
Got inspired and started writing a simple tower defence battle system last night :o
Good news! I have located an amazing 3D website called SketchFab that has rotatable renderings of famous statues!

Forum statistics

Threads
100,524
Messages
976,782
Members
132,080
Latest member
nwr
Top