-
Content Count
383 -
Joined
-
Last visited
-
Days Won
19
Content Type
Profiles
Forums
Blogs
Downloads
Calendar
Gallery
Everything posted by ForeverZer0
-
I don't really consider nested loops simpler than a single method call of Enumerable...but that's just me. "collect" is a common Ruby call that no one seems to use simply because it is not in found in RGSS, yet makes for a more efficient and simpler method of doing things. Here's a couple methods. The first uses an actor instance, the second an ID. Both return a boolean if actor is found or not. $game_party.actors.include?(@actor) $game_party.actors.find {|a| a.id == ID } != nil
-
A simpler solution to simply get an array of skills able to be learned by an actor is this: klass = $data_classes[$data_actors[1].class_id] skills = klass.learnings.collect {|ln| $data_skills[ln.skill_id] } You have to replace the index for $data_actors with your actor's id, or simply use an instance of an actor instead of using $data_actors. ie. @actor
-
Why not just set them all to a single switch and have it set to true at the start of the game? Seems kinda worthless to me...
-
It needs placed in the refresh method. It is convention that a refresh method clears the bitmap and redraws it, so whatever you do in the initialize method, which only gets called once, will be deleted the nanosecond the window contents is drawn.
-
Uh, aliasing DOES change the name of a method, hence the keyword being "alias". def method_A p "Method 1" end alias method_A_newName method_A def method_A end Here we renamed "method_A" to "method_A_newName". Since we do not call do not use it in the new method_A, the method does absolutely nothing. If we change it to do this: def method_A p "Method 1" end alias method_A_newName method_A def method_A method_A_newName p "Method 2" end It calls the renamed method, and then prints "Method 2". EDIT: Kell beat me to the post, but yeah. :)
-
It basically comes down to not making your password the word "password". Things is, aside from online financial institutions and email, there is no real need for some uber-strong password. I could really care less if someone got my password for a forum or something. Absolute worse-case scenario, they mess around with my account and get me banned along with causing some mayhem on the site. Getting the misunderstanding resolved would only be as hard as contacting the admin, if it was even needed. If not, the only thing in life I am out of is a membership to a website. That is hardly anything of any real-life consequence.
-
Having a strong password prevents a dictionary-based or brute-force attack. It obviously does not help with the theft of a database, but that is up to the security of the site, not the person. True, all characters are interpreted simply as a "bunch of bits", but most brute-force attackers target combinations of specific "bits", and simply adding a single foreign character increases the possibilities exponentially, since it forces the use many millions, even billions more enumerations, depending on the size of the table.
-
Decreasing variables when selling items.
ForeverZer0 replied to VerticalSunsetIX's question in Support
class Scene_Shop ITEM_ID = 1 ITEM_TYPE = RPG::Item VARIABLE_ID = 1 alias zer0_update_number update_number def update_number if Input.trigger?(Input::C) && @command_window.index == 1 if @item.is_a?(ITEM_TYPE) && @item.id == ITEM_ID $game_variables[VARIABLE_ID] -= @number_window.number end end zer0_update_number end end This will make it so that it only decreases when it is SOLD, not just when you lose an item. The variable will decrease by the number of items sold, but if you want it to decrease only by one no matter how many are sold, replace the "@number_window.number" with simply "1". -
A little late to ask, but was it you forgot the to add "Dir.getwd" in front of the script name you were loading?
-
Here's a little "export" snippet that will output all the scripts in the editor to external .rb files automatically. I think it would make a great addition to your manager to help get people started. Dir.mkdir('Exported') unless File.directory?('Exported') Dir.chdir('Exported') no_name = 0 count = 0 $RGSS_SCRIPTS.each {|script| title = script[1] if title == '' no_name += 1 title = 'untitled ' + no_name.to_s end title = title.gsub(/[\x00\/\\:\*\?\"<>\|]/, '_') + '.rb' File.open(title, 'wb') {|file| file.write(script[3]) } count += 1 } print "#{count} scripts successfully exported!" exit
-
The "sample" method wasn't added until version 1.9(.1?). If it was available, it would be the easiest solution, but being that is osn't readily available, I personally would choose the "slice" method instead of extending the Array class. Sample could be used for other things, so both ways are good. As for your question, "slice" basically just takes an element from an array using its index and returns it, pretty much what you do when you reference an array element using array[iNDEX]. It does have a little more functionality than that for taking multiple elements, etc, but in this case, the most handy thing is that it has a destructive form of the method (slice!). This means that it actually modifies the original array when it is called. It is a Ruby convention using an exclamation point in a method name means it is destructive, and it will usually, if not always have a form that does the same thing but doesn't modify the original. Some examples are "compact" and "compact", "sort" and "sort!", etc. For more about the slice method, check out this link. http://ruby-doc.org/core-1.8.7/Array.html Its some documentation for Ruby 1.8.7, which is not much newer than the RMXP version of Ruby, so most things that are there will work in RGSS. Enterbrain did trim down much of Ruby and removed some classes before compiling, but Array and Enumerable were left alone, just some of the less used classes got the axe.
-
I made a tut to this a while back. I thought I posted over here, but I can't find it... The tut goes a little more in depth on setting Notepad++ up as the editor that will launch RMXP. Anyways, here be the link if anyone wants to check it out. http://forum.chaos-project.com/index.php/topic,9938.0.html
-
Just create a linear array of numbers, the do a random slice. array = (1..56).to_a number = array.slice!(rand(array.size)) You can simply store the array in a $game_variable or something.
-
[RMXP] Module.RPG::BaseItem
ForeverZer0 replied to Bigace360's topic in Archived RPG Maker XP Scripts (RGSS1)
Just to let you know, you don't need to redefine every class. This does the same thing: http://pastebin.com/Wt3e5Uq3 -
Alpha, Beta, Demo, or Trial? Do you know the difference?
ForeverZer0 replied to Jon Bon's topic in General Game Development
Very true, you make a good point. -
MCI Audio Module [XP][VX][VXA]
ForeverZer0 replied to ForeverZer0's topic in Archived RPG Maker XP Scripts (RGSS1)
The host system , RPG Maker is fully bypassed. Aside from the aliases to the RGSS module, this script will run and play music using just Ruby. For this reason, it's important that you either distribute or link user of your game to the appropriate codecs, since there is no guaranteed their system knows how to handle it. -
Probably just need a codec installed. I downloaded the file from YouTube and converted it again to get the right resolution using a H.264/MPEG-4 AVC codec. If your computer doesn't have something to match that, it won't play. If you still want to test, just put your own video in the main directory, and in the script replace the filename of "Rick.avi" with the name of your own.
-
So I was continuing to fool around with MCI functions after completing my little Audio module rewrite, and I found that it also allows for making the most simple video player in RPG Maker. Seriously, it only takes about 15-20 lines of code to get just about any standard video format to play right in the game window. Here's an example if anyone wants to see how easy it is. http://www.mediafire.com/?b8gblyim83m772k God, I wish I understood Win32API functions better back when I used to write more scripts for RMXP, I could have done so much more...
-
MCI Audio Module [XP][VX][VXA]
ForeverZer0 replied to ForeverZer0's topic in Archived RPG Maker XP Scripts (RGSS1)
No, I don't mind at all, it was something I threw together for the demo. It was coded kinda quick and sloppy, so I just didn't want to release it as a full script, nor spend a bunch of time working on at the moment. It started out as debug tool when writing the other parts, and I just cleaned it up a bit for demo purposes. It was actually your post that kinda spawned the idea for this. I think I even suggested using MCI for control, and afterwards I got to thinking that it actually wouldn't be to difficult to implement a wrapper for it in Ruby, so I wrote it. I'm glad that you can find use for it, although the lack of MIDI support does kinda suck. MIDI is a horrible format to work with programmatically, it is a complete different animal from every other format... I hope you can still manage with what there is, though. -
Alpha, Beta, Demo, or Trial? Do you know the difference?
ForeverZer0 replied to Jon Bon's topic in General Game Development
I thought this was common knowledge...or am I wrong? Also, you forgot RC's, but that mainly applies to software more than games. -
MCI Audio Module Version: 1.2 Author: ForeverZer0 Introduction This script acts a either a drop-in replacement or enhancement to the built-in Audio module. It contains a plethora of functions that the default player lacks, such as seek, pause, record, fade in/out, and many more. It works by totally bypassing the built-in audio library, and directly accessing Window's "winmm" library using Ruby's Win32API. This library is home to the Media Control Interface, or MCI, which provides functions for manipulating audio and video. This allows for much more control over sound, and the ability for RPG Maker to play additional audio formats, since all that is needed is to distribute the appropriate codecs along with your game in order to use them. Features Full seek functions, accurate to the millisecond Ability to read file lengths Ability to pause and resume a playing file Functions for transitioning from one volume to another over a given number of frames, to both lower and higher volumes Can create as many mixers as needed, which allows to play multiple sounds simultaneously, which gives the ability to play more than one BGM or BGS at a time Record function to capture input from the user (.wav format only) Ability to set volume to left and right speaker independently Mute functions Can set the speed of playback Ability to set treble and bass (Not all devices support this) Searches RTP files and uses them automatically if file is not local Easy access for additional calls to the Media Control Interface No porting external libraries with your game, all functioning is done within the script and the operating system Can use any audio format you wish, so long as the appropriate codec is installed on the host computer Compatibility with RMXP, RMVX, and RMVXA Screenshots This is a small audio player scene I made for the XP version. Its incomplete, and for demo puroposes only. Demo RMXP Demo 1.2 Script Pastebin Link Auto-Restore Plugin Instructions Simply set the code in the configuration to what version of RPG Maker you are using. See script for detailed instructions on scrip calls available to you, and demo for examples of a few. On some systems, audio can continue to play after the RGSS player has closed. To prevent this, add the following line to the botton of "Main", after all the code: Audio.mci_eval('close all') Compatibility Not tested on Linux running under Wine. I don't have a VM installed at the present time, so if anyone tests this, let me know. High chance of incompatibility with programs that encrypt audio files Due to vast differences in how the format is handled, some of this player's features do not work with MIDI, most notably volume control, which also effects fading. I have created alternate controls to control MIDI volume, but they can only work with the sacrifice of many other functions, and the volume applies to ALL playing MIDIs, not just the one the volume is applied to. I decided this was not worth it, so I omitted volume control of MIDI by default, but if you are willing to make these sacrifices, there is a setting to enable it. If you your game relies heavily on MIDI, but you still would like to use this script, there are conversion programs available, which I can assist you with if need be. Author's Notes If you are looking for a good codec pack, I recommend K-Lite Codec Pack. This is a single package that will cover pretty much every standard audio format available, and even a few exotics (especially with the Mega-Pack). Changing pitch will be different. MCI does not have a function for this, so I am changing the speed as a generic substitute. Changing the speed does change the pitch, but it true sound pitch alters the sampling rate as well, which this player does not. You have a couple alternatives if you absolutely need the pitch change: Edit the files using an external editor and import it Use the default system to play such sounds using the alias names For more information about using MCI commands, please see the full documentation at MSDN
-
A "for..end" loop is not the same as using "each", and your error is because of it. They are both very similar, and are interchangeable the majority of the time, but not always. A variable created inside of a for..end loop's scope is retained. Meaning it still exists after the loop. Example. for i in 0..34 number = i end p number As you can see if you run this, "number" has a value of 34, outside of the loop, even though is was created within it, and did not exist before it. Now try the same with an "each" block. (0..34).each {|i| number = i } p number Now the game crashes, telling you "undefined method or local variable for "number" ". This because any local variable created in a block only has a scope of that block.
-
Scripting Question: displaying enemy conditions
ForeverZer0 replied to Bigace360's topic in Requests
First, this: Now look at "make_action" in Game_Enemy, and "setup_battle_event" in Scene_Battle 1. Its not actually overly difficult, but very tedious. You need to "translate" all the numerical formulas into plain English. Yes, that sucks. -
Did you try looking at the demo and seeing the basic setup there? I can try a bit more in-depth explanation in a bit, but I can't until I get home later on.
-
Good idea using the MIDI. If you don't want to have to download the 4-6 GB for Cubase and go through the whol cracking thing, you can also use Anvil Studio. Its only like 2.6 MB and completely free. http://www.anvilstudio.com/