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.
[RMVX] Bit of a problem with a script I'm working on...

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 82
I'm working on a custom ABS HUD, and I'm having a problem that I can't quite figure out.  I have it so that the script will only draw the icons of the items you actually have (the IDs can be changed from inside a config module).  What I can't figure out is how to do the same thing with the skills; the closest I've been able to come is drawing all of the icons for the skill IDs in the config module:

Item Icons:

Code: [Select]
class Hud_Item_Bar_Icons < Window_Base
  def initialize
    super(312, 357, 160, 100)
    self.opacity = 0
    self.z = 16
  end
  def update
    contents.clear
    draw_icon($data_items[MNK_ABS_HUD::ITEM_IDS[0]].icon_index, 0, 0) unless $game_party.item_number($data_items[MNK_ABS_HUD::ITEM_IDS[0]]) == 0
    draw_icon($data_items[MNK_ABS_HUD::ITEM_IDS[1]].icon_index, 24, 0) unless $game_party.item_number($data_items[MNK_ABS_HUD::ITEM_IDS[1]]) == 0
    draw_icon($data_items[MNK_ABS_HUD::ITEM_IDS[2]].icon_index, 48, 0) unless $game_party.item_number($data_items[MNK_ABS_HUD::ITEM_IDS[2]]) == 0
    draw_icon($data_items[MNK_ABS_HUD::ITEM_IDS[3]].icon_index, 72, 0) unless $game_party.item_number($data_items[MNK_ABS_HUD::ITEM_IDS[3]]) == 0
    draw_icon($data_items[MNK_ABS_HUD::ITEM_IDS[4]].icon_index, 96, 0) unless $game_party.item_number($data_items[MNK_ABS_HUD::ITEM_IDS[4]]) == 0
  end
end

Skill Icons:

Code: [Select]
class Hud_Skill_Bar_Icons < Window_Base
  def initialize
    super(312, 407, 160, 100)
    self.opacity = 0
    self.z = 16
  end
  def update
    contents.clear
    draw_icon($data_skills[MNK_ABS_HUD::SKILL_IDS[0]].icon_index, 0, 0)
    draw_icon($data_skills[MNK_ABS_HUD::SKILL_IDS[1]].icon_index, 24, 0)
    draw_icon($data_skills[MNK_ABS_HUD::SKILL_IDS[2]].icon_index, 48, 0)
    draw_icon($data_skills[MNK_ABS_HUD::SKILL_IDS[3]].icon_index, 72, 0)
    draw_icon($data_skills[MNK_ABS_HUD::SKILL_IDS[4]].icon_index, 96, 0)
  end
end

What am I missing?

*
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
Well, for your condition, you just need to check if the actor has learned the skill. Assuming it is the first actor, it would be:

Code: [Select]

    draw_icon($data_skills[MNK_ABS_HUD::SKILL_IDS[0]].icon_index, 0, 0) if $game_actors[1].skill_learn?($data_skills[MNK_ABS_HUD::SKILL_IDS[0]])

Just replace the 1 with the ID of the actor. Alternately, you could use lead actor with:

Code: [Select]
$game_party.members[0].skill_learn?($data_skills[MNK_ABS_HUD::SKILL_IDS[0]])

However, you might want to do a check to make sure that $game_party.members isn't empty first, as there could be situations in the game where the creator takes all members out of the party (for a cutscene or something), and if that check is conducted at that time then it would return a NoMethod Error.


EDIT::

Sorry, I had originally kept "unless". It should be "if".
« Last Edit: July 24, 2013, 12:45:38 AM by modern algebra »