Jump to content

Recommended Posts

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?

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

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 by beepbeepbot

I have found a solution, although no one has replied to me, I will list the method below for others to refer to.

  1. You need to use the DropTarget() method to completely drop the current target (that is, make the attacked entity lose hatred towards Abby)
  2. You should use the EngageTarget() method to re-set the attack target, which will work, at least in my case

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...