Jump to content

DST character / item mod


Recommended Posts

im wanting to make a scythe that allows you to pick things such as saplings, flowers, ect faster than by hand while still showing the swinging animation... if someone could help me or point me to a guide so far this is what i have for the script\prefab\scythe.lua 

local assets=
{ 
    Asset("ANIM", "anim/scythe.zip"),
    Asset("ANIM", "anim/swap_scythe.zip"), 

    Asset("ATLAS", "images/inventoryimages/scythe.xml"),
    Asset("IMAGE", "images/inventoryimages/scythe.tex"),
}

local prefabs = 
{
}

local function fn(colour)

    local function OnEquip(inst, owner) 
        --owner.AnimState:OverrideSymbol("swap_object", "swap_scythe", "purplestaff")
        owner.AnimState:OverrideSymbol("swap_object", "swap_scythe", "scythe")
        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()
    local trans = inst.entity:AddTransform()
    local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    
    anim:SetBank("scythe")
    anim:SetBuild("scythe")
    anim:PlayAnimation("idle")

    inst:AddTag("sharp")

    inst.entity:SetPristine()

    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "scythe"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/scythe.xml"
    
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.AXE_DAMAGE)
		

    return inst
end

STRINGS.NAMES.SCYTHE = "Crowlie's Scythe"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.SCYTHE = "Crowlie's personal scythe!"

return  Prefab("common/inventory/scythe", fn, assets, prefabs)

and for the modmain.lua i just have the prefab and a crafting recipe added

PrefabFiles = {
	"crowlie",
	"crowlie_none",
    "scythe",
}

-- asset stuff inbetween

GLOBAL.RECIPETABS['CROWLIE'] = {str = "CROWLIE", sort=0, icon = "avatar_crowlie.tex", icon_atlas = "images/avatars/avatar_crowlie.xml"}
GLOBAL.STRINGS.TABS.CROWLIE="CROWLIE"

-- local stuff 

-- Adding recipes
AddRecipe("cane", {Ingredient("goldnugget",2), Ingredient("nightmarefuel",1), Ingredient("twigs",4)}, GLOBAL.RECIPETABS.CROWLIE, GLOBAL.TECH.NONE, nil, nil, nil, nil, "crowlie",nil)GLOBAL.STRINGS.RECIPE_DESC.CANE = "Craft a walking cane!"

AddRecipe("nightmarefuel", {Ingredient("butterfly",2), Ingredient("monstermeat",2)}, GLOBAL.RECIPETABS.CROWLIE, GLOBAL.TECH.NONE, nil, nil, nil, nil, "crowlie",nil)GLOBAL.STRINGS.RECIPE_DESC.NIGHTMAREFUEL = "Cook up some delicious food!"

AddRecipe("scythe", {Ingredient("twigs",2), Ingredient("flint",3)}, GLOBAL.RECIPETABS.CROWLIE, GLOBAL.TECH.NONE, nil, nil, nil, nil, "crowlie","images/inventoryimages/scythe.xml")GLOBAL.STRINGS.RECIPE_DESC.SCYTHE = "Craft Crowlie's Scythe!"

everything shows up in game and functions properly as is however i still need to figure out the code to make it do the things i wanted :/ any help whether it be with the coding or directing to guides is heavily appreciated :) 

Edited by lord2clash
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...