[RESOLVED(I think)]Help me out with this if you could...

Started by Satoh, October 21, 2008, 09:13:17 pm

Previous topic - Next topic

Satoh

OK, so as is in my request thread, I'm trying to get a custom EXP distribution system... but rather than wait indefinitely for someone to simply say they don't have time...(as I assume would be my best case reply... being a pessimist) I decided to at least attempt it...

Here's what I have so far...

  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
class Scene_Battle
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold
        # Determine if treasure appears
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Determine the EXP to use in the exp variable above
  #--------------------------------------------------------------------------
  def satoh_level_exp(result)
    s_lvl = enemy.exp - actor.level #compare the Enemy Level(EXP field)
          #with the actor's current level
    s_exp = 0 #initialize
#    for enemy in $game_troop.enemies #not sure if I need this...
    case s_lvl #is this correct syntax?
    when s_lvl >= 10 #when the player lvl is 10+ less than the enemy level...
      s_exp = 520
    when s_lvl = 9
      s_exp = 430
    when s_lvl = 8
      s_exp = 350
    when s_lvl = 7
      s_exp = 280
    when s_lvl = 6
      s_exp = 220
    when s_lvl = 5
      s_exp = 170
    when s_lvl = 4
      s_exp = 130
    when s_lvl = 3
      s_exp = 100
    when s_lvl = 2
      s_exp = 80
    when s_lvl = 1
      s_exp = 70
    when s_lvl = 0
      s_exp = 60
    when s_lvl = -1 #Can RGSS deal with negatives?
      s_exp = 50
    when s_lvl = -2
      s_exp = 40
    when s_lvl = -3
      s_exp = 28
    when s_lvl = -4
      s_exp = 13
    when s_lvl = -5
      s_exp = 8
    when s_lvl = -6
      s_exp = 6
    when s_lvl = -7
      s_exp = 4
    when s_lvl = -8
      s_exp = 3
    when s_lvl = -9
      s_exp = 2
    when s_lvl <= -10
      s_exp = 1
    end


I intend to replace the Phase 5 script of Scene_Battle
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

What kind of system do you need anyway? You should explain it a bit better than just in code.

Also, that code would give syntax errors because the case clause only allows direct comparisons with value similarry to C, C++ or other languages. You'll have to use if-elsif-else branches to compare the values. It is possible to check ranges, though, since case doesn't work with the == operator but with the === operator. Comparing a number to a range with === is equivalent to checking if the number is in the range. In your case a case clause would actually work if you structured it like this:

    case s_lvl
    when 10..100000 # depending on the highest difference possible, let's say it's 100000
      s_exp = 520
    when 9
      s_exp = 430
    when 8
      s_exp = 350
    when 7
      s_exp = 280
    when 6
      s_exp = 220
    when 5
      s_exp = 170
    when 4
      s_exp = 130
    when 3
      s_exp = 100
    when 2
      s_exp = 80
    when 1
      s_exp = 70
    when 0
      s_exp = 60
    when -1
      s_exp = 50
    when -2
      s_exp = 40
    when -3
      s_exp = 28
    when -4
      s_exp = 13
    when -5
      s_exp = 8
    when -6
      s_exp = 6
    when -7
      s_exp = 4
    when -8
      s_exp = 3
    when -9
      s_exp = 2
    when -100000..-10 # again, -100000 is the max difference
      s_exp = 1
    end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

Beauty, mate! Thanks for cleaning up the case statement...

What I essentially want is for the s_exp variable to be the "(result)" of "satoh_level_exp" then I will replace

for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold


with this(or something like it)

for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += satoh_level_exp(result) #satoh_level_exp(s_exp) ?
        gold += enemy.gold
       


This is intended to give the character an exp amount = to whatever s_exp is after the comparison is finished...

However, when I try it as is listed above it throws up generic "error on line ___" messages when I win a battle....(during the EXP gain portion, obviously)
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

October 22, 2008, 07:53:39 am #3 Last Edit: October 22, 2008, 12:04:48 pm by Blizzard
Hm... "result" is irrelevant for the EXP calculation. Also, this piece of code sums up all the EXP from all enemies so I don't think you need to edit that one. Instead edit the part where the actors get the EXP added:

    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp


Change it to:

    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += satoh_level_exp(actor, exp)


And you should edit your method to support the new parameters:

  def satoh_level_exp(actor, exp)
    s_lvl = exp - actor.level #compare the Enemy Level(EXP field)
          #with the actor's current level


The rest seems fine to me except that you have something missing at the bottom of you code:

    return s_lvl
  end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

October 22, 2008, 10:37:20 am #4 Last Edit: October 22, 2008, 10:48:43 am by Satoh
Quote from: Blizzard on October 22, 2008, 07:53:39 am
Hm... "result" is irrelevant for the EXP calculation. Also, this piece of code sums up all the EXP from all enemies so I don't think you need to edit that one. Instead edit the part where the actors get the EXP added:

    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp[code]

Change it to:

[code]    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += satoh_level_exp(actor, exp)[code]

And you should edit your method to support the new parameters:

[code]  def satoh_level_exp(actor, exp)
    s_lvl = exp - actor.level #compare the Enemy Level(EXP field)
          #with the actor's current level


The rest seems fine to me except that you have something missing at the bottom of you code:

    return s_lvl
  end



Ok, If I'm reading your code correctly, then that would only allow for a maximum if 520 exp, even if multiple enemies are killed.. right?

the reason I was modifying "exp" earlier is because I want it to add a biased amount of EXP per every monster killed, based on that monster's EXP field and the current actor's Level, and do it for each character individually....

Ok, so I tried redefining the method with (actor, exp) but upon finishing a battle I get an error stating
---------------------------
Project3
---------------------------
Script 'EXP_Variation' line 21: NameError occurred.

undefined local variable or method `actor' for #<Scene_Battle:0x3afdc50>
---------------------------
OK   
---------------------------


I get similar messages whenever I try to use 'alias', but for now I'm only concerned with the aforementioned.[/code][/code][/code][/code]



EDIT: Ok I've got it to add exp properly...--but! it only works with one enemy, even if I kill 2 enemies, I only get exp for one of them.

Also I think I've neglected the exp display... it only displays the exp field of the enemy (which I'm using for the enemy's level)
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

For every enemy? Try this instead of the 2nd code I gave you:

    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        for enemy in $game_troop.enemies
          actor.exp += satoh_level_exp(actor, enemy.exp)
        end


This should add the EXP of each enemy properly. You won't be able to display it properly, because it's dynamic for every actor. I suggest that you use my Easy LvlUp Notifier as it support separate EXP display for each party member.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

Ah! now it works, thanks for the help.

Now that you mention it, I was planning on using the Level-up Notifier... I had forgotten about it...

the next thing I need to do is set up the To-Next-Level to be exactly 1000exp to each new level...

I'm not sure where to access that yet but I'm gonna look around for it...

After I get it working for the default version I'll try to modify it for Blizz-ABS...
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

Lol! The default Notifier doesn't work with Blizz-ABS. You'll have to modify it either way. xD Good luck with that. There are some people that would appreciate a version for Blizz-ABS since I am not going to make one.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

October 22, 2008, 12:41:50 pm #8 Last Edit: October 22, 2008, 01:21:00 pm by Satoh
I meant I'll make a version of the exp script for Blizz-ABS...

If I can figure out the notifier I'll do that too though, since you mention it...

EDIT:

Ok, here's what I tried...

class Game_Actor < Game_Battler
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= 1000
      @level += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
end


the results were... less than what was desired... it basically just caused a crash... no error message, nothing...

Probably because I had it set to be a constant... perhaps I'll have to rewrite the entire level-up script...

What I want is for the player to gain 1000+ exp and level up, then, the exp is set back to 0+ anything over 1000 and it starts over from there till the next time the exp >= 1000...

however, the default script seems to use a list that determines level by total cumulative exp... Am I right?

When you made BlizzABS, did you make a new level-up script for it?
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

No, I didn't. Blizz-ABS uses a majority of the alread present system to ensure compatibility with other systems. IDK why your code crashes. BTW, somebody askes me once for a custom EXP list here on the forum. Try the search button, you might be able to find the topic. It was the same thing you wanted with resetting the EXP. He only wanted it to be 100 EXP, not 1000. As I said, try the search function, you should be able to find it quickly.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

Well, I didn't find the script, but I think I managed to get what I want...

Do you see any potential flaws in this?
class Game_Actor < Game_Battler
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= 1000
      @level += 1
      @exp -= 1000
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
  end
end


It seems to work correctly in the test play so I think it may be done...
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

ok, I'm sorry to ask this, after I thought it was finished, but can you make a demo game and test this, I can't seem to get the menu to open...

  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
class Scene_Battle
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold
        # Determine if treasure appears
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
        for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        for enemy in $game_troop.enemies
          actor.exp += satoh_level_exp(actor, enemy.exp)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Determine the EXP to use in the exp variable above
  #--------------------------------------------------------------------------
=begin
With this script, Enemy level is determined by the Enemy Exp Field in the
Database. For best results, the Enemy Lvl/EXP field should be limited to
the same number as character level, and should be determined by relative
difficulty of slaughter.
If the enemy is one that a Lvl 7 player would face, the Enemy Lvl/EXP field
should be listed at somewhere between 6 and 8... The basic idea is that players
are given massive ammounts of experience for killing things more powerful
than themselves, but are given meager EXP for beating up weaklings...
Boss monsters should be set a level or maybe 2 levels above that of the rest
of the enemies on the map.
***NOTE***
This system is designed to work with a non-evolving levelup system; IE: a
system where 1000 exp will lvl you up from 1 to 2, and 1000 exp will lvl
you from 98 to 99. The to-next-level amount should NEVER increase in this system.
=end
  def satoh_level_exp(actor, exp)
    s_lvl = exp - actor.level #compare the Enemy Level(EXP field)
          #with the actor's current level
    s_exp = 0
#    for enemy in $game_troop.enemies #not sure if I need this...
        case s_lvl
    when 10..100000 # depending on the highest difference possible, let's say it's 100000
      s_exp = 520
    when 9
      s_exp = 430
    when 8
      s_exp = 350
    when 7
      s_exp = 280
    when 6
      s_exp = 220
    when 5
      s_exp = 170
    when 4
      s_exp = 130
    when 3
      s_exp = 100
    when 2
      s_exp = 80
    when 1
      s_exp = 70
    when 0
      s_exp = 60
    when -1
      s_exp = 50
    when -2
      s_exp = 40
    when -3
      s_exp = 28
    when -4
      s_exp = 13
    when -5
      s_exp = 8
    when -6
      s_exp = 6
    when -7
      s_exp = 4
    when -8
      s_exp = 3
    when -9
      s_exp = 2
    when -100000..-10 # again, -100000 is the max difference
      s_exp = 1
    end
  return s_exp
end
end
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    actor = $data_actors[actor_id]
    @actor_id = actor_id
    @name = actor.name
    @character_name = actor.character_name
    @character_hue = actor.character_hue
    @battler_name = actor.battler_name
    @battler_hue = actor.battler_hue
    @class_id = actor.class_id
    @weapon_id = actor.weapon_id
    @armor1_id = actor.armor1_id
    @armor2_id = actor.armor2_id
    @armor3_id = actor.armor3_id
    @armor4_id = actor.armor4_id
    @level = actor.initial_level
    @exp_list = Array.new(101)
    make_exp_list
    @exp = 0#@exp_list[@level]
    @skills = []
    @hp = maxhp
    @sp = maxsp
    @states = []
    @states_turn = {}
    @maxhp_plus = 0
    @maxsp_plus = 0
    @str_plus = 0
    @dex_plus = 0
    @agi_plus = 0
    @int_plus = 0
    # Learn skill
    for i in 1..@level
      for j in $data_classes[@class_id].learnings
        if j.level == i
          learn_skill(j.skill_id)
        end
      end
    end
    # Update auto state
    update_auto_state(nil, $data_armors[@armor1_id])
    update_auto_state(nil, $data_armors[@armor2_id])
    update_auto_state(nil, $data_armors[@armor3_id])
    update_auto_state(nil, $data_armors[@armor4_id])
  end
  #--------------------------------------------------------------------------
  # * Calculate EXP
  #--------------------------------------------------------------------------
=begin
This is to prevent character not starting at Lvl 1 from having an EXP boost.
=end
  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    pow_i = 0#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
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
=begin
Ok, this portion of the script rewrites the Level-up process. Now, anytime you
gain 1000 or more exp you gain a level. Then 1000 exp is subtracted from that
and any leftover exp is saved for your next level.
EXAMPLE:
Markus gains 1040 exp.
Markus levels up once and 1000 is subtracted.
Markus has 40 saved, and only needs 960 for his next level.
=end
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= 1000
      @level += 1
      @exp -= 1000
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
  end
end
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

@exp_list is an array of data. You have only initialized the first (actually second, indices start from 0) value. Use this make_exp_list method and it will work fine.

  def make_exp_list
    actor = $data_actors[@actor_id]
    for i in 2..100
      @exp_list[i] = 1000
    end
  end


I set the value to 1000 because every level needs 1000 EXP. Usually it would be an exponential function where the value of each element in the array would be bigger than the preceeding one. Since you are always subtracting EXP, each value should be 1000.

You will notice that the "Level Up!" display in the status window doesn't work right. My Easy LvlUp Notifier should have no problem with this. And even if it has, Blizz-ABS will not.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

October 22, 2008, 06:36:09 pm #14 Last Edit: October 22, 2008, 06:43:26 pm by Satoh
Awesome, I'll try it out now.

If I understand you, you're saying that it shouldn't interfere with blizz-abs as is?

EDIT: ok now I'm getting ridiculous and confusing errors....(which I've been getting every time I change anything...)
 
Script 'Game_Actor' line 341: NoMethodError occurred.

undefined method `>' for nil:NilClass



EDIT2: I get the error when I open the menu...

and this when I finish a battle


undefined method `+' for nil:NilClass


Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

October 22, 2008, 06:51:26 pm #15 Last Edit: October 22, 2008, 06:52:31 pm by Blizzard
Try removing this line:

actor = $data_actors[@actor_id]


I oversaw it, you don't need it.

You will only have to edit Blizz-ABS at the place where the EXP are calculated like you did in Scene_Battle. But that spot is easy to find. It's in the "remove_enemy" method.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

I've done everything you suggested and I'm getting this error after battles...

Script 'EXP_Variation' line 45: NoMethodError occurred.

undefined method `+' for nil:NilClass


Sorry to keep bothering you.... -_-;

I really appreciate the help...
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

Give me your full code once more and I will test it. I mean the same your are using right now.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Satoh

A direct copy and paste from the project itself...

  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
class Scene_Battle
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold
        # Determine if treasure appears
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
        for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        for enemy in $game_troop.enemies
          actor.exp += satoh_level_exp(actor, enemy.exp)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Determine the EXP to use in the exp variable above
  #--------------------------------------------------------------------------
=begin
With this script, Enemy level is determined by the Enemy Exp Field in the
Database. For best results, the Enemy Lvl/EXP field should be limited to
the same number as character level, and should be determined by relative
difficulty of slaughter.
If the enemy is one that a Lvl 7 player would face, the Enemy Lvl/EXP field
should be listed at somewhere between 6 and 8... The basic idea is that players
are given massive ammounts of experience for killing things more powerful
than themselves, but are given meager EXP for beating up weaklings...
Boss monsters should be set a level or maybe 2 levels above that of the rest
of the enemies on the map.
***NOTE***
This system is designed to work with a non-evolving levelup system; IE: a
system where 1000 exp will lvl you up from 1 to 2, and 1000 exp will lvl
you from 98 to 99. The to-next-level amount should NEVER increase in this system.
=end
  def satoh_level_exp(actor, exp)
    s_lvl = exp - actor.level #compare the Enemy Level(EXP field)
          #with the actor's current level
    s_exp = 0
#    for enemy in $game_troop.enemies #not sure if I need this...
        case s_lvl
    when 10..100000 # depending on the highest difference possible, let's say it's 100000
      s_exp = 520
    when 9
      s_exp = 430
    when 8
      s_exp = 350
    when 7
      s_exp = 280
    when 6
      s_exp = 220
    when 5
      s_exp = 170
    when 4
      s_exp = 130
    when 3
      s_exp = 100
    when 2
      s_exp = 80
    when 1
      s_exp = 70
    when 0
      s_exp = 60
    when -1
      s_exp = 50
    when -2
      s_exp = 40
    when -3
      s_exp = 28
    when -4
      s_exp = 13
    when -5
      s_exp = 8
    when -6
      s_exp = 6
    when -7
      s_exp = 4
    when -8
      s_exp = 3
    when -9
      s_exp = 2
    when -100000..-10 # again, -100000 is the max difference
      s_exp = 1
    end
  return s_exp
end
end
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  # * Calculate EXP
  #--------------------------------------------------------------------------
=begin
This is to prevent character not starting at Lvl 1 from having an EXP boost.
=end
class Game_Actor < Game_Battler
  def make_exp_list
    #actor = $data_actors[@actor_id]
    for i in 2..100
      @exp_list[i] = 1000
    end
  end
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
=begin
Ok, this portion of the script rewrites the Level-up process. Now, anytime you
gain 1000 or more exp you gain a level. Then 1000 exp is subtracted from that
and any leftover exp is saved for your next level.
EXAMPLE:
Markus gains 1040 exp.
Markus levels up once and 1000 is subtracted.
Markus has 40 saved, and only needs 960 for his next level.
=end
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= 1000
      @level += 1
      @exp -= 1000
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
  end
end


I have a party of lvl1 lvl9 lvl97 and another lvl 1

the enemy I'm fighting has 15 in the EXP field (as it stands for a level 15 monster)
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

Blizzard

This should solve all your problems. I also aliased that one method to initialize the EXP to 0 or it would be set to 1000, automatially leveling the character up if his starting level is not 1.

  def make_exp_list
    @exp_list[1] = 0
    for i in 2..100
      @exp_list[i] = 1000
    end
  end
 
  alias setup_satoh_expmod_aliased setup
  def setup(actor_id)
    setup_satoh_expmod_aliased(actor_id)
    @exp = 0
  end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.