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

Discussion in 'RGSSx Script Support' started by Mr. Bubble, Mar 14, 2012.

  1. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    Right, forgot about that. That's probably why. Missing scripts. Thanks
     
  2. ekhartpl

    ekhartpl Veteran Veteran

    Messages:
    60
    Likes Received:
    24
    Location:
    ROI
    First Language:
    Polish
    Primarily Uses:
    RMVXA
    How can I, via script, change the name of actor X to the same as actor Y?
     
  3. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    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.
     
    ekhartpl likes this.
  4. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    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.
     
  5. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    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.
     
    Engr. Adiktuzmiko likes this.
  6. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    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"
     
  7. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    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.
     
  8. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,451
    Likes Received:
    5,042
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    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.

    Code:
    $game_actors[id].character_name
    $game_actors[id].face_name
    use whatever you need
     
  9. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    upload_2019-6-21_2-56-38.png
    ...
    Didn't work.
    I don't get it.
    Can you give an example?
     
  10. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,451
    Likes Received:
    5,042
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    Don't include the file extension, just the name
     
  11. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    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
     
    ZirconStorms likes this.
  12. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,451
    Likes Received:
    5,042
    Location:
    Riftverse
    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.
     
  13. Egerunt

    Egerunt Villager Member

    Messages:
    19
    Likes Received:
    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.
     
  14. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,451
    Likes Received:
    5,042
    Location:
    Riftverse
    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
     
  15. Egerunt

    Egerunt Villager Member

    Messages:
    19
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    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.
     
  16. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,451
    Likes Received:
    5,042
    Location:
    Riftverse
    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.
     
  17. Egerunt

    Egerunt Villager Member

    Messages:
    19
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    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.
     
  18. BelovedDoll

    BelovedDoll Warper Member

    Messages:
    1
    Likes Received:
    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.
     
  19. Wavelength

    Wavelength Pre-Merge Boot Moderator

    Messages:
    4,454
    Likes Received:
    3,724
    Location:
    Florida, USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    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!
     
    BelovedDoll likes this.
  20. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    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.
     

Share This Page