Game goes black
<div class="IPBDescription">I looked it up, its has a very odd reason.</div>So, the game went black when I was playing, so I decided to actually check out the error to see if I could find a fix. Thusly I opened the console, and saw (wish I could copypasta, as I had to type this out myself)
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Error: lua/Player_Client.lua:1556: attempt to index local 'player' (a nile value)
Lua call stack:
__index [C]:-1
PlayerUI_GetMapXY lua/Player_Client.lua:1556
UpdateIcon lua GUIMinimap.lua:306
Update lua/GUIMinimap.lua:257
Update lua/GUIMinimap.lua:222
lua/Client.lua:354<!--QuoteEnd--></div><!--QuoteEEnd-->
So I looked up the code at Player_Client at line 1556 and this is it (marked out the exact line it errors at)
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->/**
* Converts world coordinates into normalized map coordinates.
*/
function PlayerUI_GetMapXY(worldX, worldZ)
local player = Client.GetLocalPlayer()
local success, mapX, mapY = player:GetMapXY(worldX, worldZ) --this is line 1556
return mapX, mapY
end<!--QuoteEnd--></div><!--QuoteEEnd-->
As you can see it complains that player is nil, but it should be localplayer. So for some reason the function fails, which would make sense if it was serverside, but this should be running clientside (seeing as I am a client and its Player_Client that errors).
So any ideas why that function would randomly fail?
EDIT:
Also, this seemed to have happened because of the minimap trying to do something when this function glitched, which is odd as iirc I was not trying to look at the minimap.
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Error: lua/Player_Client.lua:1556: attempt to index local 'player' (a nile value)
Lua call stack:
__index [C]:-1
PlayerUI_GetMapXY lua/Player_Client.lua:1556
UpdateIcon lua GUIMinimap.lua:306
Update lua/GUIMinimap.lua:257
Update lua/GUIMinimap.lua:222
lua/Client.lua:354<!--QuoteEnd--></div><!--QuoteEEnd-->
So I looked up the code at Player_Client at line 1556 and this is it (marked out the exact line it errors at)
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->/**
* Converts world coordinates into normalized map coordinates.
*/
function PlayerUI_GetMapXY(worldX, worldZ)
local player = Client.GetLocalPlayer()
local success, mapX, mapY = player:GetMapXY(worldX, worldZ) --this is line 1556
return mapX, mapY
end<!--QuoteEnd--></div><!--QuoteEEnd-->
As you can see it complains that player is nil, but it should be localplayer. So for some reason the function fails, which would make sense if it was serverside, but this should be running clientside (seeing as I am a client and its Player_Client that errors).
So any ideas why that function would randomly fail?
EDIT:
Also, this seemed to have happened because of the minimap trying to do something when this function glitched, which is odd as iirc I was not trying to look at the minimap.
Comments
It should be said that, regardless of this particular issue, because of Lua's dynamic (read: unreliable) nature, the existence of (return-)parameters as well as their validity should be continuously verified at just about every point in the program.
When modding the game I've often seen errors like this as a byproduct of something else going wrong (which can end up breaking calls to player:GetLocalPlayer(). Can you look further up the log file and see if there is any error before that one?
About other errors, I could not realy see any, but we cant scroll the console, so I am not sure (it got repeated several times).