//------------------------------------------------ // Include //------------------------------------------------ include library.utils; //------------------------------------------------ // OnAttribModDone //------------------------------------------------ trigger OnAttribModDone(string modName, boolean isDead) { // Retrieve active spice name string name = utils.getStringScriptVar(self, "spice.name"); if (modName.startsWith("spice."+name)) { // Get spice data int[] mods = utils.getIntArrayScriptVar(self, "spice.mods"); int dur = utils.getIntScriptVar(self, "spice.duration"); float downTimeReduction = utils.getFloatScriptVar(self, "spice.downTimeReduction"); if (modName.endsWith(".up")) { // Calculate duration of downer dur = (dur / 3); if (downTimeReduction > 0) dur *= downTimeReduction; // Apply downer boolean buffIcon = false; for (int i = 0; i < mods.length; i++) { if (mods[i] != 0) { int val = mods[i]; if (val > 0) val *= -1; attrib_mod newMod; if (!buffIcon) { newMod = new attrib_mod("spice."+name+".down", i, val, dur, 0, 0, false, true, true); buffIcon = true; } else { newMod = new attrib_mod(null, i, val, dur, 0, 0, false, false, false); } addAttribModifier(self, newMod); } } // Chance we get sick. int puketime = 30 + rand( 0, 30 ); messageTo( self, "spicePuke", null, puketime, false ); // Send the downer message. string_id cmsg = new string_id( "spice/spice", name + "_downer" ); sendSystemMessage( self, cmsg ); } else { // Send the done message. string_id cmsg = new string_id( "spice/spice", name + "_done" ); sendSystemMessage( self, cmsg ); // Stop vomiting. utils.setScriptVar( self, "numPukes", 100 ); // Clear spice data utils.removeScriptVarTree(self, "spice"); // Remove this script. detachScript( self, "player.player_spice" ); } } return SCRIPT_CONTINUE; } //------------------------------------------------ // spicePuke //------------------------------------------------ messageHandler spicePuke() { if (!hasAttribModifier(self, "spice")) return SCRIPT_CONTINUE; queueCommand( self, ##"social", null, "puke", COMMAND_PRIORITY_DEFAULT ); // Continue to vomit, but limit it to about 5 times. int numPukes = 0; if ( utils.hasScriptVar( self, "numPukes" ) ) numPukes = utils.getIntScriptVar( self, "numPukes" ); if ( numPukes < 5 ) { // Puke again. int puketime = 40 + rand( 0, 30 ); messageTo( self, "spicePuke", null, puketime, false ); numPukes++; utils.setScriptVar( self, "numPukes", numPukes ); } return SCRIPT_CONTINUE; }