[XP] Strike First States

Started by G_G, April 07, 2010, 09:09:54 pm

Previous topic - Next topic

G_G

April 07, 2010, 09:09:54 pm Last Edit: April 07, 2010, 09:12:46 pm by game_guy
First Strike States
Authors: game_guy
Version: 1.0
Type: Turn-Based Modification
Key Term: Battle Add-on



Introduction

Remember in most RPG's there was always an armor that let you strike first at the beginning of battle? This script does exactly that! Note that actors do not attack first unless they have a Strike First state. Note that if two actors have a strike first state at the same time, the faster actor will attack first.


Features


  • Setup as many states
  • Allows actor to strike first at beginning of battle
  • Can also set it up so actor attacks first at the beginning of every turn



Screenshots

N/A


Demo

N/A


Script

Spoiler: ShowHide

#===============================================================================
# First Strike States
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Remember in most RPG's there was always an armor that let you strike first
# at the beginning of battle? This script does exactly that!
# Note that actors do not attack first unless they have a Strike First state.
# Note that if two actors have a strike first state at the same time, the faster
# actor will attack first.
#
# Features:
# Setup as many states
# Allows actor to strike first at beginning of battle
# Can also set it up so actor attacks first at the beginning of every turn
#
# Instructions:
# Go down to Config and set everything up.
#
# First_Strike_States = Array of state id's
#    State id's that allow the actor to attack first at the beginning of battle.
#    Example: First_Strike_States = [17, 18, 19]
#    It will include state id's 17, 18, and 19
# Attack_Always = true/false
#    If true, if an actor has a strike first state, the actor will attack first
#    at the beginning of every turn. If false, the actor will only attack first
#    at the beginning of the battle.
#    Example: Attack_Always = true
#    If an actor has a strike first state, he'll attack first at the beginning
#    of every turn in the battle.
#
# You can also turn Attack_Always on and off in game. Use this code.
# $game_system.attack_always = true/false
#
# Compatibility:
# Made for default battle system.
# Not tested with SDK.
# Probably won't work with RTAB. (Haven't tested)
#
# Credits:
# game_guy ~ for making it
# Classic RPG's ~ inspired me to make the script
#===============================================================================
module GameGuy
 #==========================================
 # Config
 #==========================================
 First_Strike_States = [17]
 Attack_Always       = true
 #==========================================
 # End Config
 #==========================================
end
class Game_System
 attr_accessor :attack_always
 alias gg_first_strike_always_lat initialize
 def intitialize
   @attack_always = GameGuy::Attack_Always
   return gg_first_strike_always_lat
 end
end
class Game_Party
 attr_accessor :attacked
 alias gg_setup_actors_always_lat initialize
 def initialize
   @attacked = false
   return gg_setup_actors_always_lat
 end
end
class Scene_Battle
 alias gg_reset_attack_party_lat main
 def main
   $game_party.attacked = false
   return gg_reset_attack_party_lat
 end
 alias gg_attack_first_states_lat make_action_orders
 def make_action_orders
   gg_attack_first_states_lat
   if $game_system.attack_always == false
     if $game_party.attacked
       return
     end
   end
   @tempa = @action_battlers
   @tempa2 = []
   @tempa3 = []
   for i in @tempa
     if GameGuy::First_Strike_States.any? {|j| i.states.include?(j)}
       @tempa2.push(i)
     else
       @tempa3.push(i)
     end
   end
   @action_battlers = []
   @tempa2.each {|i| @action_battlers.push(i)}
   @tempa3.each {|i| @action_battlers.push(i)}
   $game_party.attacked = true
 end
end



Instructions

Above blizzard's scripts and below Scene_Debug.
Rest of instructions in the script.


Compatibility

Made for default battle system.
Not tested with SDK.
Probably won't work with RTAB. (Haven't tested)


Credits and Thanks


  • game_guy ~ for making it
  • Classic RPG's ~ inspired me to make the script
  • Branden ~ Beta Testing



Author's Notes

Enjoy!

Spaceman McConaughey

I've tested it; works flawlessly. ;)

Good job, as always, G_G! :D

Jragyn

Say, erhm, judging by just the name of the script and the description, I was wondering if by "first strike" it just meant you hit first in a the first turn...or if it meant youhad an entire free turn to start the battle...or what? lol, I'm not sure.
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

Fantasist

QUICK ATTACK!!! Nice going G_G :) (I'm currently playing pokemon crystal in my phone, bringing back old memories)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




G_G

Quote from: jragyn00 on April 08, 2010, 12:54:21 am
Say, erhm, judging by just the name of the script and the description, I was wondering if by "first strike" it just meant you hit first in a the first turn...or if it meant youhad an entire free turn to start the battle...or what? lol, I'm not sure.


Okay there are two ways you can set it up.

1: Actors with a First Strike state attack first in the first turn in the battle.
or
2: Actors with a First Strike state attack first in every turn in the battle.

You can set it up to do either of those ways.

@Fantasist: THanks!

Holyrapid

Intersting. Good work like always G_G