iThorgrim / lua_aoe_loot

AOE Loot for Eluna.
GNU General Public License v3.0
12 stars 9 forks source link

lua_scripts/aoe_loot.lua:3: attempt to call method 'GetData' (a nil value) #7

Closed xSparky911x closed 2 months ago

xSparky911x commented 2 months ago

Fresh server fresh install on azerothcore. I also ran git apply --directory=modules/mod-eluna azerothcore_eluna.diff but when killing two mobs and trying to either just loot one or auto loot one I get this error in the console...

lua_scripts/aoe_loot.lua:3: attempt to call method 'GetData' (a nil value)

iThorgrim commented 2 months ago

The GetData method is on this file : https://github.com/ElunaLuaEngine/Eluna/blob/master/extensions/ObjectVariables.ext

Verify you have this one

Maypul commented 2 months ago

I have also the same error but I do use Azerothcore's Eluna, which from what I know, is customized to AC but might be outdated with the main Eluna brach. Could it be the issue? AC's Eluna GetData: https://github.com/azerothcore/mod-eluna/blob/master/src/LuaEngine/extensions/ObjectVariables.ext

iThorgrim commented 2 months ago

It's strange because this is the same file for TC: Can you test to do this ?

RegisterPlayerEvent(3, function(event, player)
   player:SetData("Test", true)
end)

RegisterPlayerEvent(4, function(event, player)
   print(player:GetData("Test"))
end)

Just Login and Logout :)

Maypul commented 2 months ago

Oh, you are right. I thought I saw a difference, my bad. Please correct me wrong if I did something wrong: I have created test.lua in my lua_scripts directory. I have also added print("Hello Server"). I actually had to reload worldserver to get it working.

and in the server log I see the following (I logged and relogged):

(...) Hello Server

WORLD: World Initialized In 0 Minutes 30 Seconds

AzerothCore rev. cf95c1dfbdb2+ 2024-09-07 15:39:31 +0200 (master branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon) ready...

ServerAutoShutdown: System loading

ServerAutoShutdown: Next time to shutdown - Sun Sep 15 2024 12:00:00

ServerAutoShutdown: Remaining time to shutdown - 6d 21h 45m 49s

ServerAutoShutdown: Next time to pre annouce - Sun Sep 15 2024 11:00:00

ServerAutoShutdown: Remaining time to pre annouce - 6d 20h 45m 49s

Starting up Auction House Listing thread...

AC> Calendar deletion of old events.

Anticheat: Resetting daily report states.

Anticheat: Next daily report reset: Mon Sep 09 2024 06:00:00

Saving reports for 0 players.

Config: Found config value 'LogsDir' from environment variable 'AC_LOGS_DIR'.

/azerothcore/lua_scripts/AOE_Loot/test.lua:4: attempt to call method 'SetData' (a nil value)

Saving reports for 1 players.

/azerothcore/lua_scripts/AOE_Loot/test.lua:8: attempt to call method 'GetData' (a nil value)

/azerothcore/lua_scripts/AOE_Loot/test.lua:4: attempt to call method 'SetData' (a nil value)

xSparky911x commented 2 months ago

The GetData method is on this file : https://github.com/ElunaLuaEngine/Eluna/blob/master/extensions/ObjectVariables.ext

Verify you have this one

I just checked and I do have that file in the src and doing a search have that function GetData. Does it have anything to do with it being a local function in Eluna? Forgive me I'm not a programmer.

iThorgrim commented 2 months ago

You need to have this file on your lua_script folder :

lua_scripts/extensions/

iThorgrim commented 2 months ago

Oh, you are right. I thought I saw a difference, my bad. Please correct me wrong if I did something wrong: I have created test.lua in my lua_scripts directory. I have also added print("Hello Server"). I actually had to reload worldserver to get it working.

and in the server log I see the following (I logged and relogged):

(...) Hello Server

WORLD: World Initialized In 0 Minutes 30 Seconds

AzerothCore rev. cf95c1dfbdb2+ 2024-09-07 15:39:31 +0200 (master branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon) ready...

ServerAutoShutdown: System loading

ServerAutoShutdown: Next time to shutdown - Sun Sep 15 2024 12:00:00

ServerAutoShutdown: Remaining time to shutdown - 6d 21h 45m 49s

ServerAutoShutdown: Next time to pre annouce - Sun Sep 15 2024 11:00:00

ServerAutoShutdown: Remaining time to pre annouce - 6d 20h 45m 49s

Starting up Auction House Listing thread...

AC> Calendar deletion of old events.

Anticheat: Resetting daily report states.

Anticheat: Next daily report reset: Mon Sep 09 2024 06:00:00

Saving reports for 0 players.

Config: Found config value 'LogsDir' from environment variable 'AC_LOGS_DIR'.

/azerothcore/lua_scripts/AOE_Loot/test.lua:4: attempt to call method 'SetData' (a nil value)

Saving reports for 1 players.

/azerothcore/lua_scripts/AOE_Loot/test.lua:8: attempt to call method 'GetData' (a nil value)

/azerothcore/lua_scripts/AOE_Loot/test.lua:4: attempt to call method 'SetData' (a nil value)

Do you have ObjectVariables.ext in your lua_scripts/extensions folder?

Maypul commented 2 months ago

Oh, you are right. I thought I saw a difference, my bad. Please correct me wrong if I did something wrong: I have created test.lua in my lua_scripts directory. I have also added print("Hello Server"). I actually had to reload worldserver to get it working. and in the server log I see the following (I logged and relogged): (...) Hello Server WORLD: World Initialized In 0 Minutes 30 Seconds AzerothCore rev. cf95c1dfbdb2+ 2024-09-07 15:39:31 +0200 (master branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon) ready...

ServerAutoShutdown: System loading

ServerAutoShutdown: Next time to shutdown - Sun Sep 15 2024 12:00:00

ServerAutoShutdown: Remaining time to shutdown - 6d 21h 45m 49s

ServerAutoShutdown: Next time to pre annouce - Sun Sep 15 2024 11:00:00

ServerAutoShutdown: Remaining time to pre annouce - 6d 20h 45m 49s

Starting up Auction House Listing thread... AC> Calendar deletion of old events. Anticheat: Resetting daily report states. Anticheat: Next daily report reset: Mon Sep 09 2024 06:00:00 Saving reports for 0 players.

Config: Found config value 'LogsDir' from environment variable 'AC_LOGS_DIR'.

/azerothcore/lua_scripts/AOE_Loot/test.lua:4: attempt to call method 'SetData' (a nil value) Saving reports for 1 players. /azerothcore/lua_scripts/AOE_Loot/test.lua:8: attempt to call method 'GetData' (a nil value) /azerothcore/lua_scripts/AOE_Loot/test.lua:4: attempt to call method 'SetData' (a nil value)

Do you have ObjectVariables.ext in your lua_scripts/extensions folder?

No, I have not. My lua scripts directory was empty at creation and I did not realize I needed to copy anything manually.

So to sum it up:

There are no more errors in the log when picking up loot, but it still loots only one corpse.

Created test.lua with the previous code you provided. .reload eluna Log off and log on I just get printed 'nil' in the server log when I log off

Tried copying whole /src to script location and restarting the server, still getting just 'nil' from the test script and aoe loot not working, but no errors are shown now.

I think I am missing some crucial information, I though I have followed installing Eluna module but it seems there might be more to it.

xSparky911x commented 2 months ago

You need to have this file on your lua_script folder :

lua_scripts/extensions/

Have it in the the extensions folder now. No longer get the errors but still having to loot each mod individually

iThorgrim commented 2 months ago

Ok you have AIO or CSMH on client and server ? Or you don't need to use custom client modification ?

xSparky911x commented 2 months ago

Ok you have AIO or CSMH on client and server ? Or you don't need to use custom client modification ?

I don't have either on either. Don't really care about client customization but do I need these on the server?

xSparky911x commented 2 months ago

Ok I now have AIO on both server and client. I can turn it on or off in interface options but still having to loot all mobs one at a time. For the record no errors seen in the server console

iThorgrim commented 2 months ago

Can you just test to force the AOE Loot like this : Switch this :

local aoe_loot_active = player:GetData("AOE_LOOT_STATUS") or false

To this :

local aoe_loot_active = player:GetData("AOE_LOOT_STATUS") or true