RPG Fusion
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.



 
AccueilPortailRechercherDernières imagesS'enregistrerConnexion
-50%
Le deal à ne pas rater :
-50% sur les sacs à dos pour ordinateur portable Urban Factory ...
19.99 € 39.99 €
Voir le deal

 

 Téléportation par mot clé

Aller en bas 
AuteurMessage
Invité
Invité
Anonymous



Téléportation par mot clé Empty
MessageSujet: Téléportation par mot clé   Téléportation par mot clé EmptyDim 03 Aoû 2008, 23:12

Auteur : GoldenShadow

Fonction : Permet de ce téléporter à un endroit grâce à une combinaison de mot clé.

Image(s) :
Image n°1

Ressource(s) : Aucune

Démo :Télécharger le fichier ( 287 Ko ; Fichier EXE)


Remarque : Testé et fonctionnel Testé et fonctionnel

Nombre de scripts : 1

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:


Spoiler:

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

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 :


Spoiler:

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:


Spoiler:

Code :

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
 
Téléportation par mot clé
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Fusion :: BANQUE DU CODE :: Antre des Scripts :: Divers-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser