Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Choice Injector by Balrogic
- #
- # This is a hack, not a finished script. Is is
- # intended to demonstrate the feasibility of
- # certain scripting approaches within the system.
- # I'd have used accessor methods if they didn't
- # keep CTDing me. Uncooperative in parts of this
- # or maybe I'm just doing it wrong, I'm still
- # really new to all of this but I've chased it
- # several levels deep until it still crashes with
- # a warning that there's no @variable= method set.
- # ...Even after creating that specific method.
- module Test
- def self.run
- @override = true
- Test::add("Hey! Where do you think you're going!?
- Go find some villages and I'll teleport you.") unless @teleport
- if @teleport
- Test::choice_cancel(0)
- Test::add("There's no backing out now!")
- @teleport.each {|x|
- case x
- when 1
- Test::choice("Village A")
- when 2
- Test::choice("Village B")
- when 3
- Test::choice("Village C")
- end
- }
- Test::add("Where would you like to go!?")
- @chain = 1
- end
- end
- def self.chain
- @override = nil unless @chain
- case @chain
- when nil
- # Do nothing.
- when 1
- Test::teleport
- when 2
- # Do-me-do-me-dooooooo... If you ever... Need me to!
- end
- end
- def self.teleport
- case @teleport[@index]
- when 1
- $game_player.reserve_transfer(3, 21, 39, 8)
- when 2
- $game_player.reserve_transfer(4, 20, 40, 8)
- when 3
- $game_player.reserve_transfer(5, 17, 41, 8)
- end
- $game_temp.fade_type = 1
- RPG::SE.new("Teleport", 100, 100).play
- Test::clear
- end
- #######################################################################
- # Everything below this point relates to basic functionality. #
- #######################################################################
- @chain = nil # Selector for next method in chain.
- @index = nil # Remembers previous menu choice.
- @loop = nil # Prevents side-effects.
- @override = nil # Prevents CTD when set, also breaks event set choices.
- @teleport = nil # Teleportation array.
- def self.index(index)
- @index = index
- end
- def self.loop
- @loop
- end
- def self.loop_set(x)
- @loop = x
- end
- def self.override
- @override
- end
- def self.add(text)
- $game_message.add(text)
- end
- def self.choice(text)
- $game_message.choices.push(text)
- end
- def self.choice_cancel(type)
- $game_message.choice_cancel_type = type
- end
- def self.teleport_set(town)
- @teleport ||= []
- @teleport.push(town)
- end
- def self.clear
- @chain = nil
- @index = nil
- @loop = nil
- @override = nil
- end
- end
- class Window_ChoiceList < Window_Command
- def call_ok_handler
- $game_message.choice_proc.call(index) unless Test::override
- close
- Test::index(index)
- Test::loop_set(true)
- end
- def call_cancel_handler
- $game_message.choice_proc.call($game_message.choice_cancel_type - 1) unless Test::override
- Test::index($game_message.choice_cancel_type - 1)
- close
- Test::loop_set(true)
- end
- end
- class Window_Base < Window
- def update_close
- self.openness -= 48
- @closing = false if close?
- Test::chain if Test::loop
- Test::loop_set(nil) if Test::loop
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement