Jump to content

Recommended Posts

Hello, I have a question :).

So, I have a item which I want to change it's animstate to

" owner.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai") "

then when the owner's not in dig state the animstate changes back to

" owner.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai") "

would anyone know how to do that? Because I don't :(...

I would really appreciate some help :D!!! 

Edited by SuperDavid

Well I tried something like this

local function OnDig(inst, owner) 
owner.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai")
owner.AnimState:Show("ARM_carry") 
owner.AnimState:Hide("ARM_normal")
owner:DoTaskInTime(2, function()
owner.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai")
end)
end

local function fn(colour)
inst:ListenForEvent("ACTIONS.DIG", OnDig)
end

and nothing happened, not even a crash :wilsondisappointed:.

local function OnNewState(inst, data)
	local using_kunai = inst.replica.inventory:EquipHasTag("kunai")
	if using_kunai then
		local statename = data and data.statename
		if statename == "dig_start" or statename == "dig" then
			inst.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai")
		else
			inst.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai")
		end
	end
end

local function KunaiFix(inst)
	inst:ListenForEvent("newstate", OnNewState)
end

AddPlayerPostInit(KunaiFix)

And add the "kunai" tag to your custom shovel item.

1 hour ago, DarkXero said:

local function OnNewState(inst, data)
	local using_kunai = inst.replica.inventory:EquipHasTag("kunai")
	if using_kunai then
		local statename = data and data.statename
		if statename == "dig_start" or statename == "dig" then
			inst.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai")
		else
			inst.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai")
		end
	end
end

local function KunaiFix(inst)
	inst:ListenForEvent("newstate", OnNewState)
end

AddPlayerPostInit(KunaiFix)

And add the "kunai" tag to your custom shovel item.

Thanks so much :D!!! I'm just sorry but can you tell me where to put the codes, i'm dumb hahaha :D....

Huh.

local function OnNewState(inst, data)
	local using_kunai = inst.replica.inventory and inst.replica.inventory:EquipHasTag("kunai")
	if using_kunai then
		local statename = data and data.statename
		if statename == "dig_start" or statename == "dig" then
			inst.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai")
		else
			inst.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai")
		end
	end
end

local function KunaiFix(inst)
	inst:ListenForEvent("newstate", OnNewState)
end

AddPlayerPostInit(KunaiFix)

I forgot that happened.

Use this instead.

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...