BadSamaritan
Gone Fishin'
- 148
- Posts
- 15
- Years
- Seen Jun 8, 2023
------------------------------------------------------
Last edited:
Yeah, I worded my post kind of badly.
I suppose to clarify a bit better, I'm primarily looking for the best way to trade between people, whether that be directly via an online server, or by creating a separate piece of data(i.e. mystery gift) that people will have to manually trade. However simultaneously I'm also curious about peoples experiences with the other trade methods, like the wonder trade and stuff.
Yeah, I worded my post kind of badly.
I suppose to clarify a bit better, I'm primarily looking for the best way to trade between people, whether that be directly via an online server, or by creating a separate piece of data(i.e. mystery gift) that people will have to manually trade. However simultaneously I'm also curious about peoples experiences with the other trade methods, like the wonder trade and stuff.
#==============================================================================
# RMXOS::Network
# Trades between players using commands. Example: /trade /y and another utilities.
#==============================================================================
module RMXOS
class Network
alias check_game_pokemon_trade_alias check_game
def check_game(message)
case message
when /\ATRI\t(.+)/ # trade pokemon
stream = $1
chars = []
size = stream.size
(0...(size / 2)).each {|i| chars.push("0x#{stream[i * 2, 2]}".hex.chr)}
data = chars.join('')
$game_temp.trade_other_pokemon = Marshal.load(data)
return true
when /\ATRF\Z/ # trade finalization
pokemon = $Trainer.party[$game_temp.trade_party_index]
newspecies = pbTradeCheckEvolution(pokemon, $game_temp.trade_old_pokemon)
if newspecies > 0
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pokemon, newspecies)
evo.pbEvolution(false)
evo.pbEndScreen
$network.save
end
end
return check_game_pokemon_trade_alias(message)
end
def trade_send_pokemon(pokemon)
data = Marshal.dump(pokemon)
hex = []
data.each_byte {|b| hex.push(sprintf('%02X', b))}
stream = hex.join('')
self.send("TRI\t#{$game_temp.trade_id}\t#{stream}")
end
end
end
#==============================================================================
# Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :trade_party_index
attr_accessor :trade_other_pokemon
attr_accessor :trade_old_pokemon # used for evolution checking
alias trade_reset_pokemon_alias trade_reset
def trade_reset
trade_reset_pokemon_alias
@trade_party_index = -1
@trade_other_pokemon = nil
@trade_old_pokemon = nil
end
end
#==============================================================================
# Window_TradeStatus
#==============================================================================
class Window_TradeStatus < Window_CommandPokemon
def initialize(commands, width)
super(commands, width - 32)
self.index = -1
self.active = false
self.update
end
def update
commands = []
commands.push("Trading with: #{$network.players[$game_temp.trade_id].username}")
if $game_temp.trade_party_index >= 0
commands.push("Yours: " + $Trainer.party[$game_temp.trade_party_index].name)
else
commands.push("Yours: NONE")
end
if $game_temp.trade_other_pokemon != nil
commands.push("Other: " + $game_temp.trade_other_pokemon.name)
else
commands.push("Other: NONE")
end
self.commands = commands if (@commands != commands)
super
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
def update_trade
create_trade_windows if @trade_command_window == nil
updateMaps
pbMapInterpreter.update
$game_system.update
$game_screen.update
updateSpritesets
$game_player.update_chat_messages
if $game_temp.trade_abort
dispose_trade_windows
return
end
return if $game_temp.chat_active
if $game_temp.trade_host && $game_temp.trade_canceled
$network.trade_confirm_cancel
$game_temp.trade_confirmed = false
$game_temp.trade_canceled = false
end
if @trade_command_window.active
update_trade_command
else
update_trade_wait
end
$game_temp.trade_cancel_confirmed = false
end
def create_trade_windows
@trade_command_window = Window_CommandPokemon.new(
RMXOS::Data::TradeCommands, 224)
@trade_command_window.y = 128
@trade_command_window.active = true
@trade_command_window.z = 20000
@trade_top_window = Window_TradeStatus.new(['', '', ''], RMXOS::Data::SCREEN_WIDTH)
@trade_wait_window = Window_Button.new(0, 160, RMXOS::Data::SCREEN_WIDTH, RMXOS::Data::TradeWait)
@trade_wait_window.z = 20000
@trade_wait_window.visible = false
end
def dispose_trade_windows
@trade_command_window.dispose
@trade_command_window = nil
@trade_top_window.dispose
@trade_top_window = nil
@trade_wait_window.dispose
@trade_wait_window = nil
$game_temp.trade_reset
end
def update_trade_command
@trade_top_window.update
@trade_command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$network.trade_abort
dispose_trade_windows
elsif Input.trigger?(Input::C)
case @trade_command_window.index
when 0
$game_system.se_play($data_system.decision_se)
scene = PokemonScreen_Scene.new
screen = PokemonScreen.new(scene, $Trainer.party)
index = screen.pbChooseAblePokemon(proc {|poke|
!poke.egg? && poke.hp > 0 && !poke.isShadow?}, false)
if $game_temp.trade_party_index != index
$game_temp.trade_party_index = index
pokemon = $Trainer.party[index]
$network.trade_send_pokemon(pokemon)
$network.trade_confirm_cancel
@trade_top_window.update
end
when 1
if $game_temp.trade_other_pokemon == nil
$game_system.se_play($data_system.buzzer_se)
return
end
scene = PokemonSummaryScene.new
screen = PokemonSummary.new(scene)
screen.pbStartScreen([$game_temp.trade_other_pokemon], 0)
when 2
if $game_temp.trade_party_index < 0
$game_system.se_play($data_system.buzzer_se)
return
end
if $game_temp.trade_other_pokemon == nil
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@trade_command_window.active = false
if $network.players[$game_temp.trade_id] != nil
text = RMXOS::Data::TradeWait.gsub('PLAYER') {
$network.players[$game_temp.trade_id].username}
@trade_wait_window.set_command(text)
else
@trade_wait_window.set_command(RMXOS::Data::TradeNoPlayer)
end
@trade_wait_window.visible = true
if $game_temp.trade_host
if $game_temp.trade_confirmed
$network.trade_confirm
execute_trade
end
else
$network.trade_confirm
end
when 3
$game_system.se_play($data_system.decision_se)
$network.trade_abort
dispose_trade_windows
end
end
end
def execute_trade
$game_temp.trade_old_pokemon = $Trainer.party[$game_temp.trade_party_index]
$Trainer.party[$game_temp.trade_party_index] = $game_temp.trade_other_pokemon
$network.send_save_data
$network.trade_execute
$game_temp.trade_finalized = false
@trade_wait_window.set_command(RMXOS::Data::ExecutingTrade)
end
end
In game trades, like the way of obtaining Jynx on RBY? This is already in Essentials, look at the example maps.so there is no way to set up an ingame trade system?
In game trades, like the way of obtaining Jynx on RBY? This is already in Essentials, look at the example maps.
There a GTS script on Scripts & Tutorials section.