beepbeepbot Posted December 6, 2024 Share Posted December 6, 2024 Hey everyone, I am making another version of skill tree for Wendy. Lunar Abby is more powerful than my imagination. I don't want players to just watch them fight, that's not interesting. So I hope there is a 50% chance that the creature will switch its attack target to Wendy after being attacked by Lunar Abby.I have no idea about this. Is there something controlling the targets of the creatures' attacks? Link to comment https://forums.kleientertainment.com/forums/topic/161885-about-the-attack-targets-of-creatures/ Share on other sites More sharing options...
beepbeepbot Posted December 6, 2024 Author Share Posted December 6, 2024 I found a method called SetTarget in combat. And use this statement: if not potential_target.components.combat == nil then -- If this works, I will add the probability later. potential_target.components.combat:SetTarget(inst.components.follower.leader) end But.... not works, idk why Link to comment https://forums.kleientertainment.com/forums/topic/161885-about-the-attack-targets-of-creatures/#findComment-1769163 Share on other sites More sharing options...
beepbeepbot Posted December 6, 2024 Author Share Posted December 6, 2024 (edited) The code says SetTarget() won't work on entities that have "player" tag, and I tried using EngageTarget(). It worked but when Abby went to “Escape State”, the entities that she attacked before would immediately lose their hatred towards me. This doesn't make sense. I tried to check the code of "Escape State" in SGabigail.lua and there is nothing of revelation. Edited December 6, 2024 by beepbeepbot Link to comment https://forums.kleientertainment.com/forums/topic/161885-about-the-attack-targets-of-creatures/#findComment-1769251 Share on other sites More sharing options...
beepbeepbot Posted December 6, 2024 Author Share Posted December 6, 2024 I have found a solution, although no one has replied to me, I will list the method below for others to refer to. You need to use the DropTarget() method to completely drop the current target (that is, make the attacked entity lose hatred towards Abby) You should use the EngageTarget() method to re-set the attack target, which will work, at least in my case Link to comment https://forums.kleientertainment.com/forums/topic/161885-about-the-attack-targets-of-creatures/#findComment-1769264 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