New account registration is temporarily disabled.

[RMVX] PARTY FORMATION OR CHARACTER MEMORIZATION

Posts

Pages: first 12 next last
I am not asking for a script to allow the player to edit the formation, I want the game to change it for them in 1 single instance.

I am making a monster collection/battle game where, through a simple caterpillar script, the player is a human who is followed around by monsters. This is, in theory, to be done by having the player be an Actor that only appears on the maps. When the play opens the menu, they only see the monsters in their party.

The system I have set up, all with events, is as such: When the player hits B (x or esc) the screen fades out, the main Actor is removed and the menu is opened. When the player closes the menu the main actor returns to the party and the screen fades in.

The problem? When the player closes the menu they now are in control of their #1 monster and the player Actor is at the BACK of the party.

My idea for this system was to just force the player Actor to the front of the formation, which is impossible. The other idea was save the party monsters (a max of 3) each in 3 different variables and then re add the player Actor followed by whatever monster date is in the 3 variables. I can see a Variable command to add the party members to a variable, but not a way to Add the part based on what's in the variable. This is totally something that would've been possible in RM2K3.

So does anyone know a way to remove the party leader and then re-add him in the same leader position?
SunflowerGames
The most beautiful user on RMN!
13323

author=Kairou
So does anyone know a way to remove the party leader and then re-add him in the same leader position?


Event: Remove all actors. Then re-add all actors, starting with the actor you want as the lead first.

If your going to do this a number of times, with different actors at the front or back you could make a series of common events. Then just call the common event that fits your situation.
Right, that was the plan. BUT there will be dozens of actors the player can have in of their team. I need a way for the game to memorize what actors at currently in the party and then only re-add those actors.
Marrend
Guardian of the Description Thread
21806
Then, may I suggest using a variable for each party member? It might get a little wonky getting the party back into the positions they were in before (it may involve scripting), but, I'm pretty sure it's possible.
Deltree
doesn't live here anymore
4556
You are on the right track with storing the old party in temporary variables! You can use this inline script call to add actors back by ID # after removing all actors from the party:

$game_party.add_actor($game_variables[1])


Replace the number in brackets with the variable number. Then just call it for each variable/character. This works in Ace, but it will probably work in vanilla VX too.
The script doesn't seem to do anything, but I am not getting an error either.
Deltree
doesn't live here anymore
4556
Drat. Maybe it doesn't work in VX, then.

Can you post a screen of the event page calling it, for context?


The line where it removes "Buzzy" is a palceholder, because obviously Buzzy will not always be in the party. Ideally a something that removes the entire party should go there.

EDIT: The part where it re-adds Hiro probably shouldn't be there either.
Deltree
doesn't live here anymore
4556
I see what's going on! I think "Party Members" is just a count of how many people are in the party. You'll need to set a variable for each slot, like this. It also removes them after they've been stored (one at a time since I didn't see a "Remove All" button), and I have a window open showing where the data is held under Change Variable.



Then, when you're ready to restore your party, you'd remove the monsters and then use something like this:

$game_party.add_actor($game_variables[1])

$game_party.add_actor($game_variables[2])
$game_party.add_actor($game_variables[3])
$game_party.add_actor($game_variables[4])


That will push the members back in order, so the first one you add can be your leader. Hope that does it!
I'll try this later tonight. I really, really wish there was a "Remove all" function because the game could have 99 heroes in it.
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
Try this instead.

$game_party.members.unshift($data_actors[1])

That should insert actor 1 at the beginning of the party, no need to remove anyone.
author=Deltree
I see what's going on! I think "Party Members" is just a count of how many people are in the party. You'll need to set a variable for each slot, like this. It also removes them after they've been stored (one at a time since I didn't see a "Remove All" button), and I have a window open showing where the data is held under Change Variable.



Then, when you're ready to restore your party, you'd remove the monsters and then use something like this:

$game_party.add_actor($game_variables[1])

$game_party.add_actor($game_variables[2])
$game_party.add_actor($game_variables[3])
$game_party.add_actor($game_variables[4])


That will push the members back in order, so the first one you add can be your leader. Hope that does it!


That's not at all what my Variable edit dialogue box looks like. I guess you're using Ace?

author=Trihan
Try this instead.

$game_party.members.unshift($data_actors[1])

That should insert actor 1 at the beginning of the party, no need to remove anyone.


Nope :/ I was really hoping a simple command like that would exist.
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
What happens when you try to do that? I don't have a copy of VX handy on my laptop to try it.
If I add Actor #1 to party after the menu close and then do that script, Actor #1 is still at the back of the caterpillar. If I do NOT Actor #1 back in the party, he does not show up at all... So technically the script does nothing.
Marrend
Guardian of the Description Thread
21806
I might have a possible solution for you. The first function...

def memorize_party
  i = 0
  while i <= Game_Party::MAX_MEMBERS - 1
    actor = $game_party.members[i]
    if actor.instance_of?(Game_Actor) == true
      $game_variables[i+1] = actor.id
    else
      $game_variables[i+1] = 0
    end
    i += 1
  end
end

...memorizes each party members' ID, and puts them into variables. The next function...

def recall_party
  i = 0
  while i <= Game_Party::MAX_MEMBERS - 1
    if $game_variables[i+1] != 0
      $game_party.add_actor($game_variables[i+1])
      i += 1
    else
      break
    end
  end
end

...sets the party positioning according to the variables, as (presumably) defined by the last function. The next function...

def wipe_party
  i = 0
  while $game_party.members.size > 0
    actor = $game_party.members[0].id
    $game_party.remove_actor(actor)
  end
end

...was written and tested because I heard that your party size was insanely huge, and you wanted a quick-and-dirty way to reset the party to zero members. Which the above script should accomplish.
I am having trouble getting the scripts to actually copy from this page and into RMVX. For some reason only your last one can be copied directly from here and into RMVX. The other two.... can't be? So I pasted them into Word and then from there into RMVX, but the formatting gets all screwed up. I tried to manually fix it but the Event Script Caller thing doesn't allow for scripts longer than so many lines it seems.

Am I doing something wrong?


EDIT: Never mind I figured it out. Sorry, this is the most scripting I've dealt with aside from editing a few basic ones. What was not clear to me was to put those 3 function into a script itself and then use the Event script thing to call those separate functions. IT TOTALLY WORKS!!!! Thank you so much, Merrand. I'm gonna name a something after you.

EDIT2: I am experiencing some weirdness. I did a test where the Player starts off with 3 monsters and then puts 1 away (in like a PC box if you will) but now whenever I call the menu i see the 2 characters and not the Player, as I should, but when I close the menu another random Actor is added to seemingly fill the gap. And after that, every single time I open and close the menu the part gets weirdly shuffled around.

EDIT3: I think the issue is it saves 4 Actor IDs in 4 variables and then if there are only 3 actors in the party (player plus 2 monsters) then it only overwrites 3 variables but the "recall" function still calls 4 variables? Maybe? So the variables in question should be wiped after each time the menu is called and closed?
Marrend
Guardian of the Description Thread
21806
Wait, what? You're putting, like, literal monsters into the party? I assumed the party would consist of only characters. Which is why...

if actor.instance_of?(Game_Actor) == true

...this piece of code in the memorize_party function exists! If that sees a member of Game_Enemy (which is the class the monster party-members would have), the function would place 0 into the appropriate $game_variable. Then, when the recall function is called, when it sees a 0, it stops adding members.

So, with that in mind, I think what would need to happen with the memorize function would be that it would end up looking something like...

def memorize_party
  i = 0
  while i <= Game_Party::MAX_MEMBERS - 1
    actor = $game_party.members[i]
    if actor.instance_of?(Game_Actor) == true || actor.instance_of?(Game_Enemy) == true
      $game_variables[i+1] = actor
    else
      $game_variables[i+1] = 0
    end
    i += 1
  end
end

...that, while the recall function might look something more like...

def recall_party
  wipe_party
  i = 0
  while i <= Game_Party::MAX_MEMBERS - 1
    if $game_variables[i+1] != 0
      $game_party.add_actor($game_variables[i+1])
      i += 1
    else
      break
    end
  end
end

...that? I haven't tested this at all, and am going off the top of my head, but...
I think I confused you. As originally explained, the game is monster collection. The player acquires an army of monsters and can only take 3 of them with him on adventures. These are Actors with different Classes that will make them "monsters." It has NOTHING to do with the Database Enemies.

Think how in pokemon games you are a single human but when you check the menu the player sees their pokemon party. And when they switch back, they only see the human trainer.

Your (merrand) original scripts worked fine, but only with 1 single party of the player and 3 monsters (again, Actors not Enemies) but when I tested changing up the party it went completely crazy.
Marrend
Guardian of the Description Thread
21806
Okay, my fault on misinterpreting what was going on. It sounds to me like the old version would have worked, though the recall_party function assumed that the party was empty before it would be called. Which could be part of the issue you are having. Try inserting "wipe_party" at the beginning of the function...

def recall_party
  wipe_party
  i = 0
  while i <= Game_Party::MAX_MEMBERS - 1
    if $game_variables[i+1] != 0
      $game_party.add_actor($game_variables[i+1])
      i += 1
    else
      break
    end
  end
end


...like so, and see if this works the way you want.
Pages: first 12 next last