What I want to do is record all the experience gained by a player gained from battles, then transfer that experience gained to a different actor after several battles. How do I set up the variable for this? Any help is appreciated, thanks!
There is no exp gained from any events. The only exp gained at this point in the game is from battles. I read your post but still uncertain how I would go about setting it, meaning, where do I put the certain variables at, how do I make the exp transfer to the other player, etc. Do I put a variable in each battle troop to record the exp gained in that session?
ksjp17, thanks, that would be the easier solution, but I want the player to be the approiate level from the amount of exp gained.
Ok, you've got me confused.
If the only exp gained at this point is from battles, then you could just set the new players XP equal to the old players, no? This only becomes problematic if Player 1 (Actor 1, I'm assuming you mean) had gained XP from other means that you don't want included. Let's go with Actor 1 having gained a bunch of XP from events and other stuff (quests, conversations, opening chests, whatever...).
I can think of at least three or four different ways to do this, each of which has their pros and cons.
1) The direct approach: Go into into the scripts (gain_exp in BattleManager would be the easiest place) and set up a variable that keeps track of all XP gained in battles.
The pro to this is it's crisp, clean, and concise.
The con is you need to go into the scripts to make it work.
2) The 'negative' approach: The only place the game 'naturally' gives XP is through battles, so if an Actor is getting any more, it's from someplace where you're giving it to him, probably via an event. Create a common event that adds XP gained to an XP counter (this is why they are called 'common' events, by the way - several other events/maps/etc... hold it in common). Every place you give an Actor non-combat XP, call the common event and add the amount to that variable. When the time comes for Actor 2 to start, Actor 1's current XP minus the common event variable will give you the XP Actor 1 gained in battle.
The pro here is you don't need any scripting.
The con is you need to find every place you give out XP to be sure it calls the common event.
3) The 'Why am I doing this, anyway?' approach.
What's your real goal with all of this? If it's just to be sure Actor 2 doesn't start at too high a level, simply look at Actor 1's level and set Actor 2's level equal to the lower of Actor 1's level or the level you've decided as the 'cap'.
The pro is it's incredibly simple, direct, and probably solves what you're trying to do better than either of the above.
The con is it doesn't allow the player to 'power-level' Actor 2 by grinding out battles with Actor 1 before she joins.