Help - Search - Members - Calendar
Full Version: Auto-Preemptive or Surprise
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
AlphaWhelp
Script is simple and self explanatory, so I'm not going to use a template. Just post here if you have an issue.

PREEMPTIVE = Party attacks first
SURPRISE = Enemies attack first

Minor bug fix, if you downloaded it before, download it again.

CODE
=begin
AlphaWhelp's Auto Preemptive or Surprise

Add the troop ids to the appropriate variables below
noted with comments above them. If you input a troop
ID into both variables, auto-preemptive takes effect
instead of auto-surprise. Enjoy.

Version 0.2a
Changes from 0.1a
Minor bug fix involving random encounters
Created 6/7/09, 1:34 A.M.
=end
module AW
#Insert auto-preemptive troop IDs below
#E.X. [1, 2, 3, 4]
AUTOPREEMPTTROOPIDS = [1]

#Insert auto-surprise troop IDs below
#E.X. [5, 6, 7, 8]
AUTOSURPRISETROOPIDS = [2]
end

class Scene_Battle < Scene_Base
alias aw_preempt_pbs process_battle_start
def process_battle_start
awtroopid = $game_troop.troop.id
if AW::AUTOPREEMPTTROOPIDS.include?(awtroopid)
$game_troop.preemptive = true
else
if AW::AUTOSURPRISETROOPIDS.include?(awtroopid)
$game_troop.surprise = true
end
end
aw_preempt_pbs
end
end

class Scene_Map < Scene_Base
alias aw_preempt_pos preemptive_or_surprise
def preemptive_or_surprise
awtroopid = $game_troop.troop.id
if AW::AUTOPREEMPTTROOPIDS.include?(awtroopid)
$game_troop.preemptive = true
else
if AW::AUTOSURPRISETROOPIDS.include?(awtroopid)
$game_troop.surprise = true
else
aw_preempt_pos
end
end
end
end
AlphaWhelp
Nobody's interested? I thought this would be an insanely useful script for anyone trying to event a preemptive or surprise battle.

Oh well.
SuperMega
Nice script you got here AlphaWhelp! It's a shame no one commented! Thanks for the nice script!
AlphaWhelp
QUOTE (SuperMega @ Jun 22 2009, 07:46 PM) *
Nice script you got here AlphaWhelp! It's a shame no one commented! Thanks for the nice script!

Thanks. Considering how easy it was to write this script, I'm very surprised nobody beat me to it (I couldn't find anything like it).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.