SG AutoWin on button pressed
#1
SG AutoWin on button pressed
Version: 3


This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


I had posted this somewhere else, but it seems like something you guys might find useful too. Using a different name here [Image: smile.gif]

Tested, works: Ccoa's, Cogwheel/Minkoff's, Cybersam's, Default Battle System, SephirothSpawn's(Beta)

Tested, doesn't work: Taret Blade

Make a post if you try it in something else and it works/doesn't work.

Introduction

Please play through your game without using this before releasing it!

Intended to make playtesting games with a default-style battle system a lot easier. Press F8 in the battle command windows during test play and you win automatically, still giving everyone the experience and items.

Features
  • Automatically win battles by pressing "F8" during test play
    This key can be changed by editing one line
  • AutoEscape (CTRL+F8) or AutoLose (ALT+F8) if those options are enabled
  • Skips the victory delay and result window, drops you right back out of battle
  • Works on both the Party Command and Individual Command windows
  • Works immediately in any game that doesn't use the SDK or uses it.
    SDK logging still present. No commenting or editing necessary (thanks Prexus!)
  • Notification reminder to delete it when playing outside of test mode
    Reminder and script can be disabled, for those who don't care about performance
Screenshots

Doesn't alter anything on the screen.

This demo contains different code than below. Use THIS SCRIPT and not the demo one. The demo doesn't have to be run in test mode, but the script below won't work unless you're playing in it.

This is a demo I'll be including all my scripts in, so if I've released more and it doesn't start off on the island: Walk to the boat. Talk to the jumping guy to enable/disable testplay. The slimes demonstrate this script.

Script
Code:
#=============================================================================
# ** Sandgolem AutoWin on button pressed (battles in debug mode)
#=============================================================================
# sandgolem
# Version 3
# 03.03.06
#=============================================================================
#
# PLEASE PLAY THROUGH YOUR GAME WITHOUT THIS at least once
#
# DELETE this script from your game's release version to improve performance.
#
# Uncomment the $ line below if for some reason you don't DELETE this script
# and are releasing your game:
#
# $sg_release_mode = true
#
# It disables this script.
#
# -   -   -   -   -
#
# @sg_disable_autowin_message = true
#
# Uncomment the line above if you want to hide the notification popup
# when release mode is on. The other notification is meant to be annoying
# and remind you to delete this or turn $sg_release_mode on..
#
#=============================================================================
#
# Using this script ingame, while in test mode:
#   F8       - Win a battle automatically
#   CTRL+F8  - Escape a battle automatically
#   ALT+F8   - Lose a battle automatically
#
# The bottom two only work if you have their options set in battle processing.
#
#=============================================================================
#
# To set a different key to automatically win, search for "Input::F8"
# Press F1 ingame to find out what buttons are available and what they do.
#
# Only change the "F8" part. This is generally not the key you press.
# For example, "R" is actually pressing W.
#
# F5, F6, F7, F8 and F9 are the only function keys available.
# F8 will be compatible with any other playtesting scripts I release.
#
#=============================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts.htm
#
# To use this script, copy it and insert it in a new section above "Main",
# Insert this directly above main, with any other playtesting scripts you
# have. This should be below the SDK and any other non-playtesting scripts.
#
# Have problems? You can leave me a message at:
# http://www.gamebaker.com/users/sandgolem
#
#=============================================================================

#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------

begin
  SDK.log("SG AutoWin on button pressed", "Sandgolem", 3, "03.03.06")
  if SDK.state("SG AutoWin on button pressed") != true
    $sg_autowin_script_disabled = true
  end
  rescue
end

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if !$sg_autowin_script_disabled
  
#--------------------------------------------------------------------------
# Checks to see if you've set the game to release mode
#--------------------------------------------------------------------------
if !$sg_release_mode
  
  class Scene_Battle
    
#--------------------------------------------------------------------------
# The script below inserts itself into the Individual Commands
#--------------------------------------------------------------------------
    alias sandgolem_autowindebug_scbattle_upd3bc update_phase3_basic_command
  
    def update_phase3_basic_command
      sandgolem_autowindebug_keycheck
      sandgolem_autowindebug_scbattle_upd3bc
    end

#--------------------------------------------------------------------------
# The script below inserts itself before the victory screen & delays
#--------------------------------------------------------------------------
    alias sandgolem_autowindebug_scenebattle_updatephase5 update_phase5

    def update_phase5
# Checks if you've skipped the battle. If so, no wait delay or enter required
      if @sg_battle_skipped == true
        @sg_battle_skipped = false
        battle_end(0)
      end
      sandgolem_autowindebug_scenebattle_updatephase5
    end
  
#--------------------------------------------------------------------------
# The script below inserts itself into the Party Command window
#--------------------------------------------------------------------------
    alias sandgolem_autowindebug_scenebattle_updatephase2 update_phase2
  
    def update_phase2
      sandgolem_autowindebug_keycheck
      sandgolem_autowindebug_scenebattle_updatephase2  
    end

#--------------------------------------------------------------------------
# Checks if you're pressing the key listed at the top and in debug mode.
#--------------------------------------------------------------------------
    def sandgolem_autowindebug_keycheck
      if Input.press?(Input::F8) && $DEBUG
          if Input.press?(Input::CTRL)
            if !$game_temp.battle_can_escape
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            $game_system.se_play($data_system.escape_se)
            $game_system.bgm_play($game_temp.map_bgm)
# Calls escape
            battle_end(1)
          elsif Input.press?(Input::ALT)
            if !$game_temp.battle_can_lose
              $game_system.se_play($data_system.buzzer_se)
              return                
            end
            $game_system.se_play($data_system.actor_collapse_se)
            $game_system.bgm_play($game_temp.map_bgm)
# Calls lose
            battle_end(2)
          else
          @sg_battle_skipped = true
# Gives you the "battle rewards", plays victory and then boots you out
          start_phase5
          end
        end
      end
    end
    
  end
  
#--------------------------------------------------------------------------
# Ends the $sg_release_mode check
#--------------------------------------------------------------------------
end

#--------------------------------------------------------------------------
# Adds a notification if not in test play that the script is still here
#--------------------------------------------------------------------------

if !$DEBUG

  if $sg_release_mode
    if @sg_disable_autowin_message != true
    
          p "Playtesting script still included! Delete AutoWin. If you don't",
          "care about better game performance, just disable this popup at the",
          "start of the script - read the comments. (Script is inactive)"
          while !Input.press?(Input::C)
          end
      
    end
  else
  
        p "Playtesting script still included AND active! This is bad. Read the",
        "comments at the top of AutoWin to find out how to disable it, or you",
        "should delete it if you're ready to the release the game."
        while !Input.press?(Input::C)
        end
    
  end
end

#--------------------------------------------------------------------------
# End of notification
#--------------------------------------------------------------------------

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end


Instructions

Place this script all the way at the bottom, above main. Make sure it's under any battle system scripts you have.

When you're ready to release your game, delete this script. If you don't care about making your game more laggy for no reason, you can disable it. It features a notification popup to remind you of that when not played in test mode (you can only automatically win battles in test mode).

Credits and Thanks

Prexus for the way to have it not crash people without the SDK.

Thanks to Magic Magor, MeisMe, Prexus & SephirothSpawn for putting up with newbie-ish scripting questions.

Author's Notes

This script will probably be updated as more battle systems are tested and add support for incompatible SDK-using ones.

This is the first of several playtesting scripts I'll be releasing
}




Users browsing this thread: 2 Guest(s)