Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Question: Putting XP into Variables

Status
Not open for further replies.

MRevelle83

Villager
Xy$
0.00
Hello all! A question. It is kind of annoying me as I think it would have an easy solution, but how can you put XP needed to level up as a value in a variable?

Putting XP game data into a variable is determined by how much XP a character has, not what the character needs.

So if the character has 5 xp and needs 45 to level up, the variable would be 5 if I put in through game data. I want to know how to make the variable 45. It is for a custom level up system... that I'm sure most of you have guessed. Anyway, any help is appreciated!

(I have this funny feeling it is a simple solution that I simply overlooked. :P )
 

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
You can use the following in the script part when setting a variable:
JavaScript:
$gameActors.actor($gameParty._actors[0]).nextRequiredExp()
Replace the 0 with the actor position in the party (starting with 0 being the leader).
If you wish to take it a step further you can also adjust a game variable to determine that such as this:
JavaScript:
$gameActors.actor($gameParty._actors[$gameVariables.value(1)]).nextRequiredExp()
Replace 1 with the gameVariableID that would control the actor position in the party.
Alternatively you could also just use a game variable to pick a actor directly using the actorID
JavaScript:
$gameActors.actor($gameVariables.value(1)).nextRequiredExp()
Replace 1 with the gameVariableID that would control the actor position in the party.

That should do the trick for ya. Let me know if this helps. (cool)
 
Last edited:

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
Thank you! It worked perfectly.

If I have any more questions I will post them. :)
You're welcome! (cute)
Glad to hear that suits your needs.
Happy game making! (hella)(thumbsup)

Thread closed, problem solved.
If you want it reopened just let me know. (cute)
 
Status
Not open for further replies.
Top