Tried this out. Seems to transfer the condition of a weapon just fine, but all the weapon attachments get repaired. Also, fuel in candle hats / miner hats disappears. I copied some of the weapon mod code to save item.contents and this worked on hats but only transferred one fuel. The rest of the fuel disappeared. Anyone know how do deal with the fuel quantity?
-EDIT: I got fuel quantity working.
Run the loop that copies weapon mods on all items with item.contents. To transfer the fuel quantity, do:
item.contents.AddItem(BuildItem(mod).info, mod.amount);
Really simple, 'mod.amount' used to be a hard-coded 1.
Still can't get weapon mod durability to transfer.
Also, anyone know how to preserve hotbar positions? I want my item in slot 1 to stay in slot 1.
RestoreUponDeath
Moved
Total Downloads: 1,396 - First Release: Apr 21, 2016 - Last Update: Jun 11, 2018
- 5/5, 12 likes
-
is it possible to create a command to restore the inventory?
-
Something like this perhaps. You would also have to get rid of the OnPlayerRespawned hook.
Code:[Command("restoremystuff")] void TestCommand(IPlayer player, string command, string[] args) { RestoreInventory(player); }
-
k1lly0u updated Restore Upon Death with a new update entry:
0.2.0
-
can you make things not come back in case of suicide, but return in case of other deaths?
-
-
Hey k1lly0u, there are a couple of pieces of data missing from restored items. Names of player skulls, note text, max condition, and the dataint that lines keys up with locks. I've been playing around with a local version of your plugin, but tailored to my own needs.
Here's what I'm using to save items. It's a mix of your plugin before the re-write. and the Backpacks plugin. Different but it shows the omitted data. As far as I know it saves everything relevant.
Code:private SavedItem ProcessItem(Item item, int container = 0) { SavedItem x = new SavedItem(); x.shortname = item.info?.shortname; x.itemid = item.info.itemid; x.container = container; x.position = item.position; x.amount = item.amount; x.ammoamount = item.GetHeldEntity()?.GetComponent<BaseProjectile>()?.primaryMagazine?.contents ?? 0; x.ammotype = item.GetHeldEntity()?.GetComponent<BaseProjectile>()?.primaryMagazine?.ammoType?.itemid ?? 0; x.fuel = item.fuel; x.flamefuel = item.GetHeldEntity()?.GetComponent<FlameThrower>()?.ammo ?? 0; x.dataint = item.instanceData?.dataInt ?? 0; x.skinid = item.skin; x.name = item.name; x.text = item.text; x.condition = item.condition; x.maxcondition = item.maxCondition; x.isblueprint = item.IsBlueprint(); x.blueprinttarget = item.blueprintTarget; x.contents = item.contents?.itemList?.Select(ProcessItem).ToList(); return x; }
-
Is it possible to make it so that the inventory is saved on a command, instead of on player death?
-
Unable to equip any form of clothing after using this plugin, not sure why - unloading does nothing, restart does nothing
-
I do not know if it is the plugin or rust update but many items are not restored when on dies .... M249, hammer for example.
admin auth lvl 2 and using permission: restoreupondeath.admin
@Pro Noob: Inventory GuardianLast edited by a moderator: Jun 23, 2018 -
This should work for what I need, thanks! -
i dont think players are spawning with there items percentage is 0 but when i die i get my items
-
Can confirm this isn't working anymore.
Running latest version of oxide as of this post.
[Oxide] 19:10
[Info] Protocol: 2099.165.1
Build Date: 07/08/2018 08:39:11
Unity Version: 2018.1.0f2
Changeset: 27612
Branch: release
Oxide.Rust Version: 2.0.3999 -
Nevermind, works again after latest rust/oxide updates
-
Hello
with the use of your plugin, the object / weapon that we have in our hands when we die disappears completely ...
By disabling the plugin, we find the object / weapon on the ground close to the body
Oxide.Rust 2.0.4007 -
-
where im wrong so
Code:{ "Give default items upon respawn if the players is having items restored": true, "Can drop active item on death": false, "Percentage of total items lost (Permission Name | Percentage)": { "restoreupondeath.default": { "Belt": 100.0, "Wear": 100.0, "Main": 100.0 }, "restoreupondeath.beltonly": { "Belt": 100.0, "Wear": 100.0, "Main": 100.0 }, "restoreupondeath.admin": { "Belt": 0.0, "Wear": 0.0, "Main": 0.0 } }, "Version": { "Major": 0, "Minor": 2, "Patch": 0 } }
-
It's in the config, read the config and overview
-
Why is stuff not restored when killed by a npc, animal or environment?
-