Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Level System Script

Hi, i was wondering if anyone was willing to throw a script together for me. I would like to be able to click on an object, that object gives you exp (in a script) when you reach a certain exp you get a level(using script). This is for Mining, Smithing, etc... I dont mind what the Basis and Inflation is at as long as i can set it, Hope this is possible.
 

sarana

Member

I don't think you need a script. You could have two variables, exp and level, and have items add to the exp variable, then check if exp is equal to 100, if yes, make exp equal to 0 and add one to level. If you have to be a certain level to do something, then put a conditional branch to check if the variable is high enough.
 
Ok, you guys know how to get the exp of a character ruby uses:
Code:
  #-----------------------------------------------------------------------
  # * Calculate EXP
  #-----------------------------------------------------------------------
  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    pow_i = 2.4 + actor.exp_inflation / 100.0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
        @exp_list[i] = @exp_list[i-1] + Integer(n)
      end
    end
  end
It sets up a Basis and Inflation. I can't find away to tweak this into exp that forms levels alone to my fitting, but i think this is on the right track, anyone see what im looking for?
 
You could use Mr.Mo's mouse input script if you want to use mouse. And then for adding exp you can use this code
Code:
$game_party.actors[i].exp += amount of exp you want to gain

Where "i" is the position of the hero in your party,starting from 0.
 
Hmmm would you please clarify what are exp and level here? Is it HERO's exp and level or the SKILL exp and level? I'm kinda confuse ^ ^;;

But still, if you need to use mouse, you still have to use Mr.Mo script. I think it's in this forum somewhere :)
 
Ill check it out then, i was going to use seth's but there is just a chain of glitches i seem to be getting.
But the level will be for skills, i think i managed to replicate it but it is a loooong version:
Code:
  def mining_conversion(n)
    @mining_exp += n
    @exp = @mining_exp
    if @exp <= 82
      @level = 1
    elsif @exp <= 173
      @level = 2
    elsif @exp <= 275
      @level = 3
    elsif @exp <= 387
      @level = 4
    elsif @exp <= 511
      @level = 5
    elsif @exp <= 649
      @level = 6
    elsif @exp <= 800
      @level = 7
    elsif @exp <= 968
      @level = 8
    elsif @exp <= 1153
      @level = 9
    elsif @exp <= 1357
      @level = 10
    elsif @exp <= 1583
      @level = 11
    elsif @exp <= 1832
      @level = 12
    elsif @exp <= 2106
      @level = 13
    elsif @exp <= 2410
      @level = 14
    elsif @exp <= 2745
      @level = 15
    elsif @exp <= 3114
      @level = 16
    elsif @exp <= 3522
      @level = 17
    elsif @exp <= 3972
      @level = 18
    elsif @exp <= 4469
      @level = 19
    elsif @exp <= 5017
      @level = 20
    elsif @exp <= 5623
      @level = 21
    elsif @exp <= 6290
      @level = 22
    elsif @exp <= 7028
      @level = 23
    elsif @exp <= 7841
      @level = 24
    elsif @exp <= 8739
      @level = 25
    elsif @exp <= 9729
      @level = 26
    elsif @exp <= 10823
      @level = 27
    elsif @exp <= 12030
      @level = 28
    elsif @exp <= 13362
      @level = 29
    elsif @exp <= 14832
      @level = 30
    elsif @exp <= 16455
      @level = 31
    elsif @exp <= 18246
      @level = 32
    elsif @exp <= 20223
      @level = 33
    elsif @exp <= 22405
      @level = 34
    elsif @exp <= 24814
      @level = 35
    elsif @exp <= 27472
      @level = 36
    elsif @exp <= 30407
      @level = 37
    elsif @exp <= 33647
      @level = 38
    elsif @exp <= 37223
      @level = 39
    elsif @exp <= 41170
      @level = 40
    elsif @exp <= 45528
      @level = 41
    elsif @exp <= 50338
      @level = 42
    elsif @exp <= 55648
      @level = 43
    elsif @exp <= 61511
      @level = 44
    elsif @exp <= 67982
      @level = 45
    elsif @exp <= 75126
      @level = 46
    elsif @exp <= 83013
      @level = 47
    elsif @exp <= 91720
      @level = 48
    elsif @exp <= 101332
      @level = 49
    elsif @exp <= 111944
      @level = 50
    elsif @exp <= 123659
      @level = 51
    elsif @exp <= 136593
      @level = 52
    elsif @exp <= 150871
      @level = 53
    elsif @exp <= 166635
      @level = 54
    elsif @exp <= 184039
      @level = 55
    elsif @exp <= 203253
      @level = 56
    elsif @exp <= 224465
      @level = 57
    elsif @exp <= 247885
      @level = 58
    elsif @exp <= 273741
      @level = 59
    elsif @exp <= 302287
      @level = 60
    elsif @exp <= 333803
      @level = 61
    elsif @exp <= 368598
      @level = 62
    elsif @exp <= 407014
      @level = 63
    elsif @exp <= 449427
      @level = 64
    elsif @exp <= 496253
      @level = 65
    elsif @exp <= 547952
      @level = 66
    elsif @exp <= 605031
      @level = 67
    elsif @exp <= 668050
      @level = 68
    elsif @exp <= 737626
      @level = 69
    elsif @exp <= 814444
      @level = 70
    elsif @exp <= 899256
      @level = 71
    elsif @exp <= 992894
      @level = 72
    elsif @exp <= 1096277
      @level = 73
    elsif @exp <= 1210420
      @level = 74
    elsif @exp <= 1336442
      @level = 75
    elsif @exp <= 1475580
      @level = 76
    elsif @exp <= 1629199
      @level = 77
    elsif @exp <= 1798807
      @level = 78
    elsif @exp <= 1986067
      @level = 79
    elsif @exp <= 2192817
      @level = 80
    elsif @exp <= 2421086
      @level = 81
    elsif @exp <= 2673113
      @level = 82
    elsif @exp <= 2951372
      @level = 83
    elsif @exp <= 3258593
      @level = 84
    elsif @exp <= 3597791
      @level = 85
    elsif @exp <= 3972293
      @level = 86
    elsif @exp <= 4385775
      @level = 87
    elsif @exp <= 4842294
      @level = 88
    elsif @exp <= 5346331
      @level = 89
    elsif @exp <= 5902830
      @level = 90
    elsif @exp <= 6517252
      @level = 91
    elsif @exp <= 7195628
      @level = 92
    elsif @exp <= 7944613
      @level = 93
    elsif @exp <= 8771557
      @level = 94
    elsif @exp <= 9684576
      @level = 95
    elsif @exp <= 10692628
      @level = 96
    elsif @exp <= 11805605
      @level = 97
    elsif @exp <= 13034430
      @level = 98
    else @exp >= 13034431
      @level = 99
    end
    @mining_level = @level
  end

See what i mean? Also when the player gains a level, i can't find a way to show something happen, like a message popping up saying he did.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top