Page 1 of 1

playerRevive.lua - bon3l

Posted: Tue Apr 01, 2025 6:09 pm
by bonel_
GOOD EVENING, FRIENDS!

I made a new script that revives the player when killed. What's the use for this? If you have a semi-scripted sequence, such as a level where you don't want the player to EXPLODE AND DIE for lore reasons (which is the reason I created this script), then you can just plop the files into your level folder and voila! You can no longer DIE!!!

Tip: When creating pits, make them extend 3 blocks below the bottom of the level with a base and walls to prevent the player from falling infinitely.

Video Demo:


That should be all.
Here's your downloads:
Without player death effect: https://www.mediafire.com/file/9majji5f ... ve.7z/file
With player death effect: https://www.mediafire.com/file/157grafy ... .1.7z/file

Re: playerRevive.lua - bon3l

Posted: Wed Apr 02, 2025 1:13 am
by madman
this is great, you could base entire levels (especially kaizo and puzzles) around having to kill yourself on purpose to get that extra boost from reviving

Re: playerRevive.lua - bon3l

Posted: Sun Apr 20, 2025 8:53 pm
by AlphaBlue1011
Tested this out in a level pack I'm working on, and I can confirm that it works just fine if you use an event to activate the script.
Simply put all the code in the luna.lua that comes with the revive script into an onEvent function in your level's luna.lua, which should look something like this:

Code: Select all

function onEvent(eventName)
	if eventName == "[eventnamehere]" then
		local playerRevive = require("playerRevive")
		function onPlayerKill(eventToken)
			player.deathTimer = 1
			eventToken.cancelled = true
		end
	end
end
I personally made this get triggered by an axe that I changed to look like a Totem of Undying from Minecraft, but I'm sure there's other ways to use it with an event.

Re: playerRevive.lua - bon3l

Posted: Mon Apr 21, 2025 5:18 pm
by Bboyfergie
This is a really cool idea. Would it be possible to make it still take away a life, and maybe still get a game over if there are no lives left?

Re: playerRevive.lua - bon3l

Posted: Tue May 06, 2025 4:35 pm
by bonel_
Bboyfergie wrote:
Mon Apr 21, 2025 5:18 pm
This is a really cool idea. Would it be possible to make it still take away a life, and maybe still get a game over if there are no lives left?
Yeah; in the code that handles the onPlayerKill function, I'm pretty sure you can add a line that does that. I think it requires memory address editing, and I'm not sure what hex it is, so I'd consult the docs for that (docs.codehaus.moe)