Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
SilverCrow

[RMXP] "Variables" Question

Question

Hi ^.^

 

I have a Question about Variables.

 

Is possible to put "Variables" Values in a Menu (via Scripts) or message?

 

I need it because i want to make Variables that count the uses of different "Skill" and want to put the count in the skill page.

 

I need it to a "Variables" engine to learn skill.

 

 

Mmm i think that is all, Thankz for Reading

 

SilverCRØW~

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0

You can do that easily. Every time the skill is used, add to the variable. You're going to probably have to set this up in the Common Events tab. In a message, type in \v[x], where "x" is the variable number in the database.

Share this post


Link to post
Share on other sites
  • 0

I might be new to variables and this "RPGing" systems, but from my schoolin' days, you'd need to make this a common event (as Rgangsta said) and have it called.

Although...I didn't know how to type it in a message, so that part was new to me lol.

Share this post


Link to post
Share on other sites
  • 0

Thankz for the answers.

 

I Know about the Common Event Thingy, but what i want to know is if i can put that variable in a menu.

 

like to...

 

imagine u go to yours skill and in a corner appears a counter of how many time it has been used, maybe this can be a sort of scripting but i want to know if this is posible

Share this post


Link to post
Share on other sites
  • 0

You'll most likely need a script for that or you can edit it in the system itself. How? IDK... <_< I'm not a scripter lol

Share this post


Link to post
Share on other sites
  • 0

Hi ^.^

 

I have a Question about Variables.

 

Is possible to put "Variables" Values in a Menu (via Scripts) or message?

 

I need it because i want to make Variables that count the uses of different "Skill" and want to put the count in the skill page.

 

I need it to a "Variables" engine to learn skill.

 

 

Mmm i think that is all, Thankz for Reading

 

SilverCRØW~

 

Yes, you can use a variable in the menu. If you want to add text to a particular value of the variable, it looks like this:

 

if $ game_variables [iD variable] (<=, ==, =>) value of variable

self.contents.draw_text (layout of text and the text)

end

 

If it shows a different text for different values of the variable, it looks like this:

if $ game_variables [iD variable] (<=, ==, =>) value of variable

self.contents.draw_text (location of the text and the text itself)

elsif $ game_variables [iD variable] (<= == =>) value of variable

self.contents.draw_text (layout of text and the text)

end

Share this post


Link to post
Share on other sites
  • 0

Thankz man, but i think that that cant help me >_<, but I think that i could use it in another part.

 

The reason i wanted it is because i wanted to have an "Used Skill Counter" just like in the "Tales of Namco Games", because by using the skills those activate common events and increase a specific "Variable" and when a sertain Variable reach a determined times used the character would learn other skill by common events.

 

mmm thankz for the help guys, but i think that is better to dont try to show those values :/

 

Thankz guys :D

Share this post


Link to post
Share on other sites
  • 0

So is this resolved? Do you still want to put the "Skill used x times" thing in the skill window?

Share this post


Link to post
Share on other sites
  • 0

To make it show, all you have to do is type out the message. Unless that's not exactly what you were looking for :)

Share this post


Link to post
Share on other sites
  • 0

oops, I thought i had it, but my script only worked if all skills went into a single AP pool. I'm going to look into making a seperate menu screen to track number of times a a skill has been used

Edited by Knifewalker

Share this post


Link to post
Share on other sites
  • 0

I have a script that adds the ability to use control characters (\v[n], \N[n], \C[n]) in your Item, Class, Skill, etc... names & descriptions.

Just like you can in "Show Text" messages

 

So if your skill description was "Heal the entire party. Used: \V[100]"

It would insert the value of game variable 100

 

However, you couldn't keep track by individual actor. It will always show variable 100.

If your skills are specific to a single actor, this would work.

Share this post


Link to post
Share on other sites
  • 0

I have a script that adds the ability to use control characters (\v[n], \N[n], \C[n]) in your Item, Class, Skill, etc... names & descriptions.

Just like you can in "Show Text" messages

 

So if your skill description was "Heal the entire party. Used: \V[100]"

It would insert the value of game variable 100

 

However, you couldn't keep track by individual actor. It will always show variable 100.

If your skills are specific to a single actor, this would work.

I could really use that script. would you mind posting it or a link to it? it would be much appreciated.

Share this post


Link to post
Share on other sites
  • 0

This is great, I looked all over for this but for some reason I couldn't find it. Thanks alot. :biggrin_002:

Share this post


Link to post
Share on other sites
  • 0

If anyone wants to know how to do this in code, I messed around a bit

(NOTE: this will only work with default battle + menu systems)

(I dunno if this is the most efficient way, but it was the easiest way that I could tell :/)

(I am sorry if I miss something, if it doesn't work, please let me know I might have missed a line somewhere)

 

STEP 1:

Insert a new script right below Window_Help, and name it Window_SkillHelp

(Where you place it isn't so important, as long as it is below window_base)

This code simply displays the Skill description + "Used: X" on a new line

#=============================================================================
# ** Window_SkillHelp
#-----------------------------------------------------------------------------
#  Similar to Window_Help, resized to fit # of times a skill has been used
#=============================================================================
class Window_SkillHelp < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 640, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
 end
 #--------------------------------------------------------------------------
 # * Set Text
 #  text  : text string displayed in window
 #  align : alignment (0..flush left, 1..center, 2..flush right)
 #--------------------------------------------------------------------------
 def set_text(text, usage, align = 0)
   # If at least one part of text and alignment differ from last time or usage
   if text != @text || usage != usage || align != @align
     # Redraw text
     self.contents.clear
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
     self.contents.draw_text(4, 32, self.width - 40, 32, usage, align)
     @text = text
     @usage = usage
     @align = align
     @actor = nil
   end
   self.visible = true
 end
end

 

STEP 2:

Go to Game_Actor, go to line 494

@skills.push(skill_id)

and replace with:

@skills.push([skill_id, 0]) # Adds skill as an array, storing usage and ID

so now @skills becomes a 2-dimensional array ex. @skills[0][0] = skill_id; @skills[0][1] = times_used

 

STEP 3:

Also in Game_Actor, go to line 510

return @skills.include?(skill_id)

and replace with:

usable = false
@skills.each_index{|i| usable = true if @skills[i].include?(skill_id)}
return usable

unfortunately since ruby doesn't *technically* support multi-dimensional arrays, the array.include? doesn't work very well with 2-d arrays unless you know the index you are searching at, so instead this line of code with manually search each index to see if the skill exists. Probably a little bit slower, but probably not noticeably...

 

STEP 4:

Go to Window_Skill, go to line 13

super(0, 128, 640, 352)

replace with(just resizes skill window and repositions it to fit extra line for usage):

super(0, 160, 640, 320)

Now go to line 42

skill = $data_skills[@actor.skills[i]]

and replace with(just adjusted to grab the specific ID rather than the array):

skill = $data_skills[@actor.skills[i][0]]

Now go to line 81

@help_window.set_text(self.skill == nil ? "" : self.skill.description)

and replace with(this adds the "Used: X" line to help window)

if self.skill == nil
 @help_window.set_text("", "") 
else
 # You can modify the "Used: " part to fit your liking
 used = "Used: " + @actor.skills[self.index][1].to_s
 @help_window.set_text(self.skill.description, used)
end

 

STEP 5:

Go to Window_SkillStatus line 13 replace

super(0, 64, 640, 64)

with

super(0, 96, 640, 64)

 

STEP 6: (ALMOST there, this is the fun stuff, i guess)

In Scene_Skill Replace Line 22

@help_window = Window_Help.new

with

@help_window = Window_SkillHelp.new

 

add this line

@index = @skill_window.index

underneath line 89 or so

 

add this line

# Add to number of times skill used
@actor.skills[@index][1] += 1

underneath line 122 AND underneath line 204 or so

 

STEP 7: (LAST bitsss)

go to Scene_Battle 1

add this

@help_skill_window = Window_SkillHelp.new
@help_skill_window.back_opacity = 160
@help_skill_window.visible = false

underneath line 39 or so

then add

@help_skill_window.dispose

underneath line 78 or so

 

now go to Scene_Battle 3 (LAST PART I PROMISE)

 

replace "def update_phase3" (the entire method, from def to end) with:

def update_phase3
 # switch between Skill help window/reg help window
 if @skill_window == nil
   @help_window.visible = true unless @actor_command_window.active
   @help_skill_window.visible = false
 end
 # If enemy arrow is enabled
 if @enemy_arrow != nil
   update_phase3_enemy_select
 # If actor arrow is enabled
 elsif @actor_arrow != nil
   update_phase3_actor_select
 # If skill window is enabled
 elsif @skill_window != nil
   @help_skill_window.visible = true
   @help_window.visible = false
   update_phase3_skill_select
 # If item window is enabled
 elsif @item_window != nil
   update_phase3_item_select
 # If actor command window is enabled
 elsif @actor_command_window.active
   update_phase3_basic_command
 end
end

 

then go to "def start_skill_select" and replace the line that says:

# Associate help window
@skill_window.help_window = @help_window

with:

# Associate help window
@skill_window.help_window = @help_skill_window

 

and finally add this line DIRECTLY underneath "def end_skill_select" (which is the method right after "def start_skill_select"):

# Add to skill usage
$game_party.actors[@actor_index].skills[@skill_window.index][1] += 1

 

and that should display the number of times a skill was used by an individual in the party, for each skill.

I may have missed something, so if you have difficulties getting that to work, let me know.

OR if you are using custom scripts for the menu + battles, well I would need to know what scripts you are using in order to implement this, lemme know if that is the case I may be able to help.

 

ALSO if anyone knows of a better/more efficient way to do this lemme know, this is the best solution that I have found.

(and i am sorry if it is difficult to read)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...