Quote: "This is a great script to have, thanks!
One issue I am having is it keeps saying the medic station is empty. I kept changing the capacity but nothing works. Any suggestions? "
updated the script so it'll work correctly for you now
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player can increase his HP on a Medicstation like in Half Life
-- State to ensure user must release E key before can use again
pressed = 0
-- State that symbolizes the capacity of the medicstation
capacity = 10
function medicstation_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if PlayerDist < 120 then
-- Showing text
if capacity > 0 then
Prompt("Press E to use medic station");
else
Prompt("The Medic station is empty");
end
if g_KeyPressE == 1 then
if pressed == 0 then
-- Medicstation empty
if capacity == 0 then
PlaySound1(e);
end
-- Medicstation has supplies
if capacity > 0 then
PlaySound0(e);
AddPlayerHealth(e);
capacity = capacity - 1;
end
-- end player input reset
end
pressed = 1
-- end player input
end
-- End of PlayerDist condition
end
-- Detect if player push the E key
if g_KeyPressE == 0 then
pressed = 0;
end
-- End function
end
life's one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11