FurryEskimo Posted February 26, 2021 Share Posted February 26, 2021 I've been poking around some old code of mine, making updates and general improvements, and I found this in the hound's updated combat AI for target sharing. The rest of the code basically says 'is this hound's leader a player', 'is the target a hound tamer', 'is the target a follower of your leader', but then this comes up. -- Prevents players and companions from being shared as a target. --Note: Redundant? if target:HasTag("player") or target:HasTag("companion") then local houndtamer = GLOBAL.FindEntity(inst, 20, function(guy) return guy:HasTag("houndtamer") end) if houndtamer ~= nil then return end end It happens if the target is a player or companion, but what is it doing? I think it checks if there are any hound tamers on the server, and if there are the hound won't attack the target. Am I understanding this code correctly? With all my other checks this comes across as extremely strange and redundant. I can't even imagine under what circumstances this would apply, so I'm trying to figure out what it applies to. Link to comment https://forums.kleientertainment.com/forums/topic/127471-return-guy/ Share on other sites More sharing options...
penguin0616 Posted February 27, 2021 Share Posted February 27, 2021 If the target is a player, or the target is a companion, search for an entity within 20 units of the instance that has the houndtamer tag. If a houndtamer is found, return nil. 1 Link to comment https://forums.kleientertainment.com/forums/topic/127471-return-guy/#findComment-1433352 Share on other sites More sharing options...
FurryEskimo Posted February 27, 2021 Author Share Posted February 27, 2021 @penguin0616 Huh, weird.. So,, If a hound tamer is nearby, the hound (which is already known to be following a player) won’t attack players or companions. It seems really redundant to me. I’ll review the code again later, maybe I’m overlooking something. I spent tonight reviewing the code, cleaning it up, and now players can’t attack Trained hounds, and even pigmen will ignore them unless a fight breaks out! Link to comment https://forums.kleientertainment.com/forums/topic/127471-return-guy/#findComment-1433354 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