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.

[Resolved] Conditional Branch Help?

kaileb

Member

Hello there! :)
I have a bit of a problem ???. I'm trying to make a demo for my new pirate game. What I want to do is make a person (Captain) tell me to go kill 2 krakens and when I'm done it would transfer my player to a new level. So I thought a conditional branch would help but I just can't seem to understand how to do that. So please can you help thank you. ;D
 
In each kraken event, after battle processing, add 1 to a variable, KrakenKilled

Then in the captain event do a conditional branch,
variable KrakenKilled==2
Text:"You have killed enough Krakens! Advance"
Advance player to next level
else
Text:"You still need to kill two Krakens!!"

-Syv
 

khmp

Sponsor

First have two events on your map. These events will be your Krakens. In both events use the following commands:

Battle Processing:
  Initiate the fight between you and the Kraken
Control Variables:
  Variable:
    Krakens_Killed
  Operation:
    Add
  Operand:
    Constant:
      1
Conditional Branch:
  Page 1:
    Variable:
      Krakens_Killed equal to 2

Then in the top part of the condition do work if the player has killed 2 krakens else say they killed 1 kraken, one to go.

Good luck with it kaileb! :thumb:


 
 
Lazy script... coming up!

Code:
class Game_System
  attr_accessor :enemy_kills
  alias_method :seph_enemykillcount_gmsys_init, :initialize
  def initialize
    seph_enemykillcount_gmsys_init
    @enemy_kills = {}
    @enemy_kills.default = 0
  end
end

class Scene_Battle
  alias_method :seph_enemykillcount_scnbtl_main, :main
  def main
    seph_enemykillcount_scnbtl_main
    $game_troop.enemies.each do |e|
      $game_system.enemy_kills[e.id] = $game_system.enemy_kills[e.id] + 1
    end
  end
end

Now, to get the number of times an enemy has been defeated, use:
Code:
$game_system.enemy_kills[enemy_id]

So to test if enemy 3 has been killed 2 or more times, use:
Code:
$game_system.enemy_kills[3] >= 2
 

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