public override void onDisabled(ShapeBase obj, string lastState) { Player player = obj.getId(); player.setImageTrigger(0, false); GameBaseData item = (((GameBaseData)(player.getMountedImage(Constants.WeaponSlot)))["item"]); if (item.isObject()) { int amount = player.getInventory(item["image.ammo"]); if (amount.AsBool()) { player.Throw(item["image.clip"], 1); } } player.tossPatch(); player.playDeathCry(); player.playDeathAnimation(); //If it's a player check..... GameConnection client = player["client"]; if (client.isObject()) { //todo Remove the console.commandToClient since the default one now shows in the Util class. console.commandToClient(client, console.addTaggedString("toggleVehicleMapToggle"), new[] { "false" }); } //Util._commandToClient(client, "toggleVehicleMap", false.AsString()); int ctov = iGlobal["$CorpseTimeoutValue"]; player.schedule((ctov - 1000).AsString(), "startFade", "1000", "0", "true"); player.schedule(ctov.AsString(), "delete"); }
public override void onDisabled(ShapeBase obj, string lastState) { //console.print("### AI DEAD ###!"); Player npc = obj.ID; Util.cancelAll(npc); ScriptObject aimanager = null; aimanager = npc["aiManager"]; if (!aimanager.isObject()) { console.error("Bad aiManager"); return; } npc.setImageTarget(0, false); SimObject item = ((SimObject)npc.getMountedImage(iGlobal["$WeaponSlot"]))["item"]; if (item.isObject()) { //string item = console.GetVarString(ShapeBase.getMountedImage(npc, WeaponSlot).AsString() + ".item"); if (r.Next(1, 100) > 80) { int amount = npc.getInventory(item["image.ammo"]); if (amount.AsBool()) { npc.Throw(item["image.clip"], 1); } } } npc.tossPatch(); npc.playDeathCry(); npc.playDeathAnimation(); int ctov = 2000; if (AI.lastcount > 0) { AI.spawnAI(aimanager); } npc.schedule((ctov - 1000).AsString(), "startFade", "1000", "0", "true"); Util._schedule("1", "0", "SafeDeleteCallback", npc); }