Jump to content
  • 0

Any solution to put the player level on a variable?


Senpai402

Question

Hi !

Firstly, sorry for my bad english.

 

How can I get the level of a player without use "on level up" event ? 

 

An exemple, when a player change class, boom, save his level with hhis class (with a second variable), and set the level 1 to the new player class. 

If he wan't back on the first class, he recover his previous level

 

 

Have a great day! :)

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

So, you would still need to use the on level up common event to record the players current level by adding 1 to the variable every time the player levels. Name this player variable something like Players_Current_Level and start recording that data. Because your player starts off at level 1, and all variables start off as 0 your going to want to create an event that auto triggers for the players first time logging in to set the variable to 1, and then never run again.

 

Once you have your players level being recorded and updated on each level up, you can setup a player variable and call it something like Player_lvl_Before_Class_Switch or whatever you want to call it. So now you player goes and talks to an npc event to switch their class. When they do this within the even select Set variable, and set Player_lvl_Before_Class_Switch to equal Players_Current_Level. This will set your new variable to equal the players level when they made the class switch and never change unless you make it change. Now you can refer to the players level that they were when they were the old class. Depending on how many levels a player could be, the next part could get very tiresome.

 

The event that allows them to revert back to their old class and level would be setup up with conditional branches that check the variable you set for Player_lvl_Before_Class_Switch. So  if Player_lvl_Before_Class_Switch = 1, then change level to 1, if Player_lvl_Before_Class_Switch = 2, then change level to 2 ex. These would all have to be manually set so high level caps and many classes would make this not so worth it.

 

There might be a much easier way to go about this with the events, but this is how I figured it out.

 

I would just tell my players to create a second character, this way their old class and level would still be accessible on their other character and they could still try a new class. :)

Link to comment
Share on other sites

  • 0
2 minutes ago, Niko said:

So, you would still need to use the on level up common event to record the players current level by adding 1 to the variable every time the player levels. Name this player variable something like Players_Current_Level and start recording that data. Because your player starts off at level 1, and all variables start off as 0 your going to want to create an event that auto triggers for the players first time logging in to set the variable to 1, and then never run again.

 

Once you have your players level being recorded and updated on each level up, you can setup a player variable and call it something like Player_lvl_Before_Class_Switch or whatever you want to call it. So now you player goes and talks to an npc event to switch their class. When they do this within the even select Set variable, and set Player_lvl_Before_Class_Switch to equal Players_Current_Level. This will set your new variable to equal the players level when they made the class switch and never change unless you make it change. Now you can refer to the players level that they were when they were the old class. Depending on how many levels a player could be, the next part could get very tiresome.

 

The event that allows them to revert back to their old class on level would be setup up with conditional branches that check the variable you set for Player_lvl_Before_Class_Switch. So  if Player_lvl_Before_Class_Switch = 1, then change level to 1, if Player_lvl_Before_Class_Switch = 2, then change level to 2 ex.

 

There might be a much easier way to go about this with the events, but this is how I figured it out.

 

 

Wow, I'll try it right now, you're awesome !

 

Thanks! 

Link to comment
Share on other sites

  • 0

Like i said above, I would never go about doing this because of the amount of work it would be if you had a high max level cap and many classes. IT would take forever to set the event up to check every level up. If you have level cap at 70, that's 70 conditional branches to do and that's only one class. But it is possible. Maybe someone else knows of a better way...

Link to comment
Share on other sites

  • 0
10 minutes ago, Niko said:

Like i said above, I would never go about doing this because of the amount of work it would be if you had a high max level cap and many classes. IT would take forever to set the event up to check every level up. If you have level cap at 70, that's 70 conditional branches to do and that's only one class. But it is possible. Maybe someone else knows of a better way...

Event copy pasting makes this kind of stuff easier for sure

Link to comment
Share on other sites

  • 0

That's a question for @jcsnider, but im assuming the same issues can occur with anything in a online game. When trying to load too many resources from the server lag can occur.

 

The main thing I could see happening is it taking a few seconds to make the change occur, as it sifts through all the conditional branches.

Link to comment
Share on other sites

  • 0

I got and idea, i think we can skip the first step by adding an event on level up with conditionnal branch : if class = "Warrior" add +1 to Warrior_Level variable, if class = "Ranger" add + to Ranger_Level and the use it to set the conditionnal branch of level when a player change class

 

Idk if it's working, but i think yeah

Link to comment
Share on other sites

×
×
  • Create New...