public void Main() { NWObject container = NWGameObject.OBJECT_SELF; container.DestroyAllInventoryItems(); container.Destroy(); }
public bool Run(params object[] args) { NWObject container = Object.OBJECT_SELF; container.DestroyAllInventoryItems(); container.Destroy(); return(true); }
private static void ProcessCorpse() { SetIsDestroyable(false); NWObject self = _.OBJECT_SELF; if (self.Tag == "spaceship_copy") { return; } Vector3 lootPosition = Vector3(self.Position.X, self.Position.Y, self.Position.Z - 0.11f); Location spawnLocation = Location(self.Area, lootPosition, self.Facing); NWPlaceable container = CreateObject(ObjectType.Placeable, "corpse", spawnLocation); container.SetLocalObject("CORPSE_BODY", self); container.Name = self.Name + "'s Corpse"; container.AssignCommand(() => { TakeGoldFromCreature(self.Gold, self); }); // Dump equipped items in container for (var slot = 0; slot < NumberOfInventorySlots; slot++) { var inventorySlot = (InventorySlot)slot; if (inventorySlot == InventorySlot.CreatureArmor || inventorySlot == InventorySlot.CreatureBite || inventorySlot == InventorySlot.CreatureRight || inventorySlot == InventorySlot.CreatureLeft) { continue; } NWItem item = GetItemInSlot(inventorySlot, self); if (item.IsValid && !item.IsCursed && item.IsDroppable) { NWItem copy = CopyItem(item, container, true); if (inventorySlot == InventorySlot.Head || inventorySlot == InventorySlot.Chest) { copy.SetLocalObject("CORPSE_ITEM_COPY", item); } else { item.Destroy(); } } } foreach (var item in self.InventoryItems) { if (item.IsValid && !item.IsCursed && item.IsDroppable) { CopyItem(item, container, true); item.Destroy(); } } DelayCommand(300.0f, () => { if (!container.IsValid) { return; } NWObject body = container.GetLocalObject("CORPSE_BODY"); body.AssignCommand(() => SetIsDestroyable(true)); body.DestroyAllInventoryItems(); body.Destroy(); container.DestroyAllInventoryItems(); container.Destroy(); }); }
private static void ProcessCorpse() { SetIsDestroyable(FALSE); NWObject self = NWGameObject.OBJECT_SELF; if (self.Tag == "spaceship_copy") { return; } Vector lootPosition = Vector(self.Position.m_X, self.Position.m_Y, self.Position.m_Z - 0.11f); Location spawnLocation = Location(self.Area, lootPosition, self.Facing); NWPlaceable container = CreateObject(OBJECT_TYPE_PLACEABLE, "corpse", spawnLocation); container.SetLocalObject("CORPSE_BODY", self); container.Name = self.Name + "'s Corpse"; container.AssignCommand(() => { TakeGoldFromCreature(self.Gold, self); }); // Dump equipped items in container for (int slot = 0; slot < NUM_INVENTORY_SLOTS; slot++) { if (slot == INVENTORY_SLOT_CARMOUR || slot == INVENTORY_SLOT_CWEAPON_B || slot == INVENTORY_SLOT_CWEAPON_L || slot == INVENTORY_SLOT_CWEAPON_R) { continue; } NWItem item = GetItemInSlot(slot, self); if (item.IsValid && !item.IsCursed && item.IsDroppable) { NWItem copy = CopyItem(item, container, TRUE); if (slot == INVENTORY_SLOT_HEAD || slot == INVENTORY_SLOT_CHEST) { copy.SetLocalObject("CORPSE_ITEM_COPY", item); } else { item.Destroy(); } } } foreach (var item in self.InventoryItems) { CopyItem(item, container, TRUE); item.Destroy(); } DelayCommand(360.0f, () => { if (!container.IsValid) { return; } NWObject body = container.GetLocalObject("CORPSE_BODY"); body.AssignCommand(() => SetIsDestroyable(TRUE)); body.DestroyAllInventoryItems(); body.Destroy(); container.DestroyAllInventoryItems(); container.Destroy(); }); }