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

@bgillisp:

user is an instance of either Game_Actor or Game_Enemy. When it is an actor, then user.actor is a RPG::Actor instance which is probably not what you are looking for since the RPG::... - instances usually only store settings you did in the editors database.

user.actor.equips gives you an array containing IDs of that actors initial equipment, user.equips should refer to the actors actual equip here. Keep in mind that when the user is not an actor, user.equips is probably not defined.
user.equips? Ok, I'll try that when I get home, thanks! There is already a check to see if it is an actor before going to that line of code, so it should (hopefully) be ok. Though to be safe, I can add a check to make sure it is not nil before doing anything with it.
@Another Fen - Oh no, you have misunderstood - I want the class object, not just the class type. 🙂
How would I get the currently used skill's ID?

I found the script call for it a few weeks ago, but I lost my project and I can't seem to find it now. >.>

I need that for a common event attached to the skill itself.

Can someone enlighten me, pretty please? *-*

Also, is there any way to call a common event before the actual damage effects occur?

It seems that common events always trigger after the skill effect, but I would like to trigger it before the skill effects. 

Is this even possible without modifying scripts? Or should I start looking into the scripts for this?
find this method in Scene_Battle:

#-------------------------------------------------------------------------- # * Invoke Skill/Item #-------------------------------------------------------------------------- def invoke_item(target, item) if rand < target.item_cnt(@subject, item) invoke_counter_attack(target, item) elsif rand < target.item_mrf(@subject, item) invoke_magic_reflection(target, item) else apply_item_effects(apply_substitute(target, item), item) end @subject.last_target_index = target.index endthe item passed to it can be a skill or an item. So you might want to do a check if it's an RPG::Skill. You can check out the other methods in it too.. like if you only want something to happen if the skill passed all the checks to acctually hit the target.. then you'd want to look at apply_item_effects
So ,what I'm trying to achieve is to reduce the Item/skill selection windows width and I've managed that but there are still two columns;One column is outside the window ;_;

Does anyone knows how to change the number of columns in skill and Items selection window.
def col_max


return 1


end
This doesn't seem to work for me,or am I doing something wrong!?
ok I should probably ask 🙂 where are you adjusting the windows size? Is it in the window itself or in the Scenes?
Ammm neither,I'm using MOG - Battle Hud script to adjust it.
I couldn't find a spot to just view the code without downloading the the demo. But you'll probably be asked to start a thread in script support. You can try dropping this in a new section in the script editor and see if it fixes it... I've never used that battle system so I don't know if he built it off the default windows or if he did his own.

Code:
class Window_ItemList < Window_Selectable  def col_max;    return 1;     endendclass Window_SkillList < Window_Selectable  def col_max;    return 1;     endend
I've found the spot where to paste in script and it works now thanks a lot,can't describe how happy I am right now😀 😀 😀

Spoiler
Code:
#==============================================================================# ** Window_BattleSkill#==============================================================================class Window_BattleSkill < Window_SkillList include MOG_BATTLE_HUD_EX  #-------------------------------------------------------------------------- # * Initialize #--------------------------------------------------------------------------    alias mog_monogatari_battle_skill_initialize initialize def col_max  return 1end def initialize(help_window, info_viewport)     @force_hide = can_force_hide?     @force_hide_active = can_force_hide_active?          mog_monogatari_battle_skill_initialize(help_window, info_viewport)     self.width = SKILL_WINDOW_SIZE[0]     self.height = SKILL_WINDOW_SIZE[1]         @org_position = [SKILL_WINDOW_POSITION[0],          Graphics.height - self.height + SKILL_WINDOW_POSITION[1]]     self.x = @org_position[0]     self.y = @org_position[1]     self.opacity = SKILL_WINDOW_OPACITY     self.viewport = nil     self.z = MOG_BATTLE_HUD_EX::HUD_Z + 150     create_layout
I can't get to CSCA's Encyclopedia script and the other script(s) needed to run it because the site it's on is blocked by my school's internet for some reason. Could someone please send the necessary scripts to me? (If there's an anti-redistribution clause, let me know- sorry, I can't even view the terms of use.)
I'm trying to study how notetags work and was looking at yanfly's move restriction script, the reason for this is well, I'm looking to use regions, in a different way, but still.

I need a translation of this line:

/<(?:ALL_RESTRICT|all restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i 
Does anyone have an idea how to get the original positions of an actor is? For example, I changed the party leader from Eric to Ernest. How do you determine their positions? Because I want to put some function when they change their index.
I'm trying to study how notetags work and was looking at yanfly's move restriction script, the reason for this is well, I'm looking to use regions, in a different way, but still.


I need a translation of this line:


/<(?:ALL_RESTRICT|all restrict):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
The first part with the strings just checks if any of those strings are present. ((?:ALL_RESTRICT|all restrict): )
Then an empty space. ([ ])


The second part is where it expects numbers. (*(\d+(?:\s*,\s*\d+)*))


The '\d+' is an integer number.


The rest means that it can contain multiple numbers separated by commas (the part between the 2 \d+, with '\s*').


And the 'i' at the end... No idea about that one, sorry.


If you don't need multiple number checks, then you can simply use something like this too:


/<whatever_string_goes_here ([\+\-]\d+)>/


Remove the '[\+\-]' if you don't need negative numbers.


But I am just a beginner in note-tags, so a more experienced scripter can probably tell you more about note-tags.


Edit:


Damn, a smiley sabotaged my post! >.>
So what would something like this look like?

<regions: 1, Shivdale, 5>

regions = regions just the tag to make it work i spose.

1 = the id

Shivdale = name of the region

5 = A variable set to 5.

What I want is almost exactly the way move restrict works, except when you step on "1" it will do whatever you want for that region. So it would pop up..

"Entering Shivdale"

Random number

Random number = 1 make it rain

Random number = 1 tint the screen

Something like this, obviously I will be using events with this script I will be writing, the question is on actually how to make it work. I mean it's not really hard to read the notetag but its hard to make it do what you want to do. At least for me as no experience with notetags? Would this script be too... "complicated"... for me?
So you want to let something happen when you step on a region?

Like start a common event for example?
I just tested this method:

xxyyzz.note =~ /<region_name (\d+) (.*) (\d+)>/variable1 = $~[1].to_i if $~variable2 = $~[2].to_s if $~variable3 = $~[3].to_i if $~p variable1p variable2 # <-- for debuggingp variable3This code will save the first number into variable1 by converting it into an integer, then saves the next thing after the space to variable2 by converting it to string, and after that it saves the next thing (which is another integer) after the next space into variable3 by converting it into an integer.The 'xxyyzz' is the place where the note-tag should be read from.

You need to define that yourself, and most importantly, you need to know where to put all this code (in which class) and how.

When you got that, you are basically finished your note-tag setup.

Then you can just use these variables in the rest of your script.

Again, I'm a beginner in this, you have been warned! 😛
The problem is, I'm using huge maps, so the number of each regions i will be using is massive. So I have to use a notetag system or something similar that can reach them all.

Also, not all region touches will trigger an event, but all of them will have a name.

Shivdale, Haunted Forest, ETC ETC. I will try to write the script later and make a topic for it as I'm getting more into that territory. Thanks for the break down of that line though!
Does anyone have an idea how to get the original positions of an actor is? For example, I changed the party leader from Eric to Ernest. How do you determine their positions? Because I want to put some function when they change their index.
To get the actor id of a specific place in the party, you can use this call:
$game_party.members[0].id # <-- This is the party leader$game_party.members[1].id # <-- The second member in the party$game_party.members[2].id # <-- The third member in the party# and so on...These all will return the actor ID of the specified slot in the party.With simple conditional checks, you can make something trigger only when a specific actor is the party leader. For example:

Code:
if $game_party.members[0].id == 2 do somethingelsif $game_party.members[0].id == 3 do somethingelse do somethingend

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/