Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Level Cap  (Read 2146 times)

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Level Cap
« on: April 28, 2014, 05:24:27 PM »

Is there currently a way to set a hard level cap in the LevelupPlugin? Or at least a way to simulate it by cutting off point earning past a certain level?

My skills system would be totally broken without one :P
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Level Cap
« Reply #1 on: April 28, 2014, 05:54:34 PM »

Easy kludge: just set the next level of experience to something absurd.

Slightly harder: write your own FleetInteractionDialog and cut off experience if character level > blah.

Logged
Please check out my SS projects :)
Xeno's Mod Pack

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Level Cap
« Reply #2 on: April 28, 2014, 06:40:34 PM »

I don't suppose there is a tutorial for the second one? 

I am sort of, er, learning coding as I go...  ::)
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Level Cap
« Reply #3 on: April 28, 2014, 10:33:17 PM »

No, but there are multiple examples to read through; at least three mods have custom Dialogs and Vacuum has an example of how to manipulate the experience system :)

That said... if you're still new to Java, I think you'd be happier trying to build the kludge method first.  It's not perfect, since theoretically, somebody might actually get to the next level, but it's incredibly unlikely, and it's the simplest way to implement a hard level cap.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Level Cap
« Reply #4 on: April 28, 2014, 10:53:15 PM »

Perhaps the kludge is better too, as you might have XP added from sources other than fleet battles :)

In fact, perhaps the best approach is if the LevelUpPlugin interface had a method for AddXP(int xpAmount) (or similar) that you could then use to implement your own XP add. Obvious use case here is to not add anything once a certain level is hit. Perhaps this should be suggested in the API request thread?
Logged

Okim

  • Admiral
  • *****
  • Posts: 2161
    • View Profile
    • Okim`s Modelling stuff
Re: Level Cap
« Reply #5 on: April 29, 2014, 02:38:44 AM »

Force first two functions in LevelupPluginImpl.java to return 0 when reaching your specific level. You`ll get new levels, but you wont get any aptitude and skill points.

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Level Cap
« Reply #6 on: May 06, 2014, 01:48:57 PM »

Lots of ways to do this I see. Thanks for the help everyone!

I'll probably just have no skill points added after level 30. Seems to be the easiest way to account for everything that could happen experience-wise.
Logged