I need help making it so a when a player joins the server it gives them a random Origin,
So like when they join it changes there uuid or whatever to a random one out of a list of origins, so I can make these origins gives certain abilities
it is a basic smp plugin idea i guess ive been trying for like 3 days and cant figure it out
#Skript help
1 messages · Page 1 of 1 (latest)
Just use the on join event and assign a random origin
Like say you have a list of origins, you can do
random element out of {origins::*}
or similar. I recommend using a list with uuid for assigning an origin
Something kind of similar to
{data::player::%uuid of {_player}%::origin}
so you could set that to the random element which is the origin. Then to get it later on just reference the variable. When I Skript I make a bunch of helper functions because I don’t like memorizing my bad variable naming scheme so I have like
function getAllOrigins::strings:
return {origins::*} # our list of origins
functikn getOrigin(player: player):: string:
return {data::player::%uuid of {_player}%::origin} # where the players origin is stored
function assignOrigin(player: player, origin: string):
set {data::player::%uuid of {_player}%::origin} to {_origin} # bind {_origin} to the player
And this is a basic way to track player origins. Probably a good idea to change some variable but yeah
Kinda a lot, srry abt that
But if you using something similar you can just do
random element out of getAllOrigns()
Instead of using {origins::*}. they are the same thing but it can be more readable later on
And you could one line it if you want
assignOrigin(player, random element out of getAllOrigins())
you don’t has to use this structure but it’s what I do ¯_(ツ)_/¯
you need to send your code otherwise there's not much we can do to help you