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

$game_temp.troop_id may still be set from when the battle occurred.
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... >.>
Hi everyone, can i ask if anyone know a script call to increase enemy no.1 (in troop) TP by x points ?

Thanks.
This should work:

$game_troop.members[0].tp += x
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
If I remember correctly, Hime had a script for altering the choices shown by the Show Choice event command, look for it.
you mean this right?

http://himeworks.com/2013/03/choice-options/
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.
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
There are some techniques shown here if you're working with choices:


http://forums.rpgmakerweb.com/index.php?/topic/34826-rmdc-1-dynamically-ordered-choice-selections/
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 ...
$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
case $game_party.battle_members.size    when 1 $game_variables[Blood::Variable:😀ifficulty_Variable] = 0    when 2 $game_variables[Blood::Variable:😀ifficulty_Variable] = 1    when 3 $game_variables[Blood::Variable:😀ifficulty_Variable] = 2    when 4 $game_variables[Blood::Variable:😀ifficulty_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:😀ifficulty_Variable] = 0        when 1 then $game_variables[Blood::Variable:😀ifficulty_Variable] = 1        when 2 then $game_variables[Blood::Variable:😀ifficulty_Variable] = 2        when 3 then $game_variables[Blood::Variable:😀ifficulty_Variable] = 3        end #case      end #ends def  end #ends class
I also did 1-4 but it seems to not be working.
um ...

$game_variables[Blood::Variable:😀ifficulty_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:😀ifficulty_Variable variable (though doesn't starting it with upper case make it a constant?) are defined correctly.
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?
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. 😛

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.)
$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
$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 😛
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.
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. 
Here is a little snippet that will do what you want:

Spoiler
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:😀ifficulty_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.

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