General Methods XP VX & ACE - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Material Development (https://www.save-point.org/forum-8.html) +--- Forum: Scripts Database (https://www.save-point.org/forum-39.html) +--- Thread: General Methods XP VX & ACE (/thread-7562.html) Pages:
1
2
|
General Methods XP VX & ACE - kyonides - 10-23-2019 General Methods
Methods for XP
Introduction I am posting here a bunch of methods that I thought they have appeared a several times in my scripts or they are methods that seemed to be useful under certain circumstances, but are not good enough to become part of a specific script. Warning! This group of methods might not be useful for the average game developer that lacks any scripting skills. Script Calls rand_range(any_range) any_range.random Returns a random number that is included in the given range. A Range object is a number range with an initial value (the lowest) and a final value (the highest). It's something like using an entire array full of consecutive numbers. I named the second script call random because I shouldn't overwrite rand. (The script call actually needs rand!) Using the second option might be your best choice because it doesn't create a global method which would use more memory. $game_party.leader Returns the current party's leader (Aluxes!?) $game_party.subleader Returns the current party's subleader (Basil!?) $game_party.actors_by_hp $game_party.actors_by_sp $game_party.actors_by_pdef $game_party.actors_by_mdef $game_party.actors_by_eva $game_party.actors_by_agi $game_party.actors_by_dex $game_party.actors_by_strength $game_party.actors_by_mana Returns the actors sorted by the chosen stat (Descending Order) $game_player.visible? Returns if the player's sprite is not transparent $game_map.events[Number].visible? Returns if the event's sprite is not transparent $game_map.events[Number].name Returns the chosen event's name You can also check if a battler is hero or an enemy in a new way by calling its brand new kind method that will return either an :actor or :enemy symbol if called. This could be useful in any Game_Battler or Game_Actor or Game_Enemy or Scene_Battle script. Script Code: # * General Methods XP Terms & Conditions Free for use in commercial and non commercial projects. You are free to post any methods here you consider that can be useful for scripting power users and actual scripters. RE: General Methods XP - kyonides - 07-06-2020 Set the Current Map's Encounter Steps
Usually you can either enable or disable map encounters. This time I'm gonna show up here to let you know how to change your current map's monster encounter steps. This might work on any RPG Maker based on Ruby, guys! 1. Just add the scriptlet below to your script editor. Code: class Game_System 2. Call it to set the new steps value. Keep in mind it should be an integer number greater than 0. $game_map.encounter_step = NewValue That's it! RE: General Methods XP - kyonides - 08-02-2020 General Methods for XP + VX + ACE
Sometimes people show up complaining about their inability to easily setup self switches in a script call event command. Well, here's a quick way to get its current value or set a new one. Since we're using scripts here, you can use any letter you can think off as an self switch ID element. Keep in mind the default implementation requires you to provide an array of 3 elements as a key to find that self switch. This scriptlet allows you to only set those elements you really care about at any given time. For XP Code: class Interpreter For VX or ACE Code: class Game_Interpreter To get its current state: self_switch('C') To set it to a different state: set_self_switch('C', false) To toggle it: toggle_switch('C") toggle_switch('C", 21) Add another parameter at the end, in both cases, to select a different map event. The advantage is that you no longer need to include thisEvent, thus saving valuable space there. Plus you get the chance to use it for any map event... RE: General Methods XP - kyonides - 08-22-2020 Convert Your Current Temperature
to Celsius or Fahrenheit
with Ruby and RGSS! To make that ever happen, you'd only need to copy and paste the following scriptlet. Code: module Termometer Then you call Termometer.f2c(Degrees) or Termometer.c2f(Degrees) to get the corresponding conversion of your current temperature. Kilometers and Miles
Yes, you can do the same with kilometers (km) and miles (m). Code: module Distance The script calls are: Distance.km_to_miles(KM) Distance.miles_to_km(MILES) RE: General Methods XP - kyonides - 12-31-2021 Bitmaps and Color Inversion
On another board people were working with a stripped down version of one of LittleDrago's scripts that featured the color inversion method. I disagreed with his implementation and the minimalistic version Roninator has published so I felt the need to code it the following way: Code: # * Color Inversion Script There's also a need to make a few fixes in his draw_item related methods. Warning! You should NOT change a bitmap's colors directly! It's always better to work with a duplicate or dup. Why? Because bitmaps get cached by the engine. Thus you might need to perform a color inversion every time you draw any face, no matter if the hero is dead or alive. Even if there's a slight possibility this might happen, it's better to avoid this color inversion madness from the very beginning. VX ACE Window_MenuStatus Modification Code: class Window_MenuStatus Keep in mind RMXP never sported any faces at all. This means you'd need to include a custom script to make it possible in XP. RE: General Methods XP VX & ACE - kyonides - 03-30-2022 Memorize Events at Will!
Just make sure they will not come back to slap the hell out of your face. XP Version Code: class Interpreter ACE Version Code: class Game_Map If you are going to use these events from a custom script, use the following calls: XP Calls $game_system.map_interpreter.memo_events[MapID][EventID] $game_system.map_interpreter.this_map_memo_events[EventID] ACE Calls $game_map.interpreter.memo_events[MapID][EventID] $game_map.interpreter.this_map_memo_events[EventID] Else if you are editing script commands, use the ones below: Any Version memo_events[MapID][EventID] this_map_memo_events[EventID] clear_memo_events clear_map_memo_events RE: General Methods XP VX & ACE - kyonides - 11-11-2022 This post includes two new features for Game_Variables and Game_Switches respectively.
Manually Calculate with Multiple Game_Variables!
I know that the event commands allow you to add two game variables at a time. Even so, don't you think that it would be convenient to add or subtract or multiply or even divide by many game variables in a row? Now you can do it! Code: # * Game Variables Addons The new methods for $game_variables are:
You can pass them as many ID's or positions as you wish!
Toggle Your Game_Switches!
Code: # * Game_Switches Addon Just call the method: $game_switches.toggle!(ID1, ID2, etc.)
...and those Game_Switches will get their inverted boolean value in no time! RE: General Methods XP VX & ACE - kyonides - 11-17-2022 Process Game.ini Data
Usually, you would need to set a brand new string or constant to your game's official name by hand. Then you would call it every single time your game is loaded or reloaded. Now that's no longer necessary! Include this scriptlet and you will only need to setup a single constant, namely INI_FILENAME and that's it! Code: # * Game.ini Data Extractor From now on, you can directly access Game::DATA["Title"] or any other variable you may have set in your Game.ini file. RE: General Methods XP VX & ACE - kyonides - 12-02-2022 Is the Player Behind You, NPC?
You only need a snippet to figure it out! Simply call: behind_event?(EventID) And you'll soon know if your character is just about to get rid of some nasty tyrant... Or some dissenter a la Belarus instead. XP Version Code: class Interpreter VX & ACE Version Code: class Game_Interpreter RE: General Methods XP VX & ACE - kyonides - 03-08-2023 How to Get Rid of Those Weird Invisible Characters
Let me guess... your username or a directory has a multibyte character or space inbetween that shouldn't be displayed on screen and now you're having this issue right? Let us think this has been caused by a nasty character found in the environmental variable HOME. Since we are working with Ruby 1.9 or below if talking about the RGSS based engines, this might only be solved by applying one of the following solutions: Method #1 - Ruby 1.9 Code: env_home = "#ENV['HOME']}/AppData/Local/game" Method #2 - Ruby 1.8 or 1.9 Code: env_home = "#ENV['HOME']}/AppData/Local/game" Replace "" (nothing) with " " (a single space) if it's supposed to be a simple space there. In this case, the order of the replacements of the matched regular expressions do matter here. Other solutions might tell you that you need to use iconv, but it'd be way better for the average game developer to keep it as simple as possible as shown above. |