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.

Getting more then one attack off. (Ccoa's side view system)

Dko

Member

I guess since my last post got no reply ill try a different approach to my problem. I want to try to have it so based on a characters statistic that selected character in battle can make more then one attack of different powers. (Sorta like Chrono Cross)
Now ive had it for a while where pressing certain keys caused the different damage to be dealt but I can't seam to get the multiple attacks to work. SO I was wondering if anyone could share some ideas on how I would get this to work?

because this bellow doesn't work. There are no errors. It just acts like I never changed my code at all to try for multiple attacks.

Code:
#--------------------------------------------------------------------------
  # * Frame Update (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
 def update_phase3_enemy_select
    # Update enemy arrow
    @enemy_arrow.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End enemy selection
      end_enemy_select
      return
    end
    
    # If C button was pressed
    if Input.trigger?(Input::C) or Input.trigger?(Input::Y) or Input.trigger?(Input::X) or Input.trigger?(Input::Z)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      if @active_battler.is_a?(Game_Actor)
        @num_attacks = @active_battler.stam
      else
        @num_attacks = 1
      end
      # Set each attacks strength
      for i in (1..@num_attacks)
        
        if Input.trigger?(Input::C) or Input.trigger?(Input::Y)
          $atk_power[i] = "MED"
        end
        if Input.trigger?(Input::X)
          $atk_power[i] = "STR"
        end
        if Input.trigger?(Input::Z)
          $atk_power[i] = "WEAK"
        end
      end
 

Dko

Member

EDIT: Well ive narrowed things down and changed some of my code. But now im getting an error.
Script 'CBS Game_Battler' line 52: NoMethodError occurred.
undefined method '[]=' for nil:NilClass

Which for some reason is caused by this line code..
Code:
for i in (1..@num_attacks)
      # First hit detection
      hit_result = (rand(100) < attacker.hit)
      # If hit occurs
      if hit_result == true
        # Calculate basic damage    
          atk = [attacker.ap * 4 * (1 - self.pdef/255), 0].max
          self.damage[i] = atk # this line is the problem.
For some reason trying to change damage to a array is causing it and I can't remember what is the cause of this kind of error. Could I get a refresher as to what that is?
 

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