Jump to content

Recommended Posts

 I am messing around on modding, and me and friends got around some way to make the character change builds via tab, however, we have one character that is assimetrical, which I am currently using the following:

inst:ListenForEvent("locomote", function()
	if inst:HasTag("playerghost") then 
		return 
	end
	if inst.AnimState:GetCurrentFacing() == 2 then 
		inst.AnimState:SetBuild("mychar") -- left animation
	elseif inst.AnimState:GetCurrentFacing() == 0 then 
		inst.AnimState:SetBuild("mychar_right") -- right animation
	end
end)

( thanks aquaterion for the shorter version of the camera mess)

so the idea is to make the whole ability to change the build via the building tab, but find a way to insert the asymmetry, I know where is a way around with hotkeys, but so far I didn't manage to get some good results on this one, what I am doing to perform the build change is the following:

(note the tab part is already done)

local assets =
{
	Asset( "ANIM", "anim/mychar.zip" ),
	Asset( "ANIM", "anim/ghost_mychar_build.zip" ),
	
    Asset("ATLAS", "images/inventoryimages/mychar.xml"),
    Asset("IMAGE", "images/inventoryimages/mychar.tex"),
}

local function onbuilt(inst, builder)

	SetSkinMode(builder.AnimState, "mychar", "mychar", builder.components.skinner:GetClothing(), nil, "mychar")
	inst:Remove()
end

local function fn()
	local inst = CreateEntity()

	inst.entity:AddTransform()

	inst:AddTag("CLASSIFIED")

	inst.persists = false

	inst:DoTaskInTime(0, inst.Remove)

	if not TheWorld.ismastersim then
		return inst
	end
	
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "mychar"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/mychar.xml"

	inst.OnBuiltFn = onbuilt

	return inst
end

return Prefab("mychar", fn, assets)

if anyone has any pointer or idea I would greatly appreciate the help!

 

 

EDIT: It has been resolved, Neutral_Steve helped me out! thanks dude really!

Edited by halfrose
solved
Link to comment
https://forums.kleientertainment.com/forums/topic/71132-help-with-a-mod-issue/
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
×
  • Create New...