include library.buff; include library.trial; include library.utils; trigger OnAttach() { detachScript(self, "systems.combat.credit_for_kills"); dictionary dict = new dictionary(); dict.put("degrade", 0); messageTo(self, "destroyDecoy", null, 8.0f, false); return SCRIPT_CONTINUE; } trigger OnAboutToLoseItem(obj_id destContainer, obj_id transferer, obj_id item) { return SCRIPT_OVERRIDE; } trigger OnIncapacitated(obj_id killer) { messageTo(self, "handleDecoyCleanup", null, 2.0f, false); return SCRIPT_CONTINUE; } trigger OnCreatureDamaged(obj_id attacker, obj_id weapon, int[] damage) { if (pvpCanAttack(self, attacker) && isFlanking(self)) { buff.applyBuff(attacker, "sp_decoy_debuff"); } return SCRIPT_CONTINUE; } messageHandler destroyDecoy() { int stage = params.getInt("degrade"); switch(stage) { case 0: setHologramType(self, HOLOGRAM_TYPE1_QUALITY4); break; case 1: setCreatureCoverVisibility(self, false); kill(self); messageTo(self, "handleDecoyCleanup",null, 2.0f, false); return SCRIPT_CONTINUE; } stage++; params.put("degrade", stage); messageTo(self, "destroyDecoy", params, 2.0f, false); return SCRIPT_CONTINUE; } boolean isFlanking(obj_id self) { return utils.getBooleanScriptVar(self, "flank"); } trigger OnObjectMenuRequest(obj_id player, menu_info mi) { mi.addRootMenu(menu_info_types.ITEM_USE, new string_id("spam", "decoy_start_trade")); mi.addRootMenu(menu_info_types.ELEVATOR_UP, new string_id("spam", "decoy_character_sheet")); mi.addRootMenu(menu_info_types.ELEVATOR_DOWN, new string_id("spam", "invite_to_group")); return SCRIPT_CONTINUE; } messageHandler handleDecoyCleanup() { obj_id[] haters = getHateList(self); if (haters != null || haters.length > 0) { for(int i=0;i