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

TheOddFellow

Overactive Artisan Story Crafter
Veteran
Joined
Jul 3, 2014
Messages
152
Reaction score
67
First Language
English
Primarily Uses
RMMV
I have XY coordinates on a map. Is there someway to use those XY, let's say (3, 4) as an example, and check that tile for:

A. Any event.

B. If the tile is passable.

If there's not a simple, one way of doing it, does anyone know how to script this?

I want to check (theoretically 3,4) for tile impassibility and if an event is there. I've tried googling but to no avail. I'll keep searching but I figured I would ask here as well.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
First Language
English
Primarily Uses
RMMV
You could use '$game_map.passable?(x, y, d)' and '$game_map.event_id_xy(x, y)' to do what you want.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,420
Reaction score
7,709
First Language
German
Primarily Uses
RMMV
A. Any event.
You can do that by eventing alone - the command is called "get location info". The same command can also be used to identify the tiles on the coordinate, but getting passability from that would still require either script or some tricky logic.
 

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
hi, is it possible to get the name of the skill an enemy uses during battle? 
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
The current skill performed can be gotten with this:

@subject.current_action.item@subject = The user of the item.
That returns the current item used in battle, be it a skill or item, and can be used for enemies and actors alike.


So, just add a .name at the end and you get it's name.


I forgot to mention, you can call that in Scene_Battle only!
 
Last edited by a moderator:

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
thank you very much! ^^

I was close to this, I only missed the ".item" in front of ".name" ... ^^"

and yes, I will use this only in Scene_Battle. 
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
quick question, how would I go around making my damage formula's run a different formula based on the weapon type?
 

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
Check the weapon's type id on the damage formula...
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
so a simple if a.wtype_id.include?(x) ; Formula?
 

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 believe its a property of the weapon... So it would be something like a.weapons[0].wtype_id == id
 
Joined
Jun 11, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
Is there a way to add files or information to $game_data? I want to put in an array or matrix (X rows by Y columns) with some info in it, to be accessed by code within the game. Preferably useable when I hit the "test game" button rather than having to export the whole thing every time I want to test (not sure if that'd be an issue or not).
 

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
Why not add it as a new accessor to $game_system?
 
Joined
Jun 11, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
Because I have no idea how :p I didn't know where to look, going through the game_system scripts I'm not finding anything that stands out to me... Wait never mind, am I correct in looking at the DataManager scripts for VXACE that I can do:
 

$data_whatever = load_data("Data/WhateverICallThis.rvdata2")And if so, am I correct to assume it goes in the "Load Normal Database" section with all the other $data_items and such?

And finally, all of the data visible is *.rvdata2, do you have a link for how to make files in that format?

Thanks for the answer, I had no idea where to even begin looking xD
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,107
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
You would have to write a script that creates the WhateverICallThis.rvdata2 file in the first place (this needs to be set up to create the file, but you can remove it when you distribute the program), and another script that defines its layout (check the help file - F1 - and Scripts to see how this is done for all the Items, Actors, etc - you'll need something similar).
 

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
Something like

class Game_Systemattr_acessor :myvarendNow you can use it as$game_system.myvar

Its also autosaved in thesl save file as its part of game system
 
Joined
Jun 11, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
Thanks to both of you! I had the hardest time figuring out why my *.txt file wouldn't read... turns out the *real* game file wasn't in the steam directory (I have the steam copy of VX Ace), nor in the user-documents directory... finally found it, though, and finally finagled around with google and the help file! Got it working. For anyone else who stumbles across this, here's my code:
Event 1 (event with "Script" stuff put in to activate when player touches it) splitting a text file into an array, then printing it in console and saving it:

test = File.foreach("Data/Evolutions.txt").map { |line| line.split('/') }print testsave_data(test, "Data/Evolve.rvdata2")Event 2 loading the Evolve.rvdata2 stuff, then printing it to console:

test = load_data("Data/Evolve.rvdata2")print testMission successful :D
 
Joined
Jun 11, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
New question: Poking around in the help and script files, I'm confused as to where all the RPG::Stuff files/scripts are or how to edit them. For example, RPG::Skill is referenced in the script Game_Actor, and I can read the definitions in the F1 help file... but I can't figure out *where* those definitions are? Are they in the script editor, the data files... or someplace I can't access them at all? I have an idea of what to do, but am not sure where to put anything.

Example: $data_myarray is [[test, @id=2, @name=bob],[test2, @id=3, @name=claire]]
$data_myarray[x].name would use:

$data_myarray.name = $data_myarray[x][2]Thus $data_myarray[1].name would return the value "claire". Assuming I'm doing that right/acceptable, I have no idea where in the scripts to put this, or if I should be putting it in the $data_myarray file itself at the start.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
Either click on the 'Script Editor' icon on the bar at the top of the editor screen, or press F11.  Either brings up all the scripts.  Default scripts come first, and below them is the place where custom scripts go.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
They are "hidden" in the dll file, I guess.

But since you can read all of the RPG::Stuffs classes from the help files, you don't really need to directly see it in the editor itself.

Just enter the class and modify it how you want.

For example:

class RPG::Actor < RPG::BaseItem # do your stuffs here, like make new instance variables, # define new methods, or modify already existing ones.endIn order to initialize a starting value for a new instance variable in those classes, you should use the DataManager module's 'load_database' method.That is the safest way to add new instance variables there, in case you need those new instance variables in another class' initialize method too (for example, you might need a variable from RPG::Actor in the initialization of the Game_Actor class). Alias that method and call your new method (which you made in those RPG::Stuffs classes) on the selected classes after the alias.
 

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
You could always alias the initialize method of that class to create an initial value for the instance variables.. And just make them as attr_accessor then you can access them from outside calls..
 
Last edited by a moderator:

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