/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2012 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// string wasProgress(integer percent, integer length, list symbols) { percent /= (integer)((float)100.0/(length)); string p = llList2String(symbols,0); integer itra = 0; do { if(itra>percent-1) p += llList2String(symbols,2); else p += llList2String(symbols,1); } while(++itra; } integer health = 100; vector color = <0,1,0>; string agent = ""; default { state_entry() { llSetText("Health: " + wasProgress(health, 10, ["[", "█", "░", "]"]), wasPercentToGradient(health, "rg"), 1); llSetTimerEvent(1); } collision_start(integer num) { if(llDetectedType(0) == AGENT) return; if(llDetectedVel(0) == <0,0,0>) return; key detected = llDetectedKey(0); if(detected) agent = llKey2Name(llGetOwnerKey(detected)); health -= 10; llSetText("Health: " + wasProgress(health, 10, ["[", "█", "░", "]"]), wasPercentToGradient(health, "rg"), 1); } timer() { if(health <= 0) { llSetTimerEvent(0); state die; } if(health < 100) ++health; llSetText("Health: " + wasProgress(health, 10, ["[", "█", "░", "]"]), wasPercentToGradient(health, "rg"), 1); } on_rez(integer num) { llResetScript(); } } state die { state_entry() { llSetTimerEvent(1.1-llGetRegionTimeDilation()); integer comChannel = ((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; llRegionSay(comChannel, "kzb:" + agent); } on_rez(integer num) { llResetScript(); } timer() { llRezObject("Zombie", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, 0); llDie(); } }