Mod: Studying from the Skills page

Warning - Enter at your own risk! This is an area for people to experiment with changing the way the game works.
Message
Author
SET
Posts: 22
Joined: Sat Dec 28, 2013 9:59 pm

Mod: Studying from the Skills page

#1 Postby SET » Mon Jan 20, 2014 3:40 am

So I finally made an actually useful mod: This one allows you to select the two skills you want to study for the week from the Skills page, where you can see the current state of your skills and study bonuses. Just click on any skill and it will be selected as the morning study. Click another skill and it will be your evening study. Your selection is displayed in the lower right corner. If you change your mind just click there to remove the skill again and you can make another selection. There's also a "Done" button to start the week.
While you make your selections the numbers and bars will also update to show your skill level after studying your current selection. Looks something like this:
Image
Create a new text file in your LongLiveTheQueen/game directory, call it skillpage.rpy and dump the following wall of text in there. To get rid of it delete both skillpage.rpy and skillpage.rpyc from that directory.
And with that I'm officially out of ideas for mods.

Code: Select all

# skillpage
# Allows you to select your classes for the week from the skill page.
# Written for version 1.2.13
# WARNING: UNOFFICIAL AND BARELY TESTED, USE AT YOUR OWN RISK!

init 1:
  python:
    renpy.config.label_overrides['skills_page'] = 'mod_skillpage_skillspage'

    @renpy.curry
    def mod_skillpage_setskill(skill):
      global current_morning_activity_group, current_morning_activity, current_evening_activity_group, current_evening_activity
      group = Stat.instances[skill].subgroup.name
      if not current_morning_activity:
        current_morning_activity_group = group
        current_morning_activity = skill
      elif not current_evening_activity:
        current_evening_activity_group = group
        current_evening_activity = skill
      elif current_morning_activity == skill:
        current_morning_activity_group = None
        current_morning_activity = None
      elif current_evening_activity == skill:
        current_evening_activity_group = None
        current_evening_activity = None
      return 0
    @renpy.curry
    def mod_skillpage_delskill(morning=False, evening=False):
      global current_morning_activity_group, current_morning_activity, current_evening_activity_group, current_evening_activity
      if morning:
        current_morning_activity_group = None
        current_morning_activity = None
      if evening:
        current_evening_activity_group = None
        current_evening_activity = None
      return 0

    # Pretty much a complete rewrite of how the stats are drawn
    def mod_skillpage_drawstatbox(bonus, t,v,orig_v):
      global hoveredskill
      new_v = v
      new_orig_v = orig_v
      if current_morning_activity == t:
        new_v += 5 * (2 + bonus)
        new_orig_v += 5 * (2 + bonus)
      if current_evening_activity == t:
        new_v += 5 * (2 + bonus)
        new_orig_v += 5 * (2 + bonus)

      ui.button(style='hbox', clicked=mod_skillpage_setskill(t))
      ui.hbox(xpos=10)
      ui.fixed(ymaximum=16,xmaximum=stat_caption_width)

      if new_orig_v > orig_v and orig_v >= 100:
        # stat is full but we're studying it anyway => red
        color='#f00'
      elif new_orig_v > orig_v:
        # stat is *not* full and we're studying it => blue
        color = '#80C0ff'
      elif v > orig_v:
        # Not studying it but wearing the costume => green
        color='#0f0'
      else:
        color = '#fff'
      ui.text(t,style=style.statstext, color=color)

      v = min(v, 100)
      orig_v = min(orig_v, 100)
      new_v = min(new_v, 100)
      new_orig_v = min(new_orig_v, 100)

      p = '%.1f' % (new_v, )
      if new_v >= 100:
        p = '100'
      elif new_v >= 99.9:
        p = '99.9'
      ui.text(p,xpos=stat_caption_width,xanchor=1.,style=style.statsnum,color=color)
      ui.close()
      ui.null(width=8)

      # Time for mad image composition
      image = []
      # Empty border without any bar inside
      image.extend([(0, 0), im.Crop('ui/bar-right.png', 0, 0, 107, 16)])
      # Current length of the bar
      length = 0
      if orig_v >= 1:
        if orig_v >= 100:
          # Skill maxed out, light green bar
          image.extend([(4, 3), im.MatrixColor(im.Crop('ui/bar-left.png', 4, 3, 100, 9), im.matrix.hue(90))])
        else:
          # Not maxed, yellow bar for what we have right now
          image.extend([(4, 3), im.Crop('ui/bar-left.png', 4, 3, int(orig_v), 9)])
        length += int(orig_v)
      if new_orig_v - length >= 1:
        # Blue bar for what we're about to learn
        image.extend([(length + 4, 3), im.MatrixColor(im.Crop('ui/bar-left.png', 4, 3, int(new_orig_v - length), 9), im.matrix.hue(180))])
        length += int(new_orig_v - length)
      if new_v - length >= 1:
        # Green bar for what the outfit bonus will get us
        image.extend([(length + 4, 3), im.MatrixColor(im.Crop('ui/bar-left.png', 4, 3, int(new_v - length), 9), im.matrix.tint(0, 1.0, 0))])
      ui.image(im.Composite((107, 16), *image))
      ui.close()

    # The original draw_subgroup except we need to pass the tiny skill family bonus on
    def mod_skillpage_drawsubgroup(family_bonus, title, bonus, t1, v1, o1, t2, v2, o2, t3, v3, o3):
      ui.fixed(ymaximum=16,xmaximum=200)
      ui.hbox()
      ui.text(title,style=style.statstext)
      if outfit_for_statgroup.get(title,'')==current_outfit:
        ui.text('*',color='#5f5')
      ui.close()
      if bonus>=0:
        ui.text("+ %.2f"%bonus, style=style.statsnum,xalign=1.)
      else:
        ui.text("- %.2f"%-bonus, style=style.statsnum,xalign=1.,color='#f80')
      ui.close()
      mod_skillpage_drawstatbox(family_bonus + bonus, t1,v1,o1)
      mod_skillpage_drawstatbox(family_bonus + bonus, t2,v2,o2)
      mod_skillpage_drawstatbox(family_bonus + bonus, t3,v3,o3)

    # The original draw_stats with some modifications, to draw the field for the selected skills and the "Okay" button
    def mod_skillpage_drawstats():
      ui.window(background=Frame(im.MatrixColor('ui/buttpurple.png',im.matrix.brightness(-.2)),20,20),xmaximum=270,xpos=764,xanchor=.5,ypos=20,yanchor=.5,xminimum=25,yminimum=25)
      ui.text("Current mood: "+mood,style=style.statstext, xalign=.5, xminimum=40, xmaximum=300)
      global stat_caption_width
      stat_caption_width = 152
      ui.vbox(xpos=10,ypos=10)
      spacing = 15
      draw_statgroup_head('Social',social_bonus)
      mod_skillpage_drawsubgroup(social_bonus, 'Royal Demeanor',royal_demeanor_bonus,
          'Composure',composure,composure_,
          'Elegance',elegance,elegance_,
          'Presence',presence,presence_)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(social_bonus, 'Conversation',conversation_bonus,
          'Public Speaking',public_speaking,public_speaking_,
          'Court Manners',court_manners,court_manners_,
          'Flattery',flattery,flattery_)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(social_bonus, 'Expression',expression_bonus,
          'Decoration',decoration,decoration_,
          'Instrument',instrument,instrument_,
          'Voice',voice_skill,voice_skill_,)
      ui.close()
      ui.vbox(xpos=10,ypos=270)
      draw_statgroup_head('Physical',physical_bonus)
      mod_skillpage_drawsubgroup(physical_bonus, 'Agility',agility_bonus,
          'Dance',dance,dance_,
          'Reflexes',reflexes,reflexes_,
          'Flexibility',flexibility,flexibility_,)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(physical_bonus, 'Weapons',weapons_bonus,
          'Swords',swords,swords_,
          'Archery',archery,archery_,
          'Polearms',polearms,polearms_,)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(physical_bonus, 'Athletics',athletics_bonus,
          'Running',running,running_,
          'Climbing',climbing,climbing_,
          'Swimming',swimming,swimming_,)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(physical_bonus, 'Animal Handling', animal_handling_bonus,
          'Horses',horses,horses_,
          'Dogs',dogs,dogs_,
          'Falcons',falcons,falcons_,)
      ui.close()
      stat_caption_width = 182
      ui.vbox(xpos=305,ypos=8)
      draw_statgroup_head('Intellectual',intellectual_bonus)
      mod_skillpage_drawsubgroup(intellectual_bonus, 'History',history_bonus,
          'Novan History',novan_history,novan_history_,
          'Foreign Affairs',foreign_affairs,foreign_affairs_,
          'World History',world_history,world_history_)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(intellectual_bonus, 'Intrigue',intrigue_bonus,
          'Internal Affairs',internal_affairs,internal_affairs_,
          'Foreign Intelligence',foreign_intelligence,foreign_intelligence_,
          'Ciphering',ciphering,ciphering_)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(intellectual_bonus, 'Medicine', medicine_bonus,
          'Herbs',herbs,herbs_,
          'Battlefield Medicine',battlefield_medicine,battlefield_medicine_,
          'Poison',poison,poison_)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(intellectual_bonus, 'Economics',economics_bonus,
          'Accounting',accounting,accounting_,
          'Trade',trade,trade_,
          'Production',production,production_)
      ui.null(height=spacing)
      mod_skillpage_drawsubgroup(intellectual_bonus, 'Military',military_bonus,
          'Strategy',strategy,strategy_,
          'Naval Strategy',naval_strategy,naval_strategy_,
          'Logistics',logistics,logistics_,)
      ui.close()
      ui.vbox(xpos=305,ypos=428)
      draw_statgroup_head('Mystical',mystical_bonus)
      mod_skillpage_drawsubgroup(mystical_bonus, 'Faith',faith_bonus,
          'Meditation',meditation,meditation_,
          'Divination',divination,divination_,
          'Lore',lore,lore_)
      if lumen_unlocked:
        ui.null(height=spacing)
        mod_skillpage_drawsubgroup(mystical_bonus, 'Lumen',lumen_bonus,
            'Sense Magic',sense_magic,sense_magic_,
            'Resist Magic',resist_magic,resist_magic_,
            'Wield Magic',wield_magic,wield_magic_,)
      ui.close()

      ui.window(xpos=660,ypos=428,xminimum=50, xmaximum=215, yminimum=165, style=style.roundrect)
      ui.vbox(xpos=20)
      ui.text('Morning class',style=style.statstext,xalign=.5)
      ui.textbutton(current_morning_activity,clicked=mod_skillpage_delskill(morning=True),style=style.buttonwhite,yminimum=50,ymaximum=50,xminimum=160,xmaximum=160)
      ui.text('Evening class',style=style.statstext,xalign=.5)
      ui.textbutton(current_evening_activity,clicked=mod_skillpage_delskill(evening=True),style=style.buttonwhite,yminimum=50,ymaximum=50,xminimum=160,xmaximum=160)
      ui.close()
      if current_evening_activity and current_morning_activity:
        ui.textbutton('Done',clicked=starts_week,ypos=590,yanchor=1.,xpos=1024,xanchor=1.)
      else:
        ui.textbutton('Done',
            background=Frame('ui/button-disabled.png',53,24),
            hover_background=Frame('ui/button-disabled.png',53,24),
            clicked=classes_required_tooltip,
            ypos=590,yanchor=1.,xpos=1024,xanchor=1.)

label mod_skillpage_skillspage:
    scene statsbg
    call show_calendar
    pass
    hide screen moods
    hide screen log
    show statsbackdrop
    python:
        start_week = False
        mod_skillpage_drawstats()
        draw_sidebar(skills='room_nofade')
        ui.interact()
    if start_week:
        jump start_week
    jump mod_skillpage_skillspage

Ohana
Posts: 13
Joined: Sat Dec 21, 2013 11:16 am

Re: Mod: Studying from the Skills page

#2 Postby Ohana » Mon Jan 20, 2014 8:03 am

Good concept, but I would prefer the opposite approach...the class selection screen is pretty uncluttered in comparison to that one, so altering that to show current bonuses and skill levels would be a nicer effect and have less tendency for information overload than that screen has.

For example, since the mood bonuses/penalties apply to entire categories of skills, you could have + ++ - or -- next to the categories that are affected, then as each category is selected, the specific skills can have their current level next to the skill name to prevent accidentally taking something past 50 prematurely. It would be a HUGE UI improvement while still leaving the breakdown page available in case you need a more detailed reference.

You could also put the exact bonuses next to every skill category that is not zero but that might look a little cluttered later in the game when your training makes almost every category have some bonus or penalty of some kind.

EDIT: Oh, and excellent find on that override function...that SEVERELY simplifies any clean modding efforts!

Trimead
Posts: 4
Joined: Wed Jan 29, 2014 12:40 pm

Re: Mod: Studying from the Skills page

#3 Postby Trimead » Wed Jan 29, 2014 1:34 pm

Ohana wrote:Good concept, but I would prefer the opposite approach...the class selection screen is pretty uncluttered in comparison to that one, so altering that to show current bonuses and skill levels would be a nicer effect and have less tendency for information overload than that screen has.

For example, since the mood bonuses/penalties apply to entire categories of skills, you could have + ++ - or -- next to the categories that are affected, then as each category is selected, the specific skills can have their current level next to the skill name to prevent accidentally taking something past 50 prematurely. It would be a HUGE UI improvement while still leaving the breakdown page available in case you need a more detailed reference.

You could also put the exact bonuses next to every skill category that is not zero but that might look a little cluttered later in the game when your training makes almost every category have some bonus or penalty of some kind.

EDIT: Oh, and excellent find on that override function...that SEVERELY simplifies any clean modding efforts!


how do i +1 this post? oh well. What this guy said^^^^.

also it would be nice to actually be useful at the start the game rather then having 0 in EVERYTHING. how about 25 points in the harder to obtain skills like presence and meditation?

Edit: Also something not mentioned by Ohana but is still a good idea; you could basically change a portion of the tab to a different color and match it the the same progress bar from the skills tree. and virtually eliminate the need for a skills tab =D

SET
Posts: 22
Joined: Sat Dec 28, 2013 9:59 pm

Re: Mod: Studying from the Skills page

#4 Postby SET » Thu Jan 30, 2014 12:24 am

Doing it the other way round never occurred to me. My usual play style was:
1. Stare intensively at Skills page
2. Decide what skills to train
3. Go to Classes page
4. Select first class
5. Go back to Skills page because I already forgot the second skill I planned to learn
6. Go back to Classes page to actually select the second skill

But I'm not sure I actually understand what kind of data you wanted to see where exactly on the Classes page. Can you take a screenshot and scribble in the data you want to have there? Maybe it's doable, not sure right now.

Trimead
Posts: 4
Joined: Wed Jan 29, 2014 12:40 pm

Re: Mod: Studying from the Skills page

#5 Postby Trimead » Thu Jan 30, 2014 1:56 am

SET wrote:Doing it the other way round never occurred to me. My usual play style was:
1. Stare intensively at Skills page
2. Decide what skills to train
3. Go to Classes page
4. Select first class
5. Go back to Skills page because I already forgot the second skill I planned to learn
6. Go back to Classes page to actually select the second skill

But I'm not sure I actually understand what kind of data you wanted to see where exactly on the Classes page. Can you take a screenshot and scribble in the data you want to have there? Maybe it's doable, not sure right now.


http://imgur.com/ND97WZy

i hope this helps / works. :3


Return to “Modding and other Messing Around”

Who is online

Users browsing this forum: No registered users and 1 guest