Jump to content

Recommended Posts

Here's my issue. I'm currently making custom characters for my wife and I as we love playing this game together. I've based her character off wheeler as she has the dodge function, I've got everything how I want it except I want her character and only her character to get more use out of sewing kits, I pinched the attached from another mod and threw it in her characters "modmain.lua" and it works perfectly except for the fact it gives anyone in the server the same upgraded repair ability 

If anyone could help me with getting this to work exclusively for her it would be greatly appreciated,

Thanks in advance.

 

local function DoSewing(self, target, doer)

    if target:HasTag("needssewing") then
        
        target.components.fueled:SetPercent(1)

        if self.inst.components.finiteuses then
            self.inst.components.finiteuses:Use(0.05)
        end

        if self.onsewn then
            self.onsewn(self.inst, target, doer)
        end

        return true
    end

end

local function SewingPostInit(self)
    if not GLOBAL.TheWorld.ismastersim then
        return
    end
    
    self.DoSewing = DoSewing
end

AddComponentPostInit("sewing", SewingPostInit)

Hi. I see this post is about week old and nobody bothered to answer your call for help. So here I am.

Try to modify the first function just like that:

local function DoSewing(inst, self, target, doer)

    if target:HasTag("needssewing") and inst:HasTag("tailor") then
        
        target.components.fueled:SetPercent(1)

        if self.inst.components.finiteuses then
            self.inst.components.finiteuses:Use(0.05)
        end

        if self.onsewn then
            self.onsewn(self.inst, target, doer)
        end

        return true
    end

end

This part

Quote

inst:HasTag("tailor")

requires you to add tag "tailor" or whatever you like into [character's.name].lua

local common_postinit = function(inst) 
	inst:AddTag("tailor")
end

I think it should work now, but I am not 100% sure. Testing this idea was quite time consuming.

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
×
  • Create New...