Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> .note, Need general help with setting up a one for States, Like PoisonDMG =
Titanhex
post Feb 6 2012, 02:27 PM
Post #1


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




Alright I want to use the .note of a State so that I can read some values from it.

Particularly, I want it so if the string Slip DMG = is in the note it uses the value after Slip DMG =. This isn't mentioned in dah0rst's tutorial, so I came here to ask how I'd do it. How would I go about something like this?

I want it to be used in Game_Battler class, since that contains this:

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


I constructed this snippet from reference and for the most part understand it:


CODE
      $data_states[].note.each_line { |line|
      slip_amount = line.gsub('Slip DMG = ', '').chomp.to_i if line.include?('Slip DMG = ')
      }


Unfortunately I don't know how to get the number of the state causing the slip damage.


__________________________
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
Titanhex
post Feb 11 2012, 11:53 PM
Post #2


Guru of Water
Group Icon

Group: Revolutionary
Posts: 1,096
Type: None
RM Skill: Masterful
Rev Points: 5




Once again, ba-bump.


__________________________
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 12 2012, 03:28 AM
Post #3


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




QUOTE (Titanhex @ Feb 12 2012, 08:53 AM) *
Once again, ba-bump.


Try this (it was for RGSS, but I bet methods are quite the same)

CODE
def slip_damage_effect
if slip_damage? and @hp > 0
amount = 0
for state_id in self.states
if $data_states[state_id].slip_damage
#insert your snippet here...
#just one thing: damage should be stored into a variable named [i]slip_amount[/i]
#for example, I pasted your code just below this line, but if you've changed it just replace these lines...
  $data_states[state_id].note.each_line { |line|
      slip_amount = line.gsub('Slip DMG = ', '').chomp.to_i if line.include?('Slip DMG = ')
      }

#sum amounts
amount += slip_amount
end
end

#do damage
self.hp -= amount
end
end


This is a loop checking every status your hero / enemy has and check the notes only for slip_damage status.
Try and let me know...

Jens

This post has been edited by Jens of Zanicuud: Feb 12 2012, 03:38 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

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