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

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
Variables starting with a $ symbol can be used in any class.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
what is the equivalent of 

$data_system.passagesin RGSS3? How can I get the passages just like in RGSS2?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
I don't have Ace with me, but I'd say to have a look in Game_Map. There's a method there to check passability, and it uses $game_map.data to get the tile, and $game_map.tileset (I think) to get the passage settings. It does bit manipulation which can be a bit complicated.


If you need more help, state what you're trying to achieve and we can give you the correct commands :)
 

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
good morning (at least where I live)

I wanted to know, how can I save things that are written to the database during the game... lets say something like the monsters HP are calculated new and this have to be saved so it is permanent.

or rename a skill...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
You could modify your save/load scripts in DataManager to add the $data... variables to the save file and read them from the save file as well.


If you do that though, remember if you do some testing and save your game, then go into the database and make any changes, those changes will not be there when you resume your saved game.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
What I am trying to achieve with the passages is that I want to create a for loop that checks the passages and equate the result of that loop to 0x10 because I want to get all the results of the passages and change the form it has like the form how the trees and other passages are made. Here's the code:

#-------------------------------------------------------------------------- # Initialize Ceilings (New) #-------------------------------------------------------------------------- def initialize_ceil get_ceilings for i in @ceilings $data_system.passages = 0x10 end end #-------------------------------------------------------------------------- # Setup Ceilings (New) #-------------------------------------------------------------------------- def setup_ceil get_ceilings for x in 0...width for y in 0...height next if @map.data[x, y, 0] < 4352 if @ceilings.include?(@map.data[x, y, 0]) @map.data[x, y, 2] = @map.data[x, y, 0] pass = true for i in [2, 1, 0] next if y == 0 tile_id = @map.data[x, y - 1, i] next if tile_id == nil or tile_id == 0 if @block_tile pass = false if @passages[tile_id] & 0x01 == 0x01 else pass = false if @passages[tile_id] & 0x10 == 0x10 end end @map.data[x, y, 0] = REPLACEMENT_TILE if pass anim_tile = water_lava?(@map.data[x, y - 1, 0]) @map.data[x, y, 0] = anim_tile if anim_tile != nil end end end endHowever, that is in RMVX, which is a part of a script by OriginalWij. What I wanted to know is what could have been the equivalent of passages so I can port the said script.
 

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
You could modify your save/load scripts in DataManager to add the $data... variables to the save file and read them from the save file as well.

If you do that though, remember if you do some testing and save your game, then go into the database and make any changes, those changes will not be there when you resume your saved game.
so.. I have to save AND load them. and, in test games, the changes are not saved, is this right?

/E: oh, I see, in DataManager, the database will be already loaded (with enemies, actors, skills, etc.), are the changes loaded then if I save them? 

/E2: aah, guess I managed it, thanks a lot! =)
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
I have a question, I have this:

def param(param_id)      eps = Blood::Enemy::param_Settings      case $game_variables[Blood::Variable::Enemy_Variable]        when 0          (bloody_param(param_id) * eps[:easy][param_id]+1).to_i        when 1          (bloody_param(param_id) * eps[:normal][param_id]+1).to_i        when 2          (bloody_param(param_id) * eps[:hard][param_id]+1).to_i        when 3          (bloody_param(param_id) * eps[:insane][param_id]+1).to_i      end #ends case    end #ends def
Which works as intended. However I need to modify it.

after "when 3"

I need a 

"when ..."

I need it to recognize after three it will go up in a increment of 1 for each extra,.

when < 3
          (bloody_param(param_id) * eps[:insane](+1)[param_id]+1).to_i

So at four. (insane by default for my script is 4 all the way around, so lets use that.) 5.0, at 5, 6.0.

I do not want to create a when 4,5,6,7 + I would prefer after 3 it would recognize it as it would be.

I think I could do it easy by multiplying it by the variable value + 1. But that would not exactly work if the default numbers would be changed.
 

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'll just use

elseafter the when 3... and that will be ran for anything that isn't 0,1,2,3

Using a formula is better and I don't understand your last statement which says it won't work
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
I will just make an example of making unlimited amount of difficulty settings available for the makers.

Take a look at your 'def exp' method in Game_Enemy class and compare it with this:

alias :blood_exp :exp def exp ees = Blood::Enemy::Exp_Settings diff = ees.keys[$game_variables[Blood::Variable::Enemy_Variable]] return blood_exp * ees[diff] endBasically, no matter what value the variable got (as long as it is an integer, of course), it will return a difficulty multiplier as long as the maker makes sure that the variable can not go higher than the size of the difficulty hash minus 1 and if it won't go below 0. You can make a fail-proof check for these too with ease.Change all of your methods this way, and you can allow unlimited number of difficulty setups in your script.

As for the party based difficulty cap in your script, change the 4 to $game_party.max_battle_members, so it will count non-default battle party sizes as well.
 

IceSage

Sage of Ice
Member
Joined
Jul 18, 2013
Messages
29
Reaction score
3
First Language
English
Primarily Uses
I've searched but never found any good results. I'm trying to create an item that casts another spell. (I remember RM2k did this ages ago.) So if I use an item, it calls upon a spell.

What I'm ultimately trying to do is create an item that revives everyone and fully restores everything. I have an item that has a scope of "All allies (dead)" but I need a 2nd effect to heal everyone after that 1 ally is revived. Thus, 2 spells / effects.

How can I cast a spell or use multiple items in the same item? There a way to call it via a script? 

(RGSS3)
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
I will just make an example of making unlimited amount of difficulty settings available for the makers.

Take a look at your 'def exp' method in Game_Enemy class and compare it with this:

alias :blood_exp :exp def exp ees = Blood::Enemy::Exp_Settings diff = ees.keys[$game_variables[Blood::Variable::Enemy_Variable]] return blood_exp * ees[diff] endBasically, no matter what value the variable got (as long as it is an integer, of course), it will return a difficulty multiplier as long as the maker makes sure that the variable can not go higher than the size of the difficulty hash minus 1 and if it won't go below 0. You can make a fail-proof check for these too with ease.Change all of your methods this way, and you can allow unlimited number of difficulty setups in your script.

As for the party based difficulty cap in your script, change the 4 to $game_party.max_battle_members, so it will count non-default battle party sizes as well.
LOL! That changes the whole script, and probably for the better. It will make it so much smaller too. The only problem though, is it's supposed to be constomizeable until < 3. Which is why I wanted to do that. Also I wanted to it go PER param basis. Doing it this way removes that customization. In fact I really don't care changing the EXP/Gold after 3, because it would start getting into the negatives, which would just leave it as 1.  
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
Nope, it will give the maker full control over difficulty settings, including making infinite settings.

You got this EXP hash:

Exp_Settings = { #don't touch :easy => 2, :normal => 1, :hard => 0.8, :insane => 0.5, } #don't touchThe example I posted in my previous post above would always return a key from that EXP hash itself :)easy, :normal, and so on). You use hashes for everything, so the code can be the same.ees.keys will make an array of all keys from the hash (which is ees now, your EXP hash), and after that, depending on the current value of the defined variable, a single key will be selected.

Eventually, you will end up with the same script you have now + the ability to make infinite amounts of difficulties for your game.

Some practical examples using my example from my previous post:

If the Enemy_Variable is 0, the diff line would be ees.keys[0], which is :easy in the setup.

If the Enemy_Variable is 2, the diff line would be ees.keys[2], which is :hard in the setup.

If the Enemy_Variable is 3, the diff line would be ees.keys[3], which is :insane in the setup.

Now, if someone would like more difficulty settings, he/she could do it just by adding a new setting in the above EXP hash, let's say it would be named :impossible.

After this, if the Enemy_Variable becomes 4, the diff line would be ees.keys[4], which would be the newly created :impossible from the EXP hash setup.

And this can be done with every single setting hash in your module, if you change the code based on my example.

I recently used this method in a quick time event core script I created, so that the maker could add any keyboard buttons to the random pool without being limited by anything. If the maker wants only 2 buttons available, it can be done, if he/she wants 10 buttons, well, why not? :p

@IceSage

Look up a script named "Skill Links" or something similar. I forgot the name of the author, sorry. *-*
 
Last edited by a moderator:

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
I've searched but never found any good results. I'm trying to create an item that casts another spell. (I remember RM2k did this ages ago.) So if I use an item, it calls upon a spell.

What I'm ultimately trying to do is create an item that revives everyone and fully restores everything. I have an item that has a scope of "All allies (dead)" but I need a 2nd effect to heal everyone after that 1 ally is revived. Thus, 2 spells / effects.

How can I cast a spell or use multiple items in the same item? There a way to call it via a script? 

(RGSS3)
so, if I understand you right, you want one item to revive all allies and heal them and it should look like its casting a spell, right?

why want to use a script? you can make a new item with target all allies (dead) and in the effects you set up to remove the death state, so they revive, and to heal 100%. and you can call a common event there too, so in the common event you can set up to play an animation or force cast a spell or whatever you want.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
You are looking for the Script Requests forum, not the Questions That Don't Deserve Their Own Threads topic.
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Okay, I need make sure I understand this correctly.

When the key (in this case the variable) is a certain number, it corresponds to which line in the hash it uses? So like you said, ess.key[0] would be the FIRST variable/thingy in the hash?

EDIT:

Okay now I'm having an issue:

def param(param_id)      eps = Blood::Enemy::param_Settings      diff = eps.keys[$game_variables[Blood::Variable::Enemy_Variable]]      return bloody_param(param_id) * eps[diff] + 1    end #ends def
Getting the error:

Script '' line 190: TypeError occurred

Array can't be coerced into a Fixnum

This is line 190: return bloody_param(param_id) * eps[diff] + 1
 
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
which means eps[diff] returns an array... What you probably want is to get a value from that array, which will probably be

eps[diff][param_id]

Assuming your set-up was something like

Code:
module EPS  STATS  = {}  STATS[:easy] = [.5,.5,.5,.5 and so on]end
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
I should have known that, works perfectly now. Thanks. I feel dumb :p

EDIT:

oh and this is my module, if you were wondering:

Code:
module Enemy    Param_Settings = { #don't touch      # Corresponding Params:      #        MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK      :easy => [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],      :normal => [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],      :hard => [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0],      :insane => [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0],      } #don't touch    Exp_Settings = { #don't touch      :easy => 2,               :normal => 1,             :hard => 0.8,      :insane => 0.5,    } #don't touch    Gold_Settings = { #don't touch    :easy => 2,    :normal => 1,    :hard => 0.8,    :insane => 0.5,    } #don't touch  end #ends Enemy
 
Last edited by a moderator:

IceSage

Sage of Ice
Member
Joined
Jul 18, 2013
Messages
29
Reaction score
3
First Language
English
Primarily Uses
so, if I understand you right, you want one item to revive all allies and heal them and it should look like its casting a spell, right?

why want to use a script? you can make a new item with target all allies (dead) and in the effects you set up to remove the death state, so they revive, and to heal 100%. and you can call a common event there too, so in the common event you can set up to play an animation or force cast a spell or whatever you want.
I tried that and it doesn't work. To force an action a player must be performing the action. The event that handles it forces you to select a party member who will be performing the action. Playing the animation on all players also does not work from a common event. I had considered this first. It doesn't work properly, at all.

@IceSage

Look up a script named "Skill Links" or something similar. I forgot the name of the author, sorry. *-*
Thanks. I found it. The author is our wonderful resident Tsukihime. This is exactly what I was looking for.
 
Last edited by a moderator:

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
I tried that and it doesn't work. To force an action a player must be performing the action. The event that handles it forces you to select a party member who will be performing the action. Playing the animation on all players also does not work from a common event. I had considered this first. It doesn't work properly, at all.
this doesn't work? oh... I remember the rm2k3 could do that... well, sorry for misinformation then.
 

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,447
Members
137,820
Latest member
georg09byron
Top