way or script call to check actors in party?

i don't know if this is the right section to post this if its not i apologize. I also feel like an idiot posting basically the last 3 topics here and am sorry. I'm using tomoakys tactical battle system and it has me tell it what actors to use for battles via events. I specify actors with a script call like this :$game_system.srpg_member = [0, 1, 2, 3]. I'm wondering if there's a way to have it check what actors are in my party and place them. Any help would be appreciated.
I'm a little rusty with RPG Maker, but it would be something like this:

if $game_party.actors.include?($game_actors[1])

$game_party.actors should be an array, so include? can be used to see if the array contains a certain thing. I'm assuming these things are $game_actors. I may be wrong.

You'd use this in a conditional branch, using the "script" condition. So it would be something like:

conditional branch
script


$game_party.actors.include?($game_actors[1]) == 1


Where it will equal 1 if true, 0 if false. (You don't need the "== 1" but I've put it there for readability.)

Hopefully somebody else can elaborate if that's right or not, as I don't have RM in front of me.
sorry if i dont follow the only reason i even knew that line of script was cause the tbs demo used it. I'm guessing what you said checks for one actor. what im hoping to get it it to do is just place whatever actors are in my party. this way though it seems to require the actors specified and that number of actors. sorry for not being clearer
Ah, I get you.

I think that would have to be done in a script, as you'd have to work out how many members are in the party, too.

Something like this. Create a new script in the script editor.

  1. class Interpreter
  2.   def battle_members
  3.     # new array to replace [1, 2, 3, 4]
  4.     actors = Array.new
  5.     # for each member in the party
  6.     for i in 0..$game_party.actors.size-1
  7.       # add their id to the array
  8.       actors.push($game_party.actors[i].actor_id)
  9.     end
  10.     # call the original line but with our array instead of [1, 2, 3, 4]
  11.     $game_system.srpg_member = array
  12.   end
  13. end
Expand to see the code.


Then call battle_members instead of $game_system.srpg_member = [0, 1, 2, 3].

There's a chance I've got the actor_id bit wrong (the longest line), it might just be .id not .actor_id.

I think that should work.
Will do when i get home. I'll let you know if there's any problems. Thanks so much. Gonna see if i can see avengers 2 in the mean time.
EDIT:
i pasted the script and in the event called battle_members as you said. it gave this error.

Namerror occurred while running script.
undefined local variable or method 'battle_members' for #<Gamezz_Interpreter:0x298b550>
Ah, sorry. If it's VX Ace it will be:

  1.  
  2. class Game_Actor
  3.   attr_accessor :actor_id
  4. end
  5.  
  6. class Game_Interpreter
  7.   def battle_members
  8.     # new array to replace [1, 2, 3, 4]
  9.     actors = Array.new
  10.     # for each member in the party
  11.     for i in 0..$game_party.actors.size-1
  12.       # add their id to the array
  13.       actors.push($game_party.actors[i].actor_id)
  14.     end
  15.     # call the original line but with our array instead of [1, 2, 3, 4]
  16.     $game_system.srpg_member = array
  17.   end
  18. end
Expand to see the code.


They renamed Interpreter to Game_Interpreter.

I have RM in front of me so I'll check the rest now.
I'm not using vx ace just vx. i did try that though and got this error at line 11 of what you posted.

script ' ' line 11:no method error occurred.
undefined 'method actors' for #<game_party:0x29aace0>
Right, think I'm there now.

  1.    class Game_Party
  2.       attr_accessor :actors
  3.     end
  4.  
  5.     class Game_Interpreter
  6.       def battle_members
  7.         # new array to replace [1, 2, 3, 4]
  8.         actors = Array.new
  9.         # for each member in the party
  10.         for i in 0..$game_party.actors.size-1
  11.           # add their id to the array
  12.           actors.push($game_party.actors[i])
  13.         end
  14.         # call the original line but with our array instead of [1, 2, 3, 4]
  15.         $game_system.srpg_member = actors
  16.       end
  17.     end
Expand to see the code.


Have tested properly this time. Assuming the line you're using is correct, this will work.
no errors from what you coded anymore but getting this error unfortunately in the tbs script. his translated demo can be found below after clicking on srpg2. very sorry about this.

script 'game_srpgevent' line 97 no method error occurred
undefined method 'set_tile_effect' for nil:nilclass

https://momorpg2012.wordpress.com/download/

edit: sorry had the wrong link up for a bit the one above is correct
Use THREE dots instead of TWO:

for i in 0..$game_party.actors.size - 1 (two dots in the i in 0..range)

That will increment i to 5 even if the actors.size is 4, which is why -1 is needed. The ruby guys already saw this and use an additional period in the range specification.

for i in 0...$game_party.actors.size (three dots in the i in 0...range)
end

Also a brief note, $game_actors works a bit different. $game_actors[0] is always nil, so your first Actor starts at $game_actors[1]. At least in XP, not sure about VX series. That can cause some crashes where it says "no method error for nil class". Its also most likely what caused your error above. Amy gets slack due to her rust, but was very very close.
Thank you. I'm thoroughly embarrassed now :robot:

Let's try again.

  1. class Game_Party
  2.    attr_accessor :actors
  3. end
  4.      
  5. class Game_Interpreter
  6.   def battle_members
  7.     # new array to replace [1, 2, 3, 4]
  8.     actors = Array.new
  9.     # for each member in the party
  10.     for i in 1..$game_party.actors.size
  11.       # add their id to the array
  12.       actors.push($game_party.actors[i])
  13.     end
  14.     # call the original line but with our array instead of [1, 2, 3, 4]
  15.     $game_system.srpg_member = actors
  16.   end
  17. end
Expand to see the code.


1..$game_party.actors.size because it's incrementing from 1 to 4 now instead of 0 to 3.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=78623