FurryEskimo Posted July 21, 2020 Share Posted July 21, 2020 I have a character that excels at winter hunting, but is afraid to be alone, ensuring that the character doesn't wander off from the group. I think I've managed to tag entities as "bestfriend" and generate a positive sanity aura based on time since a friend was nearby, but am having trouble testing it.. A lot of my conditional stats aren't activating, and the same goes for this one. I think this code activates for all pig mobs, but I want it to tag followers and players. I might rework it, to relate to players with low sanity, but I have no idea how to check for that. ---------------------------------------------------------------------------------------------- local function FindFriend(inst) local x, y, z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x, y, z, 3, {"pig"}, {"player","werepig","guard","bestfriend"}) for k, v in pairs(ents) do if not v:IsAsleep() and not v.components.sleeper:IsAsleep() then if inst.components.leader:CountFollowers() >= 1 then return end if v.components.health and not v.components.health:IsDead() then inst:PushEvent("makefriend") inst.components.leader:AddFollower(v) v.components.follower:AddLoyaltyTime(240) v:AddTag("bestfriend") v:DoTaskInTime(480,function() v:RemoveTag("bestfriend") end) end end end end furryeskimo.lua Link to comment Share on other sites More sharing options...
Ultroman Posted July 21, 2020 Share Posted July 21, 2020 The post explains how to use the tags. If you don't want it to target pigs, why the pig-tag, then? Link to comment Share on other sites More sharing options...
FurryEskimo Posted July 21, 2020 Author Share Posted July 21, 2020 Parts of this code is pulled and edited from another mod. That character made others sane when in proximity, but I want to make my own character's sanity influenced by proximity to players/followers. Link to comment 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