L'auteur est : Fomar0153Ce script permet de faire des fenêtres de sélection permettant plus de 4 choix :
En premier lieux, créez un nouveau script au dessus de Main, nommez-le comme il vous plaira, puis copiez ceci dedans :
- Code:
-
=begin
More Choices
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
No requirements
Allows you to have more than four choices
----------------------
Instructions
----------------------
Edit the method more_choice and then use the call in
a choice option.
----------------------
Known bugs
----------------------
None
=end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● Edit Here
# when handle
# $game_message.choices.push("a choice")
#--------------------------------------------------------------------------
def more_choice(p)
case p
when "Pizza Topping"
$game_message.choices.push("Ham & Pineapple")
$game_message.choices.push("Meat Feast")
$game_message.choices.push("Chocolate")
$game_message.choices.push("BBQ")
$game_message.choices.push("Diamonds")
$game_message.choices.push("Spicy Chicken")
$game_message.choices.push("Garlic")
else
$game_message.choices.push(p)
end
end
#--------------------------------------------------------------------------
# ● Long Choices - Don't edit this bit
#--------------------------------------------------------------------------
def setup_choices(params)
for s in params[0]
more_choice(s)
end
$game_message.choice_cancel_type = params[1]
$game_message.choice_proc = Proc.new {|n| @branch[@indent] = n }
end
end
class Window_ChoiceList < Window_Command
#--------------------------------------------------------------------------
# ● Feel free to change the 1 to another variable that you'd prefer
#--------------------------------------------------------------------------
alias mc_call_ok_handler call_ok_handler
def call_ok_handler
$game_variables[1] = index
mc_call_ok_handler
end
end
Chaque choix doit être configuré dans le script.
Voici l'exemple fourni dans le script :
- Code:
-
when "Pizza Topping"
$game_message.choices.push("Ham & Pineapple")
$game_message.choices.push("Meat Feast")
$game_message.choices.push("Chocolate")
$game_message.choices.push("BBQ")
$game_message.choices.push("Diamonds")
$game_message.choices.push("Spicy Chicken")
$game_message.choices.push("Garlic")
Ici vous pouvez donc voir le nom de la liste de choix "Pizza Topping". Ce nom est important, c'est avec lui que vous appellerez le choix.
En dessous se trouvent les différents choix ("Ham & Pineapple", "Meat Feast", etc...).
Vous n'avez qu'à ajouter votre propre liste de choix, par exemple :
- Code:
-
def more_choice(p)
case p
when "Pizza Topping"
$game_message.choices.push("Ham & Pineapple")
$game_message.choices.push("Meat Feast")
$game_message.choices.push("Chocolate")
$game_message.choices.push("BBQ")
$game_message.choices.push("Diamonds")
$game_message.choices.push("Spicy Chicken")
$game_message.choices.push("Garlic")
when "Choix de glace"
$game_message.choices.push("Vanille-Fraise")
$game_message.choices.push("Menthe")
$game_message.choices.push("Chocolat")
$game_message.choices.push("Pistache")
$game_message.choices.push("Citron")
else
$game_message.choices.push(p)
end
end
Pour appeler le choix dans un événement, il suffit d'utiliser la commande d'événement habituelle de choix, et de mettre pour seul choix le nom de la liste de choix ("Pizza Topping" dans notre premier exemple). Ensuite, le numéro du choix que fait le joueur est enregistré dans une variable.
Voici donc un exemple complet d'utilisation :
Si vous voulez modifier le numéro de la variable dans laquelle le choix est enregistré, rendez-vous dans les dernières lignes du script où vous trouverez ceci :
- Code:
-
$game_variables[1] = index
Remplacer simplement le "1" par l'ID de la variable.
Bon making !