RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Resolved] Auto-Calculated XP

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 90
I want to make the XP gained from battle be automatically calculated from the difficulty of the enemy. I'm already doing this but it's quite tedious to calculate and enter the XP myself, especially while I do balance testing for my game (Adjust one stat, and the XP changes - or adjust the XP equation and have to redo every monster!).

The problem is not so much a lack of ability (this is pretty much just inserting some simple arithmetic...) but I can't seem to locate the part of the base RMXP code where the XP is given to the party at the end of a battle...

Edit: I seem to have found it; however I am still slightly mystified... So far I have:
Code: [Select]
# Add EXP and amount of gold obtained
exp += (enemy.exp + (enemy.str + enemy.dex + enemy.agi + enemy.int + )

I want to use the exp as bonus XP, for monsters with special abilities that might make them more difficult than their base stats suggest. But I want the equation to be the average of the sum of the monsters ten base stats.
« Last Edit: December 13, 2009, 05:14:54 PM by Zethzune »
My strength is that of ten men, for I am wired to the eyeballs on espresso!

****
Rep:
Level 83
mabey this helps?
Try looking at Blizz's Tons of add ons
http://forum.chaos-project.com/index.php?topic=105.0
i think in part 2 under "Different Difficulties"
to see how he made his changes...
Spoiler for:
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com


**
Rep:
Level 83
Detective Scrotes
I want to use the exp as bonus XP, for monsters with special abilities that might make them more difficult than their base stats suggest. But I want the equation to be the average of the sum of the monsters ten base stats.

Isn't that what you were doing in the code you have there? I'm not really sure what you need to know :P.

**
Rep: +0/-0Level 90
Yes, I seem to have figured it out myself. :lol:
I ended up adding auto-calculated gold too.

Here's my completed code for anyone trying to do the same - You might have to edit the multiplier at the end to better suit your game's balance and XP scale. Replace "start_phase5" in Scene_Battle2 to add it.
Code: [Select]
  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
    autoexp = 0
    gold = 0
    autogold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add amount of experience obtained
        autoexp = ((enemy.maxhp + enemy.maxsp + enemy.str + enemy.dex + enemy.agi + enemy.int + enemy.atk + enemy.pdef + enemy.mdef + enemy.eva)*0.04).floor
        exp += (enemy.exp + autoexp)
        #Add amount of gold obtained
        if gold > 0
          autogold = (rand(enemy.gold) + enemy.gold)
          gold += (enemy.gold + autogold)
        else
          gold += 0
        end
        # 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
My strength is that of ten men, for I am wired to the eyeballs on espresso!