Jump to content
kal

Ruby/RGSS3 questions that don't deserve their own thread

Recommended Posts

It's because you made your change and THEN called the default initialize. So it sets @max_level to 999, then in the original one, it sets it to 99.

 

Change it to this:

def initialize
init
@max_level = 999
end

 

This comes back to a question you had some time ago. When you're aliasing a method, if you want your changes to take precedence over something the method does, you have to call the aliased method first, and then do your own changes after. If your new stuff doesn't touch anything that's in the original method, you can do them in any order. And if you want to change something that's going to affect the default processing of the aliased method, THEN you do your stuff first.

Edited by shaz

Share this post


Link to post
Share on other sites

how do I make a image to slide(slowly)?

like

@image.x= 10
@image.x=400 #the image jumped instantly from 10 to 400 I want it to move slowly

 

You would need to do it a bit at a time and update the graphics

 

@image.x = 10
while @image.x < 400
@image.x += 10
# graphics update goes here
end

Share this post


Link to post
Share on other sites

how do I make a image to slide(slowly)?

like

@image.x= 10
@image.x=400 #the image jumped instantly from 10 to 400 I want it to move slowly

 

You would need to do it a bit at a time and update the graphics

 

@image.x = 10
while @image.x < 400
@image.x += 10
# graphics update goes here
end

 

For some other math formulas to go about this with, or to have it go parallel while other things can happen, you can also check out my Tweening sprite addition:

 

http://www.rpgmakervxace.net/index.php?/topic/216-scripters-tool-tweening/

Share this post


Link to post
Share on other sites

@Fomar0153

I dont know why but even while using the "while" command

 while  @itembox.y !=0
	 @itembox.y -=1
	  @itembox.update
  end # the exactly same code on my scrpit

the images still jumps from 400 to 0

 

@Jet

Your script is very good, I just downloaded the demo.

but its kind of very complicated I past 15min staring to your script and didnt figure out how to put it on use

I guess its not to RGSS starters like me

Share this post


Link to post
Share on other sites

@Fomar0153

I dont know why but even while using the "while" command

 while  @itembox.y !=0
	 @itembox.y -=1
	  @itembox.update
  end # the exactly same code on my scrpit

the images still jumps from 400 to 0

 

@Jet

Your script is very good, I just downloaded the demo.

but its kind of very complicated I past 15min staring to your script and didnt figure out how to put it on use

I guess its not to RGSS starters like me

 

Interesting script Jet, I'll have a look through some of those formulas later.

 

@darcangel - e.g. if I was doing that in Scene_Battle it'd be:

 

# it's already defined updating method

 def update_basic
   super
   $game_timer.update
   $game_troop.update
   @spriteset.update
   update_info_viewport
   update_message_open
 end


while  @itembox.y !=0
                @itembox.y -=1
                update_basic
         end # the exactly same code on my scrpit



 

It depends where this script is. If you tell me more I can probably point you in the right direction.

Share this post


Link to post
Share on other sites

@Fomar0153

 

 

Thanks I just created

def update
super
end

and then

while  @itembox.y !=0
			 @itembox.y -=1
			 update_basic
	  end

it worked, I was working on scene_item

thanks a lot

 

That method (update) you added with super isn't needed but I'm glad I helped, update_basic is in Scene_Base and looks like this:

  def update_basic
Graphics.update
Input.update
update_all_windows
 end

Edited by Fomar0153

Share this post


Link to post
Share on other sites
@Fomar0153

I dont know why but even while using the "while" command

 

while  @itembox.y !=0
   @itembox.y -=1
   @itembox.update
 end # the exactly same code on my scrpit

 

the images still jumps from 400 to 0

 

Because the UI doesn't have a chance to update. Windows works via a message queue. You can call draw() all you like, but if you're in a tight loop you never allow the message queue to process and you see only the last update. You are circumventing the basic game model of initialize_data(), update_data(), draw_screen().

Share this post


Link to post
Share on other sites

I've been pouring through code in the list, but I can't figure this out- How would I go about adding a cursor to the scene (already have a window_selectable), and moving it within the window, and having it scroll the contents of the window if the cursor goes to the bottom, and there are other items that are unable to be drawn on the screen.

Share this post


Link to post
Share on other sites

Stupid question I know, sorry:

 

How do you define your own x and y cordniates so that windows or objects move along those cordniates?

Share this post


Link to post
Share on other sites

I'm pretty good with Ruby, but this has me stumped.

 

I'm working on a script that can be used as an event script as well as a trigger script.

 

The problem is I haven't gotton myself around this error, and it's probably something I've overlooked.

 

For example if I created an even and used the script option and did this ($class_name.something) for testing purposes I simply wanted to print out "You have working code" in the console confirming it worked, however I'm getting this error.

 

"Game_Interperter Line 1409: NoMethodError Occured"

"undefined method "testing" for nil:NilClass

 

And for reference, basic code.

class Game_Player < Game_Character

 class Test
  def testing
	 print "You have working code!"
	end
end

end

 

If I tried using this say with Game_Character it does display the print out, I just can't get it working with event scripts.

Edited by Rukiri

Share this post


Link to post
Share on other sites

What does your call code in the event look like? You have a no method error because you are trying to call the 'testing' method on nil. This is either because some other code set the variable/constant that you are calling testing on to nil, or that you are calling testing on an uninitialized global variable (the default value for globals is nil).

Share this post


Link to post
Share on other sites

You say that you call the method like so:

 

$class_name.whatever

 

That would be incorrect. The name of the class is not the same as an instance of said class. Creating a class does not magically create a gobal variable along with it. You would need to create it first.

 

$some_var ||= SomeClass.new
#some_var.whatever 

Share this post


Link to post
Share on other sites

this has been bothering me. I like to experiment with scripts and what have you how ever this method is odd:

 

 def next_level_exp
exp_for_level(@level + 1)
 end

 

iets assume you need 50xp for the next level, if I change that +1 to a +2 you now need:162xp. how ever if i triger an event which increases the level by 1 then my current xp is 50 and my next is 162-50 = 112. so my question is: (note: you never gain your level)

 

If I am to change this value in some script some where what else must I change to make sure that if I use an event to auto increae the characters level by 1 or x that they not only increase properly but that the xp is repersented properly as well?

Edited by A.

Share this post


Link to post
Share on other sites

Are you saying if your character still needs 50xp to get to the next level, and you use an event to increase his level, that you want him to be given the 50xp? That already happens:

 

from Game_Actor class:


def change_level(level, show)
 level = [[level, max_level].min, 1].max
 change_exp(exp_for_level(level), show)
end

 

So to increase their level by 1 or x, you just call this function with 1 or x as the first argument. You don't need to worry about the xp at all.

 

Are you saying this is not happening? Or am I misunderstanding the question?

Edited by shaz

Share this post


Link to post
Share on other sites

This is probably done, but how do you continue (@step_anime) if you run into an event or near the screen?

 

like if keyboard input is given the step animation should continue (regardless if the player can actually move)

 

Edit:

Nevermind, I got it.

 

class Game_Player
#--------------------------------------------------------------------------
# continuously play the step animation
#--------------------------------------------------------------------------
alias :xeilsoft_ani_update :update
def update
  xeilsoft_ani_update
  if actor && $game_switches[2] == true
	@walk_anime = true
	@step_anime = true
  else
	@step_anime = false
  end
end
 end

Edited by Rukiri

Share this post


Link to post
Share on other sites

Small question... Everytime I try to dispose a window, I get an error. Anyone knows what the problem could be?

 

Specifications:

  • Normally, the problem occurs when you try to dispose an already disposed window
  • I only have to enter .dispose once and I get the problem
  • I stay in the same scene but or activate another window directly afterwards, or switch a newly created window
  • Happens in methods executed by handlers
  • Window is normally disposed when leaving the scene
  • Error is on line 83 of Window_Base

Edited by Emerald

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×