Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Mr. Higgsbury II

Grue

Recommended Posts

So I'm making a character that can't be attack be attacked by the Grue, and I'm wondering if any of you would be so kind as to pose a snippet of code that would do that because I haven't a clue how I would manage that c:

Share this post


Link to post
Share on other sites
_Q_    636

So I'm making a character that can't be attack be attacked by the Grue, and I'm wondering if any of you would be so kind as to pose a snippet of code that would do that because I haven't a clue how I would manage that c:

Don't know how custom characters files looks like, but you don't want grue component in there:

inst:AddComponent("grue")

so you can just remove it.

 

You can post files here so I can see how it looks inside, and see what will work to remove grue.

 

Tested this with some custom char and you can't remove component by inst:RemoveComponent("grue")

Grue component is added in player_common prefab, there is no post init functions for that prefab if I rember correctly.

Maybe some kind of SimPostInit, or something like that in modmain:

AddPrefabPostInit("world", function(inst)	GLOBAL.assert( GLOBAL.GetPlayer() == nil )	local player_prefab = GLOBAL.SaveGameIndex:GetSlotCharacter()	GLOBAL.TheSim:LoadPrefabs {player_prefab}	local oldfn = GLOBAL.Prefabs[player_prefab].fn	GLOBAL.Prefabs[player_prefab].fn = function()		local inst = oldfn()		inst:RemoveComponent("grue")				return inst	endend)

That will remove Grue from all characters while mod will be enabled.

Share this post


Link to post
Share on other sites
greenglacier    1247

Don't know how custom characters files looks like, but you don't want grue component in there:

inst:AddComponent("grue")

so you can just remove it.

 

You can post files here so I can see how it looks inside, and see what will work to remove grue.

Very useful advice!

Share this post


Link to post
Share on other sites