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

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
$game_temp.troop_id may still be set from when the battle occurred.
 

FeaR616

Veteran
Veteran
Joined
Nov 22, 2014
Messages
277
Reaction score
52
First Language
german
Primarily Uses
yeah, thanks! =)

I have done this ago and yesterday I remembered but forgot to edit my post. sometimes things are this simple, yet I thought of this a bit... late... >.>
 

Kensoloko

Villager
Member
Joined
Dec 20, 2013
Messages
19
Reaction score
4
First Language
English
Primarily Uses
Hi everyone, can i ask if anyone know a script call to increase enemy no.1 (in troop) TP by x points ?

Thanks.
 

WorldWakeSTU

Veteran
Veteran
Joined
Feb 5, 2015
Messages
95
Reaction score
6
Primarily Uses
I was wondering if you could tell me if there is a way to set an if or and statement in vs ace so I can get altered choice menu (working on teleport key for fast travel,maps got to big) say if not here but there and maby nowhere get there and nowhere but not here
 

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
If I remember correctly, Hime had a script for altering the choices shown by the Show Choice event command, look for it.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
that's the one. Hime also has a "larger choices" script (or similarly-named) that lets you have more than 4 choices in a single window.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Okay so I' ma little confused on a certain way to see how many party members a party has.

def battle_members    all_members[0, max_battle_members].select {|actor| actor.exist? }  end
I know this has something to do with it right? I need to be able to make a case where is you have 1 member it will do one thingy, etc etc.

I'm guessing it is something like this?

Code:
case $game_party[battle_members]when 1 ...when 2 ...
 

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
$game_party.members.size for whole party, if you want battle members only just replace members with battler_members


anyway, that's the general way to look for how many items an array has (assuming you didn't declare it as fixed)


array.size
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
case $game_party.battle_members.size    when 1 $game_variables[Blood::Variable::Difficulty_Variable] = 0    when 2 $game_variables[Blood::Variable::Difficulty_Variable] = 1    when 3 $game_variables[Blood::Variable::Difficulty_Variable] = 2    when 4 $game_variables[Blood::Variable::Difficulty_Variable] = 3  end #caseSo like this? Also I'm assuming this does not have to be in a class? Or should it be in a the Game_Party class? As I'm not defining anything, or do I actually need to do that. Just define something random.

Also I know the when 1 $nblahblah = 0 isn't working, although I thought it would. Hmmm

EDIT: okay so here is my edited code

class Game_Party < Game_Unit    def party_difficulty      case $game_party.battle_members.size        when 0 then $game_variables[Blood::Variable::Difficulty_Variable] = 0        when 1 then $game_variables[Blood::Variable::Difficulty_Variable] = 1        when 2 then $game_variables[Blood::Variable::Difficulty_Variable] = 2        when 3 then $game_variables[Blood::Variable::Difficulty_Variable] = 3        end #case      end #ends def  end #ends class
I also did 1-4 but it seems to not be working.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
um ...

$game_variables[Blood::Variable::Difficulty_Variable] = $game_party.battle_members.size - 1?
Whether it has to be in a class or not depends on where, when and why you want to run it. If you want it as a method that you can call at any time, yes it has to be in a class. In fact, if you put it into the script editor without putting it into a class, it'll probably crash your game, because $game_variables isn't defined until you select New Game, and any code that's not in a class will run on launching.


Assuming your Blood and Blood::Variable modules and Blood::Variable::Difficulty_Variable variable (though doesn't starting it with upper case make it a constant?) are defined correctly.
 
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
try printing the value of size before the case block...

Code:
p $game_party.battle_members.sizecase $game_party.battle_members.size
and yeah, why use a case block when you're just basically setting the variable to be equal to the size anyway?
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
try printing the value of size before the case block...

p $game_party.battle_members.sizecase $game_party.battle_members.sizeand yeah, why use a case block when you're just basically setting the variable to be equal to the size anyway?
Because I need it capped at a certain point. :p

EDIT:

Okay so apparently 

$game_party.battle_members.size

without a class and def gives undefined method 'battle_members' for nil:NilClass

(Also does this inside of a class and without a def.)
 
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
$game_variables[iD] = $game_party.battle_members.size < CAP ? $game_party.battle_members.size : value


so if for example, it should max out at 3, at which point the difficulty should also be 3


$game_variables[iD] = $game_party.battle_members.size < 3 ? $game_party.battle_members.size : 3
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
$game_variables[iD] = $game_party.battle_members.size < CAP ? $game_party.battle_members.size : value

so if for example, it should max out at 3, at which point the difficulty should also be 3

$game_variables[iD] = $game_party.battle_members.size < 3 ? $game_party.battle_members.size : 3
Wouldn't that pose a problem as the battle_members go from 1-4 and I'm using a 0-3 for my variable?

EDIT: the nil:NilClass thingy I think is what's stopping me, I have no idea why it's doing that, ugh. Anyways I'm going to go to sleep. Perhaps a nights rest will let me think properly :p
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Because you haven't got it defined inside a class. There IS no $game_party until you hit the New Game button.


How 'bout giving us some context? When are you going to run this? How are you going to call it? If you tell us what you're trying to achieve, we can give you not only the command, but tell you how to set it up and how to call it where/when you need to.


And capping it is easy - another thing we could have provided in the original answer if you had only given us more detail.
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Before a battle starts, actually even before then. When you have x amount battle members (1-4) it will set the variable accordingly. 0-3. As you can change the amount of battle members you can have at any given time out-side of battle, this needs to be on at all times. Or at least check it before every battle. 
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
Here is a little snippet that will do what you want:

class Scene_Map < Scene_Base alias some_name_forthemalias update def update some_name_forthemalias update_difficulty end def update_difficulty @old_size = 0 if @old_size.nil? if @old_size != $game_party.battle_members.size $game_variables[Blood::Variable::Difficulty_Variable] = [$game_party.battle_members.size - 1,4].min # 4 is the cap, change it if you need @old_size = $game_party.battle_members.size end end end
But if you are doing this for your difficulty script, than it is a bad idea.

This means that if someone is using actor stat changes for difficulties, the actor's stats will change during the game depending on how many battle members are in the party... Generally a bad thing, I think.

You can however update the enemies' stats the same way, but instead of changing the variable, you change the stat of the enemies directly.
 

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,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top