RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Name display

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 82
display a name above event(npc) and actor(player)
someone have wrote a script like this, but too long and complex, i write a new one that simple to see and simple to use

Code: [Select]
class Game_Event
attr_reader :name
def initialize
@name = @event.name
end
end

class Game_Player
def name
  return $game_party.actors[0].name
end

end
class Sprite_Character < RPG::Sprite
  attr_accessor :character
  def initialize(viewport, character = nil)
    super(viewport)
    @character = character
    @filename = @character.character_name.to_s
    @x_frame = @y_frame = 4
    @x_frame = @filename.split(/@/)[1].to_i if @filename.split(/@/)[1].to_i != 0
    @y_frame = @filename.split(/@/)[2].to_i if @filename.split(/@/)[2].to_i != 0
    @name_spr = Sprite.new
    @name_spr.bitmap = Bitmap.new(100,20)
    update
  end
  def update
    super
    if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue
    @tile_id = @character.tile_id
    @character_name = @character.character_name
    @character_hue = @character.character_hue
    self.bitmap = RPG::Cache.character(@character.character_name,0) rescue self.bitmap = RPG::Cache.character("",0)
    @name_spr.bitmap.clear
    @name_spr.bitmap.draw_text(0,0,100,30,@character.name,1)
    @cw = bitmap.width / @x_frame
    @ch = bitmap.height / @y_frame
    self.ox = @cw / 2
    self.oy = @ch
    end
    self.visible = (not @character.transparent)
    if @tile_id == 0
    sx = @character.pattern * @cw
   case @character.direction
   when 2
     sy = 0 * @ch
   when 4
     sy = 1 * @ch
   when 6
     sy = 2 * @ch
   when 8
     sy = 3 * @ch
   when 1
     if @y_frame == 8
     sy = 4 * @ch
     else
     sy = 1 * @ch
     end
   when 3
     if @y_frame == 8
     sy = 5 * @ch
     else
     sy = 0 * @ch
     end
   when 7
     if @y_frame == 8
     sy = 6 * @ch
     else
     sy = 3 * @ch
     end
   when 9
     if @y_frame == 8
     sy = 7 * @ch
     else
     sy = 2 * @ch
     end
   when 5
     if @y_frame == 8
     sy = 0 * @ch
     else
     sy = 0 * @ch
     end
   end
    self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x

    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    @name_spr.x = self.x - @cw/2
    @name_spr.y = self.y - @ch - 30
    @name_spr.z = self.z
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    if @character.animation_id != 0
    animation = $data_animations[@character.animation_id]
    animation(animation, true)
    @character.animation_id = 0
    end
  end
end

ok, all done, F12 and test.

** this script include Charset frame change
« Last Edit: January 14, 2010, 02:53:51 PM by ngoaho »

****
Rep:
Level 83
How does one use this script?
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep:
Level 82
add script and test game..... naming event by edit event name.

****
Rep:
Level 83
i get an error:

Script 'Game_Map' line 76: ArgumentError occurred.
wrong number of arguments(2 for 0)
 
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep:
Level 82
copy Game_Map line 76 to here.

****
Rep:
Level 83
Game_Map


# 76      @events = Game_Event.new(@map_id, @map.events)
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep:
Level 82
replace
Code: [Select]
class Game_Event
attr_reader :name
def initialize
@name = @event.name
end
end
with
Code: [Select]
class Game_Event
attr_reader :name
alias old_init initialize
def initialize(*arg)
old_init(*arg)
@name = @event.name
end
end

*hug hug hug*

****
Rep:
Level 83
Cool, for some suggestions on an update, is that  there is some way some way of making the name of the event (the one that shows over top of it) where it has to be in Quotes or some thing along that lines, so you can turn it off for certain events.

Because (unless i don't know about it) right now it will show what you have the event labeled as, so if you have some events that are hidden (transfer players, Auto runs, and such) when you lablbe them for organization, it will show your label as the events name.
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep:
Level 82
my english is bad, i don't understand your reply clearly.
if you want to turn off event name, leave blank name box.

**
Rep: +0/-0Level 81
RMRK Junior
Is there a way to change the size, font and position?

****
Rep:
Level 83
where it says this in the script:
Code: [Select]
    @name_spr.bitmap.draw_text(0,0,100,30,@character.name,1)

above it put this in:
Code: [Select]
    @name_spr.bitmap.font.size = 24
    @name_spr.bitmap.font.name = "Arial Black"
    @name_spr.bitmap.font.color = Color.new( 255, 255, 255, 240)

change those values to what ever you want.
color is controlled by (R, G, B, Opacity)
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep: +0/-0Level 76
RMRK Junior
I know this is an old topic, but is there an option that i can erase the name above your own actor? Because I don't like the name above my own head all the time.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Try changing this:

Code: [Select]
class Game_Player
def name
  return $game_party.actors[0].name
end

end

to this:

Code: [Select]
class Game_Player
def name
  return ""
end

end

**
Rep: +0/-0Level 76
RMRK Junior
It worked. Thank you very much  ;)

**
Rep: +0/-0Level 76
RMRK Junior
I have an other problem now. When i start a battle, the name of the events that were in-screen, will stay there. How to fix this?