Inn System Help

Hi everyone!


I'm trying to get working an inn system which has two specific characteristics:


- Cost of the inn is determined by lost HP (ie 1 gold per 1HP to recover)


- Inn restores all HP/MP and states except for KO


Does anyone have any workarounds or suggestions on how to do this?
Well, there is the hard way...


I'd suggest a common event, since you can just call it anytime instead of copying every time you need it

  • Set a variable to 0,
  • through forks to check if they are in the party, add the maxhp of every actor to the variable, then subtract the current hp, giving you a sum of their lost hp
  • Give the message with the value of the variable as the cost
  • put a choice, and if the player agrees put a second to check if they have enough gold. If so, subtract the value from the variable from the player's gold
  • use the Add HP and Add MP commands to recover them, and Change States to remove states one by one.

As you can see, plenty of work... would be much easier if done by plugin, true. But then you'd need to have it written first. No idea if one already exists.
Would it be possible to share what you've made so far? 


Waterguy pretty much said what had to be done, you would have to work with variables.


But I would add 2 more things to it. x:

  • I would say that it would be best to make this into a Common Event, since you might have more than only 1 INN.
  • When checking for actors in the party, ignore these that have the KO state.





Let the common event run like this (not sure if you want to know it like this, just in case i put it in spoilers.)

Spoiler
conditional branch: If Actor 1 is in party then (This will check if Actor 1 is in the party!)


- conditional branch: Does Actor 1 have State KO? (This will check if Actor 1 is KO)


- - Yes?: (leave empty)  (If Actor 1 is KO, it will do nothing and cancel this conditional branch)


- - No?: (continue with bellow)  (If Actor 1 is not KO, it will continue with the things bellow)


- - control variables: "Variable 1: Actor's Current HP" set Game Data > Actor 1 > HP  (This will set variable 1 to the Actor's current HP)


- - control variables: "Variable 2: Actor's MAX HP" set Game Data > Actor 1 > MAX HP  (This will set variable 2 to the Actor's MAX HP)


- - conditional branch: "Variable 1: Actor's Current HP" == "Variable 2: Actor's MAX HP"  (This will check if both values are the same)


- - - Yes?: (leave empty)  (If they are, then nothing further will happen and the conditional branch will cancel)


- - - No?: control variables: "Variable 2: Actor's MAX HP" sub "Variable 1: Actor's Current HP" (This will calculate the difference from MAX HP to the current HP of the actor, by calculating Max HP - Current HP)


- - - control variables: "Variable 3: Total HP cost" add "Variable 2: Actor's MAX HP"  (This will add the difference from Current HP to Max HP to variable 3)


Do this again with every possible Actor that could be in your party, copy paste the entire thing and switch from Actor 1 to Actor 2, and then to Actor 3. :3 You can always use the same 2 beginning Variables (1 and 2) in this way.


After you're done with every actor, you will have the missing total HP value for every party member in the Variable 3: Total HP cost.


At least that's how I would do it by using only 3 variables in total. o:


The question after this is how you plan on continuing after choosing knowing the total HP missing from each character.


You could have the pay up to the Variable 3 in gold, healing every character that isn't knocked out...~
Thank you very much guys it works perfectly. I was confusing myself with how to get the cost of the whole party's HP when I initially tried to do it with common events and variables, but this works!

Original thread: https://forums.rpgmakerweb.com/threads/inn-system-help.68558/