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.

HBGames

Howdy

I'm trying to set the preemptive or surprise attack status based on the state of a switch. I'm using chasing/fleeing events for my monsters instead of random encounters. I'm using default scripts/battle system except for the variable fix script and Yanfly's event chase script.

I have the event set up so that when it touches the player, it looks at the direction both the event and the player are looking. If they are looking the same way, and the event is behind the player (in effect the event is touching the back of the player), it turns on Switch 0100: Enemy attacks first. If they are looking the same way, and the event is in front of the player (in effect the player is touching the back of the event), it turns on Switch 0099: Player attacks first

In my Scene_map script I have the following for determining Preemptive/Surprise instead of the random number default:



Code:
def preemptive_or_surprise

    if $game_switches[99] = true

      $game_troop.preemptive = true

    elsif $game_switches[100] = true

      $game_troop.surprise = true

    end

  end


The switches turn on properly, but I don't get the appropriate Preemptive or Surprise attack in the battle processing. As I have no real experience with Ruby, I'm sure I'm missing something super simple. What am I missing?

Thanks!

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