Olá gostaria que convertessem esse script de Netplay 1.7 pra netplay master v3
Aí vai o tutorial + Script que tá dentro do bloco de notas
Aí vai o tutorial + Script que tá dentro do bloco de notas
rie um script chamado Scene_player acima do main:
Código:
#==============================================================================
# ** Scene_Players - Displays the connected players.
#------------------------------------------------------------------------------
# Author GoldenAura 3 , Eragon 55100 ( Edited to work with Netplay Plus™)
# Version 1.0
# Date 12-04-06
#==============================================================================
SDK.log("Players","GoldenAura 3, Eragon 55100","1.0","12-04-06")
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
#if SDK.state('Network') and SDK.state('PlayersWindow') and SDK.state('Players')
class Scene_Players
#--------------------------------------------------------------------------
# * Main processing
#--------------------------------------------------------------------------
def main
# Creates windows.
@help_window = Window_Help.new
@player_window = Window_Players.new if SDK.state('PlayersWindow')
Graphics.transition
loop do
Graphics.frame_reset
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@player_window.dispose
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
$m.update
@help_window.update if SDK.state('PlayersWindow')
# Network::Main.send_player_data
Network::Main.update
if Graphics.frame_count % Graphics.frame_rate == 0
@player_window.update
Network::Main.update
end
@i = 0
for p in Network::Main.players.values
@i += 1
end
# if Input.trigger?(Input::C) && @i != 0
# $scene = Scene_Profile.new
# end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
return
end
if Input.press?(Input::UP)
unless @player_window.oy == 0
@player_window.oy -= 8
return
end
end
if Input.press?(Input::DOWN)
if Network::Main.players.size > 11
@player_window.oy += 8
return
end
end
end
end
#end
#-------------------------------------------------------------------------------
# End SDK Enabled Check
#-------------------------------------------------------------------------------
agora crie outro script com nome Window_Players
Código:
#===============================================================================
# ** Window_Players - Displays connected players.
#-------------------------------------------------------------------------------
# Author Destined, Eragon 55100 ( Edited to work with Netplay Plus™)
# Version 1.0
# Date 12-04-06
#===============================================================================
SDK.log("PlayersWindow", "Destined, Eragon 55100", "1.0", "12-04-06")
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
p "Network Script was not found (class Window_Players)" if not SDK.state('Network')
if SDK.state('Network') and SDK.state('PlayersWindow')
class Window_Players < Window_Base
#--------------------------------------------------------------------------
# * Object Initializing
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
self.contents = Bitmap.new(lammer - 32, height - 32)
self.contents.font.size = 16
index = 0
refresh
end
#--------------------------------------------------------------------------
# * Refreshes the window.
#--------------------------------------------------------------------------
def refresh
name = Network::Main.name
self.contents.clear
self.contents.draw_text(4, 0, 640, 32, "Username")
self.contents.fill_rect(0, 32, 640, 1, normal_color)
#self.contents.draw_text(4, 32, 128, 32, "#{name}")
# self.contents.draw_text(300, 32, 128, 32, $game_map.name)
i = 0
for p in Network::Main.players.values
begin
# self.contents.draw_text(4, i * 32 + 64, 128, 32, p.netid)
self.contents.draw_text(4, i * 32 + 30, 128, 32, p.username)
# self.contents.draw_text(300, i * 32 + 64, 128, 32, p.map_id)
i += 1
rescue
end
# if i >= 2
# end
# self.contents.draw_text(500, 360, 640, 32, "Profiles:Space") if SDK.state('Profile')
#end
#end
#--------------------------------------------------------------------------
# * Updates the window.
#--------------------------------------------------------------------------
def update
super
refresh
end
end
end
end
end
#end
#-------------------------------------------------------------------------------
# End SDK Enabled Check
#---------------------------------------------------------------------------
E DELETE O CONTEUDO do script Game Netplayer e coloque este:
Código:
#===============================================================================
# ** Network - Manages network data.
#-------------------------------------------------------------------------------
# Author Me™ and Mr.Mo
# Version 1.0
# Date 11-04-06
#===============================================================================
SDK.log("Netplayer", "Me™ and Mr.Mo", "1.0", " 11-04-06")
p "Network Script not found!(Game_NetPlayer)" if not SDK.state('Network')
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
if SDK.state('Netplayer') == true and SDK.state('Network')
class Game_NetPlayer < Game_Character
#--------------------------------------------------------------------------
# * Class Variables
#--------------------------------------------------------------------------
attr_accessor :map_id
attr_accessor :name
attr_accessor :level
attr_accessor :netid
attr_accessor :hp
attr_accessor :sp
attr_accessor :username
attr_accessor :event
attr_accessor :agi
attr_accessor :pdef
attr_accessor :eva
attr_accessor :mdef
attr_accessor :states
attr_accessor :damage
attr_accessor :gold
#--------------------------------------------------------------------------
# * Initializes a network player.
#--------------------------------------------------------------------------
def initialize
name = Network::Main.name
super
@map_id = 0
@name = ""
@level = -1
@netid = -1
@hp = -1
@sp = -1
@username = "#{name}"
@move_tom = true
@event = self
@eva = 0
@agi = 0
@pdef = 0
@mdef = 0
@states = []
@damage = 0
@gold = 0
$game_temp.spriteset_refresh = true
end
#-------------------------------------------------------------------------
# * Refresh Netplayer with Data
#-------------------------------------------------------------------------
def refresh(data)
return if @netid == Network::Main.id
@oldx = @x
@oldy = @y
eval(data) unless data == nil
@transparent = (not $game_map.map_id == @map_id) rescue @transparent =false
net_move if @oldx != @x or @oldy != @y
@move_tom = false
end
#--------------------------------------------------------------------------
# * Get the Demage
#--------------------------------------------------------------------------
def attack_effect(attacker = $game_party.actors[0])
# First hit detection
hit_result = (rand(100) < attacker.hit)
@damage = "Miss" if !hit_result
return "Miss" if !hit_result
# Calculate basic damage
atk = [attacker.atk - @pdef / 2, 0].max
damage = atk * (20 + attacker.str) / 20
# Element correction
damage *= attacker.elements_correct(attacker.element_set)
damage /= 100
# If damage value is strictly positive
if damage > 0
# Critical correction
if rand(100) < 4 * attacker.dex / @agi
damage *= 2
@critical = true
end
end
# Dispersion
if damage.abs > 0
amp = [damage.abs * 15 / 100, 1].max
damage += rand(amp+1) + rand(amp+1) - amp
end
# Second hit detection
eva = 8 * @agi / attacker.dex + @eva
hit = damage < 0 ? 100 : 100 - eva
hit = cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# State change
netid = @netid
Network::Main.socket.send("#{netid}\n")
# State Removed by Shock
Network::Main.socket.send("remove_states_shock \n")
# Substract damage from HP
@hp -= damage
#Get all the plus states
s = "["
m = attacker.plus_state_set
for i in 0..m.size
k = m[i]
s += "#{k}"
s += ", " if i != m.size
end
s += "]"
Network::Main.socket.send("states_plus(#{s}) \n")
#Get all the minus states
s = "["
m = attacker.minus_state_set
for i in 0..m.size
k = m[i]
s += "#{k}"
s += ", " if i != m.size
end
s += "]"
Network::Main.socket.send("states_minus(#{s}) \n")
@damage = damage
return damage
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def effect_skill(user, skill)
# Clear critical flag
@critical = false
# If skill scope is for ally with 1 or more HP, and your own HP = 0,
# or skill scope is for ally with 0, and your own HP = 1 or more
if ((skill.scope == 3 or skill.scope == 4) and @hp == 0) or
((skill.scope == 5 or skill.scope == 6) and @hp >= 1)
# End Method
return false
end
# Clear effective flag
effective = false
# Set effective flag if common ID is effective
effective |= skill.common_event_id > 0
# First hit detection
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
# If hit occurs
if hit_result == true
# Calculate power
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= @pdef * skill.pdef_f / 200
power -= @mdef * skill.mdef_f / 200
power = [power, 0].max
end
# Calculate rate
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculate basic damage
@damage = power * rate / 20
# Element correction
@damage *= user.elements_correct(skill.element_set)
@damage /= 100
# Dispersion
if skill.variance > 0 and @damage.abs > 0
amp = [@damage.abs * skill.variance / 100, 1].max
@damage += rand(amp+1) + rand(amp+1) - amp
end
# Second hit detection
eva = 8 * @agi / user.dex + @eva
hit = @damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
end
# If hit occurs
if hit_result == true
# If physical attack has power other than 0
if skill.power != 0 and skill.atk_f > 0
# State change
netid = @netid
Network::Main.socket.send("#{netid}\n")
# State Removed by Shock
Network::Main.socket.send("remove_states_shock \n")
# Set to effective flag
effective = true
end
# Substract damage from HP
last_hp = @hp
@hp -= @damage
effective |= @hp != last_hp
# State change
@state_changed = false
#Get all the plus states
s = "["
m = user.plus_state_set
for i in 0..m.size
k = m[i]
s += "#{k}"
s += ", " if i != m.size
end
s += "]"
Network::Main.socket.send("states_plus(#{s}) \n")
#Get all the minus states
s = "["
m = user.minus_state_set
for i in 0..m.size
k = m[i]
s += "#{k}"
s += ", " if i != m.size
end
s += "]"
Network::Main.socket.send("states_minus(#{s}) \n")
# If power is 0
if skill.power == 0
# Set damage to an empty string
@damage = ""
# If state is unchanged
unless @state_changed
# Set damage to "Miss"
@damage = "Miss"
end
end
# If miss occurs
else
# Set damage to "Miss"
@damage = "Miss"
end
# End Method
return effective
end
#--------------------------------------------------------------------------
# * Determine [Can't Evade] States
#--------------------------------------------------------------------------
def cant_evade?
for i in @states
if $data_states[i].cant_evade
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Move
#--------------------------------------------------------------------------
def net_move
if @move_tom
moveto(@x,@y)
return
end
# Get difference in player coordinates
sx = @oldx - @x
sy = @oldy - @y
# If coordinates are equal
return if sx == 0 and sy == 0
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
moveto(@x,@y) if abs_sx > 2 or abs_sy > 2
end
#-------------------------------------------------------------------------
# * Set NetId
#-------------------------------------------------------------------------
def do_id(id)
@netid = id
end
#-------------------------------------------------------------------------
# * Start
#-------------------------------------------------------------------------
def start(id)
return if id.to_i == Network::Main.id
#Network::Main.send_start_request(id)
end
#-------------------------------------------------------------------------
# * Map (dummy)
#-------------------------------------------------------------------------
def map
return
end
#-------------------------------------------------------------------------
# * Increase steps
#-------------------------------------------------------------------------
def ic
increase_steps
end
#-------------------------------------------------------------------------
# * Emptied(for errors) Check event trigger touch
#-------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return
end
end
end
#-------------------------------------------------------------------------------
# End SDK Enabled Check
#----------------------------------------------------------------
para usa-lo chame o script:
Código:
$scene = Scene_Players.new
se estiver dando erro nesta linha:
Código:
ine 38 #--------------------------------------------------------------------------
line 39 # * Update
line 40 #--------------------------------------------------------------------------
line 41 def update
line 42 $m.update
line 43 @help_window.update if SDK.state('PlayersWindow')
line 44 # Network::Main.send_player_data
line 45 Network::Main.update
line 46 if Graphics.frame_count % Graphics.frame_rate == 0
line 47 @player_window.update
line 48 Network::Main.update
line 49 end
coloque um # no $m.update