iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Recovering a certain percentage of HP per party member.
Clyve
post Dec 31 2011, 08:31 PM
Post #1



Group Icon






I'm stuck (possibly because I'm a complete noob when it comes to scripting), so I'll ask for help now.

Basically, what I want to do is have the game call a script that recovers the entire party's HP based on a percentage of their max HP, but not over. For example, if the player sleeps in a shitty bed, I would like it to where the party recovers 25% of each of their max, so if party member one has 100 HP, they can recover up to 25 HP, but not over. If they have 60, they'd have 15, etc.

Is this possible?


--------------------


A game focused more on gameplay than story, interjecting intelligent (and sometimes not quite so) humor. Suggestions welcome and appreciated!
Go to the top of the page
 
+Quote Post
   
Zetu
post Jan 1 2012, 03:01 PM
Post #2


Has broken out of Staby Rehab!
Group Icon


Type: Undisclosed
Alignment: Chaotic Evil




CODE
for member in $game_party.members
  member.hp += 0.25*member.hp
end


--------------------
My Scripts:

Best. Error. Evah!!!
Spoiler:


Team JIFZ: Jet, Ice, Fenix, Zetu

A stabbing Gesture is a friendly Gesture
Go to the top of the page
 
+Quote Post
   
Clyve
post Jan 2 2012, 07:58 PM
Post #3



Group Icon






QUOTE (Zetu @ Jan 1 2012, 08:01 AM) *
CODE
for member in $game_party.members
  member.hp += 0.25*member.hp
end



I tried this and it doesn't work. It lets players recover past 25%, it only recovers 25% of their current HP (as opposed to 25% of their max), and it allows decimals.

This post has been edited by Clyve: Jan 2 2012, 08:14 PM


--------------------


A game focused more on gameplay than story, interjecting intelligent (and sometimes not quite so) humor. Suggestions welcome and appreciated!
Go to the top of the page
 
+Quote Post
   
new
post Jan 2 2012, 10:39 PM
Post #4



Group Icon


Type: Designer
Alignment: Chaotic Evil




try this.. i think this will add HP equal to 25% of the party leaders max hp to each member in the party.
CODE
a = $game_party.members[0].maxhp/4
for member in $game_party.members
member.hp += a
end
Sound.play_recovery


this will make each party member recover 25% of their max hp
CODE
for member in $game_party.members
member.hp += member.maxp/4
end
Sound.play_recovery


This post has been edited by new: Jan 2 2012, 10:47 PM


--------------------
download here
(Ask before using a bar from someone's sig -Touchfuzzy)
Go to the top of the page
 
+Quote Post
   
XIV
post Feb 15 2012, 05:22 PM
Post #5


Oh! What's that in apples?
Group Icon


Type: Designer
Alignment: Lawful Neutral




CODE
for member in $game_party.members
member.hp += (member.maxhp*
($game_variables[1]/100.0)).to_i
end


Set the variable ID 1 to the percentage of max. hp you want to heal and then paste this script in the event "Script.." command. This should do exactly what you want.

This post has been edited by XIV: Feb 15 2012, 05:31 PM


--------------------

I Support:

Check out my scripts:
Spoiler:

Ultimate Timer v3.1 - the best timer rewrite script there is
Timed Choices v1.6 - when your choices require a little excitement
Speedy Gonzales v1.1 - make agility influence move speed
Simple Reputation System v1.0 - R.E.S.P.E.C.T.
BEM - More Skill Costs Patch v1.1 - a treat for anyone using BEM
Go to the top of the page
 
+Quote Post
   
Geokido
post Apr 2 2012, 03:32 PM
Post #6



Group Icon


Type: Designer




I think the solution he was looking for was that certain "beds" are not able to heal your party past 25% of their max health for example.
The solution semantics-wise could be implemented as follows:

1. For each individual actor check if their current HP doesn't exceed 25% of their MaxHP value.
2. If it doesn't exceed it then perform some sort of healing to their HP.
3. Check if their current health after healing doesn't exceed 25% of their MaxHP value.
4. If it does then set their current HP to 25% of their MaxHP value.

This way no matter how many times the player uses the "broken bed" their actors won't heal past 25%

NOTE: If you want the bed to heal exactly 25% health if actors are below 25% then scrap steps 2. 3. 4. and just set their healths to 25%, but remember to have the first step so the "broken bed" doesn't damage your actors who are above 25% health.

At this time the author won't probably read this but just putting it out there in case anyone else wants to do something similar.
Go to the top of the page
 
+Quote Post
   
Zetu
post Apr 3 2012, 01:21 AM
Post #7


Has broken out of Staby Rehab!
Group Icon


Type: Undisclosed
Alignment: Chaotic Evil




Oh... I see...

CODE
for member in $game_party.members
  member.hp = 0.25*member.maxhp
end


And if you don't want HP to decrease if higher...

CODE
for member in $game_party.members
  member.hp = [0.25*member.maxhp, member.hp].max
end


--------------------
My Scripts:

Best. Error. Evah!!!
Spoiler:


Team JIFZ: Jet, Ice, Fenix, Zetu

A stabbing Gesture is a friendly Gesture
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 1st September 2014 - 10:29 AM

RPGMakerVX.net is an Privacy Policy, Legal.