Jump to content

[HELP PLS] item changes


Recommended Posts

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 by Crykov
Link to comment
Share on other sites

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...