Mu nie chodzi o grę przez internet tylko o multiplayer że na przykład w jakieś grze mogą grać 2 osoby ale na jednym komputerze. Wiem że jest taki skrypt do VX może poproś Ayene o to aby ci go przerobiła.
Pomogła: 232 razy Dołączyła: 18 Wrz 2007 Posty: 2424
Wysłany: Czw 04 Lis, 2010 20:52
Sprawdź to... przerobiony z VXa. Powinien działać, choć zalecane testy.
Spoiler:
Kod:
#================================================
# Silnik 2 graczy [2 Player Engine]
#------------------------------------------------
# Autor: Woratana [woratana@hotmail.com]
# Tłumaczenie i wersja XP: Ayene [yurika@o2.pl]
# www.ultimateam.pl
#
# + [OPIS] +
# Skrypt tworzy drugiego bohatera, którego można kontrolować i, który może
# wchodzić w interakcje z otoczeniem tak samo jak główna postać.
# - Można przypisać klawisze do drugiej postaci.
# - Druga postać porusza się w 8 kierunkach.
#
# + [JAK UŻYĆ] +
# By stworzyć drugą postać, wywołaj skrypt:
# $game_player2 = Game_Player2.new
# $game_player2.create(x, y, actor id, follow?)
#
# x i y = współrzędne miejsca, w którym ma się pojawić bohater
# actor id - id bohatera z bazie danych, który ma być drugą postacią
# follow? = true (ekran podąża za nową postacią), false (nie podąża)
# *ZALECA SIĘ NIEUŻYWANIE TEJ OPCJI*
#
# By usunąć postać 2, wywołaj skrypt:
# $game_player2.delete
#==============================================================================
class Game_Player2 < Game_Character
#--------------------------------------------------------------------------
# START SETUP SCRIPT PART
# * Constants: INPUT BUTTONS FOR Game_Player 2
#--------------------------------------------------------------------------
DOWN = Input::Y # S in Keyboard
LEFT = Input::X # A in Keyboard
RIGHT = Input::Z # D in Keyboard
UP = Input::R # W in Keyboard
ENTER = Input::L # Q in Keyboard
#--------------------------------------------------------------------------
# END SETUP SCRIPT PART
#--------------------------------------------------------------------------
def create(x,y,id,need_center = false)
@actor_id = id
moveto(x,y)
@need_center = need_center
refresh
end
#--------------------------------------------------------------------------
# * Clear Player 2
#--------------------------------------------------------------------------
def delete
@actor_id = 0
refresh
$game_player2 = nil
end
#--------------------------------------------------------------------------
# * 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::CTRL)
# 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 or @actor_id == 0
# Clear character file name and hue
@character_name = ""
@character_hue = 0
# End method
return
end
# Get lead actor
actor = $game_actors[@actor_id]
# 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
if Input.press?(DOWN)
move_down
end
if Input.press?(LEFT)
move_left
end
if Input.press?(RIGHT)
move_right
end
if Input.press?(UP)
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?(ENTER)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
class Scene_Title
alias wor_sctit_command_new_game command_new_game
def command_new_game
wor_sctit_command_new_game
$game_player2 = nil
end
end
class Scene_Map
alias wor_twopla_scemap_upd update
def update
wor_twopla_scemap_upd
$game_player2.update if $game_player2 != nil
end
def transfer_player
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
$game_player2.moveto($game_temp.player_new_x, $game_temp.player_new_y - 1) if $game_player2 != nil
case $game_temp.player_new_direction
when 2
$game_player.turn_down
$game_player2.turn_down if $game_player2 != nil
when 4
$game_player.turn_left
$game_player2.turn_left if $game_player2 != nil
when 6
$game_player.turn_right
$game_player2.turn_right if $game_player2 != nil
when 8
$game_player.turn_up
$game_player2.turn_up if $game_player2 != nil
end
$game_player.straighten
$game_player2.straighten if $game_player2 != nil
$game_map.update
@spriteset.dispose
@spriteset = Spriteset_Map.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(20)
end
$game_map.autoplay
Graphics.frame_reset
Input.update
end
end
class Spriteset_Map
alias wor_twopla_sprmap_ini initialize
def initialize
wor_twopla_sprmap_ini
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
@chara_two_pushed = false
end
alias wor_twopla_sprmap_updcha update
def update
if !(@chara_two_pushed) and $game_player2 != nil
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player2))
@chara_two_pushed = true
elsif @chara_two_pushed and $game_player2 == nil
for i in 0..@character_sprites.size
if @character_sprites[i].character.is_a?(Game_Player2)
# @character_sprites[i].character.character_name = ""
@character_sprites[i].update
@character_sprites.delete_at(i)
break
end
end
@chara_two_pushed = false
end
wor_twopla_sprmap_updcha
end
end
http://www.ultimateam.pl/viewtopic.php?t=2887 z tego przetłumaczonego przez czeliossa
i mam problem z tym spkryptem uzwywam ver. Ang makera i wyskakuje mi nłąd w konfigurowanych klawiszach to jest 34 linijka
Pomogła: 232 razy Dołączyła: 18 Wrz 2007 Posty: 2424
Wysłany: Pią 05 Lis, 2010 16:54
Widocznie przyporządkowałeś klawisze, które nie są obsługiwane domyślnie przez RMXP.
Co do systemu skoku. Podmień poniższy skrypt z silnikiem 2 graczy:
Spoiler:
Kod:
#================================================
# Silnik 2 graczy [2 Player Engine]
#------------------------------------------------
# Autor: Woratana [woratana@hotmail.com]
# Tłumaczenie i wersja XP: Ayene [yurika@o2.pl]
# www.ultimateam.pl
#
# + [OPIS] +
# Skrypt tworzy drugiego bohatera, którego można kontrolować i, który może
# wchodzić w interakcje z otoczeniem tak samo jak główna postać.
# - Można przypisać klawisze do drugiej postaci.
# - Druga postać porusza się w 8 kierunkach.
#
# + [JAK UŻYĆ] +
# By stworzyć drugą postać, wywołaj skrypt:
# $game_player2 = Game_Player2.new
# $game_player2.create(x, y, actor id, follow?)
#
# x i y = współrzędne miejsca, w którym ma się pojawić bohater
# actor id - id bohatera z bazie danych, który ma być drugą postacią
# follow? = true (ekran podąża za nową postacią), false (nie podąża)
# *ZALECA SIĘ NIEUŻYWANIE TEJ OPCJI*
#
# By usunąć postać 2, wywołaj skrypt:
# $game_player2.delete
#==============================================================================
class Game_Player2 < Game_Character
#--------------------------------------------------------------------------
# START SETUP SCRIPT PART
# * Constants: INPUT BUTTONS FOR Game_Player 2
#--------------------------------------------------------------------------
DOWN = Input::Y # S in Keyboard
LEFT = Input::X # A in Keyboard
RIGHT = Input::Z # D in Keyboard
UP = Input::R # W in Keyboard
ENTER = Input::L # Q in Keyboard
JUMP = Input::CTRL
JumpID = 1
#--------------------------------------------------------------------------
# END SETUP SCRIPT PART
#--------------------------------------------------------------------------
def create(x,y,id,need_center = false)
@actor_id = id
moveto(x,y)
@need_center = need_center
refresh
end
#--------------------------------------------------------------------------
# * Clear Player 2
#--------------------------------------------------------------------------
def delete
@actor_id = 0
refresh
$game_player2 = nil
end
#--------------------------------------------------------------------------
# * 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::CTRL)
# 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 or @actor_id == 0
# Clear character file name and hue
@character_name = ""
@character_hue = 0
# End method
return
end
# Get lead actor
actor = $game_actors[@actor_id]
# 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
Audio.se_play("Audio/SE/015-jump01") #Dźwięk przy skoku
$game_player2.force_move_route(route)
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
if Input.press?(DOWN)
move_down
end
if Input.press?(LEFT)
move_left
end
if Input.press?(RIGHT)
move_right
end
if Input.press?(UP)
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?(ENTER)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
leap if Input.trigger?(JUMP)
end
end
end
class Scene_Title
alias wor_sctit_command_new_game command_new_game
def command_new_game
wor_sctit_command_new_game
$game_player2 = nil
end
end
class Scene_Map
alias wor_twopla_scemap_upd update
def update
wor_twopla_scemap_upd
$game_player2.update if $game_player2 != nil
end
def transfer_player
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
$game_player2.moveto($game_temp.player_new_x, $game_temp.player_new_y - 1) if $game_player2 != nil
case $game_temp.player_new_direction
when 2
$game_player.turn_down
$game_player2.turn_down if $game_player2 != nil
when 4
$game_player.turn_left
$game_player2.turn_left if $game_player2 != nil
when 6
$game_player.turn_right
$game_player2.turn_right if $game_player2 != nil
when 8
$game_player.turn_up
$game_player2.turn_up if $game_player2 != nil
end
$game_player.straighten
$game_player2.straighten if $game_player2 != nil
$game_map.update
@spriteset.dispose
@spriteset = Spriteset_Map.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(20)
end
$game_map.autoplay
Graphics.frame_reset
Input.update
end
end
class Spriteset_Map
alias wor_twopla_sprmap_ini initialize
def initialize
wor_twopla_sprmap_ini
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
@chara_two_pushed = false
end
alias wor_twopla_sprmap_updcha update
def update
if !(@chara_two_pushed) and $game_player2 != nil
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player2))
@chara_two_pushed = true
elsif @chara_two_pushed and $game_player2 == nil
for i in 0..@character_sprites.size
if @character_sprites[i].character.is_a?(Game_Player2)
# @character_sprites[i].character.character_name = ""
@character_sprites[i].update
@character_sprites.delete_at(i)
break
end
end
@chara_two_pushed = false
end
wor_twopla_sprmap_updcha
end
end
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum