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.
different mp types?

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 86
i thought i saw it, but now i cant find a script that allows different actors different types of mp. for example: 1 actor having MP while another actor has SP or AP or whatever. Any ideas?

*
Rep:
Level 82
I'm sure I've seen a similar script to what you want but I might be mistaken, or it was part of another script.

If you're only wanting to change the text that appears next to the 'MP' value, then this should suffice. I've not really tested it with too many scripts that might use the draw_actor_mp method. I'm still in the process of figuring out how to make proper use of the aliasing so it just overwrites the way that draw_actor_mp works.

It'll change only the vocab for the actors whose ids are included. Everyone else's mp vocab will be the default set in the database. I also shifted the text to the left a little to make a little room for the numbers. Might be better ideas, but meh, gave me something else to do whilst having a break from writing my other scripts.

Code: [Select]
module LF

  MP_VOCAB = { #DNR
 
# ACTOR ID => NAME FOR MP
  1 => "MP",
  2 => "SP",
  3 => "AP",
 
  } #DNR
end

class Window_Base
 
  def draw_actor_mp(actor, x, y, width = 120)
    draw_actor_mp_gauge(actor, x, y, width)   
    self.contents.font.color = system_color
    if LF::MP_VOCAB.include?(actor.id)
      self.contents.draw_text(x-5, y, 30, WLH, LF::MP_VOCAB[actor.id])
    else
      self.contents.draw_text(x-5, y, 30, WLH, Vocab::mp_a)
    end
    self.contents.font.color = mp_color(actor)
    last_font_size = self.contents.font.size
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2)
    else
      self.contents.draw_text(xr - 99, y, 44, WLH, actor.mp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
      self.contents.draw_text(xr - 44, y, 44, WLH, actor.maxmp, 2)
    end
  end
 
end
(Why do I always feel like it's the end of the world and I'm the last man standing?)

**
Rep:
Level 86
Works great! Thanks! If you know of a way to add an option to change the color of the MP Guages for the different Vocabs, that would be great. If not, no biggie.

Thanks again!

*
Rep:
Level 82
Shouldn't be a big problem, just depends on how you'd want the color to be set. I usually add a bit that allows you to specify the rgba values of the text and then create a color based on those entries. I'll get to it if it works and no one else has better ideas.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

**
Rep:
Level 86
Thanks. Specifying the rgba sounds good. I've been trying to learn how to script, but i havn't had the time to sit and learn it.

*
Rep:
Level 82
It works as far as I'm able to tell. It's always hard to test your own script because you're aware of what to do with it. Just poke me if it doesn't work.

Code: [Select]
#LoganForrests' Different MP Notations Script v1.1 
#
# Platform: RPG Maker VX
#
# Date of last update : 23 March 2011
#   Untested for script compatibility - let me know if there's issues
#   I can be found on rmrk.net under the same name
#
# v 1.1
#    Different colors can be assigned to each definition with an RGB/RGBA
#     color setting
# v 1.0
#    Allows actors to have their own definition for their mp pool
#
#
module LF

  #Change the vocabulary used for each actor's mp
  MP_VOCAB = {
# ACTOR ID => [MP Name, Red, Green, Blue, Alpha ], RGBA values between 0-255
        1  => "MP",
        2  => "SP",
        3  => "AP",
  } #DNR
 
  #Change the color of the mp gauge for each name type
  #If a type is not included (i.e. there is no match) the default gauge
  #color will be used instead.
  #ALPHA CHANNEL isn't necessary to be specified unless you want transparency
  #Gauge color : LEFT SIDE
  MP_GAUGE_COLOR_1 = {
# MP NAME =>   RED, GREEN, BLUE, ALPHA],
     "MP" => [ 150,     0,    0],
     "SP" => [   0,   150,    0],
     "AP" => [   0,     0,  150],
  }
 
  #Gauge color : RIGHT SIDE
  MP_GAUGE_COLOR_2 = {
# MP NAME =>   RED, GREEN, BLUE, ALPHA],
     "MP" => [ 255,     0,    0],
     "SP" => [   0,   255,    0],
     "AP" => [   0,     0,  255],
  }
 
end

class Window_Base
 
  alias lf_mpv_draw_actor_mp draw_actor_mp
  def draw_actor_mp(actor, x, y, width = 120)
    mpvocab = Vocab::mp_a #set default text
    if LF::MP_VOCAB.include?(actor.id)
      mpvocab = LF::MP_VOCAB[actor.id] #change text if requested
    end
 
    draw_actor_mp_gauge(actor, x, y, width, mpvocab)
   
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, mpvocab) #display mp text
    self.contents.font.color = mp_color(actor)
    last_font_size = self.contents.font.size
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2)
    else
      self.contents.draw_text(xr - 99, y, 44, WLH, actor.mp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
      self.contents.draw_text(xr - 44, y, 44, WLH, actor.maxmp, 2)
    end
  end
 
  alias lf_mpv_draw_actor_mp_gauge draw_actor_mp_gauge
  def draw_actor_mp_gauge(actor, x, y, width = 120, type = nil)
   
    if (LF::MP_GAUGE_COLOR_1.include?(type) &&  #ensure id is specified in
            LF::MP_GAUGE_COLOR_2.include?(type) ) #both hashes
     
      gw = width * actor.mp / [actor.maxmp, 1].max
      gc1 = lf_mpv_gauge_color1(type)
      gc2 = lf_mpv_gauge_color2(type)
      self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
      self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
     
    else #if none/only 1 is specified, run original method
       lf_mpv_draw_actor_mp_gauge(actor, x, y, width)
    end

  end
 
  def lf_mpv_gauge_color1(type)
    r = LF::MP_GAUGE_COLOR_1[type][0]
    g = LF::MP_GAUGE_COLOR_1[type][1]
    b = LF::MP_GAUGE_COLOR_1[type][2]
    a = LF::MP_GAUGE_COLOR_1[type][3] != nil ?
             LF::MP_GAUGE_COLOR_1[type][3] : 255
    return Color.new(r, g, b, a)
  end
 
  def lf_mpv_gauge_color2(type)
    r = LF::MP_GAUGE_COLOR_2[type][0]
    g = LF::MP_GAUGE_COLOR_2[type][1]
    b = LF::MP_GAUGE_COLOR_2[type][2]
    a = LF::MP_GAUGE_COLOR_1[type][3] != nil ?
             LF::MP_GAUGE_COLOR_1[type][3] : 255
    return Color.new(r, g, b, a)
  end
 

end #class Window_Base


I've dated it and put the update notes on too, in case it wants to be used. Specifically if it doesn't want to work with other scripts - it's untested for compatibility because I don't use many other people's scripts whilst writing my own.
« Last Edit: March 23, 2011, 09:04:09 AM by LoganForrests »
(Why do I always feel like it's the end of the world and I'm the last man standing?)