rpgmakerxp.frbb.net

Un forum basé sur le rpg making via rmxp
 
AccueilPortailFAQRechercherS'enregistrerMembresGroupesConnexion

Partagez | 
 

 Probleme avec changement d'équipe!

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Marec
Ecuyer
Ecuyer
avatar

Masculin
Nombre de messages : 57
Age : 27
Localisation : Nancy
Projet en cours: : Rising Legend
Date d'inscription : 21/11/2007

niveau du maker
mapping:
0/100  (0/100)
events:
0/100  (0/100)
scriptage:
2/100  (2/100)

MessageSujet: Probleme avec changement d'équipe!   Jeu 29 Nov - 11:37

Voilà, j'ai un script de changement d'équipe, mais je n'arrive pas à rendre un perso obligatoire, et le problème, c'est qu'il est en anglais...
de plus, j'arrive pas à ajouter des persos dans l'equipe de reserve...
Voici ce qu j'ai:
Citation :
Citation :
Changement des membres de l'équipe
Ce script permet de faire un menu qui permet de changer d'équipe par rapport aux autres personnages.
Alors, aprés une longue attente, je me suis enfin décidé a mettre les autres scripts que j'ai trouvé, mais le probléme, c'est qu'il est en Anglais et pas encore traduit....
Si vous lisez l'anglais, c'est superbe, sinon, traduisez mot-à-mot....(sorry)
________________________________________

Citation :
Reserve Party Tools
This script enables support for a "reserve" party of arbitrary size. These characters don't fight in battle. When you want the player to be able to switch characters into and out of the reserve party, use the "Script" command to call "$scene = Scene_PartyChange.new(value), where value is the maximum active party size. Use 0 to allow a four-member party as normal. This script supports required party members. To make a party member required, use "$game_party.actors[index].required = true" (or false to remove the requirement). The names of required party members will show up in orange (by default). You should only make a character already in the party required. Making a reserve member required will not work. This script changes how the "Change Party Members" event command works. If you add a character when the party is full, that character will automatically be added to the reserve party. If you remove a party member, that character will be removed if they are either in the main party or the reserve party.

By default, inactive party members gain experience at the same rate as active members. To change this, go to Scene_Battle and change the constant RESERVE_EXP_PERCENT to the percentage of experience you want the inactive party to gain.

If you want reserve members to show up on the main menu and be selectable for using skills, equipping, etc., go to Window_MenuStatus and change the constant MANAGE_RESERVE_CHARACTERS to true.

To use this script, add the instance variables to Game_Actor and Game_Party, as shown. Next, replace methods and add new methods in game party, using the comments next to the method names as a guide. In Scene_Menu, Scene_Skill, and Scene_Equip, replace the default code with the code shown in red, using the surrounding code as a guide. Then, add the method to Window_Base. In Scene_Battle, add the constant and replace the code the same way as above in start_phase5. Next, replace the entire Window_MenuStatus with the one shown. Finally, add the new classes Window_ChangeMain, Window_ChangeReserve, Window_PartyChangeInfo, and Scene_ChangeParty.
Script by RPG Advocate

class Game_Actor < Game_Battler
# ---------------------
attr_accessor :required
[...]
@required = false
[...]


class Game_Party
# ---------------------
attr_accessor :reserve_actors
[...]
@reserve_actors = []
[...]
# ---------------------
def add_actor(actor_id) # replace this method
actor = $game_actors[actor_id]
if @actors.size < 4 and not @actors.include?(actor)
@actors.push(actor)
$game_player.refresh
else
if not @reserve_actors.include?(actor)
@reserve_actors.push(actor)
end
end
end
# ---------------------
def remove_actor(actor_id) # replace this method
@actors.delete($game_actors[actor_id])
@reserve_actors.delete($game_actors[actor_id])
$game_player.refresh
end
# ---------------------
def swap(actor1, actor2) # new method
error = false
if not @actors.include?(actor1)
error = true
end
if not @reserve_actors.include?(actor2)
error = true
end
if error
print("Cannot swap members. One or both are not in the porper position.")
end
temp = actor1
@actors.delete(actor1)
@reserve_actors.push(temp)
add_actor(actor2.id)
@reserve_actors.delete(actor2)
end
# ---------------------
def transfer_to_party(reserve_actor) # new method
if not @reserve_actors.include?(reserve_actor)
print("Warning: Requested character is not in the reserve party.")
return
end
if @actors.size == 4
print("Warning: Main party is full.")
return
end
add_actor(reserve_actor.id)
@reserve_actors.delete(reserve_actor)
end
# ---------------------
def transfer_to_reserve(main_party_actor) # new method
if not @actors.include?(main_party_actor)
print("Warning: Requested character is not in the main party.")
return
end
remove_actor(main_party_actor.id)
@reserve_actors.push(main_party_actor)
end

Ce qui est en rouge, c'est ce que vous modifiez ou ajoutez au script de départ...

class Scene_Menu
# ---------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if @status_window.index < $game_party.actors.size
check_actor = $game_party.actors[@status_window.index]
else
size = $game_party.actors.size
check_actor = $game_party.reserve_actors[@status_window.index - size]
end
if check_actor.restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end

$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end


class Scene_Skill
# ---------------------
def main
if @actor_index < $game_party.actors.size
@actor = $game_party.actors[@actor_index]
else
@actor = $game_party.reserve_actors[@actor_index - $game_party.actors.size]
end

@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
[...]


class Scene_Equip
# ---------------------
def main
if @actor_index < $game_party.actors.size
@actor = $game_party.actors[@actor_index]
else
@actor = $game_party.reserve_actors[@actor_index - $game_party.actors.size]
end

@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
[...]


class Window_Base < Window
# ---------------------
def required_color
return Color.new(216, 150, 20, 255)
end


class Scene_Battle
# ---------------------
class Scene_Battle
RESERVE_EXP_PERCENT = 100
[...]
# ---------------------
def start_phase5
[...]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
for i in 0...$game_party.reserve_actors.size
actor = $game_party.reserve_actors[i]
if actor.cant_get_exp? == false
actor.exp += exp * RESERVE_EXP_PERCENT / 100
end
end

$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
[...]


Dernière édition par le Jeu 29 Nov - 11:40, édité 2 fois
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://rising-legend.teamgoo.net
Marec
Ecuyer
Ecuyer
avatar

Masculin
Nombre de messages : 57
Age : 27
Localisation : Nancy
Projet en cours: : Rising Legend
Date d'inscription : 21/11/2007

niveau du maker
mapping:
0/100  (0/100)
events:
0/100  (0/100)
scriptage:
2/100  (2/100)

MessageSujet: Re: Probleme avec changement d'équipe!   Jeu 29 Nov - 11:38

Voici les scripts entiers, à mettre au dessus de main^^


Citation :
class Window_MenuStatus < Window_Selectable # replace this class
MANAGE_RESERVE_CHARACTERS = false
# ---------------------------
def initialize
super(0, 0, 480, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
# ---------------------------
def refresh
self.contents.dispose
if MANAGE_RESERVE_CHARACTERS
@item_max = $game_party.actors.size + $game_party.reserve_actors.size
slots = $game_party.actors.size + $game_party.reserve_actors.size
else
@item_max = $game_party.actors.size
slots = $game_party.actors.size
end
self.contents = Bitmap.new(width - 32, @item_max * 120 - 32)
self.contents.clear
actor_array = []
for actor in $game_party.actors
actor_array.push(actor)
end
if MANAGE_RESERVE_CHARACTERS
for actor in $game_party.reserve_actors
actor_array.push(actor)
end
end
for i in 0...slots
x = 64
y = i * 116
actor = actor_array[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
# ---------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116 - self.oy, self.width - 32, 96)
end
if self.cursor_rect.y < 0
self.oy -= 116
refresh
update_cursor_rect
end
if self.cursor_rect.y > 348
self.oy += 116
refresh
update_cursor_rect
end
end
# ---------------------------
end

Citation :

class Window_ChangeMain < Window_Selectable
# ---------------------
def initialize
super(0, 0, 320, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
# ---------------------
def refresh
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 24
@item_max = 4
for i in 0..3
x = 64
y = i * 116
if $game_party.actors[i] != nil
actor = $game_party.actors[i]
else
self.contents.draw_text(0, y + 32, 288, 32, "-Empty-", 1)
next
end
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 160, y)
draw_actor_hp(actor, x, y + 32)
draw_actor_sp(actor, x, y + 64)
end
end
# ---------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
# ---------------------
end
Citation :

class Window_ChangeReserve < Window_Selectable
# ---------------------
def initialize
super(320, 0, 320, 360)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
# ---------------------
def refresh
@item_max = $game_party.reserve_actors.size + 1
size = 96 + @item_max * 96 - 32
if size < 328
size = 328
end
self.contents.dispose
self.contents = Bitmap.new(width - 32, size)
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 24
for i in 0...$game_party.reserve_actors.size
x = 64
y = i * 116
actor = $game_party.reserve_actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 160, y)
draw_actor_hp(actor, x, y + 32)
draw_actor_sp(actor, x, y + 64)
end
end
# ---------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116 - self.oy, self.width - 32, 96)
end
if self.cursor_rect.y < 0
self.oy -= 116
refresh
update_cursor_rect
end
if self.cursor_rect.y > 232
self.oy += 116
refresh
update_cursor_rect
end
end
# ---------------------
end
Citation :

class Window_PartyChangeInfo < Window_Base
# ------------------
attr_reader :max_size
# ------------------
def initialize(max_size)
super(320, 360, 320, 120)
self.contents = Bitmap.new(width - 32, height - 32)
@max_size = max_size
refresh
end
# ------------------
def refresh
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 24
text1 = "Please form a party."
text2 = "Please form a party"
text3 = "of up to " + @max_size.to_s + " members."
if @max_size < 0
print("Warning: Invalid max size for party.")
exit
end
if @max_size == 0
self.contents.draw_text(4, 0, 240, 32, text1)
end
if @max_size > 0
self.contents.draw_text(4, 0, 240, 32, text2)
self.contents.draw_text(4, 32, 240, 32, text3)
end
end
# ------------------
end
Citation :

class Scene_ChangeParty
# ------------------
def initialize(max_size)
@max_size = max_size
end
# ------------------
def main
@left_window = Window_ChangeMain.new
@right_window = Window_ChangeReserve.new
@info_window = Window_PartyChangeInfo.new(@max_size)
@left_window.index = 0
@right_window.index = -1
@left_window.active = true
@right_window.active = false
@actor1 = nil
@actor2 = nil
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
$game_map.refresh
Graphics.freeze
@left_window.dispose
@right_window.dispose
@info_window.dispose
end
# ------------------
def update
@left_window.update
@right_window.update
@info_window.update
if @left_window.active
update_left
return
end
if @right_window.active
update_right
return
end
end
# ------------------
def update_left
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
place = @left_window.index
if @max_size > 0
if place >= @max_size
$game_system.se_play($data_system.buzzer_se)
return
end
end
if $game_party.actors[place] != nil
if $game_party.actors[place].required
$game_system.se_play($data_system.buzzer_se)
return
end
end
if $game_party.reserve_actors.size == 0
$game_system.se_play($data_system.decision_se)
$game_party.transfer_to_reserve($game_party.actors[place])
@left_window.refresh
@right_window.refresh
return
end
if $game_party.reserve_actors.size > 0
$game_system.se_play($data_system.decision_se)
@left_window.active = false
@right_window.index = 0
@right_window.active = true
@actor1 = $game_party.actors[place]
return
end
end
end
# ------------------
def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.index = -1
@right_window.active = false
@left_window.active = true
return
end
if Input.trigger?(Input::C)
place = @right_window.index
if place == $game_party.reserve_actors.size
if @actor1 == nil
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.transfer_to_reserve(@actor1)
@right_window.index = -1
@right_window.active = false
@left_window.active = true
@left_window.refresh
@right_window.refresh
return
end
if @actor1 == nil
$game_system.se_play($data_system.decision_se)
@actor2 = $game_party.reserve_actors[place]
$game_party.transfer_to_party(@actor2)
@right_window.index = -1
@right_window.active = false
@left_window.active = true
@left_window.refresh
@right_window.refresh
return
else
@actor2 = $game_party.reserve_actors[place]
$game_system.se_play($data_system.decision_se)
$game_party.swap(@actor1, @actor2)
@right_window.index = -1
@right_window.active = false
@left_window.active = true
@left_window.refresh
@right_window.refresh
end
end
end
# ------------------
end
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://rising-legend.teamgoo.net
 
Probleme avec changement d'équipe!
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Probleme avec de l'herbe statique
» Problème, problème, problème, avec un 'P' majuscule } Robyn ?
» Probleme avec l'evolution de mon caninos...
» Commande Buy 4 Less
» A la croisée des chemins

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
rpgmakerxp.frbb.net :: Une question, un bug ? :: Au sujet des scripts-
Sauter vers: