Sujet n°12518
Posté par luisfos le 28 Mar - 03:40 (2013)
Titre : Problème Badges
Bonjour Je ne suis pas en mesure d'activer les badges, regardez le script.


Spoiler
#==============================================================================
# ¦ Carte Dresseur
# Script Communauté PSP - Louro (PSP 0.7)
# Remis en forme par Krosk
# Modifié par Palbolsky (PSPDS)
# Modifier par Slash (PSP5G)
#-----------------------------------------------------------------------------
# Support de carte dresseur
#-----------------------------------------------------------------------------
# Pour changer l'image de vos badges, réglez les noms juste en dessous
# Pour afficher un badge, Insérez un script: badgex où x est le num du badge
# Pour afficher un objectif, Insérez un script: objectifx où x est le num de
# l'objectif
#-----------------------------------------------------------------------------
# Variables occupées : 200, 1000, 1500
# Interrupteurs occupés : 1001-1008, 1500-1505
#-----------------------------------------------------------------------------

module POKEMON_S_TCARD
# Script crée par Louro pour les membres de la communautée de PSP
# qui veulent s'en servir

# Les noms d'icones pour chaque badge
BADGE1 = "baie01.png"
BADGE2 = "baie02.png"
BADGE3 = "baie03.png"
BADGE4 = "baie04.png"
BADGE5 = "baie05.png"
BADGE6 = "baie06.png"
BADGE7 = "baie07.png"
BADGE8 = "baie08.png"

# Réglez les coordonnées horizontales de vos badges ici,
# si vous avez un décalage !
BADGE1_X = 95
BADGE2_X = 143
BADGE3_X = 191
BADGE4_X = 239
BADGE5_X = 95
BADGE6_X = 143
BADGE7_X = 191
BADGE8_X = 239

# Numéro de la variable stockant le nombre de badge acquit
VAR = 200

# Nom des objectifs
OBJECTIF1 = "PREMIER OBJECTIF"
OBJECTIF2 = "DEUXIEME OBJECTIF"
OBJECTIF3 = "TROISIEME OBJECTIF"
OBJECTIF4 = "QUATRIEME OBJECTIF"
OBJECTIF5 = "CINQUIEME OBJECTIF"
end

class TrainerCardWindow < Window_Base
attr_accessor :devant
include POKEMON_S_TCARD
include POKEMON_S

def initialize(devant)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsizebig
self.z = 25
#self.contents.font.color = Color.new(60,60,60)
@captured = 0
@devant = devant
for i in 1..$data_pokedex.length-1
if $data_pokedex[i][1]
@captured += 1
end
end
refresh
end

def refresh
self.contents.clear
if @devant == true

draw_text_trainer(20, 219, 120, 64, "Nom :")
draw_text_trainer(29, 219, 120, 64, Player.name,2)
draw_text_trainer(29, 235, 120, 64, "Dresseur Pokémon",2)
draw_text_trainer(20, 251, 120, 64, "Statut :")
if $data_pokedex[0] == true
draw_text_trainer(20, 267, 120, 64, "Pokédex :")
draw_text_trainer(29, 267, 120, 64, @captured.to_s, 2)
end
draw_text_trainer(20, 291, 120, 64, "Argent :")
draw_text_trainer(118, 291, 120, 64, $pokemon_party.money.to_s+"$", 2)

elsif @devant == false
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
temps = sprintf("%02d:%02d", hour, min)
score = $score
date = sprintf("%02d",$game_variables[197].to_s) + " " +
$game_variables[198].to_s + " " + $game_variables[199].to_s

draw_text_trainer(20, 203, 120, 64, "N°ID :")
draw_text_trainer(109, 203, 120, 64, Player.id.to_s, 2)
draw_text_trainer(109, 219, 120, 64, temps, 2)
draw_text_trainer(20, 235, 320, 64, "Aventure commencée le :")
draw_text_trainer(109, 251, 120, 64, date, 2)


#if $game_switches[1500] == true
# draw_text_trainer(117, 207, 120, 64, $date_ligue, 2)
#draw_text_trainer(117, 223, 120, 64, $game_variables[1500].to_s, 2)
#else
# draw_text_trainer(117, 207, 120, 64, "-- --- ----", 2)
#draw_text_trainer(117, 223, 120, 64, "--:--", 2)
#end

if $game_switches[1501] == true
draw_text_trainer_bis(32, 275, 180, 64, OBJECTIF1)
draw_text_trainer_bis(98, 275, 120, 64, $game_variables[1501].to_s, 2)
end

if $game_switches[1502] == true
draw_text_trainer_bis(32, 291, 180, 64, OBJECTIF2)
draw_text_trainer_bis(98, 291, 120, 64, $game_variables[1502].to_s, 2)
end

if $game_switches[1503] == true
draw_text_trainer_bis(32, 307, 180, 64, OBJECTIF3)
draw_text_trainer_bis(98, 307, 120, 64, $game_variables[1503].to_s, 2)
end

if $game_switches[1504] == true
draw_text_trainer_bis(32, 323, 180, 64, OBJECTIF4)
draw_text_trainer_bis(98, 323, 120, 64, $game_variables[1504].to_s, 2)
end

#if $game_switches[1505] == true
# draw_text_trainer(13, 311, 180, 64, OBJECTIF5)
#draw_text_trainer(109, 311, 120, 64, $game_variables[1505].to_s, 2)
# end

end
end
end

class TCARD
include POKEMON_S_TCARD
include POKEMON_S

def main
@tcard = TrainerCardWindow.new(true)
@tcard.opacity = 0
@background = Sprite.new
@option = Sprite.new
if $data_pokedex[0] == true
@background.bitmap = RPG::Cache.picture("tcard.png")
else
@background.bitmap = RPG::Cache.picture("tcard1.png")
end
@option.bitmap = RPG::Cache.picture("optioncard.png")
@option.x = 13
@option.y = 227
@option.z = 21
@background.x = 13
@background.y = 227
@background.z = 21
@background_sup = Sprite.new
@background_sup.bitmap = RPG::Cache.picture("supcard.png")
@background_sup.x = 13
@background_sup.y = 13
@background_sup.z = 21
@fondviewport = Viewport.new(0, 0, 288, 464)
@fondviewport.z = 20
@fond = Plane.new(@fondviewport)
@fond.bitmap = RPG::Cache.picture("fondcard.png")
@fond.z = 20
@badge1 = Sprite.new
@badge2 = Sprite.new
@badge3 = Sprite.new
@badge4 = Sprite.new
@badge5 = Sprite.new
@badge6 = Sprite.new
@badge7 = Sprite.new
@badge8 = Sprite.new
$game_variables[VAR] = 0
unless $game_switches[1001] == true then @badge1.visible = false else @badge1.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1002] == true then @badge2.visible = false else @badge2.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1003] == true then @badge3.visible = false else @badge3.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1004] == true then @badge4.visible = false else @badge4.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1005] == true then @badge5.visible = false else @badge5.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1006] == true then @badge6.visible = false else @badge6.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1007] == true then @badge7.visible = false else @badge7.visible = true and $game_variables[VAR] += 1 end
unless $game_switches[1008] == true then @badge8.visible = false else @badge8.visible = true and $game_variables[VAR] += 1 end
@badge1.bitmap = RPG::Cache.icon(BADGE1)
@badge2.bitmap = RPG::Cache.icon(BADGE2)
@badge3.bitmap = RPG::Cache.icon(BADGE3)
@badge4.bitmap = RPG::Cache.icon(BADGE4)
@badge5.bitmap = RPG::Cache.icon(BADGE5)
@badge6.bitmap = RPG::Cache.icon(BADGE6)
@badge7.bitmap = RPG::Cache.icon(BADGE7)
@badge8.bitmap = RPG::Cache.icon(BADGE8)
@badge1.x = BADGE1_X
@badge1.y = 87
@badge2.x = BADGE2_X
@badge2.y = 87
@badge3.x = BADGE3_X
@badge3.y = 87
@badge4.x = BADGE4_X
@badge4.y = 87
@badge5.x = BADGE5_X
@badge5.y = 127
@badge6.x = BADGE6_X
@badge6.y = 127
@badge7.x = BADGE7_X
@badge7.y = 127
@badge8.x = BADGE8_X
@badge8.y = 127
@badge1.z = @badge2.z = @badge3.z = @badge4.z = @badge5.z = @badge6.z = @badge7.z = @badge8.z = 25
@perso = Sprite.new
if $game_variables[11] == nil or $game_variables[11] == 0
@perso.bitmap = RPG::Cache.picture("persogars.png")
end
if $game_variables[11] == 1
@perso.bitmap = RPG::Cache.picture("persogars.png")
end
if $game_variables[11] == 2
@perso.bitmap = RPG::Cache.picture("persofille.png")
end
@perso.x = 169+13-3
@perso.y = 49+239-40
@perso.z = 23
Graphics.transition
loop do
@fond.ox -= 1
@fond.oy -= 1
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
unless @tcard == nil then @tcard.dispose end
unless @background == nil then @background.dispose end
unless @fond == nil then @fond.dispose end
unless @background_sup == nil then @background_sup.dispose end
unless @badge1 == nil then @badge1.dispose end
unless @badge2 == nil then @badge2.dispose end
unless @badge3 == nil then @badge3.dispose end
unless @badge4 == nil then @badge4.dispose end
unless @badge5 == nil then @badge5.dispose end
unless @badge6 == nil then @badge6.dispose end
unless @badge7 == nil then @badge7.dispose end
unless @badge8 == nil then @badge8.dispose end
unless @perso == nil then @perso.dispose end
@option.dispose
end

def update
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
if @tcard.devant == false
Audio.se_play("Audio/SE/Carte Dresseur")
@tcard.visible = false
loop do
@background.zoom_x -= 0.03
@background.x += 4
Graphics.update
if @background.zoom_x <= 0
Graphics.update
break
end
end
loop do
@background.zoom_x += 0.03
@background.x -= 4
Graphics.update
if @background.zoom_x <= 1
@background.zoom_x = 1
@background.x = 13
Graphics.update
break
end
end
$scene = TCARD.new
return
end
if @tcard.devant == true
@tcard.devant = false
Audio.se_play("Audio/SE/Carte Dresseur")
@tcard.dispose
loop do
@background.zoom_x -= 0.03
@background.x += 4
@perso.zoom_x -= 0.03
@perso.x -= 0.25
Graphics.update
if @background.zoom_x <= 0
Graphics.update
break
end
end
@perso.dispose
@tcard = TrainerCardWindow.new(false)
@tcard.opacity = 0
loop do
@background.zoom_x += 0.03
@background.x -= 4
Graphics.update
if @background.zoom_x <= 1
@background.zoom_x = 1
@background.x = 13
Graphics.update
break
end
end
@background.bitmap = RPG::Cache.picture("backcard.png")
end
end

if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Pokemon_Menu.new(3)
return
end
end
end


class Interpreter
def ligue_finie
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
temps = sprintf("%02d:%02d", hour, min)
$game_variables[1500] = temps
$date_ligue = sprintf("%02d",$game_variables[33].to_s) + " " +
$game_variables[36].to_s + " " + $game_variables[35].to_s

$game_switches[1500] = true
end

def objectif1
$game_switches[1501] = false
end

def objectif2
$game_switches[1502] = false
end

def objectif3
$game_switches[1503] = false
end

def objectif4
$game_switches[1504] = false
end

def objectif5
$game_switches[1505] = false
end

def fille
$game_variables[1000] = 2
end

def gars
$game_variables[1000] = 1
end

def badge1
$game_switches[1001] = false
end

def badge2
$game_switches[1002] = false
end

def badge3
$game_switches[1003] = false
end

def badge4
$game_switches[1004] = false
end

def badge5
$game_switches[1005] = false
end

def badge6
$game_switches[1006] = false
end

def badge7
$game_switches[1007] = false
end

def badge8
$game_switches[1008] = false
end

def carte_dresseur
$scene = TCARD.new
end

end

# Merci à Zellyunie qui a changé les couleurs de l'ancienne version pour
# arranger la mise en page, ce qui m'a donné envi de l'améliorer entièrement.

Posté par Redder le 1 Avr - 10:07 (2013)
Dans l'évènement "carte dresseur" tu enlève tout sauf carte dresseur(commande script)
Pour en activer un c'est (toujours en commande script) "badgeX" où X est le numéro de ton badge.
t s'il te plait, mets ton script en code!