Jump to content

Recommended Posts

I've been trying to fix a mod of mine, and the playable character it adds in is a Deerclops, it orginally worked a few updates ago, but it seems using SetBuild no longer works, so the character no longer appears.  Did something change in the last few updates surrounding this, or is this a bug?

Link to comment
https://forums.kleientertainment.com/forums/topic/52269-setbuild-issue/
Share on other sites

Maybe this is skin related?

I tried with the spider but I got Wilson's floating eyes stuck in 6 floating limbs.

 

Hmm, I'm not really sure...  From what I can tell, it should work, and the characters do have their gameplay functionality, but they just aren't appearing right/appearing at all.

 

I suppose desperate times calls for desperate measures, since I want to fix those mods and try to see how Deerclops vs. Survivors would work.  Anyways, @PeterA,  do you know if anything with the new skin system had anything to do with this?

Edited by Mario384

Mod is here: http://forums.kleientertainment.com/files/file/1105-dst-playable-deerclops/

 

I'm in the RoG branch, I tried using SetBank("deerclops") then SetBuild("deerclops_build") in realtime in console and I went invisible.

However, using ThePlayer.AnimState:SetBuild("wx78"), for example, works.

 

Using ThePlayer.AnimState:SetBuild("deerclops_build") without switching bank also yields no effect.

ThePlayer.AnimState:SetBank("deerclops")

ThePlayer.AnimState:SetBuild("deerclops_build")

ThePlayer:SetStateGraph("SGDeerclops")

 

in succession in console does the trick. :-)

 

However, calling them in that order in AddPlayerPostInit or in a character prefab will result in an invisible entity that has the deerclops stategraph.

 

If you run these three in AddPlayerPostInit or AddPrefabPostInit, then when you make ThePlayer.AnimState:SetBuild("deerclops_build"), you don't have to set bank or stategraph.

Edited by DarkXero
  • Developer

@Mario384 and @DarkXero, you are correct that it's changes to the skin code that is causing a problem here. There are a couple of options to fix this. The first is to copy the builds that you want to use into your mod and make sure that the prefab name matches the build name. Currently the Build gets set to the prefab name if no skin is set.

 

The other option is to change your master_postinit to have the following

inst.OnSetSkin = function(skin_name)	inst.AnimState:SetBuild("deerclops_build")end

Thanks for letting us know about this issue. It's something we'll have to look into further.

Nice, thanks, @PeterA, @bizziboi.

 

Can confirm that works.

 

For future reference:

AddPlayerPostInit(function(inst)    inst.AnimState:SetBank("deerclops")    inst:DoTaskInTime(0, function() inst.AnimState:SetBuild("deerclops_build") end)    inst:SetStateGraph("SGdeerclops")end)

also works.

Edited by DarkXero
  • Developer

@DarkXero and @Mario384, you probably want to keep the existing line, and do it like this. 

inst.AnimState:SetBuild("deerclops_build")inst.OnSetSkin = function(skin_name)	inst.AnimState:SetBuild("deerclops_build")end

The skin code is still very early and is likely to see changes in the future, so keeping the original line should "somewhat" future proof you if OnSetSkin goes away.

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