Jump to content

Recommended Posts

hello! first time making a mod, and I am trying to make a custom character that bees will not attack. 

this link is the only thread I could find on the subject, but either the files for bees are written differently, or the way the code is written has changed. 

I have added the tag "beefriend" to the character as shown below; I don't know if it is in the right place

local function onbecamehuman(inst)
	inst.components.locomotor:SetExternalSpeedMultiplier(inst, "alyx_speed_mod", 2)
	inst:AddTag("beefriend")

here is the code that I think dictates what the bees attack

local function KillerRetarget(inst)
    return FindEntity(inst, SpringCombatMod(8),
        function(guy)
            return inst.components.combat:CanTarget(guy)
        end,
        { "_combat", "_health" },
        { "insect", "INLIMBO" },
        { "character", "animal", "monster" })
end

local function SpringBeeRetarget(inst)
    return TheWorld.state.isspring and
        FindEntity(inst, 4,
            function(guy)
                return inst.components.combat:CanTarget(guy)
            end,
            { "_combat", "_health" },
            { "insect", "INLIMBO" },
            { "character", "animal", "monster" })
        or nil
end

if anyone knows where and how to add the tag to the code, and where to put that code in the modmain.lua , that would help me a lot.

 

thank you for reading!

True. That'll also make mosquitos and wasps neutral to the character, though. It'll also change the impact sound when not wearing armor, because his target-type will be determined as "insect_" instead of "flesh_". If those things are acceptable, then this is definitely the easiest and least intrusive solution.

Edited by Ultroman

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...