- tibluedreamMembre
- Nombre de messages : 944
Age : 34
Localisation : France, Rueil, près de Paris
Distinction : Poisson 2017 [Amal]
Poisson 2018 [Amal']
Date d'inscription : 05/09/2016
Salut j'ai besoin d'aide pour scripter s'il vous plait
Mar 15 Jan 2019 - 15:28
Salut les p'tit loup aujourd'hui je poste mon ensemble de script à améliorer certains problèmes auront lieux, voila voila...
Problème: la table de donnée
j'ai besoin de rajouter des points à lovepoints pour gérer les relation entre couple et autre...
Si vous avez la moindre idée qui pourrait me faire avancer dans mon projet je suis toute ouïe merci à tout ceux qui m'aide et m'aideront ^^.
Script
Problème: la table de donnée
j'ai besoin de rajouter des points à lovepoints pour gérer les relation entre couple et autre...
Si vous avez la moindre idée qui pourrait me faire avancer dans mon projet je suis toute ouïe merci à tout ceux qui m'aide et m'aideront ^^.
Script
- Code:
ruby
class Window_Base
#fonction centrer texte en hauteur
def centered_y(text)
#hauteur actuel de la box - fonction calcul de ligne de texte / 2
(contents_height - calc_line_height(text))/2
end
end
class Game_System
#Fonction ajout de cadeau de base
attr_accessor :giftc
attr_accessor :gift
alias rm_extender_giftc_initialize initialize
#~ alias_method :rm_extender_giftc, :initialize
def initialize
@gift = false
if @giftc == nil
@giftc = 0
end
rm_extender_giftc_initialize()
end#fin def
def give_gift(gift)
if @giftc == nil
@giftc = 0
end
if gift == true
@giftc += 1
return @giftc
else
return @giftc
end#fin condition
end#fin def
end#fin class
class Window_MenuStatusLove < Window_Selectable
attr_reader :pending_index
def initialize(x, y)
super(x, y, window_width, window_height)
@pending_index = -1
refresh
end
#Script selection de perso dessiner et fenêtre paramètrée
#--------------------------------------------------------------------------
# ● MODIF ~
#--------------------------------------------------------------------------
def window_width
Graphics.width - 400
end
#--------------------------------------------------------------------------
# ● MODIF ~
#--------------------------------------------------------------------------
def window_height
Graphics.height - 50
end
def item_max
itemmax = 3
end
#--------------------------------------------------------------------------
# ● MODIF ~
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2) / 3
end
def draw_item(index)
lp=LovePicture.new
lp.love_choice_actor(index, false)
rect = item_rect(index)
draw_item_background(index)
draw_face(lp.get_name, $game_message.face_index = lp.get_id_sprite, rect.x, rect.y)
p("#{index}")
end
def draw_face(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face2(face_name)
rect = Rect.new(face_index % 4 * 216 , face_index / 4 * 132, 96+120, 96+35)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
def draw_item_background(index)
if index == @pending_index
contents.fill_rect(item_rect(index), pending_color)
end
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
super
@game_p = 1
end
#--------------------------------------------------------------------------
# * Restore Previous Selection Position
#--------------------------------------------------------------------------
def select_last
select(0 || 0)
end
#--------------------------------------------------------------------------
# * Set Pending Position (for Formation)
#--------------------------------------------------------------------------
def pending_index=(index = $perso2)
last_pending_index = @pending_index
@pending_index = index
redraw_item(@pending_index)
redraw_item(last_pending_index)
end
def menu_actor
@menu_actor_id = 3
end
end#FinClass
class Scene_Love < Scene_ItemBase
def start
super
create_title
create_commands
generate_choice
create_window_message
end
def create_title #create window
@window=Window_MenuStatusLove.new(175,50)
@title=Window_Help.new(1)
@title.set_text("Love!")
end
#Appel Commande
def create_commands
@window_selection= Window_Love.new(0,48)
@window_selection.set_handler(:formation, method(:formation))
@window_selection.set_handler(:lovel, method(:lovel))
@window_selection.set_handler(:sex_appeal, method(:sex_appeal))
@window_selection.set_handler(:talk, method(:talk))
@window_selection.set_handler(:gift, method(:gift))
@window_selection.set_handler(:rdv, method(:rdv))
@window_selection.set_handler(:help, method(:help))
@window_selection.set_handler(:cancel, method(:return_scene))
end
attr_accessor :lover
attr_accessor :giftc
attr_accessor :giftupl
attr_accessor :face_index
attr_accessor :status_window
def initialize
@face_index = 0
@lover = 0
@giftupl = 0
if @giftc == nil
@giftc = 0
end
end
def generate_choice #Fonction générer choix via résultat @lover
@giftupl = 0
@giftupl = $game_system.give_gift(false)
if @giftupl > 20
@lover = 2
elsif @giftupl > 10
@lover = 1
end
@computer_choice = @lover
end
#~ end
#Boite de messagerie
def create_window_message
y=380-25
x=0
@message = Window_Message.new
@message = Window_Base.new(x, y, 640, 125)
@message.hide
end
def display_message(text,name,index, origin = 1, x= 0, y= 0, zoom_x = 100, zoom_y = 100, opacity =255, blend_type = 0) #centre le texte en hauteur et l'affiche
@message.create_contents
@message.draw_text_ex(300,@message.centered_y(text),text)
@message.draw_face($game_message.face_name = name, $game_message.face_index = index, 0, 0)
@message.show
end
#until Input.trigger?(:C) = tant que entrer n'est pas presser
def wait_for_message
update_basic until Input.trigger?(:C)
end
#appel de l'update basic et de l'affichage de texte
def display_message_with_wait(text,name,index)
display_message(text,name,index)
wait_for_message
end
#--------------------------------------------------------------------------
# * Commandes
#--------------------------------------------------------------------------
#commande selection perso
def formation
@window.select_last
@window.activate
@window.set_handler(:ok, method(:on_formation_ok))
@window.set_handler(:cancel, method(:on_formation_cancel))
end
#~ # Cas de sélection de scène de romance
def lovel
if @computer_choice == 0
display_message_with_wait("....","Jink_fc1",0)
SceneManager.goto(Scene_Love)
elsif @computer_choice == 1
display_message_with_wait("On s'entend bien!","Jink_fc1",6)
SceneManager.goto(Scene_Love)
else
display_message_with_wait("je taime \\I[122]","Jink_fc1",1)
SceneManager.goto(Scene_Love)
end
end
# Cas de sélection de scène coquine
def sex_appeal
puts "......"
SceneManager.goto(Scene_Love)
end
# Cas de sélection de discussion
def talk
p "comment va tu?"
SceneManager.goto(Scene_Love)
end
# Cas de sélection de don de cadeau
def gift
@giftc=$game_system.give_gift(true)
@giftupl=@giftc
lp=LovePicture.new
lp.love_choice_actor(0, false)
#~ points = lp.get_love_points
lp.get_love_points
display_message_with_wait("c'est gentil #{@lover}, #{@giftc}, #{@giftupl}, #{lp.get_love_points}","Jink_fc1",2)
SceneManager.goto(Scene_Love)
end
# Cas de RDV
def rdv
p "un rendez vous?"
SceneManager.goto(Scene_Love)
end
# Cas d'aide
def help
p "tu peux m'aider?"
SceneManager.goto(Scene_Love)
end
#Selection perso
def on_formation_ok
if @window.pending_index >= 0
@window.pending_index = -1
@window.redraw_item(@window.pending_index)
@lp.supp_image
else
@lp=LovePicture.new
@lp.love_choice_actor (@window.index)
@window.pending_index = @window.index
end
@window.activate
end
#--------------------------------------------------------------------------
# ● Annuler selection perso
#--------------------------------------------------------------------------
def on_formation_cancel
@commands=@window
if @window.pending_index >= 0
@window.pending_index = -1
@window.activate
else
@window.unselect
@commands.activate
SceneManager.goto(Scene_Love)
end
end
end#fin Class
class Window_Love < Window_Command
#Commandes dessinées
def make_command_list
add_command("Personnage", :formation)
add_command("Amour", :lovel)
add_command("Sex_Appeal", :sex_appeal)
add_command("Discussion", :talk)
add_command("cadeau", :gift)
add_command("rendez_vous", :rdv)
add_command("aide", :help)
add_command("annuler", :cancel)
end
end#fin Class
- Code:
ruby
class LovePicture
def initialize
if @points == nil
@points=0
end
end
def love_choice_actor(index = 1, love = true, value = 1)
#nom du sprite
items = {
0 => "Jink_fc1",
1 => "02_grizzy_03b",
2 => "01_grizzy_02a",
}
#emplacement du rectangle sélectionné dans le sprite
identifiants = {
0 => 4,
1 => 1,
2 => 0,
}
lovepoints = {
0 => 0,
1 => 0,
2 => 0,
}
#lire le resultat de la ligne indiqué dans index du tableau
#lire la valeur de la ligne indiqué dans value du tableau (chiffre, variable string, ou symbole précédant =>)
#.each {|key, value| p value} lire toutes les valeurs du tableau
#.each {|key, index| p index} lire tout les résultat du tableau
#each {|key, nomtableau| p nomtableau} lire tout ce qu'il y a dans le tableau peut faire individuellement de la même façon que les autres...
@name = items[index]
@idname = items[value]
@id_l = identifiants[index]
@lovepoints = lovepoints[index]
if love == true
dispose_bitmap_l
end
return @name
end
def set_love_points (points)
@lovepoints = points
end
def get_love_points
@lovepoints += 1
return @lovepoints
end
def get_name
return @name
end
def get_id_picture
return @idname
end
def set_id_sprite (id_l)
@id_l = id_l
end
def get_id_sprite
return @id_l
end
def dispose_bitmap_l
v1=Viewport.new(0, 0, 600, 400)
v1.z=1
v1.x=200
@s1=Sprite.new(v1)
name = @name
@b1=Bitmap.new("Graphics/Pictures/"+name)
@s1.bitmap=@b1
end
def supp_image
if @s1 == nil
else
@s1.dispose
@b1.dispose
end
end
end
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|