New account registration is temporarily disabled.

A SCRIPTING QUESTION ABOUT SPRITES

Posts

Pages: 1
Since I'm new to Rpgmaker XP in general I've spent the last couple of days sorting through the code to see what makes what. I've got a decent grasp, or so I hope, of how everything links together. However the one sore spot I am coming up with is where does the game actually call the sprite_character class to load the sprite specified in the game_actors database? Nowhere in the code have I been able to find where any other class actually calls the sprite_character class to load and display the sprite, however it apparently does so as altering it alters how my players sprite is displayed. I've search the Game_character, the Game_player, the game_actor, and every other class that is called when starting a new game(I've used Scene_Title as my starting place for my search and combed through everything that it calls, assuming that since it is starting a new game then it must set everything up). Yet I found nothing.

If it helps I am simply trying to display sprite that will be used in a in-game cutscene, however I don't like loading them up using the display graphic that you can attach to an event as it limits me to only 4 "walking animation" frames that it can cycle through(frames whos height and width I am not even allow to set no less!). I've fixed the same problem for my player sprite, he is now able to use any number of frames to make a walking animation! That is getting off the topic though.

So if anyone can shed some light on where it calls the sprite_character class in the game for the main character then please lend me your wisdom. Is it something that is called outside the script that we see in the editor? Have I simply gone blind for staring at the screen for far too long? Any help is appreciated!

I haven't worked with XP in a while, but if I remember correctly (and I'm understanding you correctly), then you might want to take a look at Spriteset_Map I believe it's called. Again, going off memory here, but I believe Spriteset_Map creates a new Sprite_Character which references to a variable (I forget it's name though!) which is an instance of Game_Character to get the "character_name" (which is the name of the file used).
That is exactly what I am looking for actually, and I have no idea how I missed that file before. I guess I am blind lol. Thanks for the info, it certainly helps in piecing things together.
Ctrl+Shift+F can be really helpful when you're learning the base scripts. It searches all sections instead of just your current one. :) So you could search Sprite_Character.new to see everywhere the system creates an instance of that class.
Ahh, I was getting aggravated by the need to individually search scripts, the Ctrl+Shift+F will definitely speed things up. You doth rocketh greatly Racheal

I've come across another problem and since it is on the same topic I shall post it here in attempts to save forum space(is that even the right term?) Anyway, I am trying to load a bitmap using the RPG::cache.character method in a custom class I am creating, the bitmap is not used anywhere else in the program except for where I try to call it up. Whenever I attempt to load it using the RPG::cache.character method it returns that the sprite is disposed. Which brings me to my question, does RPGmaker load all graphics in it's subfolders(ie Characters, tiles, animations, etc..) into the RPG::Cache or does it only load those that are assigned a use in the database tab? Since I never disposed of the bitmap I have to assume that it either was never loaded into the RPG::cache or that RPGmaker disposed of it somewhere down the line in some sort of mass-disposal thingy to get rid of unused bitmaps.

Just in case it matters heres the line that calls the .character method:
self.bitmap = RPG::Cache.character(filename, 0)

filename in this case is the variable that contains, dun dun duuuun, the filename of my bitmap. In any case I am going to keep poking it with a stick and see what happens, however any help is mostly greatly appreciated!

Jason, those bitmaps are loaded by the test run when the game is first loaded. Then they are disposed of. This is so that errors for missing files will be thrown up right when a game loads. They are later loaded on demand when the game needs them. You might not find this code because it's hard-coded (check the help documentation). However, you should be able to find out in what instances they are loaded, and thus determine if you can access them and make modifications, or if you simply need to create your own sprites.

I could be way off base, but this is what I think.
Good advice S.F. , it wasn't what directly helped me solve it but it pointed me on a train of thought that ended up fixing it. I think you are right about the Cache being hard-coded though as I can't find it anywhere it the script where it loads. However I did realize that I wasn't specifying a viewport for my sprite. I just created another method in the spriteset class where I put all of my custom sprite loaders which gets called whenever spriteset map is called(which appears to be every time a new map is loaded). That fixed the problem right up and now my sprites load up without error.

*random thought ahead*
I did notice that there is a viewport for each layer that is represented in the mapmaker, I am guessing in theory you could add more layers simply by making more viewports and thus could have even more stuff layered on top of other stuff. That is just a guess as I have yet to mess with it. But anyway, mission accomplished with the sprite stuff and now I can start writing the custom animation bit for the cut scenes.
*/random thought*

Thanks for both S.F. and Racheal's help!
Pages: 1