johnfs723 Posted July 6, 2015 Share Posted July 6, 2015 I need to add a tag to my custom character, such as, "robotwhisperer", that will make clockwork mobs be passive towards him. What code do I need to use to make sure the clockwork mobs detect the tag and then are passive? Thanks Link to comment Share on other sites More sharing options...
DarkXero Posted July 7, 2015 Share Posted July 7, 2015 local robots = {"knight", "rook", "bishop"}for _, robot in pairs(robots) do AddPrefabPostInit(robot, function(inst) local old_set = inst.components.combat.SetTarget inst.components.combat.SetTarget = function(self, target) if target and target:HasTag("robotwhisperer") then local enemytarget = target.components.combat.target if not (enemytarget and enemytarget:HasTag("chess")) then return end end return old_set(self, target) end end)endIn modmain should make the tag work. Link to comment Share on other sites More sharing options...
johnfs723 Posted July 12, 2015 Author Share Posted July 12, 2015 local robots = {"knight", "rook", "bishop"}for _, robot in pairs(robots) do AddPrefabPostInit(robot, function(inst) local old_set = inst.components.combat.SetTarget inst.components.combat.SetTarget = function(self, target) if target and target:HasTag("robotwhisperer") then local enemytarget = target.components.combat.target if not (enemytarget and enemytarget:HasTag("chess")) then return end end return old_set(self, target) end end)endIn modmain should make the tag work. thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now