Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[FILLED] Call Script Adding to an Actor's Name Without Deleting Current Name

I think that the title doesn't explain enough, so I am going to go decently in depth. If someone would be kind enough to help me, I will give scripter game credit, and post it on RGSS/RGSS2 Script Board. Basically what I would like help making is a script, that runs on call scripts. These calls scripts will contain an actor's name to edit, a notification for the script to read telling it that it is on the back, or front of the name, and what you would like to add to the name. I know that name editing can already be done, but not by the game creator, leaving the name that the player inputed. This way you could have such things as army rankings, or titletracks that you earn through the game, without experience, or a scene to view your experience. So an example of a call script would be (actor1, front, "Recruit"), that would turn out to be Recruit [Actor Name]. Say the actor name was luke, this would be "Recruit Luke", to give a name title feel to this player, without changing their inputted name, which alows them to keep their name, which they oviously like, but have a totally sick title in it. Could a scripter please help me out with this minor script request?
 
Simple enough.

Code:
class Game_Actor
  def base_name
    return $data_actors[@actor_id].name
  end
  def add_name_prefix(prefix = '', return_base_name = false)
    return if prefix.size == 0
    return_to_base_name if return_base_name
    @name = "#{prefix}#{@name}"
  end
  def add_name_suffix(suffix = '', return_base_name = false)
    return if suffix.size == 0
    return_to_base_name if return_base_name
    @name = "#{@name}#{suffix}"
  end
  def return_to_base_name
    @name = base_name
  end
end

To get actor data:
Code:
actor = $game_actors[actor_id]

Now, methods for each actor:
Code:
# Gets original defined base_name from the database
actor.base_name
# Add prefix to name
actor.add_name_prefix(prefix = '', return_base_name = false)
# Add suffix to name
actor.add_name_suffix(suffix = '', return_base_name = false)
# Return name to base name
actor.return_to_base_name

When you add a prefix or suffix to the name, and wish to return the name back to the base_name, replace that false with true. Let me know if you need any help.
 
Thank you very much SephirothSpawn, and thanks for the quick response. This script is exactly what I wanted, and simple, you will be credited as a scripter, and already are anyway, want any special credit, for custom scripting? Also I got it to work perfectly, thank you.

EDIT: Congrats, on scripter of the year, I didn't even know until I saw your sig, good job!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top