Player spawn points are inaccessible (Or nil) through Lua w/o iterator

Flame

WR 102
I'm attempting to access a Player Spawn point using either the "PlayerSpawn" and "MapThingSpawn" hooks, using this and this as a reference.

My code below. It's simple, but the Player Mo's spawnpoint appears to be nil when attempting to access it. It should be returning a userdata value of some kind.

Code:
addHook("PlayerSpawn", function(p)
	if p and p.valid and not p.spectator
	and p.mo and p.mo.valid
		print("Player "+#p+" spawnpoint is "+p.mo.spawnpoint)
	end
end)

The "MapThingSpawn" hook also refuses to print information for the player mobj or the corresponding player spawn point.
 

Attachments

  • srb20127.jpg
    srb20127.jpg
    72.1 KB · Views: 176
Last edited:
MapThingSpawn hook stuff does not trigger for player starts, because players are spawned in a different way to other objects/map things, after everything else in the level has been loaded.
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top