SuperVideoGames
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

SuperVideoGames


 
AccueilPortailRechercherDernières imagesS'enregistrerConnexion
Le Deal du moment : -29%
PC portable – MEDION 15,6″ FHD Intel i7 ...
Voir le deal
499.99 €

 

 Faire un A-Rpg Avec Rpg Maker ?

Aller en bas 
3 participants
AuteurMessage
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:19

Ce script permet de faire un Zelda-like avec le programme Rpg Maker !


1>Les Scripts

Tout d'abord, créez un nouveau script au-dessus de Main, appelez-le ABS. Mettez-y ceci:


Dernière édition par le Mar 11 Juil 2006 - 11:50, édité 2 fois
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:22

1ère partie


Code:
#==============================================================================
# ¦ Action Battle System
#------------------------------------------------------------------------------
#  By: Near Fantastica
#  Date: 07/2/05
#  Version 2
#
#  A key – X input – Skill Hot Key 1
#  S key – Y input – Skill Hot Key 2
#  D key – Z input – Skill Hot Key 3
#  Q key – L input – Attacking
#  W key –R input – Defending
#
#  The Skill Hot Keys can be changed in the Skill Menu by cursering over to the
#  skill you want and pressing the hot key you want to set that skill too ~!
#
#  Thanks to Harosata, Akura, Hazarim, Deke, Arcaine and
#  Thanks to everyone for testing and for your input
#==============================================================================

class Action_Battle_System
  #--------------------------------------------------------------------------
  # ? Open instance variable
  #--------------------------------------------------------------------------
  attr_accessor :active_actor
  attr_accessor :display
  attr_accessor :player_defending
  attr_accessor :skill_hot_key
  attr_accessor :dash_level
  #--------------------------------------------------------------------------
  # ? Initialization
  #--------------------------------------------------------------------------
  def initialize
    @event_counter = 0
    @display = Sprite.new
    @display.bitmap = Bitmap.new(88, 48)
    @clear_counter = 0
    @active_actor = 0
    @player_defending = false
    @restore = false
    @reduce= false
    @timer = 0
    @dash_level = 5
    @sec = 0
    @skill_hot_key = {}
    @skill_hot_key[1]  = 0
    @skill_hot_key[2]  = 0
    @skill_hot_key[3] = 0
    @enemy_id = {}
    @enemy_name = {}
    @enemy_hp = {}
    @enemy_sp = {}
    @enemy_str = {}
    @enemy_dex = {}
    @enemy_agi  = {}
    @enemy_int = {}
    @enemy_atk = {}
    @enemy_pdef = {}
    @enemy_mdef = {}
    @enemy_eva = {}
    @enemy_animation1_id = {}
    @enemy_animation2_id = {}
    @enemy_exp = {}
    @enemy_gold = {}
    @enemy_item_id = {}
    @enemy_weapon_id = {}
    @enemy_armor_id = {}
    @enemy_treasure_prob = {}
    @enemy_engagement = {}
    @enemy_movment = {}
    @enemy_frequency = {}
    @enemy_speed = {}
    @enemy_defending = {}
    @enemy_dex_loop = {}
  end
  #--------------------------------------------------------------------------
  # ? Enemy Setup
  #--------------------------------------------------------------------------
  def enemy_setup
    # Setup Event Max
    @event_counter = 0
    for i in 1..999
      if $game_map.map.events[i].id > @event_counter
        @event_counter = $game_map.map.events[i].id
      end
    end
    # Setup Event
    for i in 1..@event_counter #$game_map.map.events.size
      # Set the event to nill setting
      @enemy_id[i] = 0
      for x in 1..$data_enemies.size - 1
        if $game_map.map.events[i] == nil
          next i
        end
        if $game_map.map.events[i].name == $data_enemies[x].name
          # Event is an Enemy Setup Emeny
          @enemy_id[i] = $data_enemies[x].id
          @enemy_name[i] = $data_enemies[x].name
          @enemy_hp[i] = $data_enemies[x].maxhp
          @enemy_sp[i] = $data_enemies[x].maxsp
          @enemy_str[i] = $data_enemies[x].str
          @enemy_dex[i] = $data_enemies[x].dex
          @enemy_agi [i] = $data_enemies[x].agi
          @enemy_int[i] = $data_enemies[x].int
          @enemy_atk[i] = $data_enemies[x].atk
          @enemy_pdef[i] = $data_enemies[x].pdef
          @enemy_mdef[i] = $data_enemies[x].mdef
          @enemy_eva[i] = $data_enemies[x].eva
          @enemy_animation1_id[i] = $data_enemies[x].animation1_id
          @enemy_animation2_id[i] = $data_enemies[x].animation2_id
          @enemy_exp[i] = $data_enemies[x].exp
          @enemy_gold[i] = $data_enemies[x].gold
          @enemy_item_id[i] = $data_enemies[x].item_id
          @enemy_weapon_id[i] = $data_enemies[x].weapon_id
          @enemy_armor_id[i] = $data_enemies[x].armor_id
          @enemy_treasure_prob[i] = $data_enemies[x].treasure_prob
          @enemy_states = []
          @enemy_engagement[i] = false
          @enemy_movment[i] = 0
          @enemy_frequency[i] = 0
          @enemy_speed[i] = 0
          @enemy_defending[i] = false
          @enemy_dex_loop[i] = 0
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? Update Dash
  #--------------------------------------------------------------------------
  def update_dash
    # check if sheild is active
    if @player_defending == true
      $game_player.move_speed = 3
      return
    end
    # check is Dash Mode Active
    if Input.press?(Input::A)
      if $game_player.moving?
        # If A Key press enter dash mode
        # reduce dash level
        $game_player.move_speed=5
        @restore = false
        if @reduce == false
          @timer = 50 # Initial time off set
          @reduce = true
        else
          @timer-= 1
        end
        @sec = (@timer / Graphics.frame_rate)%60
        if @sec == 0
          if @dash_level != 0
            @dash_level -= 1
            @timer = 50 # Timer Count
          end
        end
        if @dash_level == 0
          $game_player.move_speed=4
        end
      end
    else
      # restore dash level
      $game_player.move_speed=4
      @reduce = false
      if @restore == false
        @timer = 80 # Initial time off set
        @restore = true
      else
        @timer-= 1
      end
      @sec = (@timer / Graphics.frame_rate)%60
      if @sec == 0
        if @dash_level != 5
          @dash_level+= 1
          @timer = 60 # Timer Count
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? Clear Display
  #--------------------------------------------------------------------------
  def clear_display
    @clear_counter += 1
    if @clear_counter == 50
      @clear_counter = 0
      @display.bitmap.clear
    end
  end
  #--------------------------------------------------------------------------
  # ? Update
  #--------------------------------------------------------------------------
  def update
    update_dash
    clear_display
    for i in 1..@event_counter
      # Check if Event is an Enemy
      if @enemy_id[i] == 0
        next
      else
        # Enemy Engaged
        if @enemy_engagement[i] == true
          # Check Range
          if in_range?(i,5)
            # Update Battle
            if in_range?(i,1)
              event_melee_attack(i)
            else
              event_skill_attack(i)
            end
            next
          else
            @enemy_engagement[i] = false
            # Change Movement
            $game_map.events[i].move_type = @enemy_movment[i]
            $game_map.events[i].move_frequency = @enemy_frequency[i]
            $game_map.events[i].move_speed = @enemy_speed[i]
            next
          end
        end
        # Check Range
        if in_range?(i,5)
          # Check Event Direction
          if facing_player?(i)
            # Set Enemy Engaged
            @enemy_engagement[i] = true
            # Change Movement
            @enemy_movment[i] = $game_map.events[i].move_type
            $game_map.events[i].move_type = 2
            @enemy_frequency[i] = $game_map.events[i].move_frequency
            $game_map.events[i].move_frequency = 5
            @enemy_speed[i] = $game_map.events[i].move_speed
            $game_map.events[i].move_speed = 4
            # Update Battle
            if in_range?(i,1)
              event_melee_attack(i)
            else
              event_skill_attack(i)
            end
          end
        end
      end
    end
  end 
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:23

2ème partie:

Code:

 #--------------------------------------------------------------------------
  # ? Check If Event Is In Range
  #--------------------------------------------------------------------------
  def in_range?(event_index, range)
    playerx = $game_player.x
    playery = $game_player.y
    eventx = $game_map.events[event_index].x
    eventy = $game_map.events[event_index].y
    # Determine x and y of circle
    x = (playerx - eventx) * (playerx - eventx)
    y = (playery - eventy) * (playery - eventy)
    # Determine raduis
    r = x +y
    if r <= (range * range)
      return true
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  # ? Check If Event Is Facing Player
  #--------------------------------------------------------------------------
  def facing_player?(event_index)
    playerx = $game_player.x
    playery = $game_player.y
    eventx = $game_map.events[event_index].x
    eventy = $game_map.events[event_index].y
    event_direction = $game_map.events[event_index].direction
    # Check down
    if event_direction == 2
      if playery >= eventy
        return true
      end
    end
    # Check Left
    if event_direction == 4
      if playerx <= eventx
        return true
      end
    end
    # Check Right
    if event_direction == 6
      if playerx >= eventx
        return true
      end
    end
    # Check Up
    if event_direction == 8
      if playery <= eventy
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ? Check Event Attack Condisions
  #    NOTE : there is no turns in the ABS therfore there is no turn percondition
  #--------------------------------------------------------------------------
  def event_melee_preconditions(event_index)
    if @enemy_dex_loop[event_index] >= @enemy_dex[event_index] * 20
      @enemy_dex_loop[event_index]  = 0
      for i in 0..$data_enemies[@enemy_id[event_index]].actions.size - 1
        if $data_enemies[@enemy_id[event_index]].actions[i].kind == 0
          actions = $data_enemies[@enemy_id[event_index]].actions[i]
          # Check Hp Level condition
          if @enemy_hp[event_index] * 100.0 / $data_enemies[@enemy_id[event_index]].maxhp > actions.condition_hp
            next
          end
          # Check Max Level condition
          if $game_party.max_level < actions.condition_level
            next
          end
          # Check switch condition
          switch_id = actions.condition_switch_id
          if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
            next
          end
          # Check Rank to see if it is larger then the dice roll
          n = rand(10)
          if actions.rating < n
            next
          end
          # Return Action
          case actions.basic
          when 0
            return 0
          when 1
            return 1
          when 2
            return 2
          when 3
            return 3
          end
        end
      end
      # No action taken
      return 3
    else
      # add to the dex loop
      @enemy_dex_loop[event_index] += @enemy_dex[event_index]
      return 3
    end
  end
  #--------------------------------------------------------------------------
  # ? Check Event Attack Condisions
  #    NOTE : there is no turns in the ABS therfore there is no turn percondition
  #--------------------------------------------------------------------------
  def event_skill_preconditions(event_index)
    if @enemy_dex_loop[event_index] >= @enemy_dex[event_index] * 100
      @enemy_dex_loop[event_index]  = 0
      for i in 0..$data_enemies[@enemy_id[event_index]].actions.size - 1
        if $data_enemies[@enemy_id[event_index]].actions[i].kind == 1
          actions = $data_enemies[@enemy_id[event_index]].actions[i]
          # Check Hp Level condition
          if @enemy_hp[event_index] * 100.0 / $data_enemies[@enemy_id[event_index]].maxhp > actions.condition_hp
            return 0
          end
          # Check Max Level condition
          if $game_party.max_level < actions.condition_level
            return 0
          end
          # Check switch condition
          switch_id = action.condition_switch_id
          if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
            return 0
          end
          return actions.skill_id
        end
      end
      return 0
    else
      # add to the dex loop
      @enemy_dex_loop[event_index] += @enemy_dex[event_index]
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ? Calculation of attribute correction
  #    element_set : Attribute
  #--------------------------------------------------------------------------
  def player_elements_correct(element_set)
    # In case of non attribute
    if element_set == []
      # return 100
      return 100
    end
    # The weakest one is returned in the attribute which is given * method element_rate
    #  is defined in Game_Actor and the Game_Enemy class which are succeeded from this class
    weakest = -100
    for i in element_set
      weakest = [weakest, $game_party.actors[@active_actor].element_rate(i)].max
    end
    return weakest
  end
  #--------------------------------------------------------------------------
  # ? Event Melee Attack
  #--------------------------------------------------------------------------
  def event_melee_attack(event_index)
    kind = event_melee_preconditions(event_index)
    case kind
    when 0 # Enemy Attacking
      @enemy_defending[event_index] = false
      # First on-target hit decision
      hit_rate = 100
      for i in @enemy_states
          hit_rate *= $data_states[i].hit_rate / 100.0
      end
      hit_result = (rand(100) < hit_rate)
      # In case of on-target hit
      if hit_result == true
        # Calculating the basic damage
        atk = [@enemy_atk[event_index] - $game_party.actors[@active_actor].pdef / 2, 0].max
        damage = atk * (20 + @enemy_str[event_index] ) / 20
        # Attribute correction
        damage *= player_elements_correct([])
        damage /= 100
        # When the mark of the damage is correct
        if damage > 0
          # Critical correction
          if rand(100) < 4 * @enemy_dex[event_index] / $game_party.actors[@active_actor].agi
            damage *= 2
          end
          # Defense correction
          if  @player_defending == true
            damage /= 2
          end
        end
        # Dispersion
        if damage.abs > 0
          amp = [damage.abs * 15 / 100, 1].max
          damage += rand(amp+1) + rand(amp+1) - amp
        end
        # Second on-target hit decision
        eva = 8 * $game_party.actors[@active_actor].agi / @enemy_dex[event_index] + $game_party.actors[@active_actor].eva
        hit = damage < 0 ? 100 : 100 - eva
        # Check evade
        cant_evade = false
        for i in $game_party.actors[@active_actor].states
          if $data_states[i].cant_evade
            cant_evade = true
          end
        end
        hit = cant_evade ? 100 : hit
        hit_result = (rand(100) < hit)
      end
      # In case of on-target hit
      if hit_result == true
        # State shocking cancellation
        # Note : I still can not get the states effects to work correctly
        # remove_states_shock
        # From HP damage subtraction
        damage = damage.abs
        $game_party.actors[@active_actor].hp -= damage
        hit_player(damage, @enemy_animation2_id[event_index])
        if $game_party.actors[@active_actor].hp <= 0
          player_dead
        end
        # State change
        # Note : I still can not get the states effects to work correctly
        # states_plus(@enemy_states)
        # states_minus(@enemy_states)
      end
    when 1 # Enemy Defening
      if @enemy_defending[event_index] != true
        @enemy_defending[event_index] = true
        $game_map.events[event_index].move_speed = $game_map.events[event_index].move_speed - 1
      end
    when 2 # Enemy Escaping
      # Note : Could Add a Teleport Event to make the Event jump far away from player
    when 3 # No Action Taken
    end
  end
  #--------------------------------------------------------------------------
  # ? Event Skill Attack
  #--------------------------------------------------------------------------
  def event_skill_attack(event_index)
    # Check Percondisions  of the Enemy
    skill_id = event_skill_preconditions(event_index)
    # If Condisions not meet
    if skill_id ==  0
      return
    end
    skill = $data_skills[skill_id]
    # Check Sp Cost
    if skill.sp_cost > @enemy_sp[event_index]
      return
    end
    @enemy_sp[event_index] -= skill.sp_cost
    # When the effective range of skill with friend of HP 1 or more, your own HP 0,
    # or the effective range of skill with the friend of HP 0, your own HP are 1 or more,
    if ((skill.scope == 3 or skill.scope == 4) and @enemy_hp == 0) or
      ((skill.scope == 5 or skill.scope == 6) and @enemy_hp >= 1)
      # ??????
      return
    end
    # Clearing the effective flag
    effective = false
    # When common event ID is effective, setting the effective flag
    effective |= skill.common_event_id > 0
    # First on-target hit decision
    skill_hit = 100
    for i in @enemy_states
      skill_hit *= $data_states[i].hit_rate / 100.0
    end
    user_hit = 100
    for i in @enemy_states
      user_hit *= $data_states[i].hit_rate / 100.0
    end
    hit = skill_hit
    if skill.atk_f > 0
      hit *= user_hit / 100
    end
    hit_result = (rand(100) < hit)
    # In case of uncertain skill setting the effective flag
    effective |= hit < 100
    # In case of on-target hit
    if hit_result == true
      # Calculating power
      power = skill.power + @enemy_atk[event_index] * skill.atk_f / 100
      if power > 0
        power -= $game_party.actors[@active_actor].pdef * skill.pdef_f / 200
        power -= $game_party.actors[@active_actor].mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # Calculating magnification ratio
      rate = 20
      rate += (@enemy_str[event_index] * skill.str_f / 100)
      rate += (@enemy_dex[event_index] * skill.dex_f / 100)
      rate += (@enemy_agi[event_index] * skill.agi_f / 100)
      rate += (@enemy_int[event_index] * skill.int_f / 100)
      # Calculating the basic damage
      damage = power * rate / 20
      # Attribute correction
      damage *= player_elements_correct(skill.element_set)
      damage /= 100
      # When the mark of the damage is correct,
      if damage > 0
        # Defense correction
        if @player_defending == true
          damage /= 2
        end
      end
      # Dispersion
      if skill.variance > 0 and damage.abs > 0
        amp = [damage.abs * skill.variance / 100, 1].max
        damage += rand(amp+1) + rand(amp+1) - amp
      end
      # Second on-target hit decision
      eva = 8 * $game_party.actors[@active_actor].agi / @enemy_dex[event_index] + $game_party.actors[@active_actor].eva
      hit = damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      cant_evade = false
      for i in $game_party.actors[@active_actor].states
        if $data_states[i].cant_evade
          cant_evade = true
        end
      end
      hit = cant_evade ? 100 : hit
      hit_result = (rand(100) < hit)
      # In case of uncertain skill setting the effective flag
      effective |= hit < 100
    end
    # In case of on-target hit
    if hit_result == true
      # In case of physical attack other than power 0
      if skill.power != 0 and skill.atk_f > 0
        # State shocking cancellation
        # Note : I still can not get the states effects to work correctly
        # remove_states_shock
        # Setting the effective flag
        effective = true
      end
      # From HP damage subtraction
      last_hp = $game_party.actors[@active_actor].hp
      $game_party.actors[@active_actor].hp -= damage
      effective |= $game_party.actors[@active_actor].hp != last_hp
      # State change
      # Note : I still can not get the states effects to work correctly
      # effective |= states_plus(skill.plus_state_set)
      # effective |= states_minus(skill.minus_state_set)
      if skill.power == 0 # When power is 0
        # Set Damage to Zero
        damage = 0
      end
      hit_player(damage, skill.animation2_id)
      if $game_party.actors[@active_actor].hp <= 0
          player_dead
        end
    end
  end
  #--------------------------------------------------------------------------
  # ? Display Hit Animation
  #--------------------------------------------------------------------------
  def player_dead
    if $game_party.all_dead?
      $game_temp.gameover = true
    end
    $scene = Scene_Menu.new
  end
  #--------------------------------------------------------------------------
  # ? Display Hit Animation
  #--------------------------------------------------------------------------
  def hit_player(damage, animation_id)
    if damage != 0
      $game_player.jump(0, 0)
      $game_player.animation_id = animation_id
      @display.bitmap.clear
      @clear_counter = 0
      @display.bitmap.font.name = $defaultfonttype  # Unknown At This Time
      @display.bitmap.font.size = 32
      @display.x = ($game_player.real_x - $game_map.display_x) / 4
      @display.y = ($game_player.real_y - $game_map.display_y) / 4
      @display.z = 500
      @display.bitmap.font.color.set(255, 0, 0)
      @display.bitmap.draw_text(@display.bitmap.rect, damage.to_s, 1)
    end
  end
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:25

Dernière partie du premier code:


Code:
#--------------------------------------------------------------------------
  # ? Calculation of attribute correction
  #    element_set : Attribute
  #--------------------------------------------------------------------------
  def event_elements_correct(element_set, event_index)
    # In case of non attribute
    if element_set == []
      # return 100
      return 100
    end
    # The weakest one is returned in the attribute which is given * method element_rate
    #  is defined in Game_Actor and the Game_Enemy class which are succeeded from this class
    weakest = -100
    for i in element_set
      # Note: I still can not get the states effects to work correctly
      weakest = [weakest, $data_enemies[@enemy_id[event_index]].element_rate(i)].max
    end
    return weakest
  end
  #--------------------------------------------------------------------------
  # ? Player Melee Attack Preconditions
  #--------------------------------------------------------------------------
  def player_melee_preconditions
    for i in 1..@event_counter
      # Check if Event is an Enemy
      if @enemy_id[i] == 0
        next
      end
      if in_range?(i,1)
        player_melee_attack(i)
        next
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? Event Melee Attack
  #--------------------------------------------------------------------------
  def player_melee_attack(event_index)
      # First on-target hit decision
      hit_rate = 100
      for i in  $game_party.actors[@active_actor].states
          hit_rate *= $data_states[i].hit_rate / 100.0
      end
      hit_result = (rand(100) < hit_rate)
      # In case of on-target hit
      if hit_result == true
        # Calculating the basic damage
        atk = [$game_party.actors[@active_actor].atk - @enemy_pdef[event_index] / 2, 0].max
        damage = atk * (20 + $game_party.actors[@active_actor].str) / 20
        # Attribute correction
        damage *= 100 #event_elements_correct($game_party.actors[@active_actor].element_set, event_index)
        damage /= 100
        # When the mark of the damage is correct
        if damage > 0
          # Critical correction
          if rand(100) < 4 * $game_party.actors[@active_actor].dex / @enemy_agi[event_index]
            damage *= 2
          end
          # Defense correction
          if @enemy_defending== true
            damage /= 2
          end
        end
        # Dispersion
        if damage.abs > 0
          amp = [damage.abs * 15 / 100, 1].max
          damage += rand(amp+1) + rand(amp+1) - amp
        end
        # Second on-target hit decision
        eva = 8 * @enemy_agi[event_index] / $game_party.actors[@active_actor].dex + @enemy_eva[event_index]
        hit = damage < 0 ? 100 : 100 - eva
        # Check evade
        cant_evade = false
        for i in @enemy_states
          if $data_states[i].cant_evade
            cant_evade = true
          end
        end
        hit = cant_evade ? 100 : hit
        hit_result = (rand(100) < hit)
      end
      # In case of on-target hit
      if hit_result == true
        # State shocking cancellation
        # Note : I still can not get the states effects to work correctly
        # remove_states_shock
        # From HP damage subtraction
        damage = damage.abs
        @enemy_hp[event_index] -= damage
        # State change
        # Note : I still can not get the states effects to work correctly
        # states_plus($game_party.actors[@active_actor].states)
        # states_minus($game_party.actors[@active_actor].states)
        hit_event(event_index,damage, $game_party.actors[@active_actor].animation2_id)
        if @enemy_hp[event_index] <= 0
          battle_spoils(event_index)
        end
      end
    end
  #--------------------------------------------------------------------------
  # ? Player Skill Attack Preconditions
  #--------------------------------------------------------------------------
  def player_skill_preconditions(index)
    if$game_party.actors[@active_actor].skill_learn?(@skill_hot_key[index])
      # Set Skill
      skill = $data_skills[@skill_hot_key[index]]
      # Check Sp Cost
      if skill.sp_cost > $game_party.actors[@active_actor].sp
        return
      end
      # Set Sp
      $game_party.actors[@active_actor].sp -= skill.sp_cost
      # Check Skills Scope
      case skill.scope
      when 1 # One Enemy
        for i in 1..@event_counter
        # Check if Event is an Enemy
          if @enemy_id[i] == 0
            next
          else
            case $data_classes[$game_party.actors[@active_actor].class_id].position
            when 0
              if in_range?(i,1)
                player_skill_attack(skill, i)
                return
              end
            when 1
              if in_range?(i,2)
                player_skill_attack(skill, i)
                return
              end
            when 2
              if in_range?(i,5)
                player_skill_attack(skill, i)
                return
              end
            end
          end
        end
      when 2 # All Emenies
        for i in 1..@event_counter
        # Check if Event is an Enemy
          if @enemy_id[i] == 0
            next
          else
            case $data_classes[$game_party.actors[@active_actor].class_id].position
            when 0
              if in_range?(i,1)
                player_skill_attack(skill, i)
                return
              end
            when 1
              if in_range?(i,2)
                player_skill_attack(skill, i)
                return
              end
            when 2
              if in_range?(i,5)
                player_skill_attack(skill, i)
                return
              end
            end
          end
        end
      when 3 # One Ally
        # Note : I still can not get the states effects to work correctly and therefore
        # can not scrîpt this but these skill can skill be actived from the Main Menu
      when 4 # All Allies
        # Note : I still can not get the states effects to work correctly and therefore
        # can not scrîpt this but these skill can skill be actived from the Main Menu
      end
    else
      return
    end
  end
  #--------------------------------------------------------------------------
  # ? Player Skill Attack
  #--------------------------------------------------------------------------
  def player_skill_attack(skill, event_index)
    # When the effective range of skill with friend of HP 1 or more, your own HP 0,
    # or the effective range of skill with the friend of HP 0, your own HP are 1 or more,
      if ((skill.scope == 3 or skill.scope == 4) and @enemy_hp == 0) or
        ((skill.scope == 5 or skill.scope == 6) and @enemy_hp >= 1)
        return
      end
    # Clearing the effective flag
    effective = false
    # When common event ID is effective, setting the effective flag
    effective |= skill.common_event_id > 0
    # First on-target hit decision
    skill_hit = 100
    for i in $game_party.actors[@active_actor].states
      skill_hit *= $data_states[i].hit_rate / 100.0
    end
    user_hit = 100
    for i in $game_party.actors[@active_actor].states
      user_hit *= $data_states[i].hit_rate / 100.0
    end
    hit = skill_hit
    if skill.atk_f > 0
      hit *= user_hit / 100
    end
    hit_result = (rand(100) < hit)
    # In case of uncertain skill setting the effective flag
    effective |= hit < 100
    # In case of on-target hit
    if hit_result == true
      # Calculating power
      power = skill.power + $game_party.actors[@active_actor].atk * skill.atk_f / 100
      if power > 0
        power -= @enemy_pdef[event_index] * skill.pdef_f / 200
        power -= @enemy_mdef[event_index] * skill.mdef_f / 200
        power = [power, 0].max
      end
      # Calculating magnification ratio
      rate = 20
      rate += ($game_party.actors[@active_actor].str * skill.str_f / 100)
      rate += ($game_party.actors[@active_actor].dex * skill.dex_f / 100)
      rate += ($game_party.actors[@active_actor].agi * skill.agi_f / 100)
      rate += ($game_party.actors[@active_actor].int * skill.int_f / 100)
      # Calculating the basic damage
      damage = power * rate / 20
      # Attribute correction
      damage *= 100 #event_elements_correct(skill.element_set, event_index)
      damage /= 100
      # When the mark of the damage is correct,
      if damage > 0
        # Defense correction
        if @enemy_defending == true
          damage /= 2
        end
      end
      # Dispersion
      if skill.variance > 0 and damage.abs > 0
        amp = [damage.abs * skill.variance / 100, 1].max
        damage += rand(amp+1) + rand(amp+1) - amp
      end
      # Second on-target hit decision
      eva = 8 * @enemy_agi[event_index] / $game_party.actors[@active_actor].dex + @enemy_eva[event_index]
      hit = damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      cant_evade = false
      for i in @enemy_states
        if $data_states[i].cant_evade
          cant_evade = true
        end
      end
      hit = cant_evade ? 100 : hit
      hit_result = (rand(100) < hit)
      # In case of uncertain skill setting the effective flag
      effective |= hit < 100
    end
    # In case of on-target hit
    if hit_result == true
      # In case of physical attack other than power 0
      if skill.power != 0 and skill.atk_f > 0
        # State shocking cancellation
        # Note : I still can not get the states effects to work correctly
        # remove_states_shock
        # Setting the effective flag
        effective = true
      end
      # From HP damage subtraction
      last_hp = @enemy_hp[event_index]
      @enemy_hp[event_index] -= damage
      effective |= @enemy_hp[event_index] != last_hp
      # State change
      # Note : I still can not get the states effects to work correctly
      # effective |= states_plus(skill.plus_state_set)
      # effective |= states_minus(skill.minus_state_set)
      if skill.power == 0 # When power is 0
        # Set Damage to Zero
        damage = 0
      end
      hit_event(event_index, damage, skill.animation2_id)
      if @enemy_hp[event_index] <= 0
            battle_spoils(event_index)
        end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ? Display Hit Animation
  #--------------------------------------------------------------------------
  def hit_event(event_index, damage, animation_id)
    if damage != 0
      $game_map.events[event_index].jump(0, 0)
      $game_map.events[event_index].animation_id = animation_id
      @display.bitmap.clear
      @clear_counter = 0
      @display.bitmap.font.name = $defaultfonttype  # Unknown At This Time
      @display.bitmap.font.size = 32
      @display.x = ($game_map.events[event_index].real_x - $game_map.display_x) / 4
      @display.y = ($game_map.events[event_index].real_y - $game_map.display_y) / 4
      @display.z = 500
      @display.bitmap.font.color.set(255, 0, 0)
      @display.bitmap.draw_text(@display.bitmap.rect, damage.to_s, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ? Spoils of Battle
  #--------------------------------------------------------------------------
  def battle_spoils(event_index)
    $game_map.map.events[event_index].name = "Dead"
    @enemy_id[event_index] = 0
    $game_map.events[event_index].erase
    treasures = []
    if rand(100) < @enemy_treasure_prob[event_index]
      if @enemy_item_id[event_index] > 0
        treasures.push($data_items[@enemy_item_id[event_index]])
      end
      if @enemy_weapon_id[event_index]> 0
        treasures.push($data_weapons[@enemy_weapon_id[event_index]])
      end
      if @enemy_armor_id[event_index] > 0
        treasures.push($data_armors[@enemy_armor_id[event_index]])
      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 += @enemy_exp[event_index]
      end
    end
    # ??????
    $game_party.gain_gold(@enemy_gold[event_index] )
    # ???????
    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
  end
end
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:26

1ère partie du deuxième code:

Ensuite, mettez juste en dessous un nouveau script, nommé... ABS 2. Collez-y ceci:


Code:
#==============================================================================
# ¦ Scene_Map
#------------------------------------------------------------------------------
#  It is the class which processes the title picture
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # ? Refer setup to Scene Map
  #--------------------------------------------------------------------------
  alias scene_map_main main
  alias scene_map_update update
  #--------------------------------------------------------------------------
  # ? Refers to Main
  #--------------------------------------------------------------------------
  def main
    if $game_switches[1] == true
      @on_map_diplay = Window_Mapstats.new
    end
    $ABS.display = Sprite.new
    $ABS.display.bitmap = Bitmap.new(88, 48)
      scene_map_main
    $ABS.display.dispose
    if $game_switches[1] == true
      @on_map_diplay.dispose
    end
  end
  #--------------------------------------------------------------------------
  # ? Refers to Update
  #--------------------------------------------------------------------------
  def update
    if $game_switches[1] == true
      @on_map_diplay.update
    end
    $ABS.update
    if Input.trigger?(Input::L)
      # Player Attack
      if $ABS.player_defending == false
        $ABS.player_melee_preconditions
      end
    end
    if Input.press?(Input::R)
      # Player Shield Active
      $ABS.player_defending= true
    else
      # Player Sheild Disactive
      $ABS.player_defending = false
    end
    if Input.trigger?(Input::X)
      # Player Skill Hot Key 1
      $ABS.player_skill_preconditions(1)
    end
    if Input.trigger?(Input::Y)
      # Player Skill Hot Key 2
      $ABS.player_skill_preconditions(2)
    end
    if Input.trigger?(Input::Z)
      # Player Skill Hot Key 3
      $ABS.player_skill_preconditions(3)
    end
    scene_map_update
  end
end


#==============================================================================
#  Window_Base
#------------------------------------------------------------------------------
#  Adds Draw line function, Draw Hp, Draw Sp, Draw Exp,
#  Adds Draw Actors Battler, Refines Draw Text Actors Level
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? The drawing of HP
  #    actor : actor
  #    x    : Ahead drawing X coordinate
  #    y    : Ahead drawing Y-coordinate
  #    width : Width ahead drawing
  #--------------------------------------------------------------------------
  def draw_actor_hp_text(actor, x, y, width = 144)
    # Character string "HP" It draws
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    # Calculates is a space which draws MaxHP
    if width - 32 >= 108
      hp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      hp_x = x + width - 48
      flag = false
    end
    # Drawing HP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.contents.draw_text(hp_x, y, 40, 32, actor.hp.to_s, 2)
    # Drawing MaxHP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(hp_x + 40, y, 12, 32, "/", 1)
      self.contents.draw_text(hp_x + 52, y, 48, 32, actor.maxhp.to_s)
    end
  end
  #--------------------------------------------------------------------------
  # ? The drawing of SP
  #    actor : actor
  #    x    : Ahead drawing X coordinate
  #    y    : Ahead drawing Y-coordinate
  #    width : Width ahead drawing
  #--------------------------------------------------------------------------
  def draw_actor_sp_text(actor, x, y, width = 144)
    # Character string "sP" It draws
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
    # Calculates is a space which draws MaxSP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    # Drawing HP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 40, 32, actor.sp.to_s, 2)
    # Drawing MaxHP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(sp_x + 40, y, 12, 32, "/", 1)
      self.contents.draw_text(sp_x + 52, y, 48, 32, actor.maxsp.to_s)
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Hp meter
  #--------------------------------------------------------------------------
  def draw_actor_hp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(255, 0, 0, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    w = width * actor.hp / actor.maxhp
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Sp meter
  #--------------------------------------------------------------------------
  def draw_actor_sp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(0, 0, 255, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    w = width * actor.sp / actor.maxsp
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Exp meter
  #--------------------------------------------------------------------------
  def draw_actor_exp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(255, 255, 0, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    if actor.level == 99
      w = 0
    else
      w = width * actor.exp / actor.next_exp_s.to_f
    end
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Str meter
  #--------------------------------------------------------------------------
  def draw_actor_str_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(255, 0, 0, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    w = width * actor.str / 999
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Dex meter
  #--------------------------------------------------------------------------
  def draw_actor_dex_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(0, 255, 0, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    w = width * actor.dex / 999
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Agi meter
  #--------------------------------------------------------------------------
  def draw_actor_agi_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(0, 0, 255, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    w = width * actor.agi / 999
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Int meter
  #--------------------------------------------------------------------------
  def draw_actor_int_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(180, 100, 200, 255))
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    w = width * actor.int / 999
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Dash Power bar
  #--------------------------------------------------------------------------
  def draw_dash_bar(x, y, width = 50, height = 10)
    self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
    case $ABS.dash_level
    when 0 .. 1
      bar_color = Color.new(255, 0, 0, 255)
    when 2 .. 3
      bar_color = Color.new(255, 255, 0, 255)
    else
      bar_color = Color.new(0, 255, 0, 255)
    end
    w = width * $ABS.dash_level / 5
    for i in 0..height
      r = bar_color.red  * (height -i)/height  + 0  * i/height
      g = bar_color.green * (height -i)/height  + 0 * i/height
      b = bar_color.blue  * (height -i)/height  + 0 * i/height
      a = bar_color.alpha * (height -i)/height  + 255 * i/height
      self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # ? Draws Actors Battler
  #--------------------------------------------------------------------------
  def draw_actor_battler(actor, x, y)
      bitmap = RPG::Cache.battler(actor.character_name, actor.character_hue)
      cw = bitmap.width
      ch = bitmap.height
      src_rect = Rect.new(0, 0, cw, ch)
      self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:26

Dernière partie du deuxième code:


Code:
#==============================================================================
#  ¦  On Map Display
#------------------------------------------------------------------------------
#    Displayes curent player stats to the window
#=============================================================================

class Window_Mapstats < Window_Base
  #--------------------------------------------------------------------------
  # ? Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 400, 640, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    self.back_opacity = 125
    # self.opacity = 0
    update
  end
  #--------------------------------------------------------------------------
  # ? Update
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    actor = $game_party.actors[$ABS.active_actor]
    draw_actor_graphic(actor, 10, 45) # draws the actor graphic
    draw_actor_name(actor, 30, -5) #draws the actors name
    draw_actor_level(actor, 30, 15) #draws the actor level
    draw_actor_hp_text(actor, 110, -5) #draws the actors hp
    draw_actor_hp_bar(actor, 260, 5)  #draws the actors hp bar
    draw_actor_sp_text(actor,110, 15) #draws the actors sp
    draw_actor_sp_bar(actor, 260, 27) #draws the actors sp bar
    draw_dash_bar(375, 27) #draws the dash level bar
    self.contents.draw_text(377, -5, 120, 32, "Dash")
  end
  #--------------------------------------------------------------------------
  # ? Update
  #--------------------------------------------------------------------------
  def update
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end

#==============================================================================
# ¦ Scene_Title
#------------------------------------------------------------------------------
#  It is the class which processes the title picture
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # ? Refer setup to Scene Title
  #--------------------------------------------------------------------------
  alias scene_title_update update
  #--------------------------------------------------------------------------
  # ? Loads Event names
  #--------------------------------------------------------------------------
  def update
    $ABS = Action_Battle_System.new
    scene_title_update
  end
end

#==============================================================================
# ¦ Game_Map
#------------------------------------------------------------------------------
#  Add defenision of the names to Game Map Class
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ? Refer setup to Game Map
  #--------------------------------------------------------------------------
  attr_accessor :map
  alias game_map_setup setup
  #--------------------------------------------------------------------------
  # ? Refers the Map Setup
  #--------------------------------------------------------------------------
  def setup(map_id)
    game_map_setup(map_id)
    $ABS.enemy_setup
  end
end

#==============================================================================
# ¦ Game_Character
#------------------------------------------------------------------------------
#  Add move_type to the accessor adderse
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # ? Open instance variable
  #--------------------------------------------------------------------------
  attr_accessor :move_type
  attr_accessor :move_speed
  attr_accessor :move_frequency
  attr_accessor :character_name
end

#==============================================================================
# ¦ Scene_Skill
#------------------------------------------------------------------------------
#  It is the class which processes the skill picture.
#==============================================================================

class Scene_Skill
#--------------------------------------------------------------------------
# ? Object initialization
#    actor_index : Actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
  @actor_index = actor_index
end
#--------------------------------------------------------------------------
# ? Main processing
#--------------------------------------------------------------------------
def main
  # Acquiring the actor
  @actor = $game_party.actors[@actor_index]
  # Drawing up the help window, the status window and the skill window
  @help_window = Window_Help.new
  @status_window = Window_SkillStatus.new(@actor)
  @skill_window = Window_Skill.new(@actor)
  # Help window association
  @skill_window.help_window = @help_window
  # Target window compilation (invisibility non actively setting)
  @target_window = Window_Target.new
  @target_window.visible = false
  @target_window.active = false
  # Skill Hot Key Window
  @shk_window = Window_Command.new(250, ["Skill Assigned to Hot Key"])
  @shk_window.visible = false
  @shk_window.active = false
  @shk_window.x = 200
  @shk_window.y = 250
  @shk_window.z = 1500
  # Transition execution
  Graphics.transition
  # Main loop
  loop do
    # Renewing the game picture
    Graphics.update
    # Updating the information of input
    Input.update
    # Frame renewal
    update
    # When the picture changes, discontinuing the loop
    if $scene != self
      break
    end
  end
  # Transition preparation
  Graphics.freeze
  # Releasing the window
  @help_window.dispose
  @status_window.dispose
  @skill_window.dispose
  @target_window.dispose
  @shk_window.dispose
end
#--------------------------------------------------------------------------
# ? Frame renewal
#--------------------------------------------------------------------------
def update
  # Renewing the windows
  @help_window.update
  @status_window.update
  @skill_window.update
  @target_window.update
  @shk_window.update
  # When the skill window is active: Update_skill is called
  if @skill_window.active
    update_skill
    return
  end
  # When the target window is active: Update_target is called
  if @target_window.active
    update_target
    return
  end
  # When the skill_hot_key window is active: Update_shk is called
  if @shk_window.active
    update_shk
    return
  end
end
#--------------------------------------------------------------------------
# ? When frame renewal (the skill window is active)
#--------------------------------------------------------------------------
def update_skill
  # The B when button is pushed,
  if Input.trigger?(Input::B)
    # Performing cancellation SE
    $game_system.se_play($data_system.cancel_se)
    # Change to menu screen
    $scene = Scene_Menu.new(1)
    return
  end
  # When C button is pushed,
  if Input.trigger?(Input::C)
    # Acquiring the data which presently is selected in the skill window
    @skill = @skill_window.skill
    # When you cannot use,
    if @skill == nil or not @actor.skill_can_use?(@skill.id)
      # Performing buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # Performing decision SE
    $game_system.se_play($data_system.decision_se)
    # When the effective range takes part,
    if @skill.scope >= 3
      # Active conversion target window
      @skill_window.active = false
      @target_window.x = (@skill_window.index + 1) % 2 * 304
      @target_window.visible = true
      @target_window.active = true
      # Setting cursor position the effective range (the single unit/the whole) according to
      if @skill.scope == 4 || @skill.scope == 6
        @target_window.index = -1
      elsif @skill.scope == 7
        @target_window.index = @actor_index - 10
      else
        @target_window.index = 0
      end
    # When the effective range is other than taking part,
    else
      # When common event ID is effective,
      if @skill.common_event_id > 0
        # Common event call reservation
        $game_temp.common_event_id = @skill.common_event_id
        # When using the skill performing SE
        $game_system.se_play(@skill.menu_se)
        #SP consumption
        @actor.sp -= @skill.sp_cost
        # Rewriting the contents of each window
        @status_window.refresh
        @skill_window.refresh
        @target_window.refresh
        # Change to map picture
        $scene = Scene_Map.new
        return
      end
    end
    return
  end
  # When X button is pushed,
  if Input.trigger?(Input::X)
    # Performing decision SE
    $game_system.se_play($data_system.decision_se)
    @skill_window.active = false
    @shk_window.active = true
    @shk_window.visible = true
    $ABS.skill_hot_key[1] = @skill_window.skill.id
  end
  #The Y when button is pushed,
  if Input.trigger?(Input::Y)
    # Performing decision SE
    $game_system.se_play($data_system.decision_se)
    @skill_window.active = false
    @shk_window.active = true
    @shk_window.visible = true
    $ABS.skill_hot_key[2] = @skill_window.skill.id
  end
  # The Z when button is pushed,
  if Input.trigger?(Input::Z)
    # Performing decision SE
    $game_system.se_play($data_system.decision_se)
    @skill_window.active = false
    @shk_window.active = true
    @shk_window.visible = true
    $ABS.skill_hot_key[3] = @skill_window.skill.id
  end
  # The R when button is pushed,
  if Input.trigger?(Input::R)
    # Performing cursor SE
    $game_system.se_play($data_system.cursor_se)
    # To the following actor
    @actor_index += 1
    @actor_index %= $game_party.actors.size
    # Change to another skill picture
    $scene = Scene_Skill.new(@actor_index)
    return
  end
  #The L when button is pushed,
  if Input.trigger?(Input::L)
    # Performing cursor SE
    $game_system.se_play($data_system.cursor_se)
    # To actor before
    @actor_index += $game_party.actors.size - 1
    @actor_index %= $game_party.actors.size
    # Change to another skill picture
    $scene = Scene_Skill.new(@actor_index)
    return
  end
end
#--------------------------------------------------------------------------
# ? When frame renewal (the shk window is active)
#--------------------------------------------------------------------------
def update_shk
  # The C when button is pushed,
  if Input.trigger?(Input::C)
    # Performing decision SE
    $game_system.se_play($data_system.decision_se)
    # Reset Skill hot key window
    @shk_window.active = false
    @shk_window.visible = false
    @skill_window.active = true
    #Change to menu screen
    $scene = Scene_Skill.new(@actor_index)
    return
  end
end
end
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:27

Enfin, courage, dans la partie Scene_menu, remplacer l'ancien code par ça:


Code:
#==============================================================================
# ¦ Scene_Menu
#------------------------------------------------------------------------------
#  ??????????????????
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # ? ?????????
  #    menu_index : ?????????????
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def main
    # ????????????
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Sauvegarder"
    s6 = "Quitter"
    s7 = "Change perso"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    @command_window.height = 224
    # ??????? 0 ????
    if $game_party.actors.size == 0
      # ?????????????????????
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(6)
    end
    # ????????
    if $game_system.save_disabled
      # ?????????
      @command_window.disable_item(4)
    end
    # ?????????????
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # ??????????
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # ????????????
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # ?????????????
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # ?????????
    Graphics.transition
    # ??????
    loop do
      # ????????
      Graphics.update
      # ???????
      Input.update
      # ??????
      update
      # ????????????????
      if $scene != self
        break
      end
    end
    # ?????????
    Graphics.freeze
    # ????????
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    # ????????
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # ??????????????????: update_command ???
    if @command_window.active
      update_command
      return
    end
    # ???????????????????: update_status ???
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (??????????????????)
  #--------------------------------------------------------------------------
  def update_command
    # B ??????????
    if Input.trigger?(Input::B)
      # ????? SE ???
      $game_system.se_play($data_system.cancel_se)
      # ??????????
      $scene = Scene_Map.new
      return
    end
    # C ??????????
    if Input.trigger?(Input::C)
      # ??????? 0 ??????????????????????
      if $game_party.actors.size == 0 and @command_window.index < 4
        # ??? SE ???
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # ???????????????????
      case @command_window.index
      when 0  # ????
        # ??  SE ???
        $game_system.se_play($data_system.decision_se)
        # ???????????
        $scene = Scene_Item.new
      when 1  # ???
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ???????????????????
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # ??
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ???????????????????
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # ?????
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ???????????????????
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # ???
        # ????????
        if $game_system.save_disabled
          # ??? SE ???
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ??????????
        $scene = Scene_Save.new
      when 5  # ?????
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ????????????
        $scene = Scene_End.new
      when 6
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (???????????????????)
  #--------------------------------------------------------------------------
  def update_status
    # B ??????????
    if Input.trigger?(Input::B)
      # ????? SE ???
      $game_system.se_play($data_system.cancel_se)
      # ??????????????????
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # C ??????????
    if Input.trigger?(Input::C)
      # ???????????????????
      case @command_window.index
      when 1  # ???
        # ???????????? 2 ?????
        if $game_party.actors[@status_window.index].restriction >= 2
          # ??? SE ???
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ??????????
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # ??
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ?????????
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # ?????
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # ????????????
        $scene = Scene_Status.new(@status_window.index)
      when 6
        # ?? SE ???
        $game_system.se_play($data_system.decision_se)
        # Change Active Actor
        $ABS.active_actor = @status_window.index
        actor = $game_party.actors[@status_window.index]
        $game_player.character_name = actor.character_name
        @command_window.active = true
        @status_window.active = false
        @status_window.index = -1
      end
      return
    end
  end
end
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:27

2>Création du monstre

Pour créer un monstre sur une carte, vous devrez d' abord le "fabriquer" dans l' éditeur de monstre de base d' rpg maker xp, donnez lui donc un nom, des hps, ici nous appelerons ce monstre "Clad" par exemple (le nom que vous donnerez au monstre est très important !!)

Une fois notre Clad créé, (hp: 2, Intell 1 et force 3), retournez sur la map où vous souhaitez mettre le monstre puis créez un événement et DONNEZ LUI LE NOM D' UN DE VOS MONSTRES !!!(ici Clad)

Ainsi, cet événement aura EXACTEMENT les mêmes caractéristiques que le monstre référencé.
(les mêmes HPs, MPs etc...)

Voilà, maintenant ils vous suffit de donner à l' événement un charset (pour clad une touffe jaune avec une épée de 15m50 suffira) et un mode de déplacement souhaité pour l'attaque du héros

Une fois les hps du monstre descendus à 0 il disparaitra de la map !

C' est tout !
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:28

3>Les contrôles

Pour vous battre, c'est très simple, voici les comandes:


Pour le héros :

A
S } sorts rapides, touches assignables
D

Q attaque
W défense

MAJ (maintenue) course
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeLun 10 Juil 2006 - 14:29

4>Dernières remarques

Derniers trucs à savoir:

. UN seul héros peut se battre.

. Changer d' héros, de leader, de personnage se fait via le menu grâce à l' option "change lead" .

. Une barre de fatigue gère la course, arrivée à 0, le héros se met à marcher.

. Une barre d' information (Nom, level, hp etc...) se met en bas de l' écran.

. Assigner des sorts aux touches rapides, assignables (A, S et D):
-rendez vous dans le menu des sorts/compétences (PENDANT la partie)
-placez le curseur sur le sort/ la compétence à assigner,
-appuyez sur la touche assignable (A, S ou D) à laquelle vous voulez attribuer le sort
- confirmez votre choix en appuyant sur entrée sur le pop up apparaissant ("Skill Assigned to a Hot Key")
-pressez cette touche AU CONTACT de l' ennemi pour balancer le sort.
-Si votre perso meurt, il sera remplacer par un autre. Si tout les persos meurt... vous êtes partant pour recommencer le jeu.

Bon, eh bien voila. Bon a-rpg!
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeMar 11 Juil 2006 - 11:51

Ce code est pris de Zone-freegame , je ne connais pas sa provenance direct.
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
cqoica
Nouveau Venu
Nouveau Venu
cqoica


Nombre de messages : 6
Age : 31
Date d'inscription : 29/08/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeJeu 31 Aoû 2006 - 5:27

Hé ben :(-bwawawou:-):
Revenir en haut Aller en bas
tcho_i_er
Admin
Admin
tcho_i_er


Masculin Nombre de messages : 325
Age : 33
Lieu de localisation : Alsace
Emploi : Etudiant
Loisirs : Sport , Informatique , Langues
Date d'inscription : 17/06/2006

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeJeu 31 Aoû 2006 - 5:34

C'est long hein ? moi je dis , respect au créateur Faire un A-Rpg Avec Rpg Maker ? 10333075
Revenir en haut Aller en bas
http://game-gm.site.voila.fr
spool-man
Nouveau Venu
Nouveau Venu
spool-man


Masculin Nombre de messages : 5
Age : 30
Loisirs : dessin,creer jeux,creer carte à jouer,
Date d'inscription : 11/04/2008

Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitimeSam 12 Avr 2008 - 2:32

cool...
Revenir en haut Aller en bas
Contenu sponsorisé





Faire un A-Rpg Avec Rpg Maker ? Empty
MessageSujet: Re: Faire un A-Rpg Avec Rpg Maker ?   Faire un A-Rpg Avec Rpg Maker ? Icon_minitime

Revenir en haut Aller en bas
 
Faire un A-Rpg Avec Rpg Maker ?
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Aide RPG Maker
» Chercher porgrammeur RPG Maker XP
» [Astuce] Comment faire un Live CD de Linux

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
SuperVideoGames :: Rpgmaker XP :: Aide rpgmaker-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser