Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Poison Damage Help, Simple Code Change, Just Seeking Guidance and Help
amerk
post Apr 2 2012, 09:23 PM
Post #1


Level 56
Group Icon

Group: Global Mod
Posts: 1,784
Type: None
RM Skill: Undisclosed
Rev Points: 15




This would seem like such a small thing, but I haven't had much luck in finding this out. Also, I'm sure there are scripts that can do what I'd like, but it would seem like a waste for such a small snippet of code if I don't plan to implement the other features of the script. Plus, adding in a snippet (or changing the default script within my own project, not the RTP) would get me more into understanding a bit how scripts work.

Okay, with that said, what I am trying to do is alter the amount of damage you receive with the poison state. Simple enough, I know, but completely lost on a guy who doesn't understand scripting.

What I want is for damage to take 1 HP off per step while on the field (outside of battle) for the actors who have the Poison State applied. In battle, I want 20% damage applied for each turn that an actor has the Poison State applied, which I think will create a bit more urgency for a player to apply a heal as opposed as to just waiting it out.

Now, I think I can solve the latter (in battle) issue. If I'm not mistaken I look for this snippet of code.


def slip_damage_effect
if slip_damage? and @hp > 0
@hp_damage = apply_variance(maxhp / 10, 10)
@hp_damage = @hp - 1 if @hp_damage >= @hp
self.hp -= @hp_damage
end
end
end


And change the 3rd line to

@hp_damage = apply_variance(maxhp / 20, 10)

However, outside of battle, I believe it takes 10 HP for each step that Poison State is applied, and I don't know where to change that so it's just 1 per step.

Also, backing up to my percentage change for in battle, I'm guessing the number 10 on the right side of the comma is the variance. I know (to some degree) how variance works, what I don't know is if that variance is in percentages (10% variance) or in HP (10 HP variance). If it's in percentages, I'll leave it alone, but if it's a variance of actual HP, I may want to boost that up as well to say around 50 HP.


__________________________
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
Night_Runner
post Apr 3 2012, 05:30 AM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




For the steps damage, refer to the line highlighted:
image stretches forums sad.gif

It should, by default, only subtract 1 hp for each step.
Do you have any other scripts in place, a battle system or anything?
Do a Ctrl Shift F search through the script editor for def on_player_walk and see if it gets redefined as actor.hp -= 10 somewhere else.


And for the slip damage during battle, the apply_variance method takes 2 inputs, the first is the standard amount of damage, and the second is the variance., so for the line:
CODE
@hp_damage = apply_variance(maxhp / 10, 10)

it deals max_hp/10 damage, and varies randomly by 10hp, which I believe you've figured out.
The only problem is you said max_hp/20 is 20% damage, but it's only 5% damage. To get 20% damage you need to use max_hp/5


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   

Posts in this topic


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: 21st May 2013 - 01:41 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker