Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Questions about Game_party

Well, im still learing to script on Ruby.

After searching througt the forum and reading some tutorials. i still have this issue:

Using RGSS, i want to store my currently active party (the main one and other 3) in 4 variables.

Then later on, restore the same party i i had before.

im trying something like this:

for i in 0...$game_party.actors.size
$game_variables = $game_party.actors
end

but then i dont know who to restore it or remove those party members using RGSS

Regards

A little bump 8-)
 
You can just store the actor ids.
Code:
$game_variables[base] = $game_party.actors.size
for i in 0...$game_party.actors.size
  $game_variables[base + i + 1] = $game_party.actors[i].id
end

Now, I suggest using a constant variable id that records exactly how many members are in the party. This will prevent errors if you are recording 3 actors one time, 4 the next, and 2 the next.

Then, if you want them to add these back in, you can just use:
Code:
for i in 0...$game_variables[base]
  $game_party.add_actor($game_variables[base + i + 1])
end

All that should work.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top