[XP] check actors on what skill they learn next

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
183
Reaction score
6
First Language
English
Primarily Uses
RMXP
i have successfuly modifed the Window_Status Script to view the actor's current skill set.
Ruby:
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
#  This window displays full status specs on the status screen.
#==============================================================================

class Window_Status < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_graphic(@actor, 40, 112)
    draw_actor_name(@actor, 96, 24)
    draw_actor_class(@actor, 96, 48)
    draw_actor_level(@actor, 96, 72)
    draw_actor_state(@actor, 96, 64)
    draw_actor_hp(@actor, 96, 112, 172)
    draw_actor_sp(@actor, 96, 144, 172)
    draw_actor_parameter(@actor, 96, 192, 0)
    draw_actor_parameter(@actor, 96, 224, 3)
    draw_actor_parameter(@actor, 96, 256, 6)
    draw_actor_parameter(@actor, 96, 288, 1)
    draw_actor_parameter(@actor, 96, 320, 2)
    draw_actor_parameter(@actor, 96, 352, 5)
    draw_actor_parameter(@actor, 96, 384, 4)
    self.contents.font.name = "TF2 Secondary"
    self.contents.font.color = system_color
    self.contents.draw_text(320, 48, 80, 32, "TOTAL EXP")
    self.contents.draw_text(320, 80, 80, 32, "NEXT EXP")
    self.contents.font.name = "TF2 Build"
    self.contents.font.color = normal_color
    self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
    self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
    self.contents.font.name = "TF2 Build"
    self.contents.font.color = system_color
    self.contents.draw_text(320, 160, 110, 32, "Weapon")
    draw_item_name($data_weapons[@actor.weapon_id], 420 + 16, 160)
    self.contents.font.name = "TF2 Build"
    self.contents.font.color = system_color
    self.contents.draw_text(320, 190, 110, 32, "Held Item")
    draw_item_name($data_armors[@actor.armor1_id], 420 + 16, 190)
    draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
    draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
    draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
    self.contents.font.name = "TF2 Build"
    self.contents.font.color = system_color
    self.contents.draw_text(320, 235, 110, 32, "Skills")
    if @actor.skills[0]
      draw_item_name($data_skills[@actor.skills[0]], 320, 265)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(320, 205, 100, 150, "---------", 1)
    end
    if @actor.skills[1]
      draw_item_name($data_skills[@actor.skills[1]], 470, 265)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(470, 205, 100, 150, "---------", 1)
    end
    if @actor.skills[2]
      draw_item_name($data_skills[@actor.skills[2]], 320, 295)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(320, 235, 100, 150, "---------", 1)
    end
    if @actor.skills[3]
      draw_item_name($data_skills[@actor.skills[3]], 470, 295)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(470, 235, 100, 150, "---------", 1)
    end
    if @actor.skills[4]
      draw_item_name($data_skills[@actor.skills[4]], 320, 325)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(320, 265, 100, 150, "---------", 1)
    end
    if @actor.skills[5]
      draw_item_name($data_skills[@actor.skills[5]], 470, 325)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(470, 265, 100, 150, "---------", 1)
    end
    if @actor.skills[6]
      draw_item_name($data_skills[@actor.skills[6]], 320, 355)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(320, 295, 100, 150, "---------", 1)
    end
    if @actor.skills[7]
      draw_item_name($data_skills[@actor.skills[7]], 470, 355)
    else
      self.contents.font.size = 32
      self.contents.font.color = emptyskill_color
      self.contents.draw_text(470, 295, 100, 150, "---------", 1)
    end
  end
  def dummy
    self.contents.font.color = system_color
    self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
    self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
    self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
    self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
    self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
    draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
    draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
    draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
    draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
    draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
    draw_item_name($data_skills[@actor.skills[0]], 320, 265)
    draw_item_name($data_skills[@actor.skills[1]], 470, 265)
    draw_item_name($data_skills[@actor.skills[2]], 320, 295)
    draw_item_name($data_skills[@actor.skills[3]], 470, 295)
    draw_item_name($data_skills[@actor.skills[4]], 320, 325)
    draw_item_name($data_skills[@actor.skills[5]], 470, 325)
    draw_item_name($data_skills[@actor.skills[6]], 320, 355)
    draw_item_name($data_skills[@actor.skills[7]], 470, 355)
  end
end
1603852933744.png
i did made this all by myself WITHOUT any help in the forum.
i am SO proud of myself! :XP1:



but... i can't figure out how to view the actor's NEXT skill.
here is an example of what im talking about.
Screenshot 2020-10-28 094513.png
if anyone can do this, let me know.
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
104
First Language
English
Primarily Uses
RMXP
Here's a start in figuring out what you need to call.
Ruby:
next_skill = $data_classes[@actor.class_id].learnings.find { |learning| learning.level > @actor.level }
print "Your next skill will be #{$data_skills[next_skill.skill_id].name} learned at #{next_skill.level}."
I'm pretty sure XP does a good job with keeping the learnings array sorted by increasing level. Note that this also only returns one skill, should you happen to have more than one skill learned at the same level. In your snapshot, it didn't look like there was much room for more than 2.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
183
Reaction score
6
First Language
English
Primarily Uses
RMXP
@KK20 ok it worked, but i have to tweak this a bit.
Ruby:
self.contents.font.size = 20
    self.contents.font.name = "TF2 Build"
    self.contents.font.color = system_color
    next_skill = $data_classes[@actor.class_id].learnings.find { |learning| learning.level > @actor.level }
    self.contents.draw_text(325, 350, 100, 100, "Next Skill", 0)
    self.contents.draw_text(445, 350, 100, 100, "LV #{next_skill.level}", 0)
    self.contents.font.name = "Times New Roman"
    self.contents.font.color = emptyskill_color
    self.contents.draw_text(325, 375, 100, 100, "#{$data_skills[next_skill.skill_id].name}", 0)
1603864047484.png
its very close to what i have imagined, the next skill is missing it's skill icon tho.

EDIT:
(umm... you're wrong KK20, it looks like there IS still room for this window from my edited snapshot.)
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
104
First Language
English
Primarily Uses
RMXP
Don't you know how to do that already? It should be pretty similar to what you already accomplished with your "Skills" portion. Anyways, this is the bitmap you're going to be using:
Code:
bitmap = RPG::Cache.icon($data_skills[next_skill.skill_id].icon_name)
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
183
Reaction score
6
First Language
English
Primarily Uses
RMXP
@KK20 ok NOW it has the icon. thanks.
1603865767829.png


and also i've encounter an error to this.
when an actor has learned all the skills...
1603865754073.png

it errors to this:
1603865868110.png
i had a failsafe where there are gray lines where an actor hasn't learned a skill yet.
i don't know how im gonna to the same thing on the next skill thing.
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
104
First Language
English
Primarily Uses
RMXP
You can wrap all your drawing functions under a simple if-statement:
Code:
self.contents.draw_text(325, 350, 100, 100, "Next Skill", 0)
if next_skill
  self.contents.draw_text(445, 350, 100, 100, "LV #{next_skill.level}", 0)
  # ...and the rest of them
else
  # ...you can do "no more skills to be learned!" or something here
end
 
Last edited:

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
183
Reaction score
6
First Language
English
Primarily Uses
RMXP
@KK20 it works now, but the sorting is wrong.
1603870472746.png
it views that Rowlet's next skill is Diarama at LV 24.

1603870593521.png
but Media unlocks at LV 11!
i think its sort by Skill ID and NOT Level Needed to Learn Skill.
can you like... make it sort it like that?
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
104
First Language
English
Primarily Uses
RMXP
Code:
class_learnings = $data_classes[@actor.class_id].learnings.sort { |a,b| a.level <=> b.level }
next_skill = class_learnings.find { |learning| learning.level > @actor.level }
 
Last edited:

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
183
Reaction score
6
First Language
English
Primarily Uses
RMXP
@KK20
SORRY IT TOOK ME SO LONG TO RESPOND, MY FAMILY AND I WENT ON A ROAD TRIP FOR ABOUT 4 DAYS

anyways... here is the results:
1604287764651.png
1604287793340.png
again. i am REALLY SORRY for not responding for about 4 days. :aswt:
but im back home again btw!
 
Last edited:

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
279
Reaction score
104
First Language
English
Primarily Uses
RMXP
Whoops, $data_classes
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ
Oh my gosh. Thank you, Macy's! Thank you so much! You have made me very happy!
Happy Thanksgiving everyone! What are you thankful for? I'm thankful that I no longer have PTSD, and that I get to enjoy a good meal with my mom and stepdad! It might not be the same as before COVID, but at least I still get to enjoy the holiday!

Forum statistics

Threads
105,550
Messages
1,014,568
Members
137,225
Latest member
Eryndor
Top