Search the Community
Showing results for tags 'durability'.
-
So, we're trying to make a tool for the player to use, that, when it hits 0% durability, instead of breaking, will go in the player inventory and stay there, unusable until it gets repaired. I'm aware that we'd need to add a repair action, but we're struggling to actually work out how to make this happen. I did find an old thread with some code from w00tydood, but it didn't actually work. Could use a hand here on figuring out how to make this work.
- 17 replies
-
- tool
- durability
-
(and 3 more)
Tagged with:
-
Hello, really really need some help. How do I go about coding a custom item with finite uses? Fueling and perishing works on decay, and health (i think) only works on structures. Basically I have this weapon that I want to be able to be repaired with a moon rock; it shouldn't be destructible and on 0 it shouldn't be usable. Non-craftable as it would be great to just have it be "whetstoned" to good use again when it "dulls". Supposedly it also can chop trees quickly (much like Woody and Lucy chop speed), but would weather the blade quicker. I haven't coded in the speed chopping yet either, i was focusing on the durability thing first. local prefabs = { } local function fn(colour) local function makeobstacle(inst) inst.Physics:SetActive(true) inst._ispathfinding:set(true) end local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_moonRK", "swap_moonRK") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local inst = CreateEntity() inst.entity:AddNetwork() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) anim:SetBank("moonrunekatana") anim:SetBuild("moonrunekatana") anim:PlayAnimation("idle") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("weapon") inst.components.weapon:SetDamage(42.5) inst.components.weapon.attackrange = 0 inst.components.weapon.hitrange = 0 inst:AddComponent("repairable") inst.components.repairable.repairmaterial = "moonrocknugget" inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(150) inst.components.finiteuses:SetUses(150) inst.components.finiteuses:SetConsumption(ACTIONS.CHOP, 4) inst:AddComponent("tool") inst.components.tool:SetAction(ACTIONS.CHOP, 1) inst:AddTag("sharp") inst:AddTag("pointy") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "moonrunekatana" inst.components.inventoryitem.atlasname = "images/inventoryimages/moonrunekatana.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst:AddComponent("inspectable") MakeHauntableLaunch(inst) return inst end return Prefab("common/inventory/moonrunekatana", fn, assets, prefabs) The weapon already works, components for its effects are in place, but I don't really know how to implement this. I've looked into other game files/mod files and in the game, there isn't really anything that acts like this, and the repair tools mod adds an actions.lua which was too much for me to digest without some help. The way some others do it is by repairing the item with another prerequisite item, adding a component.lua that would trigger the repair? Can anyone lead me in the right direction? Thanks.
-
Greetings everyone.So i have one question.Is it possible to create a code that won't allow some(or even any)broken tool or dressing to be used in craft as ingredient?(For example: a broken pickaxe can be used to make a thermal stone.)I created a weapon that requires tentacle spike in craft and i want to be sure that nobody will use broken spike to make this. I really tried a lot but didn't succeed.
-
Hello fellow DST modders, I am in the progress of making a character mod and need some help with the scripting. My problem: One of the character perks is that items have a small chance to instantly break on use (regardless of remaining item durability). I just need a pointer on how to get the and item that the player is currently using and on how to change the durability of the item on use. Thanks a bunch in advance!
- 1 reply
-
- Help
- Character Mod
-
(and 4 more)
Tagged with:
-
For example, recipe of "yellow umbrella" is gold nugget + umbrella. How make durability of new crafted yellow umbrella the same as one of the ingredient (red umbrella)?
- 1 reply
-
- recipe
- durability
-
(and 1 more)
Tagged with:
-
One of my bee mines bugged out when triggered right in the center of my base and it spawned +50 bees which cause a lot of lag, I managed to move some of them to another island but that's not enough, is there any way I could potentially edit my world to delete them (I assume there are values that corespond to mobs present)? I have a back up before that happened but I made very many changes due to the turf update and it will be a pain to redo it all.
-
Hi, I thought the nice would be if you could be cut off from the monsters. I think the barricade is a good idea to secure the base. In my opinion (if one accepts my idea), it should have a level of durability. Here is examples of crafting and picture: Thanks.