/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // CONFIGURATION // /////////////////////////////////////////////////////////////////////////// // Set this to the total health. The maximum point- // blank cannon shot will deal 30 damage which will be // deduced from the total health. integer HEALTH = 100; /////////////////////////////////////////////////////////////////////////// // INTERNALS // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 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; } float h; default { state_entry() { h = HEALTH; llSetText("Health: " + wasProgress((integer)(h/HEALTH*100), 10, ["[", "█", "░", "]"]), wasPercentToGradient((integer)(h/HEALTH*100), "rg"), 1); } collision_start(integer num) { h -= llVecMag(llDetectedVel(0)); llSetText("Health: " + wasProgress((integer)(h/HEALTH*100), 10, ["[", "█", "░", "]"]), wasPercentToGradient((integer)(h/HEALTH*100), "rg"), 1); if(h <= 0) state dead; } } state dead { state_entry() { llSetText("☠", <1,0,0>, 1); llSetTimerEvent(1); } timer() { llDie(); } }