Hello, in my BABS game that I am creating, the control key is included in the custom controls. I have been told that this key is the "debug key". By pressing this key, I can walk through anything, but this key is only functional in the designing portion of the game, so I could still use the control key, but would not be able to test anything with it. Does anyone know where the control key is designated the debug key in the scripts, or do I need a new script to change it?
The Debug Input for the Ctrl key is in the script Game_Player, Line 31. It should look like this:
# If debug mode is ON and ctrl key was pressed
if $DEBUG and Input.press?(Input::CTRL)
Of course, Input::CTRL should be whatever else you desire, although I'm unsure whether or not you really have that many alternate choices to go for... I would love to suggest being able to use some other random/free key other than CTRL via Blizzard's Input Module, but I think that would require a new, quick script as opposed to a small edit ( Since the Module is like... after Game_Player D: ). But dunno, I'm not one for scripting, so I can be entirely wrong.
Anyway, it's at Game_Player. :)
Actually if he's using Blizz-ABS, he already has access to Blizzard's Input module. You can use it like this.
Input.trigger?(Input::Keys['key here'])
Ah! Happy days. c:
I replaced the script that Starrodkirby86 showed me with the one game_guy gave me and I inputed a key where it said 'key here'.
It gave me the error: Script 'Game_Player' line 278: SyntaxError occurred.
Quote from: The Amazing Link on January 08, 2012, 12:30:18 pm
I replaced the script that Starrodkirby86 showed me with the one game_guy gave me and I inputed a key where it said 'key here'.
It gave me the error: Script 'Game_Player' line 278: SyntaxError occurred.
I think its because the control overwriting is after Game_Player, I don't think it is safe to put it before it...
I'll try and make a script (I don't know how to scrip really so I'll just try)
Try and add this underneath the BABS scripts:
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Invariables
#--------------------------------------------------------------------------
CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4
CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4
#--------------------------------------------------------------------------
# * Passable Determinants
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# Impassable
return false
end
# If debug mode is ON and ctrl key was pressed
if $DEBUG and Input.press?(Input::Keys['YOUR KEY HERE'])
# Passable
return true
end
super
end
#--------------------------------------------------------------------------
# * Set Map Display Position to Center of Screen
#--------------------------------------------------------------------------
def center(x, y)
max_x = ($game_map.width - 20) * 128
max_y = ($game_map.height - 15) * 128
$game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
$game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
end
#--------------------------------------------------------------------------
# * Move to Designated Position
# x : x-coordinate
# y : y-coordinate
#--------------------------------------------------------------------------
def moveto(x, y)
super
# Centering
center(x, y)
# Make encounter count
make_encounter_count
end
#--------------------------------------------------------------------------
# * Increaase Steps
#--------------------------------------------------------------------------
def increase_steps
super
# If move route is not forcing
unless @move_route_forcing
# Increase steps
$game_party.increase_steps
# Number of steps are an even number
if $game_party.steps % 2 == 0
# Slip damage check
$game_party.check_map_slip_damage
end
end
end
#--------------------------------------------------------------------------
# * Get Encounter Count
#--------------------------------------------------------------------------
def encounter_count
return @encounter_count
end
#--------------------------------------------------------------------------
# * Make Encounter Count
#--------------------------------------------------------------------------
def make_encounter_count
# Image of two dice rolling
if $game_map.map_id != 0
n = $game_map.encounter_step
@encounter_count = rand(n) + rand(n) + 1
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# If party members = 0
if $game_party.actors.size == 0
# Clear character file name and hue
@character_name = ""
@character_hue = 0
# End method
return
end
# Get lead actor
actor = $game_party.actors[0]
# Set character file name and hue
@character_name = actor.character_name
@character_hue = actor.character_hue
# Initialize opacity level and blending method
@opacity = 255
@blend_type = 0
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == @x and event.y == @y and triggers.include?(event.trigger)
# If starting determinant is same position event (other than jumping)
if not event.jumping? and event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# Calculate front event coordinates
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
# If fitting event is not found
if result == false
# If front tile is a counter
if $game_map.counter?(new_x, new_y)
# Calculate 1 tile inside coordinates
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == x and event.y == y and [1,2].include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
# If not moving
unless moving?
# If player was moving last time
if last_moving
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# If C button was pressed
if Input.trigger?(Input::C)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
Ah, so my previous assumption was correct.
Game_Player was being loaded before the Input module, so you couldn't really just replace it there, sadly. Dunno if Futendra's script works since I haven't checked out, but since that thing can be placed after the Input Module, it'll probably have more success.
Futendra's script didn't work. I put it after Blizz ABS and it gave me the error:
"Script 'BABS 2' line 591: NoMethodError occurred. undefined method 'freeze_action=' for #<Game_Player:0x426f210>"
Futendra overwrote the entire Game_Player class when Blizz-ABS modifies it...
I'm not sure if Blizz-ABS makes changes to def passable?, but that's the only part you need under Blizz-ABS
If it is changed in Blizz-ABS, though, then you should be able to just change the key from within there.
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Passable Determinants
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# Impassable
return false
end
# If debug mode is ON and ctrl key was pressed
if $DEBUG and Input.press?(Input::Keys['YOUR KEY HERE'])
# Passable
return true
end
super
end
end
Futundra, you are completely wrong. All the scripts get loaded before being called on. An instance of Game_Player isn't created before the Input module gets loaded. And judging by his error, he didn't type the script snippet in right. If that were the case, so many scripts would be broken. It'd be a pain in the ass to get them to work. Now if an instance of Game_Player was created before the input rewrite then yes, it wouldn't work but thats not the case. Game_Player gets created at the title screen. The title screen gets created in main. To prove my point, place Scene_Title above Game_Player, and you'll notice it works just fine.
Lol, you just did the same mistake as Fut. If you just place Scene_Title above Game_Player, it doesn't make a differences whether Scene_Title or Game_Player is parsed first. Scene_Title#main is called down in the Main script either way, not in Scene_Title.
I have no scripting knowledge, I was just trying some stuff :O.o:
Don't hurt me :'(
Quote from: Blizzard on January 15, 2012, 03:49:55 am
Lol, you just did the same mistake as Fut. If you just place Scene_Title above Game_Player, it doesn't make a differences whether Scene_Title or Game_Player is parsed first. Scene_Title#main is called down in the Main script either way, not in Scene_Title.
Thats what I said! D: I was explaining to him that it didn't matter at that point because Game_Player doesn't get created before the Input module is overwritten.
Quote from: game_guy on January 14, 2012, 11:47:29 pm
Game_Player gets created at the title screen. The title screen gets created in main. To prove my point, place Scene_Title above Game_Player, and you'll notice it works just fine.
Ah, my bad. I misread it.
I am going to get a Basic-For-Beginners book :D
Quote from: Aqua on January 14, 2012, 10:25:23 pm
Futendra overwrote the entire Game_Player class when Blizz-ABS modifies it...
I'm not sure if Blizz-ABS makes changes to def passable?, but that's the only part you need under Blizz-ABS
If it is changed in Blizz-ABS, though, then you should be able to just change the key from within there.
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Passable Determinants
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# Impassable
return false
end
# If debug mode is ON and ctrl key was pressed
if $DEBUG and Input.press?(Input::Keys['YOUR KEY HERE'])
# Passable
return true
end
super
end
end
I'm getting an error with this:
Script 'BABS' line 2219: NoMethodError occured.
undefined method 'refresh' for #<Game_Player:0x4270878