Announcement
Announcement
| 2nd Quarter Contest Announcement posted! See the Community Announcements section. |
![]() ![]() |
Dec 31 2011, 08:31 PM
Post
#1
|
|
![]() |
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? -------------------- |
|
|
|
Jan 1 2012, 03:01 PM
Post
#2
|
|
![]() Has broken out of Staby Rehab! ![]() Type: Undisclosed Alignment: Chaotic Evil |
CODE for member in $game_party.members
member.hp += 0.25*member.hp end -------------------- |
|
|
|
Jan 2 2012, 07:58 PM
Post
#3
|
|
![]() |
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 -------------------- |
|
|
|
Jan 2 2012, 10:39 PM
Post
#4
|
|
![]() ![]() 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 -------------------- |
|
|
|
Feb 15 2012, 05:22 PM
Post
#5
|
|
![]() Oh! What's that in apples? ![]() 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 -------------------- |
|
|
|
Apr 2 2012, 03:32 PM
Post
#6
|
|
![]() 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. |
|
|
|
Apr 3 2012, 01:21 AM
Post
#7
|
|
![]() Has broken out of Staby Rehab! ![]() 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 -------------------- |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 18th May 2013 - 08:55 AM |
|
|