Game goes black

FehaFeha Join Date: 2006-11-16 Member: 58633Members
edited February 2011 in Modding
<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.

Comments

  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    This happens to me almost always after a game completion. At the moment, players are constantly shifted around in the player-table, as there are many events that trigger destruction-and-reinitialization of players (causing their position in the table to fluctuate). One of these events is a team-change, such as during an end-game (Marine\Aliens -> ReadyRoom). Perhaps the client tries to retrieve data while the server is in between destroying the old player-data and recreating a new one (causing the old index to be invalid, and the new index to be elsewhere). Mind you, this is just a complete stab in the dark. I've had a fair share of headaches regarding the wonky way players are currently managed.

    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.
  • MCMLXXXIVMCMLXXXIV Join Date: 2010-04-14 Member: 71400Members
    edited February 2011
    EDIT: wrote this before reading player's post. May or may not be relevant!

    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?
  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    Although this isn't the same issue it might be similar (player's post about the tables shifting around a lot and accessing incorrect information at times reminded me). When I try to get a steamid on player disconnect (in Gamerules.lua) it's returning 0. I'm guessing the data has been removed by this point but the other information such as name is still there??
  • FehaFeha Join Date: 2006-11-16 Member: 58633Members
    I think that the idea about game finish being responsible seems like a very likely thing, seeing as it seemed like we won right as it happened.

    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).
Sign In or Register to comment.