Jump to content
  • 0

How to create an Event to give a specified player EXP, LevelUp, etc


RandemGamor

Question

Hi there :)

So I'm setting up some admin commands and I want to be able to do things like;

/giveexp playerName 1000
/givelevel playerName 1
/giveattack playerName 5

and so on :D

How would I do this please?

Many Thanks,
Randem Gamor.
 

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0
7 hours ago, Cheshire said:

There is no way to do this through events with chat command parameters.

 

Your best bet would be to use the APIs existing endpoints, or add some new ones: https://docs.freemmorpgmaker.com/en-US/api/v1/endpoints/players.html


Aww dang okay thanks :) Not sure how all that API stuff works :D I'll have to look into it when I'm able to.

Thanks.

Link to comment
Share on other sites

  • 0

You can do 2/3 of these with events

 

/giveexp playerName 1000

--create a common event that is triggered by /command "/giveexp"

--create a global variable "giveexp" - string

--create a global variable "exp" - int

--create a variable input - enter the player name

--the value of the player's name will be assigned to the global variable

--create a variable input - enter the player exp

--the value of the player's exp will be assigned to the global variable

 

--create another commom event that is triggered by "global variable changed" choose giveexp

--set spawn/run condition to: If var global giveexp = \pn

--place the command, give exp = global variable "exp"

--then set the var global exp to 0

--then set the var global giveexp to " " (nothing)

 

/givelevel playerName 1

All the same process as above, but in the common event that will change with the variable givelevel(string), you must create a loop

--label: start

--conditional branching: if var global level > 0

--leveling up

--wait 500ms

--subtract var global 1
go to label "start"

 

then in the else

--set the var global givelevel to " " (nothing)

 

changing status is not possible without modifying the source

 

If you didn't understand anything I said, then good luck

Link to comment
Share on other sites

  • 0
2 hours ago, Weylon Santana said:

You can do 2/3 of these with events

 

/giveexp playerName 1000

--create a common event that is triggered by /command "/giveexp"

--create a global variable "giveexp" - string

--create a global variable "exp" - int

--create a variable input - enter the player name

--the value of the player's name will be assigned to the global variable

--create a variable input - enter the player exp

--the value of the player's exp will be assigned to the global variable

 

--create another commom event that is triggered by "global variable changed" choose giveexp

--set spawn/run condition to: If var global giveexp = \pn

--place the command, give exp = global variable "exp"

--then set the var global exp to 0

--then set the var global giveexp to " " (nothing)

 

/givelevel playerName 1

All the same process as above, but in the common event that will change with the variable givelevel(string), you must create a loop

--label: start

--conditional branching: if var global level > 0

--leveling up

--wait 500ms

--subtract var global 1
go to label "start"

 

then in the else

--set the var global givelevel to " " (nothing)

 

changing status is not possible without modifying the source

 

If you didn't understand anything I said, then good luck


Wow thank you :D I'll try this and let you know how I get on :)

Link to comment
Share on other sites

  • 0
3 hours ago, Cheshire said:

Clever, but what would happen if you end up with several admins doing the same thing?

 

It'd likely end up glitching out so that is something to be aware of.

I know that.  Even so, you can use it in the same way, there will never be a problem for one adm, and you will rarely have a problem for two or more if they are not typing commands simultaneously(with 5 sec delay maybe work fine).  I did this thinking only to him who asked the question, but you still have the point.

Link to comment
Share on other sites

  • 0
On 5/13/2021 at 6:39 AM, Cheshire said:

Clever, but what would happen if you end up with several admins doing the same thing?

 

It'd likely end up glitching out so that is something to be aware of.


Hmmh I guess that could easily be bypassed by having another variable (true/false)
by default it could be false. Check if it's false, if so set true. Run the script/event.
Wait X seconds at the end of the event before setting it back to true.

That would stop multiple people using the command at once.

I'm going to do using similar variables for other command cooldowns.

Thanks for making me aware that it could cause an issue, as I can then add in this extra variable and check.

Link to comment
Share on other sites

  • 0
On 5/12/2021 at 8:24 PM, Weylon Santana said:

You can do 2/3 of these with events

 

/giveexp playerName 1000

--create a common event that is triggered by /command "/giveexp"

--create a global variable "giveexp" - string

--create a global variable "exp" - int

--create a variable input - enter the player name

--the value of the player's name will be assigned to the global variable

--create a variable input - enter the player exp

--the value of the player's exp will be assigned to the global variable

 

--create another commom event that is triggered by "global variable changed" choose giveexp

--set spawn/run condition to: If var global giveexp = \pn

--place the command, give exp = global variable "exp"

--then set the var global exp to 0

--then set the var global giveexp to " " (nothing)

 

/givelevel playerName 1

All the same process as above, but in the common event that will change with the variable givelevel(string), you must create a loop

--label: start

--conditional branching: if var global level > 0

--leveling up

--wait 500ms

--subtract var global 1
go to label "start"

 

then in the else

--set the var global givelevel to " " (nothing)

 

changing status is not possible without modifying the source

 

If you didn't understand anything I said, then good luck


Hi again so I'm trying this now and running into a couple of barriers so far.

Firstly I can't figure out how to;
--create another commom event that is triggered by "global variable changed"
I tried looking under Trigger, etc.

So I bypassed this by including it in the same Event of /Commands (/giveexp)

Now I hit another barrier lol.. I can't figure out how to;
--place the command, give exp = global variable "exp"

As I if drop in the event command of "Give Experience" it only allows me to input a number and not \gv{expvalue}.

This is my entire setup / what I've done so far;

Global Variables:
\gv{exprunchk} - Boolean to check if the command is already running.
\gv{giveexpto} - String which will be the player to give exp to.
\gv{expvalue} - The Integer which is the value of EXP given.

My Event so far:
> Conditional Branch: checks if \gv{exprunchk} is equal to; False
    > Set Global Variable {exprunchk} to True.
    > Input Variable Box (Enter player to give EXP to)
          > Chatbox Text: (Player issuing command) = You have selected: \gv{giveexpto} to give EXP to.
          else
          >
   > Wait 500ms
   > Input Variable box (Enter how much EXP to give)
          > Chatbox Text: (Player) = You are going to give \gv{giveexpto} a total of \gv{expvalue} Experience.
          else
          >
   > Wait 500ms

----- This is where I hit a barrier so I carried on in this Event -----

    > Conditional Branch: If \gv{giveexpto} is equal to \pn
          > Give Player Experience

----- This is where I hit the 2nd barrier, as it only allows me to enter a number. -----
I need it to use \gv{expvalue}
How would I do this please?

Rest of the Event commands is just a wait 10000ms (10 seconds)
before setting the Global Variable \gv{exprunchk} to True. (This enables the command again)


.... So yeah, I'm probably half way there :D Thanks again for your help, hopefully we can get this complete :D

Many Thanks,
Randem Gamor.
 

Link to comment
Share on other sites

  • 0
5 minutes ago, Weylon Santana said:

@RandemGamor First, which version do you use? The "when variable changes" trigger has only the most recent versions


Oh right I installed a version about a week ago, so it's not that old but not the latest.
I'll have to see how I update my current version to the newest as I'm not sure how to "upgrade" without losing my current server stuff yet?

I'll do that so I got the "when variable changes" trigger thanks :)

But how will I be able to make it give exp based on the \gv{expvalue} please?

Thanks :)

 

Link to comment
Share on other sites

  • 0
32 minutes ago, RandemGamor said:


Oh right I installed a version about a week ago, so it's not that old but not the latest.
I'll have to see how I update my current version to the newest as I'm not sure how to "upgrade" without losing my current server stuff yet?

I'll do that so I got the "when variable changes" trigger thanks :)

But how will I be able to make it give exp based on the \gv{expvalue} please?

Thanks :)

 

Give exp based on variable value also its the recent updates.

 

to upgrade, download the latest prerelease version and replace all files in the zip file in your game server.. Client and editor.  But backup your game first, it doesn't work ok for everyone.

 

this version is ok for development, but not stable enough to go online with several players.

 

Call me on discord and I can help you and see better the details

Weylon#7909

Link to comment
Share on other sites

  • 0
15 minutes ago, Weylon Santana said:

this version is ok for development, but not stable enough to go online with several players.

 

Pre-release is the most stable thing we have right now for large amounts of players.

 

48 minutes ago, RandemGamor said:

I'll have to see how I update my current version to the newest as I'm not sure how to "upgrade" without losing my current server stuff yet?

 

In most cases (unless otherwise mentioned in the announcements) it's a matter of downloading a more recent version and simply replacing the executable files.

Link to comment
Share on other sites

  • 0
15 minutes ago, Weylon Santana said:

Give exp based on variable value also its the recent updates.

 

to upgrade, download the latest prerelease version and replace all files in the zip file in your game server.. Client and editor.  But backup your game first, it doesn't work ok for everyone.

 

this version is ok for development, but not stable enough to go online with several players.

 

Call me on discord and I can help you and see better the details

Weylon#7909



Ah okay I see thanks :) I've managed to do a work around I'll post more details here soon.
I'll update to the latest version when I can, but not sure if i'll risk a pre-release yet.

I can backup files and try though :)

I've sent you a friend request on Discord :)

Thanks.

Link to comment
Share on other sites

  • 0
1 minute ago, Cheshire said:

 

Pre-release is the most stable thing we have right now for large amounts of players.

 

 

In most cases (unless otherwise mentioned in the announcements) it's a matter of downloading a more recent version and simply replacing the executable files.


Oh right so the latest experimental is stable?
I'll have to update to that thanks :D

Link to comment
Share on other sites

  • 0
2 minutes ago, RandemGamor said:


Oh right so the latest experimental is stable?
I'll have to update to that thanks :D

 

yes and no?

 

6.2 is the ''stable'' release, but it has massive flaws that prevent it from running multiple users.

7.0 fixes these flaws, but it's not exactly entirely stable yet.

Link to comment
Share on other sites

  • 0
Just now, Cheshire said:

 

yes and no?

 

6.2 is the ''stable'' release, but it has massive flaws that prevent it from running multiple users.

7.0 fixes these flaws, but it's not exactly entirely stable yet.


Alright thanks :) I'll update to the most stable. I've managed to do a work around for EXP command for now.
Which i'll be able to implement into a lot of other things :O

I'll post more here soon with a breakdown of what I've done :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...