Ruby/RGSSx questions that don't deserve their own thread

ekhartpl

Veteran
Veteran
Joined
Apr 18, 2015
Messages
71
Reaction score
36
First Language
Polish
Primarily Uses
RMVXA
How can I, via script, change the name of actor X to the same as actor Y?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
811
First Language
Hungarian
Primarily Uses
RMVXA
Code:
$game_actors[id].name = $game_actors[id].name
Replace the ids with the database IDs of the actors you want to modify.
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Is there way to make an event move off-screen, through the map's border?
Not just stop at the edge and disappear, but walk outside of it.
I know they can jump there, but I can't make them just walk off the map, even with Through ON.

Tried googling, it doesn't get what I want.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,402
Reaction score
499
First Language
English
Primarily Uses
RMVXA
If you mean to make an event walk farther than the tile size of the map, then no (pretty sure).
What I would advise is to make a larger map and have the edges empty space. Then you can move an event to those empty spaces, to simulate walking of the map before the event is removed.
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Is there an easy way to check what graphic an actor is currently using with a call?
Something like if $game_actor.graphic="$actor1.png"
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
If you mean to make an event walk farther than the tile size of the map, then no (pretty sure).
What I would advise is to make a larger map and have the edges empty space. Then you can move an event to those empty spaces, to simulate walking of the map before the event is removed.
Well I mean... You CAN jump out of the map.
And then nothing horrible happens, you can even hold CTRL/change Through ON and walk back in unharmed.
Although you can't move around the edges and come out at a different spot, you can, in fact, jump off and walk back in.
There is life out there, you can exist outside of the map. If you can jump out, surely there must be a way to walk out.

I don't need super complicated movement beyond, just want an NPC to walk off-screen and cease to exist.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,446
Reaction score
6,259
First Language
Indonesian
Primarily Uses
RMVXA
I don't need super complicated movement beyond, just want an NPC to walk off-screen and cease to exist.
Here is the catch. Your question is "complicated" and it actually deserves its own thread.
The easiest way would be overwriting "def passable?" from Game_CharacterBase in Game_Event class and force them to return true when a switch is flipped ON. You're asking this in scripting question, so I would expect you know where to edit. If not, consider making a new thread in rgss3 script request if you want others to do the job.

Is there an easy way to check what graphic an actor is currently using with a call?
Something like if $game_actor.graphic="$actor1.png"
Code:
$game_actors[id].character_name
$game_actors[id].face_name
use whatever you need
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Alright, I figured it out.
Just swap lines 171 and 172 around in GameCharacterBase and now characters can cross to the beyond if they have Through ON.
upload_2019-6-21_18-6-56.png

Code:
#   ╔════════════════════════╗
#   ║ Walk Through Map Border║
#   ╚════════════════════════╝
  class Game_CharacterBase
    def passable?(x, y, d)
      x2 = $game_map.round_x_with_direction(x, d)
      y2 = $game_map.round_y_with_direction(y, d)
      return true if @through || debug_through?
      return false unless $game_map.valid?(x2, y2)
      return false unless map_passable?(x, y, d)
      return false unless map_passable?(x2, y2, reverse_dir(d))
      return false if collide_with_characters?(x2, y2)
      return true
    end
  end
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,446
Reaction score
6,259
First Language
Indonesian
Primarily Uses
RMVXA
@Tanarex I've been saying since a year ago, support question for someone's script deserve their own thread. So go make one.
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Hello, I'm trying to figure out a way to change the amount of TP actors receive when suffering damage in VX Ace. I know that in the base script in game_battler starting on line 738 there is a part of the script that deals with charging TP by the damage suffered. The code for that I've put below.
Code:
  #--------------------------------------------------------------------------
  # * Charge TP by Damage Suffered
  #--------------------------------------------------------------------------
  def charge_tp_by_damage(damage_rate)
    self.tp += 50 * damage_rate * tcr
  end
What I want to change in this is to make the TP increase by a set amount between 1 to 3 depending on the amount of damage the player takes, so for example if the player takes 50% or more damage of their Max HP they will gain 3 TP, if they take 25% or more damage of their Max HP they will receive 2 TP and anything lower than that will give them 1 TP. I've tried writing it out myself using elsif statements and going through the base script, but I haven't been able to make it work.
Any help would be much appreciated.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,446
Reaction score
6,259
First Language
Indonesian
Primarily Uses
RMVXA
The damage rate there is based on max hp. So it goes 1.0 if the damage is equal or more than its max hp, and 0.1 if it's 10% of its max HP. The formula goes like if you get hit 50% of your hp, you gain 25 TP multiplied by TP charge rate.

You could make a statement like
Code:
if damage_rate >= 0.5
  tp = 3
elsif damage_rate >= 0.25
  tp = 2
else
  tp = 1
end
self.tp += tp
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
The damage rate there is based on max hp. So it goes 1.0 if the damage is equal or more than its max hp, and 0.1 if it's 10% of its max HP. The formula goes like if you get hit 50% of your hp, you gain 25 TP multiplied by TP charge rate.

You could make a statement like
Code:
if damage_rate >= 0.5
  tp = 3
elsif damage_rate >= 0.25
  tp = 2
else
  tp = 1
end
self.tp += tp
Thank you for replying and so quick too. I've tried implementing it, but it hasn't worked, when my character is hit they recover much more TP than they are meant to, would you be able to tell me where exactly this statement should be put and whether any of the base script is being changed? Since it seems that may be the problem.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,446
Reaction score
6,259
First Language
Indonesian
Primarily Uses
RMVXA
It may be because some of the other scripts overwrite it, yes.
You can try it in a fresh project and see if it works or not.
 

Egerunt

Villager
Member
Joined
Jan 5, 2019
Messages
29
Reaction score
0
First Language
English
Primarily Uses
RMVXA
The damage rate there is based on max hp. So it goes 1.0 if the damage is equal or more than its max hp, and 0.1 if it's 10% of its max HP. The formula goes like if you get hit 50% of your hp, you gain 25 TP multiplied by TP charge rate.

You could make a statement like
Code:
if damage_rate >= 0.5
  tp = 3
elsif damage_rate >= 0.25
  tp = 2
else
  tp = 1
end
self.tp += tp
I have figured out the problem. There are no script clashes. However, to make it work I need to edit the core script and change it from this:
Code:
  #--------------------------------------------------------------------------
  # * Charge TP by Damage Suffered
  #--------------------------------------------------------------------------
  def charge_tp_by_damage(damage_rate)
    self.tp += 50 * damage_rate * tcr
  end

to this:
Code:
#--------------------------------------------------------------------------
# * Charge TP by Damage Suffered
#--------------------------------------------------------------------------
def charge_tp_by_damage(damage_rate)
  if damage_rate >= 0.5
    self.tp += 3
  elsif damage_rate >= 0.25
    self.tp += 2
  else
    self.tp += 1
  end
end

You were right about the damage rate working like it was meant to, that was something I had no clue about, but I noticed that you didn't put "self.tp" instead you had simply written "tp =". I changed it to self.tp and then I realised the final problem, which was that it wasn't adding that much TP upon damage, instead it was setting the total TP to between 1 or 3 depending on the damage the actor took, because it said "self.tp = x". Knowing that I made the "=" be a "+=" and it finally worked.

Thank you for the help. Had you not shown me how the damage rate there worked, I wouldn't have been able to figure it out, since I was completely glossing over that part in my earlier attempts, before I finally decided to ask for help.
 

BelovedDoll

Warper
Member
Joined
Jun 28, 2019
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMXP
How do I install a plugin for XP? I downloaded what I needed but the maker did not include any instructions on how to install it to the game project.
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,406
Reaction score
4,805
First Language
English
Primarily Uses
RMVXA
How do I install a plugin for XP? I downloaded what I needed but the maker did not include any instructions on how to install it to the game project.
1) Open up the Script Editor by either going to Tools -> Script Editor, or pressing F11
2) Insert a new Script inside your Script Editor. It needs to be somewhere above "Main", and usually you will want to do it immediately above Main. To do so, right-click "Main" on the left-hand side and choose "Insert".
3) Copy the contents of the RGSS1 script you downloaded (as plain text) and Paste it into the new Script in your Editor. (Note that it has to be RGSS. JavaScript plugins don't work in XP.)
4) Change any Parameters in the Script's setup section, if there is one. If not, skip this step.
5) Save the game and run it. If properly set up, your script will take effect on your game!
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,402
Reaction score
499
First Language
English
Primarily Uses
RMVXA
A member on another forum is asking for help and I'm not sure how to go about making a solution.

The effect is to hide item screen categories if there are no items for that category.
So if you didn't have any weapons, then the weapons category would not show up.

The hard part is trying to get a conditional branch working that will check this in Window_ItemCategory for the make_command_list section.
Actually the hard part is knowing what to check.

So the question...
How do you use ruby code to check what the item category is for every item in your inventory?
Keep in mind that custom categories are used as well.

@item.category would be great, but it doesn't exist.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 3)

Latest Threads

Latest Posts

Latest Profile Posts

Quexp wrote on Shaz's profile.
I absolutely love your profile/pic! :kaoluv:
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
I made a battle results screen for my minigame.. any feedback? :)
Things I thought would never happen but just did: I needed to use my snow shovel. In August. In the Northern Hemisphere.
So I finished Cupcake, now I need to figure out my next project!
Do I pick up one of my incomplete games?
Do I start something entirely new???
The possibilities are endless!

Forum statistics

Threads
100,682
Messages
978,380
Members
132,307
Latest member
secasus
Top