Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Shadonking on November 28, 2008, 11:21:27 am

Title: [RESOLVED]custom skill scene
Post by: Shadonking on November 28, 2008, 11:21:27 am
hello, im after a custom skill scene.

the features i want are

something to show its attack power and attribute.

and thats it really.

thanks in advance
Title: Re: custom skill scene
Post by: Fantasist on November 28, 2008, 12:54:30 pm
"Attribute" as in element? Like Fire, Darkness, Anti-Undead, Anti-Angel, etc? (The "Element Names" list in the System tab of RMXP), right?

For the elements, do you want text or do you want to use icons?
The power is a simple edit. I'll get back to you soon.

EDIT:
The power mod. It displays power : sp_cost instead of just sp_cost.
Paste this just below Window_Skill.
class Window_Skill
 
  alias win_skill_power_mod_draw_item draw_item
  def draw_item(index)
    win_skill_power_mod_draw_item(index)
    skill = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    txt = "#{skill.power} : #{skill.sp_cost}"
    self.contents.fill_rect(x+196, y, 84, 32, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x + 196, y, 84, 32, txt, 2)
  end
 
end


This is of course assuming that you're using the DMS. If you're using anything else, let me know.
Title: Re: custom skill scene
Post by: Shadonking on November 28, 2008, 01:39:05 pm
yeh i ment the elements, and thanks for helping agian

aslo im using stormtronics cms but i have disable it when in the skill scene.

ok i got it working but you cant tell what is the sp cost or the strenth. is it posible to label them with SP (Skill points) and S (Strenth)
Title: Re: custom skill scene
Post by: Fantasist on November 28, 2008, 02:04:12 pm
Just type out how you want it to look.
Title: Re: custom skill scene
Post by: Shadonking on November 28, 2008, 02:11:23 pm
o yeh. silly me. :^_^':

i didnt see how it was done but iv spotted the part now to add the SP and S.


and thanks agian :up:
Title: Re: [RESOLVED] custom skill scene
Post by: Fantasist on November 28, 2008, 02:18:43 pm
np :)
Title: Re: [RESOLVED] custom skill scene
Post by: Shadonking on November 28, 2008, 04:41:41 pm
ahh fogot some thing, is it posible to have each skills attribute (element) as an icon after the sp cost and stuff.  i know this would be abit more arwcward so it would mean a huge powersup if any one want to do it. it would prob be better if it was made so if i add a new atribute i can add it to the script then choose the icon for it by puting what icon from the icon file i want it to have.

i hope i made sense.
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 01:25:25 am
Quoteit would prob be better if it was made so if i add a new atribute i can add it to the script then choose the icon for it by puting what icon from the icon file i want it to have.


You mean you'll define an icon for each attribute in the script and that icon should show up near thr SP Cost? It isn't that hard. I'll get to it.

EDIT: What if a skill has more than one element? Things might get cramped. Give me a layout on how a line looks like.
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 06:40:13 am
ok iv been looking at it and it would be very crampt, is it posible to have them in the discription, becuase there is loads of room in there.

p.s. the icons are smaller then the average icon so they will fit the hight of the discription box
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 08:40:16 am
By description, do you mean the help window at the top? Yeah, that can totally work.
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 08:59:56 am
yeah, there would be great
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 09:09:37 am
Here it is.

class Window_Skill
 
  def get_element_icon(id)
    b = case id
    #::::::::::::::::::::::::::::::::::::::::::::::::
    # CONFIG BEGIN
    #::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then '037-Item06'
    when 2 then '035-Item04'
    when 3 then '044-Skill01'
    # when ID then ICON_FILE_NAME
    #::::::::::::::::::::::::::::::::::::::::::::::::
    # CONFIG END
    #::::::::::::::::::::::::::::::::::::::::::::::::
    else
      ''
    end
    return RPG::Cache.icon(b) if b != ''
  end
 
  alias win_skill_power_mod_draw_item draw_item
  def draw_item(index)
    win_skill_power_mod_draw_item(index)
    skill = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    txt = "#{skill.power} : #{skill.sp_cost}"
    self.contents.fill_rect(x+196, y, 84, 32, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x + 196, y, 84, 32, txt, 2)
  end
 
  alias win_skill_element_mod_upd_hlp update_help
  def update_help
    win_skill_element_mod_upd_hlp
    skill = @data[self.index]
    elements = skill.element_set
    return if elements.size < 1
    gap = 2
    elements.each_with_index {|id, i| x = 604 - (i + 1) * (24 + gap)
    self.help_window.contents.fill_rect(x, 4, 24, 24, Color.new(0, 0, 0, 0))
    bitmap = get_element_icon(id)
    next if bitmap = nil
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.help_window.contents.blt(x, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    }
  end
 
end


It will draw the icons from the right side corner.
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 10:56:09 am
ok, iv got an error.

when i added this script the other script had an error. on line 5 and it said stack level to high.
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 11:41:40 am
Oh, both are the same. Delete the old one.
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 12:19:37 pm
ok, new error. sorry

its on line 47, cant convert NilClass into bitmap.
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 12:24:42 pm
Sorry, stupid mistakes ^_^'

class Window_Skill
 
  def get_element_icon(id)
    b = case id
    #::::::::::::::::::::::::::::::::::::::::::::::::
    # CONFIG BEGIN
    #::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then '037-Item06'
    when 2 then '035-Item04'
    when 3 then '044-Skill01'
    # when ID then ICON_FILE_NAME
    #::::::::::::::::::::::::::::::::::::::::::::::::
    # CONFIG END
    #::::::::::::::::::::::::::::::::::::::::::::::::
    else
      ''
    end
    return nil if b != ''
    return RPG::Cache.icon(b)
  end
 
  alias win_skill_power_mod_draw_item draw_item
  def draw_item(index)
    win_skill_power_mod_draw_item(index)
    skill = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    txt = "#{skill.power} : #{skill.sp_cost}"
    self.contents.fill_rect(x+196, y, 84, 32, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x + 196, y, 84, 32, txt, 2)
  end
 
  alias win_skill_element_mod_upd_hlp update_help
  def update_help
    win_skill_element_mod_upd_hlp
    skill = @data[self.index]
    elements = skill.element_set
    return if elements.size < 1
    gap = 2
    elements.each_with_index {|id, i| x = 604 - (i + 1) * (24 + gap)
    self.help_window.contents.fill_rect(x, 4, 24, 24, Color.new(0, 0, 0, 0))
    bitmap = get_element_icon(id)
    next if bitmap == nil
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.help_window.contents.blt(x, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    }
  end
 
end
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 12:44:52 pm
ok, i have no errors know but i dont see any icons. i have placed the name of the icons i wanted and aslo used the one that were already in the script but non of them showed.
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 12:45:51 pm
o.o I'll check it out... hang on.
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 01:04:49 pm
ok, take your time. there is no rush
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 01:31:50 pm
It's done :)

class Window_Skill
 
  def get_element_icon(id)
    b = case id
    #::::::::::::::::::::::::::::::::::::::::::::::::
    # CONFIG BEGIN
    #::::::::::::::::::::::::::::::::::::::::::::::::
    when 100 then '037-Item06'
    # when ID then ICON_FILE_NAME
    #::::::::::::::::::::::::::::::::::::::::::::::::
    # CONFIG END
    #::::::::::::::::::::::::::::::::::::::::::::::::
    else
      ''
    end
    if b == ''
      return nil unless $DEBUG
      r = Bitmap.new(24, 24)
      r.fill_rect(0, 0, 24, 24, Color.new(255, 255, 255, 192))
      r.fill_rect(1, 1, 22, 22, Color.new(0, 0, 0, 192))
      r.draw_text(0, 0, 24, 24, id.to_s, 1)
      return r
    end
    return RPG::Cache.icon(b)
  end
 
  def make_element_icons
    return if self.index < 0
    return if self.help_window == nil
    return if self.help_window.contents ==nil
    skill = @data[self.index]
    elements = skill.element_set
    return if elements.size < 1
    gap = 4 # Gap b/w icons in pixels
    x = 608 - elements.size * (24 + gap)
    elements.each_with_index {|id, i|
    self.help_window.contents.fill_rect(x, 4, 24, 24, Color.new(0, 0, 0, 0))
    bitmap = get_element_icon(id)
    next if bitmap == nil
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.help_window.contents.blt(x, 4, bitmap, bitmap.rect, opacity)
    x += 24 + gap}
  end
 
  alias win_skill_power_mod_draw_item draw_item
  def draw_item(index)
    win_skill_power_mod_draw_item(index)
    skill = @data[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    txt = "#{skill.power} : #{skill.sp_cost}"
    self.contents.fill_rect(x+196, y, 84, 32, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x + 196, y, 84, 32, txt, 2)
  end
 
  def index=(val)
    super(val)
    make_element_icons
  end
 
  alias win_skill_power_mod_help_window_eq help_window=
  def help_window=(win)
    win_skill_power_mod_help_window_eq(win)
    make_element_icons
  end
 
  alias win_skill_power_mod_upd_hlp update_help
  def update_help
    win_skill_power_mod_upd_hlp
    if Input.repeat?(Input::LEFT) || Input.repeat?(Input::UP) ||
      Input.repeat?(Input::RIGHT) || Input.repeat?(Input::DOWN) ||
      Input.repeat?(Input::L) || Input.repeat?(Input::R)
      make_element_icons
    end
  end
 
end


Run it in DEBUG mode and you'll get dummy icons with the element ID number on them.
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 03:00:45 pm
yay it works, thanks agian. powersup
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 03:09:34 pm
np again :)

PS: What about the resolved tag :P
Title: Re: custom skill scene
Post by: Aqua on November 29, 2008, 03:22:29 pm
Fanta, mind if I use this and edit it to fit my game's needs? :D
Title: Re: custom skill scene
Post by: Shadonking on November 29, 2008, 03:36:43 pm
i fogot to put the [RESOLVED] in

:^_^':
Title: Re: custom skill scene
Post by: Fantasist on November 29, 2008, 03:38:34 pm
That's up to Shadonking, not me :P

Besides, if you look at the code, understand it and make your own edit, it'll be totally yours. I do that with other scripts. If I plan to make my own script, I'll find a similar script, understand it and try doing it on my own. I think you made a status screen edit, right? this is not really hard, I believe you can do it :)
Title: Re: [RESOLVED]custom skill scene
Post by: Shadonking on November 29, 2008, 03:45:26 pm
i dont mind you useing the script.  every one here is so helpful it would be rude to say no.

and Fantasist you made it so it should be your choice to who uses them.