- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
[Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 0:36
Bien le bonsoir,
Alors j'ai une petite demande à faire, je ne sais absolument pas si cela est compliqué, mais je me souviens d'un script que j'utilisais sur rmxp qui me permettais d'afficher à l'aide d'une commande script en événement :
$damage.popup[X] "Y"
ou encore $damage.popup[X] $game.variables[Y]
X étant l'ID de l’événement
Y étant ce qui sera affiché.
Ce script donc, me permettais d'afficher un "popup" (je ne sais pas si sa ce dit) sur la map au dessus d'un evenement. (Il m'était très utile en fait pour ma partie Scenario mais aussi pour mon systeme a-rpg. Il me permettait d'afficher les dégats que j'inflige.
Je ne sais pas du tout si je me suis fait comprendre, j’espère que l'idée est passé ^^'
Merci d'avoir pris le temps de lire en espérant une réponse ^_^
Alors j'ai une petite demande à faire, je ne sais absolument pas si cela est compliqué, mais je me souviens d'un script que j'utilisais sur rmxp qui me permettais d'afficher à l'aide d'une commande script en événement :
$damage.popup[X] "Y"
ou encore $damage.popup[X] $game.variables[Y]
X étant l'ID de l’événement
Y étant ce qui sera affiché.
Ce script donc, me permettais d'afficher un "popup" (je ne sais pas si sa ce dit) sur la map au dessus d'un evenement. (Il m'était très utile en fait pour ma partie Scenario mais aussi pour mon systeme a-rpg. Il me permettait d'afficher les dégats que j'inflige.
Je ne sais pas du tout si je me suis fait comprendre, j’espère que l'idée est passé ^^'
Merci d'avoir pris le temps de lire en espérant une réponse ^_^
- HeavenStaffeux retraité
- Nombre de messages : 2441
Age : 22
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 12:52
Hum, je crois que tu peux faire ça en event^^
Foxfiesta40 explique un truc qui pourrait te servir dans ce tutoriel (si tu veux le réaliser en event^^)
Heav'n
Foxfiesta40 explique un truc qui pourrait te servir dans ce tutoriel (si tu veux le réaliser en event^^)
- Spoiler:
Heav'n
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 13:02
Oui j'ai vu toutes ces vidéos et faut avouer que le tout gérer en image c'est vraiment... moche, très moche. Le soucis c'est que je cherche a afficher les chiffres d'une variable sur la map par une simple commande d'une ligne. Faire cette methode serait long, et surtout très moche ^^
Je pense avoir trouver un script mais j'ai encore du mal a m'en servir et l'affichage ne me plait pas trop.
S'il quelqu'un s'y connais en matière de modifications avancées je veux bien de son aide ^_^
Je pense avoir trouver un script mais j'ai encore du mal a m'en servir et l'affichage ne me plait pas trop.
- Script Damage Pop up:
- Code:
#===============================================================================
# N.A.S.T.Y. Text Pop Over Events
# Nelderson's Awesome Scripts To You
#
# By: Nelderson
# Last Updated: 3/18/20112
#
# Version 1.0 - 3/17/2012
#
#===============================================================================
#
# Update History:
# - Version 1.0 - Initial release, 1st Resource Script for rpgmakervxace.net
#===============================================================================
# *Features:
# - This script creates text above an event or the player on a map
#
# *Initial Setup
# - This script has a small setup section to define a few Defaults when
# text is first put up above an event's head:
#
# DEF_TEXT_COLOR - Is the default text color when not defined in the
# script call. When you pick a color you have to use
# the form:
#
# Color.new(r,g,b,a) - Where r = red, g = green,
# b = blue, and a = alpha
#
# DEF_TEXT_SIZE - This is the default text font size, pretty easy here.
#
# DEF_TEXT_FONT - This is the name of the default font that'll be used
# for text pops that don't specify one in the script call
#
# *Script Call:
#
# - nel_textpop(:attribute => value,
# :attribute2 => value,
# :attribute3: => value,
# )
#
# ** Where :attributes can be any one of the following:
#
# :text => Values will be in "quotes", and displays over event
# (Defaults to "" when not defined)
#
# :event_id => The Event ID that will display text.
# 0 = Current Event ID, -1 = Player,
# -2 1stFollower, -3 2ndFollower, -4 3rdFollower
# (Defaults to 0 when not defined)
#
# :time => This is the time that the text will last in FRAMES.
# 60 FRAMES = 1 second,
# *Note: Set :time => nil for the text to last forever*
# (Defaults to nil when not defined)
#
# :font => This is the name of the font you want for the text.
# Values with be in "quotes"
# (Defaults to DEF_TEXT_FONT when not defined)
#
# :size => This changes the font size on the text displayed
# (Defaults to DEF_TEXT_SIZE when not defined)
#
# :color => This changes the color of the text displayed
# Values need to be => Color.new(r,g,b,a)
# (Defaults to DEF_TEXT_COLOR when not defined)
#
# :bold => This makes the displayed text bold
# Values need to be => true or false
# (Defaults to false when not defined)
#
# :italic => This makes the displayed text italic
# Values need to be => true or false
# (Defaults to false when not defined)
#
# *Instructions
# -You can place the script call nel_textpop in any event
#
# -You don't have to define every attribute, they will automatically
# go to the defaults to make things easier.
#
# *Sample Call
#
# nel_textpop(
# :text => "I hate you!",
# :event_id => -1,
# :bold => true,
# :italic => true,
# :time => 120,
# :font => "Vrinda",
# :size => 64,
# :color => Color.new(220,20,60),
# )
#
#===============================================================================
# Credits:
# -Nelderson, tomoaky, and IceDragon
#===============================================================================
# Based off: RGSS2_namepop Ver0.02
# tomoaky (http://hikimoki.sakura.ne.jp/)
#===============================================================================
module NEL
#Default text pop font
DEF_TEXT_FONT = "Myriad"
#Default text pop font size
DEF_TEXT_SIZE = 16
#Default text pop color
DEF_TEXT_COLOR = Color.new(255,255,255,255)# <== White
end #<=== Don't Touch
#========#======================#====#================================#========#
#--------# #----# DO NOT EDIT PAST THIS POINT!!! #--------#
#--------# End of Customization #----# Editing will cause death by #--------#
#--------# #----# Zetu Stabbing your heart </3 #--------#
#========#======================#====#================================#========#
# // 02/03/2012 [
#Collects the hash keys in order, and then passes the values
class Hash
# // IceDragon <=== *The Ultimate in Awesome OTL
def get_values(*args)
args.collect {|a|self[a]}
end
end
# // 02/03/2012 ]
class Game_Interpreter
include NEL
#IceDragon helped make this script call easier with awesomeness...Thanks Icy!
def nel_textpop(*args)
if(args[0].is_a?(Hash))
text, ev_id, time, size, color, font, bold, ital = args[0].get_values(:text,:event_id,:time,:size,:color,:font,:bold,:italic)
else
text, ev_id, time, size, color, font, bold, ital = *args
end
char = nel_get_character(ev_id || 0)
return unless(char)
char.namepop_size = size || DEF_TEXT_SIZE
char.namepop_color= color || DEF_TEXT_COLOR
char.namepop_time = time || nil
char.namepop = text || ""
char.namepop_font = font || DEF_TEXT_FONT
char.namepop_bold = !!bold # // Convert to Bool
char.namepop_ital = !!ital
char.textpop_flag = true #Forces refresh
end
#--------------------------------------------------------------------------
# *New Method: nel_get_character
#
# Instead of original get_character, this include Followers in the argument
#--------------------------------------------------------------------------
def nel_get_character(param)
if $game_party.in_battle
nil
elsif param < 0
case param
when -1; return $game_player
else; return $game_player.followers[(param + 2) * (-1)]
end
else
events = same_map? ? $game_map.events : {}
events[param > 0 ? param : @event_id]
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
# ¡ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# œ œöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
#--------------------------------------------------------------------------
attr_accessor :namepop
attr_accessor :namepop_size
attr_accessor :namepop_color
attr_accessor :namepop_time
attr_accessor :namepop_font
attr_accessor :namepop_bold
attr_accessor :namepop_ital
attr_accessor :textpop_flag #Instant update if script call is used
#--------------------------------------------------------------------------
alias nel_font_type_init initialize
def initialize
@namepop_font = NEL::DEF_TEXT_FONT
@namepop_bold = false
@namepop_ital = false
@textpop_flag = false
nel_font_type_init
end
end
#==============================================================================
# ¡ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
alias nel_textx_pop_initi initialize
def initialize(*args)
@timer = 0
nel_textx_pop_initi(*args)
end
#--------------------------------------------------------------------------
# œ ‰ð•ú
#--------------------------------------------------------------------------
alias tnpop_sprite_character_dispose dispose
def dispose
dispose_namepop
tnpop_sprite_character_dispose
end
#--------------------------------------------------------------------------
# œ ƒtƒœ[ƒ€XV
#--------------------------------------------------------------------------
alias tnpop_sprite_character_update update
def update
tnpop_sprite_character_update #Original Update
if @timer > 0 && @character.textpop_flag == false#Skip when script called
@timer -= 1
update_text_pos
if @timer <= 0
@namepop_sprite.visible = false
@namepop_sprite.opacity = 255 #Reset opacity just in case
@namepop_sprite = nil
@character.namepop = nil
@namepop = nil
@tmer_rat = nil #Reset ratio, just to avoid issues
elsif @timer < 60
#Fade out text gradually within the last 60 frames
@tmer_rat ||= 255/@timer
@namepop_sprite.opacity -= @tmer_rat
end
else
update_namepop
if @character.textpop_flag == true #If script call
@namepop = @character.namepop
start_namepop
end
end
end
def update_text_pos
@namepop_sprite.x = x
@namepop_sprite.y = y - height
@namepop_sprite.z = z + 200
end
#--------------------------------------------------------------------------
# › namepop‚ÌŠJŽn
#--------------------------------------------------------------------------
def start_namepop
dispose_namepop
return if @namepop == "none" or @namepop == nil
@namepop_sprite = ::Sprite.new(viewport)
b_width = @namepop.size * 8
b_height = @character.namepop_size + 20
@namepop_sprite.ox = 80 + (b_width/2)
@namepop_sprite.oy = 16 + (b_height/2) #16
@namepop_sprite.bitmap = Bitmap.new(b_width+160, b_height)
###Change Font, Font Size, Color, and Time based off Character values##
@namepop_sprite.bitmap.font.color = @character.namepop_color
@namepop_sprite.bitmap.font.size = @character.namepop_size
@namepop_sprite.bitmap.font.name = [@character.namepop_font]
@namepop_sprite.bitmap.font.bold = @character.namepop_bold
@namepop_sprite.bitmap.font.italic = @character.namepop_ital
@namepop_sprite.bitmap.draw_text(0, 0, b_width+160, b_height, @namepop, 1)
@namepop_time = @character.namepop_time
update_namepop(@namepop_time) #Pass a timer variable
@character.textpop_flag = false
end
#--------------------------------------------------------------------------
# › namepop‚ÌXV
#--------------------------------------------------------------------------
def update_namepop(time = nil) #Add a timer variable
if @namepop_sprite != nil
@namepop_sprite.x = x
@namepop_sprite.y = y - height
@namepop_sprite.z = z + 200
if time != nil
@timer = time
@namepop_time = 0
end
end
end
#--------------------------------------------------------------------------
# › namepop‚̉ð•ú
#--------------------------------------------------------------------------
def dispose_namepop
if @namepop_sprite != nil
@namepop_sprite.bitmap.dispose
@namepop_sprite.dispose
@namepop_sprite = nil
end
end
end
S'il quelqu'un s'y connais en matière de modifications avancées je veux bien de son aide ^_^
- HeavenStaffeux retraité
- Nombre de messages : 2441
Age : 22
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 13:15
Tu as un screen pour montrer l'affichage ?
Heav'n
Heav'n
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 13:36
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 14:06
C'est paramétrable, la couleur, la taille, la police, etc. Les explications sont dans l'entête du script.
- HeavenStaffeux retraité
- Nombre de messages : 2441
Age : 22
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:06
Tu dois mettre des images dans un dossier, ou bien tu mets juste le script ?
Heav'n
Heav'n
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:09
Juste le script, aucune ressource n'est utilisé ^^
En ce qui concerne les réglages je veux un peu plus que changer la couleur ou la police... Je cherche vraiment à les afficher plus dynamiquement.
En ce qui concerne les réglages je veux un peu plus que changer la couleur ou la police... Je cherche vraiment à les afficher plus dynamiquement.
- HeavenStaffeux retraité
- Nombre de messages : 2441
Age : 22
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:11
Ligne 104 :
Heav'n
- Code:
DEF_TEXT_FONT = "Myriad"
Heav'n
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:15
Je crois que tu ne comprend pas ce que j'essaye de dire :S
En ce qui concerne la police la couleur tout sa tout sa oui certes je peux modifier mais ça ne m'interresse pas, je cherche a faire en sorte que les degats s'envolent par exemple puis qu'il retombe ou alors qu'ils s'affichent de maniere brut, un truc bien plus dynamique que ce que j'ai a l'heure actuelle quoi ^^
En ce qui concerne la police la couleur tout sa tout sa oui certes je peux modifier mais ça ne m'interresse pas, je cherche a faire en sorte que les degats s'envolent par exemple puis qu'il retombe ou alors qu'ils s'affichent de maniere brut, un truc bien plus dynamique que ce que j'ai a l'heure actuelle quoi ^^
- HeavenStaffeux retraité
- Nombre de messages : 2441
Age : 22
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:22
Bon, dans ce cas, je peux pas t'aider désolé >< (je sais pas comment je pourrai faire :/)
Heav'n
Heav'n
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:24
Il te faut l'aide d'un codeur pour faire ce genre de chose donc faut attendre qu'un d'entre eux passe par ici et surtout donner plus de renseignements sur le genre d'animation que tu veux.
- HeavenStaffeux retraité
- Nombre de messages : 2441
Age : 22
Localisation : Alpes-Maritimes VIRILITÉ OLALA
Distinction : Aucune
Date d'inscription : 18/10/2012
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 17:30
Sagi > Tu ferais mieux d'envoyer un MP à Biwy ou Dricc qui, je crois, s'y connaissent assez
dans le domaine x)
Heav'n
dans le domaine x)
Heav'n
- driccMembre
- Nombre de messages : 2760
Localisation : Lille
Distinction : Altruiste - Incarnation de la Patience [Mist']
Date d'inscription : 10/08/2009
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 19:33
Alors , voyons ...
Je regarde dans ma base de scripts existants d'abord
(http://rmvxace.wikia.com/wiki/RPG_Maker_VX_Ace_Master_Script_List)
et apparement , y'a :
http://forums.rpgmakerweb.com/index.php?/topic/3197-some-popup-28/
ça fonctionne avec les commentaires .
il faut en mettre 2 :
dans le premier [pop] et dans le deuxieme , le texte en question .
(ou [npop] pour grisé oui [ppop] pour une image)
Ou alors :
http://forums.rpgmakerweb.com/index.php?/topic/5214-sleek-item-popup/
Mais là , faudrait créer un item bidon exprés .
Je regarde dans ma base de scripts existants d'abord
(http://rmvxace.wikia.com/wiki/RPG_Maker_VX_Ace_Master_Script_List)
et apparement , y'a :
http://forums.rpgmakerweb.com/index.php?/topic/3197-some-popup-28/
ça fonctionne avec les commentaires .
il faut en mettre 2 :
dans le premier [pop] et dans le deuxieme , le texte en question .
(ou [npop] pour grisé oui [ppop] pour une image)
Ou alors :
http://forums.rpgmakerweb.com/index.php?/topic/5214-sleek-item-popup/
Mais là , faudrait créer un item bidon exprés .
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 20:04
Oui alors pour le some popup 28 je l'ai déjà, je l'utilise même mais il ne permet pas l'affichage de dégats ou alors j'ai mal compris son utilisation ^^
Et en ce qui concerne sleek item popup je l'ai également et je ne peux pas l'utiliser pour ce que je veux faire.
Voilà
ps:Merci a tous de vous intéresser a mon problème j’espère que l'on va trouver une solution ^^
Et en ce qui concerne sleek item popup je l'ai également et je ne peux pas l'utiliser pour ce que je veux faire.
Voilà
ps:Merci a tous de vous intéresser a mon problème j’espère que l'on va trouver une solution ^^
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 20:28
Tu pourras prendre n'importe quel script jamais ils afficheront les dégats, tu utilises un système de combat Arpg (a-rpg by Sapphire).
Si le script ne sais pas ou aller chercher les données rien ne sera affiché.
Bref il te faut un scripteur qui sait quel système de combat tu utilises
Si le script ne sais pas ou aller chercher les données rien ne sera affiché.
Bref il te faut un scripteur qui sait quel système de combat tu utilises
- driccMembre
- Nombre de messages : 2760
Localisation : Lille
Distinction : Altruiste - Incarnation de la Patience [Mist']
Date d'inscription : 10/08/2009
Re: [Résolu]Pop UP damage on map
Jeu 20 Mar 2014 - 20:35
J'ai l'impression que c'est juste afficher une variable dans laquelle il aurais mis les dégats qu'il voudrais . c'est ça ?
Eh Bien , il suffirait de changer dans le script "Some popup 28" :
@town_text = event.list[1].parameters[0]
en :
@town_text = $game_variables[1]
Eh Bien , il suffirait de changer dans le script "Some popup 28" :
@town_text = event.list[1].parameters[0]
en :
@town_text = $game_variables[1]
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Ven 21 Mar 2014 - 12:15
Spywaretof : Certes j'utilise ce systeme de combat mais je suis en train d'en créer un autre en event en parallèle ce qui fait que ca ne change rien.
Voilà Dricc ta tout compris, seulement comment je configure pour afficher sur un événement ou un héro ? parce que la @town_text = $game_variables[1] me permet d'afficher la variable de mon choix certes, mais sur quel événement ?
Voilà Dricc ta tout compris, seulement comment je configure pour afficher sur un événement ou un héro ? parce que la @town_text = $game_variables[1] me permet d'afficher la variable de mon choix certes, mais sur quel événement ?
- vincent26Membre
- Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010
Re: [Résolu]Pop UP damage on map
Ven 21 Mar 2014 - 18:24
J'ai modifier le script some_popup-28
maintenant si tu met
$game_variables[x]
a la place d'un text ça affiche la valeur de la variables
maintenant si tu met
$game_variables[x]
a la place d'un text ça affiche la valeur de la variables
- Code:
# Some Popup v 2.8
# VX Ace version
# by mikb89
# Details:
# Show some popup text when facing an event.
# Text can be placed in center of screen, over the player or over the event.
# Write [pop] in a comment to assign the popup to an event and write in the
# next comment the text that will be shown.
# NOTE: [pop] is by default, but you can change it in the settings.
# Text can be also grayed, to indicate a non-available something. To do so,
# write [npop] instead of [pop].
# You can also show a picture instead of text. In order to do this, the first
# comment must be [ppop] and the second will contain the name of the Picture.
# It is possible to play a sound/music effect for each event. Just write in a
# third comment these lines:
# SE (or ME or BGM or BGS)
# Audio filename
# Volume (1-100)
# Pitch (50-150)
# You can omit the two last lines, and they will be set by default:
# Volume 80 for BGS and SE, 100 for BGM and ME
# Pitch 100
# ATTENTION: comments have to be the first two (or three) commands of the event.
#
# You can also call a script with:
# $game_player.remove_town_sprite
# in it to remove the sprite. For example if you put the sprite on an event
# which you'll speak, with this code you can remove the popup.
# Configurations:
module SPOP
ID = "pop" # set "loc" for old version compatibility.
# What you have to write on a event to be identified as popup one.
# If the value here is for example "pop" you'll have to write:
# - [pop] for the common text popup;
# - [npop] for the grayed out popup;
# - [ppop] for the picture popup.
AUTO_REMOVE_AT_TRANSFER = true
# Test to understand what I mean.
# true - gives the same effect as the one in Chrono Trigger towns.
# false - let the popup be visible after the teleport. Will fade out at the
# first player movement.
GRAYED_COLOR = Color.new(255,245,255,175)
# Value of grey color. Red, green, blue, alpha. From 0 to 255.
WALK_8_DIR = true
# You don't have to include the 8dir script. Just set true this.
POPUP_TRANSITION = 9
# The effect of the popup appearing/disappearing.
# 0: no effect
# 1: fading in/out
# 2: movement up/down
# 3: movement & fading
# 4: reduced movement
# 5: reduced movement & fading
# 6: zoom in/out
# 7: zoom & fading
# 8: zoom & movement
# 9: zoom, movement, fading
# 10: zoom & reduced movement
# 11: zoom, reduced movement, fading
POPUP_SOUND = ["SE", "Book1", 80, 100]
# Play something on popup.
# 4 parameters:
# 1. Sound kind ("SE", "ME", "BGS", "BGM");
# 2. Name of the file;
# 3. Volume (0-100);
# 4. Pitch (50-150 (or 15-453 if you want MAXIMUM values)).
# To deactivate sound just set "" the 2. or set 0 to 3. Examples:
# POPUP_SOUND = ["SE", "", 80, 100]
# POPUP_SOUND = ["SE", "Book1", 0, 100]
# Won't be played.
# Eventual BGM or BGS playing will fade as the graphic fade/zoom/move and
# will start after the popup close. Obviously not valid if using SE/ME.
# Examples with ME, BGM, BGS:
# POPUP_SOUND = ["ME", "Item", 100, 100]
# POPUP_SOUND = ["BGM", "Town1", 100, 100]
# POPUP_SOUND = ["BGS", "Clock", 100, 100]
POPUP_BINDING = 2
# Where the popup should be binded.
# 0: center of the screen
# 1: over the player
# 2: over the event
end
# Others:
# You'll see 'town' everywhere in the script. This is because of the SECOND
# name given to this script: "Popup town name".
# The FIRST original name was "Location system", from this the [loc] to add in
# event comments. By the way I never publicated the version with this name, so
# you won't find anything.
#Codename: spop
($imported ||= {})[:mikb89_spop] = true
# License:
# - You can ask me to include support for other scripts as long as these scripts
# use the $imported[script] = true;
# - You can modify and even repost my scripts, after having received a response
# by me. For reposting it, anyway, you must have done heavy edit or porting,
# you can't do a post with the script as is;
# - You can use my scripts for whatever you want, from free to open to
# commercial games. I'd appreciate by the way if you let me know about what
# you're doing;
# - You must credit me, if you use this script or part of it.
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method(:initGP_b4_spop, :initialize) unless method_defined?(:initGP_b4_spop)
#class Game_Player#def initialize() <- aliased
def initialize
initGP_b4_spop
@town_sprite = nil
@town_text = ""
reset_audio
@town_ex_audio = nil
@sync_event = nil
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias_method(:updateGP_b4_spop, :update) unless method_defined?(:updateGP_b4_spop)
#class Game_Player#def update() <- aliased
def update
updateGP_b4_spop
if @town_sprite != nil
case SPOP::POPUP_BINDING
when 1
@town_sprite.x = $game_player.screen_x
if @town_sprite.y != $game_player.screen_y && $game_player.screen_y != @sync_y
@town_sprite.y = $game_player.screen_y - (@town_sprite.y - @sync_y).abs
@sync_y = $game_player.screen_y
end
when 2
if @sync_event != nil
@town_sprite.x = @sync_event.screen_x
if @town_sprite.y != @sync_event.screen_y && @sync_event.screen_y != @sync_y
@town_sprite.y = @sync_event.screen_y - (@town_sprite.y - @sync_y).abs
@sync_y = @sync_event.screen_y
end
remove_town_sprite if Math.hypot(@sync_event.distance_x_from($game_player.x), @sync_event.distance_y_from($game_player.y)) > 2
end
end
rem = false
@town_sprite.visible = SceneManager.scene_is?(Scene_Map)
@town_sprite.update
if [1,3,5,7,9,11].include?(SPOP::POPUP_TRANSITION)
@town_sprite.opacity -= 15 if @town_sprite.z == 5 && @town_sprite.opacity > 0
@town_sprite.opacity += 15 if @town_sprite.z == 10 && @town_sprite.opacity < 255
rem = true if @town_sprite.opacity <= 0
end
if [2,3,4,5,8,9,10,11].include?(SPOP::POPUP_TRANSITION)
mov = [4,5,10,11].include?(SPOP::POPUP_TRANSITION) ? 32 : 64
val = mov/16
t = @town_sprite.y
@town_sprite.y += val if @town_sprite.z == 5 && @toadd > -mov
@town_sprite.y -= val if @town_sprite.z == 10 && @toadd > 0
@toadd -= val if t != @town_sprite.y
rem = true if @toadd <= -mov
end
if [6,7,8,9,10,11].include?(SPOP::POPUP_TRANSITION)
if @town_sprite.z == 5 && @town_sprite.zoom_x > 0
@town_sprite.zoom_x -= 0.25
@town_sprite.zoom_y -= 0.25
end
if @town_sprite.z == 10 && @town_sprite.zoom_x < 1
@town_sprite.zoom_x += 0.25
@town_sprite.zoom_y += 0.25
end
rem = true if @town_sprite.zoom_x <= 0
end
if @town_ex_audio != nil
if @audiowait > 0
@audiowait -= 1
elsif @audiowait == 0
if @town_audio != nil
@town_audio.play
if @town_ex_audio.class != @town_audio.class
@town_ex_audio.replay
@town_ex_audio = nil
end
reset_audio if @town_audio.name != SPOP::POPUP_SOUND[1]
end
@audiowait = -1
end
end
remove_town_sprite(true) if rem
end
end
#--------------------------------------------------------------------------
# * Removing of town sprite when changing map
#--------------------------------------------------------------------------
alias_method(:perform_transfer_b4_spop, :perform_transfer) unless method_defined?(:perform_transfer_b4_spop)
#class Game_Player#def perform_transfer() <- aliased
def perform_transfer
remove_town_sprite(true, false) if SPOP::AUTO_REMOVE_AT_TRANSFER
perform_transfer_b4_spop
end
#--------------------------------------------------------------------------
# * Processing of Movement via input from the Directional Buttons
#--------------------------------------------------------------------------
#class Game_Player#def move_by_input() <- rewritten
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
x, y = self.x, self.y
case SPOP::WALK_8_DIR ? Input.dir8 : Input.dir4
when 1
move_diagonal(4,2)#lower_left
if !@move_succeed
check_town(x-1, y+1)
else
check_town(x-2, y+2)
end
when 2
move_straight(2)#down
if !@move_succeed
check_town(x, y+1)
else
check_town(x, y+2)
end
when 3
move_diagonal(6,2)#lower_right
if !@move_succeed
check_town(x+1, y+1)
else
check_town(x+2, y+2)
end
when 4
move_straight(4)#left
if !@move_succeed
check_town(x-1, y)
else
check_town(x-2, y)
end
when 6
move_straight(6)#right
if !@move_succeed
check_town(x+1, y)
else
check_town(x+2, y)
end
when 7
move_diagonal(4,8)#upper_left
if !@move_succeed
check_town(x-1, y-1)
else
check_town(x-2, y-2)
end
when 8
move_straight(8)#up
if !@move_succeed
check_town(x, y-1)
else
check_town(x, y-2)
end
when 9
move_diagonal(6,8)#upper_right
if !@move_succeed
check_town(x+1, y-1)
else
check_town(x+2, y-2)
end
end
end
#--------------------------------------------------------------------------
# * Operations for sprite removal and audio stopping
#--------------------------------------------------------------------------
#class Game_Player#def remove_town_sprite(instant, audio)
def remove_town_sprite(instant=false, audio=true)
if @town_sprite != nil
if instant || SPOP::POPUP_TRANSITION == 0
if audio
@town_audio.class.stop if @town_audio != nil
@town_ex_audio.replay if @town_ex_audio != nil
end
@town_ex_audio = nil
@town_sprite.dispose
@town_sprite = nil
@sync_event = nil
else
@town_sprite.z = 5
unless @town_audio.is_a?(RPG::SE)
@town_audio.class.fade(4) if @town_audio != nil
end
end
end
end
#--------------------------------------------------------------------------
# * Set the audio as the one specified in SPOP or passed
#--------------------------------------------------------------------------
#class Game_Player#def reset_audio(spn)
def reset_audio(spn = SPOP::POPUP_SOUND)
@town_audio = (spn[1] == "" ||
spn[2] <= 0) ? nil :
case spn[0]
when "BGM"; RPG::BGM.new(spn[1], spn[2], spn[3])
when "BGS"; RPG::BGS.new(spn[1], spn[2], spn[3])
when "ME"; RPG::ME.new(spn[1], spn[2], spn[3])
when "SE"; RPG::SE.new(spn[1], spn[2], spn[3])
end
end
#--------------------------------------------------------------------------
# * Check if there is a town event in front of the player
#--------------------------------------------------------------------------
#class Game_Player#def check_town(x, y)
def check_town(x, y)
return false if $game_map.interpreter.running?
result = false
for event in $game_map.events_xy(x, y)
unless [1,2].include?(event.trigger) and event.priority_type == 1
if event.list != nil
if event.list[0].code == 108 and
["[#{SPOP::ID}]", "[n#{SPOP::ID}]", "[p#{SPOP::ID}]"].include?(event.list[0].parameters[0])
result = true
next if @town_sprite != nil && @town_sprite.z == 10 && @town_text == event.list[1].parameters[0]
remove_town_sprite(true)
@town_sprite = Sprite.new
@town_sprite.z = 10
if [6,7,8,9,10,11].include?(SPOP::POPUP_TRANSITION)
@town_sprite.zoom_x = @town_sprite.zoom_y = 0.0
end
@town_sprite.opacity = 15 if [1,3,5,7,9,11].include?(SPOP::POPUP_TRANSITION)
if event.list[0].parameters[0] != "[p#{SPOP::ID}]"
@town_sprite.bitmap ||= Bitmap.new(1,1)
siz = @town_sprite.bitmap.text_size(event.list[1].parameters[0])
siz = @town_sprite.bitmap.text_size($game_variables[event.list[1].parameters[0][16..event.list[1].parameters[0].length-2].to_i].to_s) if event.list[1].parameters[0][0..15] == "$game_variables["
h = siz.height
s = siz.width
@town_sprite.bitmap.dispose
@town_sprite.bitmap = Bitmap.new(s, 24)
if event.list[0].parameters[0] == "[n#{SPOP::ID}]"
ex = @town_sprite.bitmap.font.color
@town_sprite.bitmap.font.color = SPOP::GRAYED_COLOR
end
@town_sprite.bitmap.draw_text(0,2,s,22,event.list[1].parameters[0],1) if event.list[1].parameters[0][0..15] != "$game_variables["
@town_sprite.bitmap.draw_text(0,2,s,22,$game_variables[event.list[1].parameters[0][16..event.list[1].parameters[0].length-2].to_i].to_s,1) if event.list[1].parameters[0][0..15] == "$game_variables["
@town_sprite.bitmap.font.color = ex if event.list[0].parameters[0] == "[n#{SPOP::ID}]"
else
@town_sprite.bitmap = Cache.picture(event.list[1].parameters[0])
s = @town_sprite.bitmap.width
h = @town_sprite.bitmap.height
end
@town_text = event.list[1].parameters[0]
@town_sprite.ox = s/2
@town_sprite.oy = h/2
case SPOP::POPUP_BINDING
when 1
@town_sprite.x = $game_player.screen_x#*32+16
@town_sprite.y = @sync_y = $game_player.screen_y#*32+16
when 2
@town_sprite.x = event.screen_x#*32+16
@town_sprite.y = @sync_y = event.screen_y#*32+16
@sync_event = event
else
@town_sprite.x = 544/2# - s/2
@town_sprite.y = 416/2# - h/2
end
@town_sprite.y -= 64 if [0,1,6,7].include?(SPOP::POPUP_TRANSITION)
@town_sprite.y -= 32 if [4,5,10,11].include?(SPOP::POPUP_TRANSITION)
@toadd = [2,3,4,5,8,9,10,11].include?(SPOP::POPUP_TRANSITION) ? 64 : 0
@toadd -= 32 if [4,5,10,11].include?(SPOP::POPUP_TRANSITION)
if @town_audio != nil || event.list[2].code == 108
if ["BGM", "ME", "BGS", "SE"].include?(event.list[2].parameters[0]) &&
event.list[3].code == 408
arr = []
arr.push(event.list[2].parameters[0])
arr.push(event.list[3].parameters[0])
if event.list[4].code == 408
arr.push(event.list[4].parameters[0].to_i)
arr.push(event.list[5].parameters[0].to_i) if event.list[5].code == 408
else
arr.push(["BGS", "SE"].include?(event.list[2].parameters[0]) ? 80 : 100)
end
arr.push(100) if arr.size < 4
reset_audio(arr)
end
@town_ex_audio = @town_audio.class.last if [RPG::BGM, RPG::BGS].include?(@town_audio.class)
if @town_ex_audio != nil
@town_ex_audio.class.fade(4)
@audiowait = 4
else
@town_audio.play
reset_audio if arr != nil
end
end
end
end
end
end
remove_town_sprite unless result
return result
end
end
#--------------------------------------------------------------------------
# * Sprite removal at Save (can't save a Sprite) and End
#--------------------------------------------------------------------------
class Scene_Save < Scene_File
if method_defined?(:start)
alias_method(:start_SSav_b4_spop, :start) unless method_defined?(:start_SSav_b4_spop)
end
#class Scene_Save#def start() <- aliased/added
def start
if respond_to?(:start_SSav_b4_spop)
start_SSav_b4_spop
else
super
end
$game_player.remove_town_sprite(true)
end
end
class Scene_End < Scene_MenuBase
alias_method(:start_SEnd_b4_spop, :start) unless method_defined?(:start_SEnd_b4_spop)
#class Scene_End#def start() <- aliased
def start
start_SEnd_b4_spop
$game_player.remove_town_sprite(true)
end
end
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Dim 23 Mar 2014 - 13:09
Merci Vincent !
Je dois écrire quel commande dans l’événement pour pouvoir y arriver ? ^^'
Je dois écrire quel commande dans l’événement pour pouvoir y arriver ? ^^'
- vincent26Membre
- Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010
Re: [Résolu]Pop UP damage on map
Dim 23 Mar 2014 - 17:14
tu utilise le principe de base du script qui affiche un texte a partir d'un commentaire dans ton event (l'explication de l'utilisation est au début du script)
mais au lieu de mettre un texte tu met :
$game_variables[x] avec x l'id de ta variables
mais au lieu de mettre un texte tu met :
$game_variables[x] avec x l'id de ta variables
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Dim 23 Mar 2014 - 17:54
Petit problème ^^
- vincent26Membre
- Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010
Re: [Résolu]Pop UP damage on map
Dim 23 Mar 2014 - 22:19
je n'ai pas eu ce probleme que met-tu dans ton commentaire ?
moi j'avais tester avec cela :
[pop]
$game_variables[1]
moi j'avais tester avec cela :
[pop]
$game_variables[1]
- SagiMembre
- Nombre de messages : 38
Distinction : aucune
Date d'inscription : 19/03/2014
Re: [Résolu]Pop UP damage on map
Lun 24 Mar 2014 - 13:24
En fait j'avais mis deux commentaires. Quand je les ai rassembler pour n'en faire plus qu'un ça a fonctionné. Merci beaucoup ^_^
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu]Pop UP damage on map
Lun 24 Mar 2014 - 13:29
Ton problème est il résolu s\'il te plaît ???
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|