Jump to content

Battle bernie


Recommended Posts

local RETARGET_MUST_TAGS = { "_combat" }
local RETARGET_CANT_TAGS = { "INLIMBO", "player", "companion" }
local RETARGET_ONEOF_TAGS = { "locomotor", "epic" }

local function RetargetFn(inst)
    if inst.components.combat:HasTarget() then
        return
    end
    local x, y, z = inst.Transform:GetWorldPosition()
    for i, v in ipairs(TheSim:FindEntities(x, y, z, TARGET_DIST, RETARGET_MUST_TAGS, RETARGET_CANT_TAGS, RETARGET_ONEOF_TAGS)) do
        if IsTargetable(inst, v) then
            return v
        end
    end
end

In the file bernie_big.lua, you can see that the retargetfn excludes players. You will need to overwrite

inst.components.combat:SetRetargetFunction(1, RetargetFn)

 to make him attack players in PvP. with the function changed so that he can retarget players. I would make a check to see if PvP is enabled so that he doesn't start attacking people if PvP is off.

  • Like 1
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...