rons0n

  • Content Count

    433
  • Joined

  • Last visited

 Content Type 

Profiles

Forums

Downloads

Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Posts posted by rons0n


  1. Derp:

    AddComponentPostInit("crop", function(self)
        local old = self.Fertilize
        function self:Fertilize(fertilizer)
            local pt = self.inst:GetPosition()
            local ents = GLOBAL.TheSim:FindEntities(pt.x, pt.y, pt.z, 5, {"player", "greenthumb"}, {"playerghost"})
            if #ents > 0 then
                self.growthpercent = self.growthpercent + fertilizer.components.fertilizer.fertilizervalue * self.rate
                self.inst.AnimState:SetPercent("grow", self.growthpercent)
                if self.growthpercent >=1 then
                    self.inst.AnimState:PlayAnimation("grow_pst")
                    self:Mature()
                    self.task:Cancel()
                    self.task = nil
                end
                if (fertilizer.components.stackable ~= nil) then
                    fertilizer.components.stackable:Get(1):Remove()
                end
    			if (fertilizer.components.finiteuses ~=nil) then
    				fertilizer.components.finiteuses:Use(1)
    			end
                return true
            else
                return old(self, fertilizer)
            end
        end
    end)

    It was obvious but im a dumb boi, for anyone else who needs it here you go


  2. Yeah I already know mods do this, but I tried it out with my custom fertilizer and normal fertilizer and it doesnt reduce the uses after adding it into the farmplots.

    So can someone help me edit this:

    AddComponentPostInit("crop", function(self)
        local old = self.Fertilize
        function self:Fertilize(fertilizer)
            local pt = self.inst:GetPosition()
            local ents = GLOBAL.TheSim:FindEntities(pt.x, pt.y, pt.z, 5, {"player", "greenthumb"}, {"playerghost"})
            if #ents > 0 then
                self.growthpercent = self.growthpercent + fertilizer.components.fertilizer.fertilizervalue * self.rate
                self.inst.AnimState:SetPercent("grow", self.growthpercent)
                if self.growthpercent >=1 then
                    self.inst.AnimState:PlayAnimation("grow_pst")
                    self:Mature()
                    self.task:Cancel()
                    self.task = nil
                end
                if (fertilizer.components.stackable ~= nil) then
                    fertilizer.components.stackable:Get(1):Remove()
                end
                return true
            else
                return old(self, fertilizer)
            end
        end
    end)

     

    So it consumes the uses each time I use my fertilizers. Thanks!


  3. Most things i extract with ktools comes with ease, except for this dang thing.

    While it did extract succesfully(I used whip and swap_whip for extraction) my prefab file just refuses to work correctly.

    Holding the whip is invisible, attacking with the whip uses the default whip sprites, the inventoryimage refuses to show in the inventory

    Is it something I did wrong at extraction or is my lua file at fault here? 

    (or if alternatively, if you guys have a spare whip.lua and exported whip files that actually work can you send it my way, thanks.)

    Edit: Updated the file, now the inventoryimages work but me holding the weapon is invisible and still uses the default whip sprites when attacking. Im completely stump.

    local assets =
    {
        Asset("ANIM", "anim/ocsayakawhip.zip"),
        Asset("ANIM", "anim/swap_ocsayakawhip.zip"),
    	
        Asset("ATLAS", "images/inventoryimages/ocsayakawhip.xml"),
        Asset("IMAGE", "images/inventoryimages/ocsayakawhip.tex"),
    }
    
    local function onequip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_object", "ocsayakaswap_whip", "ocsayakaswap_whip")
        owner.AnimState:OverrideSymbol("ocsayakawhipline", "ocsayakaswap_whip", "ocsayakawhipline")
        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 function supercrack(inst)
        local x,y,z = inst.Transform:GetWorldPosition()
        local ents = TheSim:FindEntities(x,y,z, TUNING.WHIP_SUPERCRACK_RANGE, { "_combat" }, { "player", "epic", "shadow", "shadowminion", "shadowchesspiece" })
        for i,v in ipairs(ents) do
            if v.components.combat:HasTarget() then
                v.components.combat:DropTarget()
                if v.sg ~= nil and v.sg:HasState("hit")
                    and v.components.health ~= nil and not v.components.health:IsDead()
                    and not v.sg:HasStateTag("transform")
                    and not v.sg:HasStateTag("nointerrupt")
                    and not v.sg:HasStateTag("frozen")
                    --and not v.sg:HasStateTag("attack")
                    --and not v.sg:HasStateTag("busy")
                    then
    
                    if v.components.sleeper ~= nil then
                        v.components.sleeper:WakeUp()
                    end
                    v.sg:GoToState("hit")
                end
            end
        end
    end
    
    local function onattack(inst, attacker, target)
        if target ~= nil and target:IsValid() then
            local chance =
                (target:HasTag("epic") and TUNING.WHIP_SUPERCRACK_EPIC_CHANCE) or
                (target:HasTag("monster") and TUNING.WHIP_SUPERCRACK_MONSTER_CHANCE) or
                TUNING.WHIP_SUPERCRACK_CREATURE_CHANCE
    
            local snap = SpawnPrefab("impact")
    
            local x, y, z = inst.Transform:GetWorldPosition()
            local x1, y1, z1 = target.Transform:GetWorldPosition()
            local angle = -math.atan2(z1 - z, x1 - x)
            snap.Transform:SetPosition(x1, y1, z1)
            snap.Transform:SetRotation(angle * RADIANS)
    
            --impact sounds normally play through comabt component on the target
            --ocsayakawhip has additional impact sounds logic, which we'll just add here
    
            if math.random() < chance then
                snap.Transform:SetScale(3, 3, 3)
                if target.SoundEmitter ~= nil then
                    target.SoundEmitter:PlaySound("dontstarve/common/whip_large")
                end
                inst:DoTaskInTime(0, supercrack)
            elseif target.SoundEmitter ~= nil then
                target.SoundEmitter:PlaySound("dontstarve/common/whip_small")
            end
        end
    end
    
    local function fn()
        local inst = CreateEntity()
    
        inst.entity:AddTransform()
        inst.entity:AddAnimState()
        inst.entity:AddNetwork()
    
        MakeInventoryPhysics(inst)
    
        inst.AnimState:SetBank("ocsayakawhip")
        inst.AnimState:SetBuild("ocsayakawhip")
        inst.AnimState:PlayAnimation("idle")
    
        inst:AddTag("whip")
    
        inst.entity:SetPristine()
    
        if not TheWorld.ismastersim then
            return inst
        end
    	
        inst:AddComponent("inventoryitem")
        inst.components.inventoryitem.imagename = "ocsayakawhip"
        inst.components.inventoryitem.atlasname = "images/inventoryimages/ocsayakawhip.xml"
    
        inst:AddComponent("weapon")
        inst.components.weapon:SetDamage(40)
        inst.components.weapon:SetRange(TUNING.WHIP_RANGE * 1.25)
        inst.components.weapon:SetOnAttack(onattack)
    
        inst:AddComponent("finiteuses")
        inst.components.finiteuses:SetMaxUses(150)
        inst.components.finiteuses:SetUses(150)
        inst.components.finiteuses:SetOnFinished(inst.Remove)
    
        inst:AddComponent("inspectable")
    
        inst:AddComponent("equippable")
        inst.components.equippable:SetOnEquip(onequip)
        inst.components.equippable:SetOnUnequip(onunequip)
    
        MakeHauntableLaunch(inst)
    
        return inst
    end
    
    STRINGS.NAMES.OCSAYAKAWHIP = "Sayaka's Whip"
    STRINGS.CHARACTERS.GENERIC.DESCRIBE.OCSAYAKAWHIP = "This will hurt."
    
    return Prefab("ocsayakawhip", fn, assets)

     


  4. So i'm trying to make it so when my character kills any creature, the creature drops the item. Sort of like adding one more additional item into its drop table

    I believe some mods do this but most of them are in Chinese and their mod layout is very different from the standard one.

    If there's a mod out there that does this in the workshop, can you redirect me to it? Thanks


  5. One of my characters can give players sanity by doing emotes in general but I wanted it to be more specific this time. Specifically, the sitting emote and over time(like 5 sanity per second while sitting), how would I approach that? Much thanks to anyone who chimes in!

    Heres what I have initially:

        inst:ListenForEvent("emote", function(inst, data)
            if inst:HasTag("cheery") then
                inst.components.sanity:DoDelta(15)
                inst.components.hunger:DoDelta(-15)
    
                for k, v in pairs(AllPlayers) do
                    if v ~= inst and v:IsNear(inst, 16) and v.components.sanity then
                        v.components.sanity:DoDelta(15)
                    end
                end
            end
        end)


  6. Well if you're fine with changing each individual recipe:

    Quote

    STRINGS = GLOBAL.STRINGS
    RECIPETABS = GLOBAL.RECIPETABS
    Recipe = GLOBAL.Recipe
    Ingredient = GLOBAL.Ingredient
    TECH = GLOBAL.TECH
    Recipe("researchlab", {Ingredient("log", 6),Ingredient("nitre", 4),Ingredient("goldnugget", 4),Ingredient("silk", 2)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer")

    Is an example. This applies to all characters


  7. I did this for my issabelle mod that makes it drop fruits from various trees:

    --Tree Test
    --Add resources from trees
    
    function EvergreenPostInit(inst)    
    if GLOBAL.TheWorld.ismastersim then local oldonfinish = inst.components.workable.onfinish
    		inst.components.workable.onfinish = function(inst, chopper)            
    		if chopper then 
    		inst.components.lootdropper:AddChanceLoot("acapple", 0.1)
    		inst.components.lootdropper:AddChanceLoot("accherry", 0.1)
    		inst.components.lootdropper:AddChanceLoot("acpear", 0.1)
    		inst.components.lootdropper:AddChanceLoot("acpeach", 0.1)
    		inst.components.lootdropper:AddChanceLoot("acorange", 0.1)         
    	end            
    		oldonfinish(inst, chopper)        
    			end    
    		end
    	return inst
    end 
    
    local trees = {"evergreen", 
    	"evergreen_normal", 
    	"evergreen_tall", 
    	"evergreen_short", 
    	"evergreen_sparse",
    	"evergreen_sparse_normal", 
    	"evergreen_sparse_tall", 
    	"evergreen_sparse_short",
    	"deciduoustree",
    	"deciduoustree_normal",
    	"deciduoustree_tall",
    	"deciduoustree_short",
    	"twiggytree",
    	"twiggy_tall",
    	"twiggy_normal",
    	"twiggy_short"} for k,v in pairs(trees) do AddPrefabPostInit(v, EvergreenPostInit)
    end
    
    --End tree test

    just take out all the unwanted trees u dont want and it should work


  8. I honestly don't know how to approach this. Browsing through past topics i found one way was to make an exact same prefab with a different name that can be crafted. While this method does work it completely ignores skins which I definitely want. 

    Another method was trying to mimic the green amulet but unfortunately ive only found ways to reducing an entire tab's worth of items rather than a specific item itself. 

    And lastly changing the recipe directly. Obviously this works but if i remember correctly, if i made it character specific then the original recipe of the item becomes unavailable and uncraftable. 

    To be frank, I just want log armor to be cheaper for this character alone. Any ideas?


  9. So my character is just well known for having horrible luck but i cant think of anything that counts as bad luck in DST?

    I just need a brainstorm of all unlucky things that can happen in dst and see If I can code that in or not. 

    Feel free to brainstorm away If you wish to contribute cause honestly my brain is churning nothing


  10. Thanks a million David. It worked!

    It's a rather simple mod but I appreciate the help you've done. I'll give my thanks!

    Edit: Voila and its done!

    Simple build switcher with the official characters. So enjoy playing as Wickerbottom but with the appearence of Wendy!(Or any other character for that matter)

    http://steamcommunity.com/sharedfiles/filedetails/?id=1229049473&searchtext=