UltimaForum

Wsparcie [XP] - %Exp

Yoroiookami - Sob 17 Kwi, 2010 13:04
Temat postu: %Exp
Idzie ustawić, żeby otrzymać x% expa w dowolnym momencie w grze? Jeżeli nie można tego zrobić w normalny sposób, to prosiłbym o skrypcik, lub inną pomoc. >_>
HESEE - Sob 17 Kwi, 2010 14:30

Po walce się dostaje expa.
A tak wogóle można ustawić w zdarzeniach.

Sabikku - Sob 17 Kwi, 2010 18:32

x% potrzebnych do następnego poziomu czy x% do osiągnięcia poziomu maksymalnego?
Rozwiązanie proste. Z matematyki.

Yoroiookami - Sob 17 Kwi, 2010 19:49

...x% expa od tego samego stwora, gdy się go pokona, zależne od obecnego poziomu i obecnego expa...nie chcę żeby bohater otrzymywał za stwory 20 expa, tylko 5% expa, tyle.
Ayene - Nie 18 Kwi, 2010 19:58

Yoroiookami, rozwiń to. Jak chcesz zróżnicować expa? Zależne od poziomu, ale w jakim stopniu? Jak 5 level to 95%, jak 10 to 90%? Najlepiej będzie, jak podasz działanie matematyczne, np. 100% - (level %)
Sabikku - Nie 18 Kwi, 2010 20:30

Wklej gdzieś nad main.
Spoiler:

Kod:
class Game_Actor < Game_Battler
  attr_reader :exp_list
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
  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
        # EDIT START
        actor.exp += exp*(actor.next_exp_s.to_i.to_f - actor.exp_list[actor.level])/100
        # EDIT END       
        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
end

class Window_BattleResult < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    x = 4
    self.contents.font.color = normal_color
    cx = contents.text_size(@exp.to_s).width
    # EDIT START
    self.contents.draw_text(x, 0, cx, 36, @exp.to_s+'%')
    # EDIT END
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size("EXP").width
    self.contents.draw_text(x, 0, 64, 32, "EXP")
    x += cx + 16
    self.contents.font.color = normal_color
    cx = contents.text_size(@gold.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
    y = 32
    for item in @treasures
      draw_item_name(item, 4, y)
      y += 32
    end
  end
end


Działać powinno tak jak napisałeś - postaci dostają x% exp potrzebnych od aktualnego do następnego levelu. X określasz tam, gdzie normalnie ustawiało się exp otrzymywany za wroga.


Powered by phpBB modified by Przemo © 2003 phpBB Group