Jump to content

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:

Edited by Mr. Higgsbury II
Link to comment
https://forums.kleientertainment.com/forums/topic/29927-grue/
Share on other sites

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.

Edited by _Q_
Link to comment
https://forums.kleientertainment.com/forums/topic/29927-grue/#findComment-376286
Share on other sites

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!
Link to comment
https://forums.kleientertainment.com/forums/topic/29927-grue/#findComment-376462
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...