Accueil du SiteAccueil du Site  AccueilAccueil  Dernières imagesDernières images  RechercherRechercher  ConnexionConnexion  S'enregistrerS'enregistrer  



Le Deal du moment : -50%
-50% Baskets Nike Air Huarache Runner
Voir le deal
69.99 €

Partagez
 

 Téléportation par mot clé

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Elekami
Fondateur
Fondateur
Elekami

Masculin
Messages postés : 19071
Date d'inscription : 19/07/2008
Jauge LPC :
Téléportation par mot clé 8915271400100 / 100100 / 100Téléportation par mot clé 8915271400

Téléportation par mot clé Pater_10
Téléportation par mot clé Staffe10
Téléportation par mot clé Mythe_10
Téléportation par mot clé Membre11
Téléportation par mot clé Doyen10
Téléportation par mot clé Scanar10
Téléportation par mot clé Compos10
Téléportation par mot clé Testeu10
Téléportation par mot clé Membre15
Téléportation par mot clé Partag10
Téléportation par mot clé Projet10
Téléportation par mot clé Projet16
Téléportation par mot clé Riche_10
Téléportation par mot clé Travai10
Téléportation par mot clé Collec10
Téléportation par mot clé Collec11
Téléportation par mot clé Collec12
Téléportation par mot clé Collec13
Téléportation par mot clé Connar10


Téléportation par mot clé Empty
MessageSujet: Téléportation par mot clé   Téléportation par mot clé EmptyMer 23 Juin 2010 - 13:10



Auteur: GoldenShadow


Installation : Copiez le code, ouvrez l'éditeur de script ( F11 ) et créez en un nouveau au dessus de 'Main'. Nommez le " WTS " et collez ce script :

Utilisation : - Pour ajouter un mot-clé dans un évènement ou dans un script:

$wtel.add_word("motclé")


- Pour ajouter une destination dans un évènement ou un script:

$wtel.add_location("name", map_ID, x-pos, y-pos)


Name: Le Mot devant être composée de mots-clé
Map ID: L'ID de la map de destination
X-pos: Position en X sur la map Ciblée
Y-pos: Position en Y sur la map Ciblée

- Pour Afficher la fenêtre de téléportation : Dans un évènement ou un script :

$scene = Scene_WTS.new


Utiliser la touche S pour passer des mots clé à la validation.
La touche X sert à effacer le dernier mot clé entré.
Un Mot est valide, quand il s'affiche en vert.

- Mettez dans Scene_Title ou un évènement au début du jeu:

$wtel = Word_Teleport_script.new

Code:


#=============================================================
# <> Word Teleport script v1.4
# ==> You can delete all the comments except the copyright and creator info. Thanks.
# ==> Do not rip, repost or any other way of reproducing without proper credit. Thanks.
# ShadowClan Technologies ©️ 2003-2005 - All rights reserved.
# Creation Asylum Project ©️ 2005 - This script is exclusively only for this project.
#---------------------------------------------------------------------------------------
# * How to use
# Set up in title screen or somewhere near intro of game:
# $wtel = Word_Teleport_script.new
# Then just call up:
# $scene = Scene_WTS.new
# That would be it. Adding...
# Words: $wtel.add_word(word) --> word must be in this format: "word" with quotes.
# Location: $wtel.add_location(name, map_id, x, y) --> name format: "name" with quotes.
# Thats all.
#
# * Notes
# 1. Don't parallel this: $wtel = Word_Teleport_script.new
# 2. First set the $wtel and then add words and locations. Not reversed.
#
# I'll try and fix bugs here and there, meanwhile, you can suggest stuff. Thanks in advance.
#--------------------------------------------------------------------------------------------
# * Suggestions? ==> PM or post in the section where this is posted.
# * Created by: GoldenShadow (invincible_p0wer_@hotmail.com)
# * Credits: JyJ for bug-/beta testing, Nick for additional scripting sources
#=============================================================

class Word_Teleport_script # this is the main thing.

attr_accessor :word # The available words
attr_accessor :map_id # Available locations with their map IDs
attr_accessor :map_x # The X to teleport to with the location
attr_accessor :map_y # The Y to teleport to with the location
attr_accessor :active # Active word. Will be reset after each cancel/teleport
def initialize
@word = [] # Yes, an array
@map_id = {} # And yes, an hash
@map_x = {} # More hash
@map_y = {} # And now im stoned
@active = [] # Array. It was required.
end

def add_word(word) # This is for adding words as the story progresses
unless @word.include?(word) # If it exists already, dont add it
@word.push(word)
end
end

def add_location(name, map_id, map_x, map_y) # Also adding locations.
if map_id.is_a?(String) or map_x.is_a?(String) or map_y.is_a?(String)#ID, x, y must be numerics
return # if its not, dont add it
else
@map_id[name] = map_id # add it: [name => id]
@map_x[name] = map_x # add X
@map_y[name] = map_y # add Y
end
end
end

class Window_Word < Window_Base # The 'status' window

def initialize
super(320, 64, 320, 416 - 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
refresh
end

def refresh
self.contents.clear
self.contents.draw_text(0, 16, self.width - 40, 32, "Votre destination sera", 1)
if $wtel.map_id.include?($wtel.active.join)
self.contents.font.color = Color.new(152, 239, 95) # green color
else
self.contents.font.color = Color.new(255, 96, 96) # red color
end
self.contents.draw_text(0, 64, self.width - 40, 32, $wtel.active.join, 1) # the temp. var
self.contents.font.color = normal_color # normal..
self.contents.draw_text(0, 114, self.width - 40, 32, "(Maximun 4 mots.)", 1) # max...
self.contents.draw_text(4, 160, self.width - 40, 32, "Appuyez sur le bouton S")
self.contents.draw_text(4, 192, self.width - 40, 32, "pour venir sur cette fenêtre.")
end
end

class Window_WTSList < Window_Selectable # the word list
# all i did was just customize the Window_Item. No big deal
def initialize
super(0, 64, 320, 416)
@column_max = 1
refresh
self.index = 0
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = $wtel.word.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
for i in 0...@item_max
draw_item(i) # show (draw) each item
end
end
end

def draw_item(index)
self.contents.font.color = normal_color
x = 4 # aligned of x-axis '4'
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x, y, 212, 32, $wtel.word[index], 0) # showing it.
end
end

class Window_WTSCommand < Window_Selectable # command box

def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface.is_a?(String) ? $fontface : $defaultfonttype
self.contents.font.size = $defaultfontsize == nil ? $fontsize : $defaultfontsize
@commands = ["Go!", "Annuler"] # the commands...
@item_max = 2
@column_max = 2
draw_item(0, normal_color) # 'Go'
draw_item(1, normal_color) # 'Cancel'
self.active = false
self.index = 0
end

def draw_item(index, color) #
self.contents.font.color = color
rect = Rect.new(index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end

def update_cursor_rect # needed to show actual selection
self.cursor_rect.set(index * 160, 0, 128, 32)
end
end


class Scene_WTS # this is the whole thing!

def main
if $wtel.word.include?("(Espace)")
$wtel.word.delete("(Espace)") # delete this word
$wtel.word.push("(Espace)") # and add it at the end of all the other words
else
$wtel.word.push("(Espace)")
end
@help_window = Window_Help.new
@help_window.set_text("Faites une combininaison de mot pour une destination.") # a msg
@status_window = Window_Word.new
@list_window = Window_WTSList.new
@command_window = Window_WTSCommand.new
@command_window.x = 320 # command box x-axis
@command_window.y = 416 # command box -y-axis
Graphics.transition # transing it, so it updates
loop do
Graphics.update
Input.update
update # updating the stuff, see def update
if $scene != self
break
end
end
Graphics.freeze # when closing, freeze it all first
@help_window.dispose # and dispose all the items
@status_window.dispose #
@list_window.dispose #
@command_window.dispose #
end

def update # update all the windows
@help_window.update
@status_window.update
@list_window.update
@command_window.update
if Input.trigger?(Input::Y) and @list_window.active # switch between windows
@list_window.active = false
@command_window.active = true
elsif Input.trigger?(Input::Y) and @command_window.active # same here
@list_window.active = true
@command_window.active = false
end
if @command_window.active
update_command
end
if @list_window.active
update_list
end
end

def update_command
if Input.trigger?(Input::C) # when the command box is active and selection is made
case @command_window.index
when 0 # the 'GO' selection
unless !$wtel.map_id.include?($wtel.active.join) # unless destination doesn't exist
$game_system.se_play($data_system.decision_se)
$game_map.setup($wtel.map_id[$wtel.active.join]) # go to map
$game_player.moveto($wtel.map_x[$wtel.active.join], $wtel.map_y[$wtel.active.join]) # exact location
$game_player.refresh # refresh stuff
$game_map.autoplay
$game_map.update
$wtel.active = [] # clear array
$scene = Scene_Map.new # go to map
else
$game_system.se_play($data_system.buzzer_se)
end
when 1
$game_system.se_play($data_system.cancel_se)
$wtel.active = [] # clear it
$scene = Scene_Map.new # and go to actual map
end
end
end

def update_list
if Input.trigger?(Input::C) and $wtel.active.size <= 3 # 4 is the max words
$game_system.se_play($data_system.decision_se)
if $wtel.word[@list_window.index] == "(Espace)" # if its space
$wtel.active.push(" ") # add a space!
@status_window.refresh
else
$wtel.active.push($wtel.word[@list_window.index]) # otherwise, add the word
@status_window.refresh
end
elsif Input.trigger?(Input::B) # cancel and remove final word
$game_system.se_play($data_system.cancel_se)
$wtel.active.pop
@status_window.refresh
end
end
end
# FINAL UPDATE: 11 August @ 13:31 GMT (damnit, 244 lines :P )
Revenir en haut Aller en bas
https://www.ledijonshow.fr https://twitter.com/EleKoptes
 
Téléportation par mot clé
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» [XP]Téléportation style Zelda
» Fondu en noir pour la téléportation.
» Téléportation améliorée toute version RPGM

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Le Palais Créatif :: ~ PARTAGE ~ :: Scripts et plugins :: RPG Maker XP :: Système-
Sauter vers: