Calintz's Scripting Questions Thread
**Let's Zoom to the Character** :???:
To add simple aesthetics is the key to graphical success when making games. A very useful feature in any game is to be able to locate a specified object(character, tile, etc...) and zoom onto that specific object. Can somebody with scripting knowledge(probably requires a 'basic' level of scripting knowledge) help me learn how to perform this action??
**I think this will be done by acquiring the (x, y) coordinates of the character or object, and then zooming to that location.
RESOLVED :D
**Let's Move the Gold Window**
I was trying to figure out how to move the gold window, and all of my attempts have failed miserably.. .. .. :|
**I am using the default command to show the gold window from a message on the map. How do I change the location for this??
FOUND A WAY AROUND :^_^':
**Let's Dispose of that Gold Menu**
I was able to generate my own gold menu and placing it where I desired by using the "Call Script" command. However, the window does not disappear when I would like it to.
**What command can I used to dispose of that window from the "Call Script" command??
**Also, what command can I use to update the same window??
FOUND A WAY AROUND :^_^':
**Let's Move the Window Pause Icon Permanently**
Everybody who uses RMXP knows that when a message is being shown, in order to continue, you have to press a certain button, right!? Well, while the system is waiting for that button to be pressed the system lets you know that it is waiting on you by displaying that small window pause icon at the bottom of your message.
What I am looking to do is to indefinitely change the y position of that little pause icon, but I do not know what syntax controls the pause icon, and I could not find anything that led me to believe that it is located in the Window Message script. Anyone wanna help me find the area that controls this icon??
**Please don't tell me to edit the windowskin itself, because the windowskins attributes for the pause icon themselves, aren't large enough to re-locate the icon to display where I desire.
**Let's Make an Icon Blink** :???:
I was wondering if somebody could help me set up a small snippet that could be added into a script that uses icons for display. The meaning of the snippet is to make the icon blink.
**I know it involves changing the icons hue, but I don't know how to loop the effect and have it continue to blink until a certain condition is met.
**Let's Determine the Passability of a Specific Tile** :???:
It has become my top priority to figure out a way to determine whether or not a tile (on any given map) is passable...Here is the catch. I need this tile to be very specific. I need to know how to determine if a tile that is placed two tiles ahead of the main character is passable or not.
RESOLVED :D
**Let's Check the System for the Current #of Party Members**
Is there a snippet I can use that can check the system for a set amount of party members?? Like, can I do something like this?? It would be called from the conditional branch, call script option.
- obviously not the proper syntax.
**Meaning if there is one member in your party.
When you say zoom, do you mean pan (i.e. scroll along a map until the person is centred on the screen)?
No, I mean ZOOM into. Like the picture zoom command in the event editor. This command allows you to zoom anywhere to any point on pictures.
Is it possible that zooming on the map isn't possible??
There was a script on Creationasylum that had a map zoom feature, too tired to get a link though...
So no, it isn't impossible.
Good deal...
I HAVE to figure out how to do it!!
I have yet to see a game that zoomed on the map though.
Just curious - wouldn't it get really pixelated...? :(
Don't tempt me, Calintz. <_<;;;
HAHAHA!!
I do no such thing Blizzard!!
@Reno:
That all depends on the level of detail in your graphics, and the distance of zoom.
Quote from: Calintz16438 on February 21, 2009, 05:24:48 am
HAHAHA!!
I do no such thing Blizzard!!
@Reno:
That all depends on the level of detail in your graphics, and the distance of zoom.
LIES. :D
<3
Yeah, as soon as I posted it I realised it might be good for a world map or something. :D I must admit I can't help you but I'd be interested to see if someone can figure this out. :shifty:
Me too...
I really hate to spoil the surprise, but for the scenes I will be zooming, I am going to use charasets with dimensions around 75pixels by 75pixels, so we'll see what happens.
calintz get on msn and I can help you with the pic at the end of teh battle.
Dunno if this'll help, but you can always take a screenshot and zoom the sprite.
I was thinking about that, but that doesn't allow for animation. I want to be able to have events playing while the zoom is in effect.
I would look at a Mode 7 script. They have to have some sort of a zoom function in there...
Alright, That one here on CP (Cata). you think it would have one?
I was thinking about Mode 7 too. And it allows for animation as well.
... bububut the pixellation... ;;_;;
New question in the 1st post.
** Please help.
move the gold window?
in the menu?
if so, you use custom menu scripts?
if no custom script:
to change the size, change in
Window_Gold around line 12:
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64) #change this
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
to change position, change in
Scene_Menu around line 51
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0 #Change these for x
@gold_window.y = 416 #change for Y
hope it works.
if you use a custom script that i need to look into the script
Depending on which scene you wnat to change its co-ordinates for.
Do a Ctrl+Shift+F for this:
@gold_window = Window_Gold.new
And shortly following, the x and y co-rods should be specified. Change them there.
Hope it helped. Ask if you don't get it. ^-^
Ah, my mistake...I should have clarified...
I am showing the gold window using the \g command in a message on the map.
How do I change the position where it appears??
EDIT
**I was able to figure this out thanks to you guys.
**I simply removed the show gold command in the message, and created my own gold window with the "call script" command, and then I moved it where I wanted it.
Thank you guys. You are both powered up...
EDIT01
I have another question. I hope someone can help.
The updste shouldn't it be like
gold_window.update if active
Or something along those lines?
And wouldn't you use scene_bler.close/quit/end
or something close to that?
I'm pretty sure that those are not the proper commands.
**I have already tried to 'refresh,' 'dispose,' and 'remove.' Update might work, but I doubt it.
Don't worry though i'm learning too, hqrd as hell isn't it?
Can be.. .. ..
For the most part, I am beginning to nail everything simple.
I can do what I need to get things the way I want. I just hit some small road blocks sometimes.
Alright try this
scene_gold.update else scene_gold.dispose
I'm using my basic knowledge of ruby sorry i can't be of more help
That might actually work, hold on.. .. ..let me try.
EDIT
No good...
probably have a idea. but need to get home from work to test it out.
will let you know.
Scene_gold.active? else scene_gold.refresh else scene_gold.dispose
?
I'm not sure how you update it from a call script. Heres what to change the gold window from the window_message class
# If \G
if c == "\002"
# Make gold window
if @gold_window == nil
@gold_window = Window_Gold.new
@gold_window.x = 560 - @gold_window.width
if $game_temp.in_battle
[b]@gold_window.y = 192[/b]
else
[b]@gold_window.y = self.y >= 128 ? 32 : 384[/b]
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
# go to next text
next
end
Here are the line numbers you change
Line 115 @gold_window.x = 560 - @gold_window.width
# Change the y positon in battle.
Line 117 @gold_window.y = 192
# Change the y depending if the y is less then 128. If goes to 32 if the y is there. Otherwise the y is 382.
Line 119 @gold_window.y = self.y >= 128 ? 32 : 384
Well Calintz the gold window should already be disposing by itself. Okay so you're using the \g command in a message box right? Well then it should dispose it already. Its not going to dispose until the message teh \g command is in is over. But if all failse use this
if @gold_window.visible
@gold_window.visible = false
end
or if that doesnt work try
if @gold_window.visible
@gold_window.dispose
end
All done in a script command even the branch. And yes it should be
Hopefully you didnt mess up the Window_Message by accident.
So if the above two fails try replacing your current Message_Window with a new one from a new project and see if it still happens.
None of this works.I don't use the gold window from the message box. I am creating a new window with the "Call Script" command. I constantly get a no method error when I use the dispose command.
**Could Ccoa's UMS be causing the issues, but I wouldn't understand why, because I am still using the default syntax.
**This is exactly as the commands appear in my game.
@gold = Window_Gold.new
@gold.x = 416
@gold.y = 288
The window will not dispose though...
I have tried using
@gold.dispose and several other commands, but all attempts have failed. I even replaced the default window message script like game_guy suggested.
then use
Only use
If you've actually named it @gold_window. And why do that when you can go into Window_Message line 115 and change teh x there and also change teh y and call it from teh message
No, no, no!! I have been using
Quote from: game_guy on March 06, 2009, 08:56:59 pm
then use
Only use
[/s]
If you've actually named it @gold_window. And why do that when you can go into Window_Message line 115 and change teh x there and also change teh y and call it from teh message
Use the method thats not strook out then.
I have tried them both Game_Guy...
Give me ccoa's message system
and I'll alter the gold x and y for you.
I was trying to cross out the code but it didnt work. But gimme ccoa's message system and the x and y coordinates and I'll alter it for you. Then just use the
\g command.
That's okay. I know how to do that.
Thank you...So far, things are working well.. .. ..
Maybe you've put the dispose command in the wrong spot. But I still suggest you give G_G your script. ^-^
I guarantee that I did not put the .dispose command into the wrong place.
This was my exact code.. .. ..
@gold = Window_Gold.new
@gold.x = 416
@gold.y = 288
Upon attempting to update, I tried all of the following:
if @gold.visible
@gold.dispose
end
if @gold != nil
@gold.dispose
end
**None of the aforementioned succeeded.
**I have everything under control now though.**Game_Guy = Power Up!!
game_guy says "So I solved it?" game_guy gets slapped by Ronnie. ronnie says " No duy look at the power up"
Haha, yes Game_Guy...you solved the problem.
I had never actually thought about changing the (X, Y) values of the default placement in Ccoa's script. I knew how, but it hadn't crossed my mind.
Thank you very much Game_Guy XD.
Calintz is now.. .. ..a...
!! LEXIMAN WARRIOR !!
HOLY SH*T! I thought I'd never see the day... :w00t:
*worships*
Haha thanks Reno...
I might have some more questions soon.
Where did you use it?
If you ever want to create your own gold window through script command again use "$gold" instead of "@gold" and see if that works.
I just used it on any old map Blizz...
I have found a way around this problem Ryexander, but thanks anyway buddy...
**Thanks to gameguy
*only read the first post and the last 4-5 on this page* Zooming in on the map isn't supported in RGSS :(
Doesn't mean it can't be done by using a Tilemap rewrite. <_<;
try searching on creation asylum calintz. I saw one there and I tried it and it was pretty good.
Yeah, there was one there too, it was even used in this one game, although I forgot what it was.
They zoomed in the map for cutscenes, and stuff like that. The only thing wrong with it was that it was pixelated when you zoomed in, but I believe that's near impossible to fix.
Of course it's gonna pixelate...Just don't radically zoom in, Lol.
Zoom in to a maximum of 125% or so for a decent effect.
I will look, thanks everyone.
New question...
Please help if you can.
Maybe you could make the icon into a sprite, and use @sprite.blink?
Lol, I really have no idea. :^_^':
Isn't there a built in method to add hews to a bitmap?
Quote from: Rgss reference
Sprite
The sprite class. Sprites are the basic concept used to display characters, etc. on the game screen.
flash(color, duration)
Begins flashing the sprite. duration specifies the number of frames the flash will last.
If color is set to nil, the sprite will disappear while flashing.
color
The color (Color) to be blended with the sprite. Alpha values are used in the blending ratio. (uses a color object)
Handled separately from the color blended into a flash effect. However, the color with the higher alpha value when displayed will have the higher priority when blended.
tone
The sprite's color tone (Tone). (uses a Tone object not a color object)
Color
The RGBA color class. Each component is handled with a floating point value (Float).
SuperclassObject
Class MethodColor.new(red, green, blue[, alpha])
Creates a Color object. If alpha is omitted, it is assumed at 255.
Methodset(red, green, blue[, alpha])
Sets all components at once.
Propertiesred
The red value (0-255). Values out of range are automatically corrected.
green
The green value (0-255). Values out of range are automatically corrected.
blue
The blue value (0-255). Values out of range are automatically corrected.
alpha
The alpha value (0-255). Values out of range are automatically corrected.
The color tone class. Each component is handled with a floating point value (Float).
SuperclassObject
Class MethodTone.new(red, green, blue[, gray])
Creates a Tone object. If gray is omitted, it is assumed at 0.
Methodset(red, green, blue[, gray])
Sets all components at once.
Propertiesred
The red balance adjustment value (-255 to 255). Values out of range are automatically corrected.
green
The green balance adjustment value (-255 to 255). Values out of range are automatically corrected.
blue
The blue balance adjustment value (-255 to 255). Values out of range are automatically corrected.
gray
The grayscale filter strength (0 to 255). Values out of range are automatically corrected.
When this value is not 0, processing time is significantly longer than when using tone balance adjustment values alone.
If I understand it correctly basically to blink an icon you would have to do this. any one else feel free to correct me.
#create sprite use this cone to create a sprite
@icon = Sprite.new
@icon.bitmap = Bitmap.new(width, height)
@icon.bitmap.blt(x, y, RPG::Cache.icon("Icon_name_here"), Rect.new(x, y, width, height))
@icon_alpha = 0
@icon_mode = 1
#flash icon call the method every frame that you are flashing the icon
def flash_icon
if @icon_mode == 1
@icon_alpha += 5
if @icon_alpha > 255
@icon_alpha = 255
end
if @icon_alpha == 255
@icon_mode = 0
end
elsif @icon_mode == 0
@icon_alpha _= 5
if @icon_alpha < 0
@icon_alpha = 0
end
if @icon_alpha == 0
@icon_mode = 1
end
end
icon_color = Color.new(255, 255, 255, @icon_alpha)
@icon.color = icon_color
end
The code creates a sprite object and then the flash_icon method blends a wight color with the sprite and changes tha alpha of the blended color depending on the previous alpha. feel free to change the color blended or the alpha limits.
please note that I have not tested this so I'm not sure that the commands for creating the bitmap in the sprite or changing the icons color are correct, but the idea should be right.
From Game_Map:
To the person who wants to help with the tile jumping: ShowHide #--------------------------------------------------------------------------
# * Determine if Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# impassable
return false
end
# If through is ON
if @through
# passable
return true
end
# If unable to leave first move tile in designated direction
unless $game_map.passable?(x, y, d, self)
# impassable
return false
end
# If unable to enter move tile in designated direction
unless $game_map.passable?(new_x, new_y, 10 - d)
# impassable
return false
end
# Loop all events
for event in $game_map.events.values
# If event coordinates are consistent with move destination
if event.x == new_x and event.y == new_y
# If through is OFF
unless event.through
# If self is event
if self != $game_player
# impassable
return false
end
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
end
# If player coordinates are consistent with move destination
if $game_player.x == new_x and $game_player.y == new_y
# If through is OFF
unless $game_player.through
# If your own graphic is the character
if @character_name != ""
# impassable
return false
end
end
end
# passable
return true
end
You'd probably have to incorporate it with your jumping script.
I changed my mind, but I haven't tested it: ShowHide case $game_player.direction
when 2
if $game_map.passable?($game_player.x, $game_player.y+2, 0)
disable_jump
end
when 4
if $game_map.passable?($game_player.x-2, $game_player.y+2, 0)
disable_jump
end
when 6
if $game_map.passable?($game_player.x+2, $game_player.y+2, 0)
disable_jump
end
when 8
if $game_map.passable?($game_player.x, $game_player.y-2, 0)
disable_jump
end
end
I'm not using a script.
My Running and Jumping System is event oriented. XD
But hopefully, your post will aide someone else.
editI thought for sure it was gonna have something to do with this...
# If unable to enter move tile in designated direction
unless $game_map.passable?(new_x, new_y, 10 - d)
# impassable
return false
end
are you wanting to see how many members are the party? If so
if $game_party.actors == 1
Blah here
else
if $game_party.actors == 2
blah here
else
if $game_party.actors == 3
blah here
else
if $game_party.actors == 4
blah here
end
end
end
end
[code]
Just select teh code thing in the 4th tab in a Conditional branch.
[/code]
Are you positive!?
Yes I've used it when I created a custom menu asystem before
Okay thank you...I will go test now, and...
*power up*