Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] In one of my scripts I'm using a global variable, and I suspect it'll be an issue if/when used on a

[DiscordArchive] In one of my scripts I'm using a global variable, and I suspect it'll be an issue if/when used on a

[DiscordArchive] In one of my scripts I'm using a global variable, and I suspect it'll be an issue if/when used on a

rektbyfaith
Administrator
0
06-26-2025, 10:44 PM
#1
Archived author: JudgeFae • Posted: 2025-06-26T22:44:35.448000+00:00
Original source

In one of my scripts I'm using a global variable, and I suspect it'll be an issue if/when used on a server with multiple players. Does it sound right that instantiating a class (some OOP) per player would fix that? And also does LUA allow stuff like that?
rektbyfaith
06-26-2025, 10:44 PM #1

Archived author: JudgeFae • Posted: 2025-06-26T22:44:35.448000+00:00
Original source

In one of my scripts I'm using a global variable, and I suspect it'll be an issue if/when used on a server with multiple players. Does it sound right that instantiating a class (some OOP) per player would fix that? And also does LUA allow stuff like that?

rektbyfaith
Administrator
0
06-26-2025, 10:44 PM
#2
Archived author: JudgeFae • Posted: 2025-06-26T22:44:59.542000+00:00
Original source

But that way I can quit using a global variable and just have a class wide variable
rektbyfaith
06-26-2025, 10:44 PM #2

Archived author: JudgeFae • Posted: 2025-06-26T22:44:59.542000+00:00
Original source

But that way I can quit using a global variable and just have a class wide variable

rektbyfaith
Administrator
0
06-26-2025, 10:55 PM
#3
Archived author: JudgeFae • Posted: 2025-06-26T22:55:59.843000+00:00
Original source

old sacred knowledge
https://www.lua.org/pil/16.html
rektbyfaith
06-26-2025, 10:55 PM #3

Archived author: JudgeFae • Posted: 2025-06-26T22:55:59.843000+00:00
Original source

old sacred knowledge
https://www.lua.org/pil/16.html

rektbyfaith
Administrator
0
06-26-2025, 11:42 PM
#4
Archived author: Traesh • Posted: 2025-06-26T23:42:49.468000+00:00
Original source

What you can do if you need to store data on a "per player" basis is use the "SetData" method

player:SetData("MyObject", {
numberOfDeaths = 0,
amount = 1,
})
rektbyfaith
06-26-2025, 11:42 PM #4

Archived author: Traesh • Posted: 2025-06-26T23:42:49.468000+00:00
Original source

What you can do if you need to store data on a "per player" basis is use the "SetData" method

player:SetData("MyObject", {
numberOfDeaths = 0,
amount = 1,
})

rektbyfaith
Administrator
0
06-26-2025, 11:52 PM
#5
Archived author: JudgeFae • Posted: 2025-06-26T23:52:13.944000+00:00
Original source

My script can now handle mount speed aura's like Crusader Aura and the talent points used by DK and Paladin.
https://youtu.be/1YlLTrd0w50

And (hopefully) can handle multiple players. That aspect I cannot test, but I am pretty sure each "movement speed " variable is specific to the player and no longer global.
[Embed: Mount Speed Buffed!]
This is built on an Azerothcore server, but other cores can probably use this too.

The moduel required is: Eluna and the script is on my github here:
https://github.com/LuckyLuc96/lua_script...mounts.lua
https://www.youtube.com/watch?v=1YlLTrd0w50
rektbyfaith
06-26-2025, 11:52 PM #5

Archived author: JudgeFae • Posted: 2025-06-26T23:52:13.944000+00:00
Original source

My script can now handle mount speed aura's like Crusader Aura and the talent points used by DK and Paladin.
https://youtu.be/1YlLTrd0w50

And (hopefully) can handle multiple players. That aspect I cannot test, but I am pretty sure each "movement speed " variable is specific to the player and no longer global.
[Embed: Mount Speed Buffed!]
This is built on an Azerothcore server, but other cores can probably use this too.

The moduel required is: Eluna and the script is on my github here:
https://github.com/LuckyLuc96/lua_script...mounts.lua
https://www.youtube.com/watch?v=1YlLTrd0w50

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)