PDA

View Full Version : TrinityCore WotLK Creature/Player/Gameobject custom data



LordSeaworth
08-11-2016, 05:23 AM
I thought i wrote somewhere that you can have variables per player/creature/gameobject?
Or am i totally wrong.

Like

Creature:SomeCustomData("SomeCustomVariable")

Or something in that way.
I can't seem to find information about it.
I think it was for eluna. not sure thought.

Can anyone understand my confusing explanation.

Kaev
08-11-2016, 08:19 AM
I thought i wrote somewhere that you can have variables per player/creature/gameobject?
Or am i totally wrong.

Like

Creature:SomeCustomData("SomeCustomVariable")

Or something in that way.
I can't seem to find information about it.
I think it was for eluna. not sure thought.

Can anyone understand my confusing explanation.

Afaik there is no specific function for something like that.
You could create a table in Lua and add your creature and your variable value to it.

Rochet2
08-11-2016, 03:38 PM
One way is like Kaev said.

However there is another way to store some data.
You should already have this in your lua_scripts folder:
https://github.com/ElunaLuaEngine/Eluna/blob/master/extensions/ObjectVariables.ext

because of the .ext ending it should load before your normal lua scripts.
Otherwise try using require("ObjectVariables")

You can use it like this:
creature:SetData("some key", 123)
print(creature:GetData("some key")) -- prints 123

LordSeaworth
08-11-2016, 04:33 PM
Thanks for that i'll look into that.

Hmm i'm so confused where i read what i think i read.
Maybe in my dream xp

Well thanks for the help! both of you