DestroyerofNorth Posted August 27, 2015 Share Posted August 27, 2015 I want that my character has more durability with something like pickaxe and that he don't get slowed from piggyback. He allready has a slower movement. Link to comment Share on other sites More sharing options...
Crykov Posted August 27, 2015 Share Posted August 27, 2015 (edited) i can't give you an exact code, but seeing as no one has replied, i'd like to help anyway. i don't know much about modding, but as far as I know there's no way to make a character's walkspeed not change when wearing a piggyback without effecting every piggyback on the server. you could possibly find some sort of script to add to your character.lua that says something along the lines of: "if 'piggyback' is equipped, set speedmult to __" to counteract the walk speed drop. what i'd suggest is copy+pasting the Walking Cane's script onto your character, as it is an equippable item that is capable of changing your speed. how to change it to the piggyback is beyond me, though. also what i'd suggest is giving your character the ability to make a custom pickaxe that only your character can make. you can make a custom item with this tutorial and use the files from an existing pickaxe in dont starve together>data>scripts you can make custom recipes by putting this in character.lua (replace "mycharacter" with your character file's name) inst:AddTag("mycharactercrafter") and then putting this script in modmain.lua under master_postinit, and editing the ingredients and tab to your liking.local customweapon = AddRecipe("customweapon", {Ingredient("itemname", 1), Ingredient("itemname", 1),Ingredient("itemname", 1) }, RECIPETABS.CUSTOMTAB, TECH.NONE, nil, nil, nil, nil, "mycharactercrafter")CUSTOMTAB can be MAGIC, SCIENCE, TOOLS, FOOD, etc. Tech determines the machine you need to prototype it. TECH.NONE means no prototype needed. TECH.SCIENCE_ONE means you need a science machine to make it. TECH.SCIENCE_TWO means you need an alchemy machine to make it. same goes for the magic tab. Edited August 27, 2015 by Crykov Link to comment Share on other sites More sharing options...
DarkXero Posted August 27, 2015 Share Posted August 27, 2015 @DestroyerofNorth:if not GLOBAL.TheNet:GetIsServer() then returnendlocal mychar = "wilson"AddPrefabPostInit("pickaxe", function(inst) local _Use = inst.components.finiteuses.Use inst.components.finiteuses.Use = function(self, num) local owner = self.inst.components.inventoryitem.owner num = (num or 1) if owner and owner.prefab == mychar then num = num / 2 end _Use(self, num) endend)AddPrefabPostInit("piggyback", function(inst) local _onequip = inst.components.equippable.onequipfn local function OnEquip(inst, owner) _onequip(inst, owner) if owner.prefab == mychar then owner.components.locomotor:SetExternalSpeedMultiplier(owner, "StrFix", 1 / GLOBAL.TUNING.PIGGYBACK_SPEED_MULT) end end inst.components.equippable:SetOnEquip(OnEquip) local _onunequip = inst.components.equippable.onunequipfn local function OnUnEquip(inst, owner) _onunequip(inst, owner) if owner.prefab == mychar then owner.components.locomotor:RemoveExternalSpeedMultiplier(owner, "StrFix") end end inst.components.equippable:SetOnUnequip(OnUnEquip)end) Link to comment Share on other sites More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 thx guys @DarkXero what do i need to change to change the uses? Link to comment Share on other sites More sharing options...
DarkXero Posted August 27, 2015 Share Posted August 27, 2015 @DestroyerofNorth:num = num / 2changes the 1 use of the pickaxe into 0.5.So it doubles the durability. Up the 2 to increase the durability, lower the 2 to decrease it. Link to comment Share on other sites More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 thx Link to comment Share on other sites More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 i think i added it wrong do i need to seperate something or all in the sript prefabs? Link to comment Share on other sites More sharing options...
DarkXero Posted August 27, 2015 Share Posted August 27, 2015 That all goes in modmain. Link to comment Share on other sites More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 i think i use the wrong name formy char Link to comment Share on other sites More sharing options...
DarkXero Posted August 27, 2015 Share Posted August 27, 2015 Put the prefab of your char instead of "wilson". Link to comment Share on other sites More sharing options...
DestroyerofNorth Posted August 27, 2015 Author Share Posted August 27, 2015 but what is the prefab of my char the name of the prefab script? Link to comment Share on other sites More sharing options...
DarkXero Posted August 27, 2015 Share Posted August 27, 2015 The prefab of your character is the name you put inreturn MakePlayerCharacter("wx78", ...)there. Link to comment Share on other sites More sharing options...
DestroyerofNorth Posted August 28, 2015 Author Share Posted August 28, 2015 thx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now