Mr. Higgsbury II Posted November 23, 2013 Share Posted November 23, 2013 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: Link to comment Share on other sites More sharing options...
_Q_ Posted November 23, 2013 Share Posted November 23, 2013 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. Link to comment Share on other sites More sharing options...
greenglacier Posted November 23, 2013 Share Posted November 23, 2013 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 Share on other sites More sharing options...
Recommended Posts
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.