• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Save a table value for each player

selvex

New Member
Joined
Sep 2, 2010
Messages
6
Reaction score
0
Hello OTland community.

I recently developed a script, which allows the server to create a private area (a personal dungeon, which is resetable too f.e.) for each player.
To do so, I write a long list of each item, that needs to contain all items, which are going to be created.
I finished this so far.

The difficult part is, to remove the created items (player logs out, or fails his mission). I made 1 huge step closer to my target by creating a table value, which contains all created items, including their position and relevant id's.
But the problem is: How can I save these tablevalues for each player individually?

Example for tablevalue:
Code:
examplevalue = {
                                      {
					id = 2195,
					pos = { x = 1194, y = 1183, z = 7 }
}

I hope i stated my problem properbly and anyone can help me.
Best regards
 
Keep one thing in mind: You can not share values across different scripting enviroments (e.g. if you create a variabele in movements, you can't use it in creaturescripts directly).

You can achieve your wanted effect by making one huge indexed table tho.

Code:
t = {}
t[PlayerUid] = { Table with data }
....
local x = t[PlayerUid] -- There it's back again.
 
Thank you for this quick reply and the helpfull advice.

I cant use it across different scripting enviroments, but in the same, if it's not set with local, right? That means, if I have f.e a startscript in actions, I can use values from the startscript in the stopscript, which lies in actions too.

However, there is actually no way around to bring the values to other scripting in environments like creaturescripts, hence I need to remove the generated items if the player logs off. - Oh wait. While writing this, a other solution came to my mind. I could easily prevent the user from loging off, while being in a private dungeon / raid / mission.

But, is there anyway to share values across different environments?
 

Similar threads

Back
Top