Tesumoto Posted January 20, 2019 Share Posted January 20, 2019 (edited) Hello! I think this is not difficult, but I do not know how to implement it. I want to prohibition bosses to attack structures. There is a mod that does not allow bosses to destroy the structure. But they stand and beat structures (bug). I want them to ignore the structure and just attack the player. Edited January 20, 2019 by Tesumoto Link to comment Share on other sites More sharing options...
Tesumoto Posted January 20, 2019 Author Share Posted January 20, 2019 If creature HasTag("epic"), then it can't attack structures. This really difficult to implement? ._. Link to comment Share on other sites More sharing options...
CarlZalph Posted January 24, 2019 Share Posted January 24, 2019 (edited) On 1/20/2019 at 5:30 PM, Tesumoto said: If creature HasTag("epic"), then it can't attack structures. This really difficult to implement? ._. It's a bit hard to create due to the different schemes these monsters have to target structures. There's no general case that could be done to make them all 'just not target structures'. For each monster you'd have to do some brain surgery to stop them from targeting the structures in specific based on their targeting scheme. For example, the deerclops has a DoAction in the behaviour tree with the name "DestroyBase"- you'd have to remove this in the bt table of the brain. Here's an example on removing the behaviour for the deerclops: AddBrainPostInit( "deerclopsbrain", function(self) if self.bt and self.bt.root and self.bt.root.children then local newchildren = {} for _, v in ipairs(self.bt.root.children) do if v.name ~= "DestroyBase" then GLOBAL.table.insert(newchildren, v) end end self.bt.root.children = newchildren end end ) Edited January 24, 2019 by CarlZalph Code dump. Link to comment Share on other sites More sharing options...
DarkXero Posted January 25, 2019 Share Posted January 25, 2019 if not GLOBAL.TheNet:GetIsServer() then return end local _HammerFn = GLOBAL.ACTIONS.HAMMER.fn GLOBAL.ACTIONS.HAMMER.fn = function(act) act.target.components.workable = act.target.components.hammerworkable local ret = _HammerFn(act) act.target.components.workable = nil return ret end local function AntiWork(inst) inst.components.hammerworkable = inst.components.workable inst.components.workable = nil end local function HammerFix(inst) if inst:HasTag("structure") and inst.components.workable and inst.components.workable.action == GLOBAL.ACTIONS.HAMMER then inst:DoTaskInTime(0, AntiWork) end end AddPrefabPostInitAny(HammerFix) Should be good as a server mod? Link to comment Share on other sites More sharing options...
CarlZalph Posted January 25, 2019 Share Posted January 25, 2019 (edited) 19 minutes ago, DarkXero said: Should be good as a server mod? That'll break other mods that rely on the workable component which has the hammer action, like server administrative loggers and such. Edited January 25, 2019 by CarlZalph Link to comment Share on other sites More sharing options...
DarkXero Posted January 25, 2019 Share Posted January 25, 2019 25 minutes ago, CarlZalph said: That'll break other mods that rely on the workable component. Yeah, you're right. Fair enough. local function EpicFilter(ret) local newret = {} for i, e in ipairs(ret) do if not e:HasTag("structure") then newret[i] = e end end return newret end -- absolute madman stuff local hax = GLOBAL.debug.getlocal AddPrefabPostInit("world", function(world) if world.ismastersim then local t = GLOBAL.getmetatable(GLOBAL.TheSim).__index local fe = t.FindEntities t.FindEntities = function(...) local ret = fe(...) if ret then local i = 1 while true do local name, value = hax(2, i) if not name then break end if name == "inst" then if value:HasTag("epic") then ret = EpicFilter(ret) else break end end if name == "self" then if value.inst and value.inst:HasTag("epic") then ret = EpicFilter(ret) else break end end i = i + 1 end end return ret end end end) -- special bearger collision edge case local _work = GLOBAL.require("components/workable") local _destroy = _work.Destroy _work.Destroy = function(self, destroyer) if destroyer and destroyer:HasTag("epic") then return end return _destroy(destroyer) end This one is server side too. 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