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.

Element Mastery system

Here what i need,

You have the Element Fire, Water, Wind and Earth and they all start at lvl 1. At the end of each battle, you gain Element XP (1, 2 or maybe 3). When it reach 100 or maybe 200 (or higher), you gain an Element Lvl-up. When this happen, you have one point to place from one of the element available.

When a certain element reach a certain lvl, you gain a spell of that element. Let say the maximum lvl is 50.
I want it so that we can add or remove elements.

If needed of more info, i can try to put more.
Thank you in advance.
 
Random numbers seem a bit unfair, being as sometimes you could have all low numbers and sometimes you could have all high numbers.
How about their current number of elem_point + 10 to the next level?

And here is the code for the merge.
Code:
class Scene_Battle
  def start_phase5
    # フェーズ 5 に移行
    @phase = 5
    # バトル終了 ME を演奏
    $game_system.me_play($game_system.battle_end_me)
    # バトル開始前の BGM に戻す
    $game_system.bgm_play($game_temp.map_bgm)
    # EXP、ゴールド、トレジャーを初期化
    exp = 0
    gold = 0
    elem_xp = 0
    treasures = []
    if @active_actor != nil
      @active_actor.blink = false
    end
    # メインフェーズフラグをセット
    $game_temp.battle_main_phase = true
    # パーティコマンドウィンドウを無効化
    @party_command_window.active = false
    @party_command_window.visible = false
    # アクターコマンドウィンドウを無効化
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @skill_window != nil
      # スキルウィンドウを解放
      @skill_window.dispose
      @skill_window = nil
    end
    if @item_window != nil
      # アイテムウィンドウを解放
      @item_window.dispose
      @item_window = nil
    end
    # ヘルプウィンドウを隠す
    @help_window.visible = false
    # ループ
    for enemy in $game_troop.enemies
      # エネミーが隠れ状態でない場合
      unless enemy.hidden
        # 獲得 EXP、ゴールドを追加
        exp += enemy.exp
        gold += enemy.gold
        elem_xp += 1
        # トレジャー出現判定
        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
    # トレジャーの数を 6 個までに限定
    treasures = treasures[0..5]
    # 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)
          actor.damage[[actor, -1]] = "Level up!"
          actor.up_level = actor.level - last_level
        end
        actor.elem_xp += elem_xp
        if actor.elem_xp >= 100
          actor.elem_points += 1
          actor.elem_xp -= 100
        end
      end
    end
    # ゴールド獲得
    $game_party.gain_gold(gold)
    # トレジャー獲得
    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
    # バトルリザルトウィンドウを作成
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # ウェイトカウントを設定
    @phase5_wait_count = 100
  end


end
 
Disregard that code now and just paste this below both the script i gave you and the rtab:
Code:
class Scene_Battle
  def start_phase5
    # フェーズ 5 に移行
    @phase = 5
    # バトル終了 ME を演奏
    $game_system.me_play($game_system.battle_end_me)
    # バトル開始前の BGM に戻す
    $game_system.bgm_play($game_temp.map_bgm)
    # EXP、ゴールド、トレジャーを初期化
    exp = 0
    gold = 0
    elem_xp = 0
    treasures = []
    if @active_actor != nil
      @active_actor.blink = false
    end
    # メインフェーズフラグをセット
    $game_temp.battle_main_phase = true
    # パーティコマンドウィンドウを無効化
    @party_command_window.active = false
    @party_command_window.visible = false
    # アクターコマンドウィンドウを無効化
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @skill_window != nil
      # スキルウィンドウを解放
      @skill_window.dispose
      @skill_window = nil
    end
    if @item_window != nil
      # アイテムウィンドウを解放
      @item_window.dispose
      @item_window = nil
    end
    # ヘルプウィンドウを隠す
    @help_window.visible = false
    # ループ
    for enemy in $game_troop.enemies
      # エネミーが隠れ状態でない場合
      unless enemy.hidden
        # 獲得 EXP、ゴールドを追加
        exp += enemy.exp
        gold += enemy.gold
        elem_xp += 1
        # トレジャー出現判定
        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
    # トレジャーの数を 6 個までに限定
    treasures = treasures[0..5]
    # 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)
          actor.damage[[actor, -1]] = "Level up!"
          actor.up_level = actor.level - last_level
        end
        actor.elem_xp += elem_xp
        if actor.elem_xp >= (10 + actor.elem_points)
          actor.elem_xp -= (10 + actor.elem_points)
          actor.elem_points += 1
        end
      end
    end
    # ゴールド獲得
    $game_party.gain_gold(gold)
    # トレジャー獲得
    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
    # バトルリザルトウィンドウを作成
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # ウェイトカウントを設定
    @phase5_wait_count = 100
  end


end

class Window_Elem_Levels < Window_Base
  
  
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, 640, 32, "Please edit your mastery of elements here:")
    self.contents.draw_text(0, 32, 90, 32, "You have ")
    self.contents.draw_text(90, 32, 40, 32,@actor.elem_points.to_s)
    self.contents.draw_text(130, 32, 300, 32, "elemental points to distribute.")
    self.contents.draw_text(0, 64, 90, 32, "You have ")
    x = @actor.elem_points
    x -= (@actor.elem_fire + @actor.elem_water + @actor.elem_wind + @actor.elem_earth)
    self.contents.draw_text(90, 64, 40, 32, x.to_s)
    self.contents.draw_text(130, 64, 400, 32, "elemental points remaining to distribute.")
    x = (10 + @actor.elem_points) - @actor.elem_xp
    x = x.to_s
    x = x + ' elemental experience to next element point'
    self.contents.draw_text(200, 106, 440, 32, x)
    
    for i in 0...4
      string = ''
      case i
      when 0
        string = string + @actor.elem_fire.to_s
      when 1
        string = string + @actor.elem_water.to_s
      when 2
        string = string + @actor.elem_wind.to_s
      when 3
        string = string + @actor.elem_earth.to_s
      end
      string = string + '/50'
      self.contents.draw_text(120, (106 + 32 * i) , 150, 32, string)
    end
  end
end
 
Can there be an edit of this so that each actor learns different skills when the element points increase?

Like, if it were Arshes, he would learn Fire Slash with 1 element point.

And Hilda would still learn fire with 1 element point. Something like this.

I tried editing it myself under case i

case i
when 0
mastery = @actor.elem_fire
case @actor_id
when 8
x[0] = 7 # Means 1 point in fire mastery lets you learn fire
x[20] = 8 # Means 21 point in fire mastery lets you learn greater fire
x[49] = 9 # Means 50 point in fire mastery lets you learn mass fire
end

etc...

and when I did, I put an "end", but the actor I assigned certain skills to didn't gain any skills when I raised the element points. Did I rearrange it wrong or something? Or can you tell me the right way it should look?
 
Well find this mthod:
Code:
    def exit_element_mastery(exit = true)
      for i in 0...4
      x = []
      for j in 0...50
        x.push(0)
      end
      
      case i
      when 0 # Fire
        mastery = @actor.elem_fire
        x[0] = 7 # Means 1 point in fire mastery lets you learn fire
        x[20] = 8 # Means 21 point in fire mastery lets you learn greater fire
        x[49] = 9 # Means 50 point in fire mastery lets you learn mass fire
      when 1 # Water
        mastery = @actor.elem_water
        x[0] = 16
        x[14] = 17
        x[29] = 18
      when 2 # Wind
        mastery = @actor.elem_wind
        x[0] = 22
        x[14] = 23
        x[29] = 24
      when 3 # Earth
        mastery = @actor.elem_earth
        x[0] = 19
        x[14] = 20
        x[29] = 21
      end
      
      if mastery > 0
      for k in 0...mastery
        @actor.learn_skill(x[k])
      end
      end
      
      if mastery < 50
      for k in mastery...50
        @actor.forget_skill(x[k])
      end
      end
      
      
      end

And modify like this:
Code:
      case i
      when 0 # Fire
        case @actor.id
        when 1 # Aluxes
          mastery = @actor.elem_fire
          x[0] = 7 # Means 1 point in fire mastery lets you learn fire
          x[20] = 8 # Means 21 point in fire mastery lets you learn greater fire
          x[49] = 9 # Means 50 point in fire mastery lets you learn mass fire
        when 8 # Hilda
          mastery = @actor.elem_fire
          x[0] = 7 # Means 1 point in fire mastery lets you learn fire
          x[20] = 8 # Means 21 point in fire mastery lets you learn greater fire
          x[49] = 9 # Means 50 point in fire mastery lets you learn mass fire
        end

That should work.
 
i see, well i dont mind puting more details but i dont want to put you on "over Work" too. :(
When i'm talking about customizable, i was thinking of...

1.add/remove elements
2.custom elements XP, so that player can put what they want for their game.
3.Merde elements (two elements with a specific lvl gain a skill. Ex: fire 14 and water 15 = Heal all)

That about it. If all these request require of redoing the system, dont take these request, its ok. :)
 

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