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

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I have a question about the battle. It might be something I need a thread of, but just incase it is still in this section, I wanted to ask. Is there a way to let the scene_battle process keys instead of using the command_attack command in making attacks? For example, I want to assign A, S, D and W as the attacks of Actor 1, 2, 3 and 4, so when inside battle, I want the command menu and the window battle status to be hidden not unless I press X into my turn.
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
I have a question about the battle. It might be something I need a thread of, but just incase it is still in this section, I wanted to ask. Is there a way to let the scene_battle process keys instead of using the command_attack command in making attacks? For example, I want to assign A, S, D and W as the attacks of Actor 1, 2, 3 and 4, so when inside battle, I want the command menu and the window battle status to be hidden not unless I press X into my turn.
Yes, it can be done (not by default though), and that would probably require its own topic.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,528
Reaction score
14,259
First Language
English
Primarily Uses
RMVXA
So I know that $game_party.members will return who is in the battle when a battle is in progress. However, is there a way to tell if a specific battler is in that list while I'm within the Game_Battler class?

Or, does any function exist that will return the list of all party members *not* in battle (or in other words, just the list of the reserve party members)? That would work just as well for what I need.

Edit: Ever figure something out 10 seconds after you post it? Yep. Anyways, battle_member? (after a check to make sure it is an actor that is) is doing what I need, so problem solved.
 
Last edited by a moderator:

Neok

Veteran
Veteran
Joined
Jul 31, 2014
Messages
45
Reaction score
15
First Language
English
Primarily Uses
Is there any way to automatically reposition the console window when testplaying? I'd like to automatically move it to the upper left of my monitor, since sometimes it appears behind the game window, meaning I'd have to move things around if I need to check it.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
First Language
English
Primarily Uses
RMMV
Is there any way to automatically reposition the console window when testplaying? I'd like to automatically move it to the upper left of my monitor, since sometimes it appears behind the game window, meaning I'd have to move things around if I need to check it.
Certainly! Just click on the icon in the upper left-hand corner of the console window, then select the 'properties' option :





After doing so, a 'Console Windows Properties' window should pop up. Next, click on the 'Layout' tab, un-check the 'let system position window' check box and enter whatever position you want.


 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I use this:

Code:
def console    game_title = "PN : TAS - Forgotten Spirits"    hwnd = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title)    Win32API.new('kernel32.dll', 'AllocConsole', '', '').call    Win32API.new('kernel32.dll', 'SetConsoleTitle', 'P', '').call(game_title + ': Message Console')    cons = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title + ': Message Console')    $stdout.reopen('CONOUT$')    cons = Win32API.new('kernel32', 'GetConsoleWindow', 'V', 'L').call    #This part changes console position    Win32API.new('user32.dll','SetWindowPos','LLLLLLL','L').call(cons,hwnd,0,0,640,416,0)    Win32API.new('user32.dll', 'SetForegroundWindow', 'P', '').call(hwnd)  end
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Just in case, is there a way in a script for me to repeat only ONE actor's turn? This means whilst the other ended their turn, this specific actor can do 2.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
First Language
English
Primarily Uses
RMMV
Hmm, in the database editor under the 'Actors' tab in the 'Features' area of the specified actor you can just set 'Action Times+' to '100%' and that actor will get two actions.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Yeah, and seems like you can add more of those to add more actions. At least according to the description. :)
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
That is a solution, yes, but what if I want to change that in game, not in the database?
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
First Language
English
Primarily Uses
RMMV
Hmm, kind of feels clunky, but I'm tired ... the following scriptlet should work just fine to change 'action times' on the fly :

Code:
#==============================================================================# ** Game_BattlerBase#------------------------------------------------------------------------------#  This base class handles battlers. It mainly contains methods for calculating# parameters. It is used as a super class of the Game_Battler class.#==============================================================================class Game_BattlerBase  #--------------------------------------------------------------------------  # * NEW - Add Array of Additional Action Time Probabilities  #--------------------------------------------------------------------------  def action_plus_add(percent)    rpg_feature = RPG::BaseItem::Feature.new(FEATURE_ACTION_PLUS, 0, percent)        feature_objects.each { |obj|      obj.features.push(rpg_feature) if obj.is_a?(RPG::Actor)    }   end    #--------------------------------------------------------------------------  # * NEW - Remove Array of Additional Action Time Probabilities  #--------------------------------------------------------------------------  def action_plus_remove_all    feature_objects.each { |obj|      obj.features.reject! { |ft| ft.code == FEATURE_ACTION_PLUS } if obj.is_a?(RPG::Actor)    }  end  end # Game_BatterBase
Code:
# The value for a 100% chance is 1.0; a 35% chance is 0.35, and so on ...$game_actors[member_id].action_plus_add(percent)$game_actors[member_id].action_plus_remove_all
EDIT: Added a 'remove all' action times method.
 
Last edited by a moderator:

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
How would I go about removing a skill type from a class and adding a new skill type during level progression.

Example:

When Arisa reaches level 7, she learns War Magic.  War Magic replaces the Magic Skill Type with the War Magic Skill Type.  In addition War Magic grants +10% spell damage and -10% spell healing.

Up until lv 7, she simply knows the skill command magic.  

Any help would be appreciated.  Thank you!
 

C-C-C-Cashmere

Veteran
Veteran
Joined
May 18, 2012
Messages
584
Reaction score
274
First Language
English
Primarily Uses
Is it possible to create an instance variable inside an event via script call, and then access it from another event later by referencing the former event's id?


e.g. in EV001:


Script call: "@var = 1"


and then EV002:


Script call: "@incoming = $game_map.events[1].@var"


Obviously, the script call in EV002 is wrong because I don't know how to access EV001's @var from EV002. That's why I'm asking how to access that variable.


Thanks.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,107
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
@listkast, is that set up in Features? You can use my Dynamic Features script (search for it).

@C-C-C-Cashmere, when a script call is processed, it belongs to the Game_Interpreter class, not to the Game_Event class. I believe this only exists while the event page is running - not sure. You could create an attr_accessor in the Game_Event class, then use that in script calls:

class Game_Event < Game_Character (check that - I don't have Ace open and am being lazy) attr_accessor :myvarendto do it properly, you would also have to set @myvar to nil in the initialize subroutine, or your game could crash if you try to look at it and it hasn't been set.Then in your script calls:

$game_map.events[@event_id].myvar = 1and
Code:
@incoming = $game_map.events[1].myvar
However I don't know why you'd want to set an @incoming variable in a script call when you'd have to do another script call to test it. It's more likely that you'd use it in a Conditional Branch or something.Also note - events are NOT saved. So if you exited the game then resumed, any previous settings would be lost. In fact, as events belong to the map and the map is loaded each time you enter it, you wouldn't even need to exit the game - if you leave the map and come back, your previous settings would be lost.

If you want something that persists along with the save file, and when you go between maps, you're better off creating a hash in Game_System that's keyed by map id and event id. Then set up a method in Game_Interpreter to set and retrieve the values, to make the script calls easier.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
to do it properly, you would also have to set @myvar to nil in the initialize subroutine, or your game could crash if you try to look at it and it hasn't been set.
I also can't RM right now, but on a portable jRuby i can access an uninitialized variable and it comes up as nil.
 

C-C-C-Cashmere

Veteran
Veteran
Joined
May 18, 2012
Messages
584
Reaction score
274
First Language
English
Primarily Uses
Thanks, Shaz. I thought there'd be a way to declare an accessor for just that singular event, to make things more elegant, because I don't need this variable for every single event in my game, but I figure it doesn't really matter anyway.

However I don't know why you'd want to set an @incoming variable in a script call when you'd have to do another script call to test it. It's more likely that you'd use it in a Conditional Branch or something.
Yeah that was just as an example. I am indeed going to be using it in a conditional branch.

If you want something that persists along with the save file, and when you go between maps, you're better off creating a hash in Game_System that's keyed by map id and event id. Then set up a method in Game_Interpreter to set and retrieve the values, to make the script calls easier.
Ah, so you're saying I should have a hash that uses an array [map_id, event_id] as its key?


Edit: Also, is it unhealthy to overwrite the method "initialize" in your external script? Since it's used by almost everyone I feel like it would create clashes. Just a programming practices question. Never mind! I just discovered what aliasing a method does. It seems much cleaner, so I can just add the initialization on the end, rather than overwriting the method and copy/pasting the entire thing over again.
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
You could, in theory, grab the singleton_class of a Game_Event object and define a method for this instance only. But this sounds way too dirty to me.

/edit: Just so you see, how dirty it really is ^^

Code:
<object>.instance_eval do	(class << self; self; end).send(:define_method, :test, lambda {|a| p a})end
//edit: I just realized that Ruby 1.9 provides define_singleton_method, but i wouldn't recommend that, either.
 
Last edited by a moderator:

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
is there a way to modify crit damage based on class.  For example, Class A does x3 crit damage while Class B only does x2.  

Would there be a way to do that?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 4)

Latest Threads

Latest Profile Posts

This is relevant so much I can't even!
Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect

Forum statistics

Threads
105,999
Messages
1,018,221
Members
137,778
Latest member
br11an
Top