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.
[RESOLVED] NPC Name Script?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 86
I tried searching and couldn't find any what so ever.... I was wondering is there a Script to have the name on the NPC above there head.
Because I am creating an Online Game through RPG Maker XP.
I suppose alot of you will say it won't succeed but I know it will because I do not give up.
And I really need this script if there is one out there.
Please reply thanks alot Springymabob
« Last Edit: October 06, 2007, 02:23:22 PM by Zeriab »
<br />Its me Springy!

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Saying you know it will means it will fail. <Usual rant on how on scripters can succeed with MMOs goes here>

Strike 1 for not using tags.

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
Code: [Select]
#==============================================================================
# ** Event Text Display
#==============================================================================
# Created By: Áص¹
# Modified By: SephirothSpawn
# Modified By: Me™
# Version 2.1
# 2006-03-04
#==============================================================================
# * Instructions :
#
#  ~ Creating Event With Text Display
#   - Put a Comment on the Page With
#   [CD____]
#   - Place Text to Be Displayed in the Blank
#------------------------------------------------------------------------------
# * Customization :
#
#  ~ NPC Event Colors
#   - Event_Color = Color
#
#  ~ Player Event Color
#   - Player_Color = Color
#
#  ~ Player Text
#   - Player_Text = text_display *
#
#  ~ text_display
#   - 'Name', 'Class', 'Level', 'Hp', 'Sp'
#==============================================================================

#==============================================================================
# ** Game_Character
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Dispaly Text Color (Event & Player)
  #--------------------------------------------------------------------------
  Event_Color = Color.new(0, 0, 200)
  Player_Color = Color.new(200, 0, 0)
  #--------------------------------------------------------------------------
  # * Display Choices
  # ~ 'Name', 'Class', 'Level', 'Hp', 'Sp'
  #--------------------------------------------------------------------------
  Player_Text = 'Name'
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :text_display
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_gevent_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Original Refresh Method
    seph_characterdisplay_gevent_refresh
    # Checks to see if display text
    # If the name contains CD, it takes the rest of the name as the text
    unless @list.nil?
      for i in 0...@list.size
        if @list[i].code == 108
          @list[i].parameters[0].dup.gsub!(/\[[Cc][Dd](.+?)\]/) do
            @text_display = [$1, Event_Color]
          end
        end
      end
    end
    @text_display = nil if @erased
  end
end

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_gplayer_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Original Refresh Method
    seph_characterdisplay_gplayer_refresh
    # Gets First Actor
    actor = $game_party.actors[0]
    # Determines Text
    case Player_Text
    when 'Name'
      txt = "Atoria"
    when 'Class'
      txt = actor.class_name
    when 'Level'
      txt = "Level: #{actor.level}"
    when 'Hp'
      txt = "HP: #{actor.hp} / #{actor.maxhp}"
    when 'Sp'
      txt = "SP: #{actor.sp} / #{actor.maxsp}"
    else
      txt = ''
    end
    # Creates Text Display
    @text_display = [txt, Player_Color]
  end
end

#==============================================================================
# ** Sprite_Character
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_scharacter_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original update Method
    seph_characterdisplay_scharacter_update
    # Character Display Update Method
    update_display_text
  end
  #--------------------------------------------------------------------------
  # * Create Display Sprite
  #--------------------------------------------------------------------------
  def create_display_sprite(args)
    Font.default_size = 12
    Font.default_name = "Verdana"
    # Creates Display Bitmap
    bitmap = Bitmap.new(160, 24)
    # Draws Text Shadow
#   if bitmap.font.respond_to?(:draw_shadow)
#      bitmap.font.draw_shadow = false
#    end
#    bitmap.font.color = Color.new(0, 0, 0)
#    bitmap.draw_text(1, 1, 160, 24, args[0], 1)
    # Changes Font Color
    bitmap.font.color = args[1]
    # Draws Text
    bitmap.draw_text(0, 0, 160, 24, args[0], 1)
    # Creates Display Text Sprite
    @_text_display = Sprite.new(self.viewport)
    @_text_display.bitmap = bitmap
    @_text_display.ox = 80
    @_text_display.oy = 24
    @_text_display.x = self.x
    @_text_display.y = self.y - self.oy / 2 - 24
    @_text_display.z = 30001
    @_text_display.visible = self.visible #true
  end
  #--------------------------------------------------------------------------
  # * Dispose Display Sprite
  #--------------------------------------------------------------------------
  def dispose_display_text
    unless @_text_display.nil?
      @_text_display.dispose
    end
    #reset font colors
    Font.default_size = 14
    Font.default_name = "Verdana"
  end
  #--------------------------------------------------------------------------
  # * Update Display Sprite
  #--------------------------------------------------------------------------
  def update_display_text
    unless @character.text_display.nil?
      if @_text_display.nil?
        create_display_sprite(@character.text_display)
      end
      @_text_display.x = self.x
      @_text_display.y = self.y - self.oy / 2 - 24
      lastx = $game_temp.player_new_x
      lasty = $game_temp.player_new_y
#      if self.x > lastx and self.y > lasty
#        @_text_display.opacity = 255 - (self.x - lastx) - (self.y - lasty)
#      elsif self.x < lastx and self.y > lasty
#        @_text_display.opacity = 255 - (lastx - self.x) - (self.y - lasty)
#      elsif self.x > lastx and self.y < lasty
#        @_text_display.opacity = 255 - (self.x - lastx) - (lasty - self.y)
#      else
#        @_text_display.opacity = 255 - (lastx - self.x) - (lasty - self.y)
#      end
    else
      unless @_text_display.nil?
        dispose_display_text
      end
    end
    #reset font colors
    Font.default_size = 14
    Font.default_name = "Verdana"
  end
end

To use it, use Comment and type:[something]

Happy now?
Be kind, everyone you meet is fighting a hard battle.

**
Rep: +0/-0Level 86
Code: [Select]
#==============================================================================
# ** Event Text Display
#==============================================================================
# Created By: Áص¹
# Modified By: SephirothSpawn
# Modified By: Me™
# Version 2.1
# 2006-03-04
#==============================================================================
# * Instructions :
#
#  ~ Creating Event With Text Display
#   - Put a Comment on the Page With
#   [CD____]
#   - Place Text to Be Displayed in the Blank
#------------------------------------------------------------------------------
# * Customization :
#
#  ~ NPC Event Colors
#   - Event_Color = Color
#
#  ~ Player Event Color
#   - Player_Color = Color
#
#  ~ Player Text
#   - Player_Text = text_display *
#
#  ~ text_display
#   - 'Name', 'Class', 'Level', 'Hp', 'Sp'
#==============================================================================

#==============================================================================
# ** Game_Character
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Dispaly Text Color (Event & Player)
  #--------------------------------------------------------------------------
  Event_Color = Color.new(0, 0, 200)
  Player_Color = Color.new(200, 0, 0)
  #--------------------------------------------------------------------------
  # * Display Choices
  # ~ 'Name', 'Class', 'Level', 'Hp', 'Sp'
  #--------------------------------------------------------------------------
  Player_Text = 'Name'
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :text_display
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_gevent_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Original Refresh Method
    seph_characterdisplay_gevent_refresh
    # Checks to see if display text
    # If the name contains CD, it takes the rest of the name as the text
    unless @list.nil?
      for i in 0...@list.size
        if @list[i].code == 108
          @list[i].parameters[0].dup.gsub!(/\[[Cc][Dd](.+?)\]/) do
            @text_display = [$1, Event_Color]
          end
        end
      end
    end
    @text_display = nil if @erased
  end
end

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_gplayer_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Original Refresh Method
    seph_characterdisplay_gplayer_refresh
    # Gets First Actor
    actor = $game_party.actors[0]
    # Determines Text
    case Player_Text
    when 'Name'
      txt = "Atoria"
    when 'Class'
      txt = actor.class_name
    when 'Level'
      txt = "Level: #{actor.level}"
    when 'Hp'
      txt = "HP: #{actor.hp} / #{actor.maxhp}"
    when 'Sp'
      txt = "SP: #{actor.sp} / #{actor.maxsp}"
    else
      txt = ''
    end
    # Creates Text Display
    @text_display = [txt, Player_Color]
  end
end

#==============================================================================
# ** Sprite_Character
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_characterdisplay_scharacter_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original update Method
    seph_characterdisplay_scharacter_update
    # Character Display Update Method
    update_display_text
  end
  #--------------------------------------------------------------------------
  # * Create Display Sprite
  #--------------------------------------------------------------------------
  def create_display_sprite(args)
    Font.default_size = 12
    Font.default_name = "Verdana"
    # Creates Display Bitmap
    bitmap = Bitmap.new(160, 24)
    # Draws Text Shadow
#   if bitmap.font.respond_to?(:draw_shadow)
#      bitmap.font.draw_shadow = false
#    end
#    bitmap.font.color = Color.new(0, 0, 0)
#    bitmap.draw_text(1, 1, 160, 24, args[0], 1)
    # Changes Font Color
    bitmap.font.color = args[1]
    # Draws Text
    bitmap.draw_text(0, 0, 160, 24, args[0], 1)
    # Creates Display Text Sprite
    @_text_display = Sprite.new(self.viewport)
    @_text_display.bitmap = bitmap
    @_text_display.ox = 80
    @_text_display.oy = 24
    @_text_display.x = self.x
    @_text_display.y = self.y - self.oy / 2 - 24
    @_text_display.z = 30001
    @_text_display.visible = self.visible #true
  end
  #--------------------------------------------------------------------------
  # * Dispose Display Sprite
  #--------------------------------------------------------------------------
  def dispose_display_text
    unless @_text_display.nil?
      @_text_display.dispose
    end
    #reset font colors
    Font.default_size = 14
    Font.default_name = "Verdana"
  end
  #--------------------------------------------------------------------------
  # * Update Display Sprite
  #--------------------------------------------------------------------------
  def update_display_text
    unless @character.text_display.nil?
      if @_text_display.nil?
        create_display_sprite(@character.text_display)
      end
      @_text_display.x = self.x
      @_text_display.y = self.y - self.oy / 2 - 24
      lastx = $game_temp.player_new_x
      lasty = $game_temp.player_new_y
#      if self.x > lastx and self.y > lasty
#        @_text_display.opacity = 255 - (self.x - lastx) - (self.y - lasty)
#      elsif self.x < lastx and self.y > lasty
#        @_text_display.opacity = 255 - (lastx - self.x) - (self.y - lasty)
#      elsif self.x > lastx and self.y < lasty
#        @_text_display.opacity = 255 - (self.x - lastx) - (lasty - self.y)
#      else
#        @_text_display.opacity = 255 - (lastx - self.x) - (lasty - self.y)
#      end
    else
      unless @_text_display.nil?
        dispose_display_text
      end
    end
    #reset font colors
    Font.default_size = 14
    Font.default_name = "Verdana"
  end
end

To use it, use Comment and type:[something]

Happy now?

Thank you so much :D  I'm gonna whack this script onto my game now :D thank you :)
<br />Its me Springy!

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Strike 2, for ignoring strike 1 and not updating the thread. This thread is locked, and the user has two strikes, y'all know what that means.