Can characters start at different places in a single map?

Revolution

Member
It is possible to make characters start in a different location on the same level? (Ex: Every character starts at the beginning, Knuckles starts in another room or half-way.) I've heard it's possible to make different characters start on different maps, but it isn't the same in terms of space.
 
It is possible to create skin-specific spawns with the use of Lua by teleporting the character in a PlayerSpawn hook, as well as mapthings for placement in Zone Builder.

This is how you would declare an placeable mapthing for Zone Builder in a Lua script:
Code:
freeslot("MT_KNUCKLESSPAWN")

mobjinfo[MT_KNUCKLESSPAWN] = {
	[I]--$Name "Knuckles Start"
	--$Category "Player Starts"
	--$Sprite EMBMW0[/I]
	doomednum = 4000,
	spawnstate = S_INVISIBLE,
	radius = 16*FRACUNIT,
	height = 16*FRACUNIT,
	flags = MF_NOBLOCKMAP|MF_SCENERY
}
This would be a method to store the placed mapthing for later use:
Code:
local knucklesspawn [I]-- Create variable knucklesspawn[/I]

addHook("MapLoad", do
	for mt in mapthings.iterate
		[I]-- Look for a Knuckles spawn mapthing[/I]
		if mt.type == mobjinfo[MT_KNUCKLESSPAWN].doomednum
			knucklesspawn = mt.mobj [I]-- Store it in the variable[/I]
		end
	end
end)
And this, to teleport the player to their intended spawn.
Code:
addHook("PlayerSpawn", function(player)
	if player.mo.skin == "knuckles" and knucklesspawn [I]-- It's Knuckles![/I]
		P_TeleportMove(player.mo, knucklesspawn.x, knucklesspawn.y, knucklesspawn.z)
	end
end)

In Single Player, the title card would manage to hide the subtle teleportation, but in a netgame players might inevitably notice a single frame of the level's original spawn. Mind that if a variable is used to store the placed spawn, it must make use of the NetVars hook to keep it synched in netgames.
 
Last edited:

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

Back
Top