PvP_Map Code:
#=============================================================
# PvP Map Class Modifié par LeDémonNTXone
#=============================================================
class Scene_Map
#-- PVP Initialize Technique --#
#if $game_map.map_id == 027
#--Alias--#
alias pvp_map_update update
alias pvp_map_main main
#--Initialize--#
def initialize
$Pvp = PvP
end
#--Main--#
def main
if $player_vs_select == true
@invite = Window_Invite.new
@invite.active = true
$player_vs_select = false
end
pvp_map_main
@invite.dispose if @invite != nil
@rvie.dispose if @rvie != nil
@rwin.dispose if @rwin != nil
end
#--Update--#
def update
@invite.update if @invite != nil
@rvie.update if @rvie != nil
@rwin.update if @rwin != nil
if $player_vs_select == true
player_select
end
if $pvp_rplay != nil
pvp_request($pvp_rplay) if @rvie == nil
end
if $player_vs_search == true
player_search
$player_vs_search = false
end
if @rvie != nil && @rwin != nil
if Input.C
case @rwin.index
when 0
for i in $network.players.values
if i.name == $Pvp::Pvp_Network.btname
$network.socket.send("#{i.global_id}\n")
else
for a in $network.players.values
$network.socket.send("#{a.global_id}\n")
end
end
end
$pvp_rplay = nil
$scene = Scene_Map.new
when 1
$network.socket.send("request_return\n")
$pvp_rplay = nil
$scene = Scene_Map.new
end
end
end
pvp_map_update
end
#--Player_Select--#
def player_select
@invite = Window_Invite.new
@invite.active = true
$player_vs_select = false
end
def pvp_request(from_player)
@rvie = Window_Help.new
@rvie.set_text("You have been invited to the 'Grassland Arena' to Vs " + from_player)
@rvie.size(16)
@rwin = Window_Command.new(160, ["Accept", "Decline"])
@rwin.y = 64
@rwin.x = 220
@rwin.active = true
$pvp_rplay = ""
end
#--Player_Search--#
def player_search
for a in $network.players.values
if a.name == $player_search_data
@player_search = "a"
$player_vs_search = false
p $player_search_data + ", Votre défie à été envoyé.... Veuillez patientez pour la réponse."
for i in $network.players.values
if i.name == $player_search_data
$Pvp::Pvp_Network.new
$Pvp::Pvp_Network.send_request(i.global_id)
end
end
end
end
if @player_search != "a"
p "Demande échoué.... The player " + $player_search_data + ", N'existe pas ou n'est pas connecté!"
@player_search = "b"
$player_vs_search = false
end
end
end
#end
Pk Code:
#=============================================================
# Pk ( Player Kill )
#=============================================================
class Scene_Map
# Alias
alias pk_update update
alias pk_main main
# Initialize
def main
$pk_maps = [13] # Addin Map Id's Here ( PK Allowed )
@pk_allow = false
for a in 0...$pk_maps.size
if $pk_maps[a] == $game_map.map_id
@pk_allow = true
end
end
pk_main
end
# Update
def update
if Input.getkey(70)
if @pk_allow == true
for i in $network.players.values
if i.map_id == $game_map.map_id
if i.level.to_i == $game_actors[1].level.to_i # PK Level Restriction
if i.x == $game_player.x + 1
attack(i.global_id)
elsif i.x == $game_player.x - 1
attack(i.global_id)
elsif i.y == $game_player.y - 1
attack(i.global_id)
elsif i.y == $game_player.y + 1
attack(i.global_id)
end
end
end
end
$ABS.player_attack # if $ABS # ABS Attack
else
$ABS.player_attack #if $ABS # ABS Attack
end
end
pk_update
end
# Attack a player
def attack(id)
damage = proccess
$network.socket.send("#{id}\n")
$network.socket.send("#{proccess}\n")
for animation in $network.players.values
if animation.global_id == id
$game_actors[1].exp += $data_actors[1].exp_inflation.to_i / 8
animation.animation_id = 7
end
end
end
# Proccess damage
def proccess
data = ($game_actors[1].str / 10 + 20)
bonus = rand($data_actors[1].exp_inflation.to_i / 5 * 4) # Bonus damage!
return data + bonus
end
end
Window_Invite Code:
#==============================================================================
# ■ Window_Invite Originally created by: Cybersam
#------------------------------------------------------------------------------
# Based on the Full-Keyboard Input script created by Cybersam.
#==============================================================================
class Window_Invite < Window_Base
attr_reader :txt
#--------------------------------------------------------------------------
# ● Initializes code input window.
#--------------------------------------------------------------------------
def initialize
super(130, 192, 380, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 16
@txt = []
refresh
end
#--------------------------------------------------------------------------
# ● Refreshes code input window.
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, -32, 640, 96, "Entrez le nom du joueur que vous souhaitez affronter. (1)")
self.contents.draw_text(0, 0, 620, 96, "Nom: #{@txt}")
end
#--------------------------------------------------------------------------
# ● Refreshes code input window.
#--------------------------------------------------------------------------
def add(char)
if @txt.size >= 80
$game_system.se_play($data_system.buzzer_se)
else
@txt.push(char.to_s)
refresh
end
end
#--------------------------------------------------------------------------
# ● Updates input code window.
#--------------------------------------------------------------------------
def update
refresh
# Removes last entry in test.
if Input.getkey(8)
if @txt.size == 0
$game_system.se_play($data_system.buzzer_se)
else
@txt.delete_at(-1)
refresh
end
end
#Return to GC
if Input.getkey(48)
$player_vs_select = false
$scene = Scene_Map.new
end
if Input.getkey(49)
$Pvp::Pvp_Network.set_name(@txt.to_s)
$player_vs_search = true
$player_search_data = @txt.to_s
$scene = Scene_Map.new
end
# Adds a pressed key.
if Input.getstate(16)
add("A") if Input.getkey(65)
add("B") if Input.getkey(66)
add("C") if Input.getkey(67)
add("D") if Input.getkey(68)
add("E") if Input.getkey(69)
add("F") if Input.getkey(70)
add("G") if Input.getkey(71)
add("H") if Input.getkey(72)
add("I") if Input.getkey(73)
add("J") if Input.getkey(74)
add("K") if Input.getkey(75)
add("L") if Input.getkey(76)
add("M") if Input.getkey(77)
add("N") if Input.getkey(78)
add("O") if Input.getkey(79)
add("P") if Input.getkey(80)
add("Q") if Input.getkey(81)
add("R") if Input.getkey(82)
add("S") if Input.getkey(83)
add("T") if Input.getkey(84)
add("U") if Input.getkey(85)
add("V") if Input.getkey(86)
add("W") if Input.getkey(87)
add("X") if Input.getkey(88)
add("Y") if Input.getkey(89)
add("Z") if Input.getkey(90)
add("^") if Input.getkey(54)
else
add("a") if Input.getkey(65)
add("b") if Input.getkey(66)
add("c") if Input.getkey(67)
add("d") if Input.getkey(68)
add("e") if Input.getkey(69)
add("f") if Input.getkey(70)
add("g") if Input.getkey(71)
add("h") if Input.getkey(72)
add("i") if Input.getkey(73)
add("j") if Input.getkey(74)
add("k") if Input.getkey(75)
add("l") if Input.getkey(76)
add("m") if Input.getkey(77)
add("n") if Input.getkey(78)
add("o") if Input.getkey(79)
add("p") if Input.getkey(80)
add("q") if Input.getkey(81)
add("r") if Input.getkey(82)
add("s") if Input.getkey(83)
add("t") if Input.getkey(84)
add("u") if Input.getkey(85)
add("v") if Input.getkey(86)
add("w") if Input.getkey(87)
add("x") if Input.getkey(88)
add("y") if Input.getkey(89)
add("z") if Input.getkey(90)
end
end
end