Jump to content
Kloqdq

VX Ace - Item with different Parties

Recommended Posts

Hello!

 

So I was working on my first game and I ran into something that I didn't know how to really fix. When I looked around I couldn't find my answer either so here it is. 

 

Basically, my game has 2 main parties of characters that act at different times in the story. What I wanted to know is how to make it so when I'm play as Character A, I don't have items from Character B and the same way around. Is there something I can do so only Character A will have his items and Character B will have his items? If you need any more information then let me know. 

 

Thanks!

Share this post


Link to post
Share on other sites

I did something like this in VX, not Ace, so I downloaded Ace Lite, hoping that they're similar enough that this is of any use to you.

Now, it sounded to me like you asked about the inventory of a single character, but I don't think Ace does that. We can save the

inventory of the party though, by saving the party itself into a variable. Now, I can't use scripts and script(lets?) with the trial version, but here goes:

 

First, I set the default party to empty(no characters, F9, System tab), then populate the party with characters, money and items and such through an event.

 

Second, save the game party object into one of the global variables that are saved when you save your games. This I'd do with a script (third

tab of the Event Commands) All of the following would go into one event.

 

$game_variables[1] = $game_party (That number represents the position in the array

where the data is stored, and can be anything. But use it again, and the old stuff is gone.)

 

Third, you give the party object a new value(reset to default). Basically the same thing as before. Just a short line:

$game_party = Game_Party.new (proper capitalization is important here. The scripting language is case sensitive.)

Most importantly though, this gives that object a new address in memory so it no longer points to the old data.

 

Fourth, populate the party again, with the other character(s), items, money etc. Again, this could be done with Event Commands.

 

Fifth, save the second party the same way you did the first.

$game_variables[2] = $game_party (Again, the number can be anything, just don't put this party in the same position in the array

as the last, that would overwrite the data and all this would be a waste.)

 

Now, make sure you run this event only once. Probably best to do it early in the game, like, the first thing you do.

The two parties are now saved in variables that get saved with games and stays between game sessions. When you want to switch from

one party to another, you just run the code below.

$game_party = $game_variables[x] (Replace x with one of the previously used numbers. This looks like the reverse of the previous line,

and that's pretty much it. Here we put the value stored in the variable into the party object.)

 

In VX I needed to then run $game_player.refresh to make the graphics show the change, but I have no idea if you need to do that in Ace.

 

This $game_party and $game_variables are global variables(those have names preceded by a dollar sign) and the $game_party object

is used by the game to store things like who's with you, what's their name, what items do you carry, how much money do you have, all that.

 

If you have VX you can try this project out. If you read the comments in the events, I explain it even better there.

Team Switcharooha!

 

I hope any or all of that was useful. If not, sorry.

 Good luck!

 

(When playing around with this old project I may have found a bug that makes the inventory of the second party not save. That might end up being game breaking for this.)

Edited by Aletheos

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted