Health Drain Event - Pico8430/PsychEngineScriptsIUse GitHub Wiki

Ah yes, health drain, that event when an opponent sings, drains the health of the player. How does this script and event work, you may ask.

File directory

Event info

  1. HealthDrain.lua

This file makes it so that the Event can run properly as expected. (Code needed)

  1. HealthDrain.txt

This file contains the text that is going to appear when the event is selected on the Chart Editor.

  1. Values

Values on here are very important for an event to work correctly.

Value 1 = How much health to drain when opponent sings (0.5 is recommended)

Value 2 = How much health to stop draining health (0.01 recommended)

Code

function onEvent(name, value1, value2)

function opponentNoteHit(id, noteData, noteType, isSustainNote)
	if getProperty('health') > (value2 / 50) and getProperty('health') < (value1 / 50) then -- Health is from 0 to 2, so dividing the value by 50 allow to just turn it into percentage easly
		setProperty('health', (value2 / 50))
	else if  getProperty('health') > (value2 / 50) and getProperty('health') > (value1 / 50) then
		setProperty('health', getProperty('health')-(value1 / 50))
	end
	end
end

end

Do not

Change something on the code

Put the value 2 on blank

Overuse it (seriously)