Birdskull Posted July 23, 2019 Share Posted July 23, 2019 (edited) Heya. I have a character who is a deer. Ideally, other deer will kind of gravitate towards them when they're near. I slapped the "saltlick" tag on them and it works pretty well for this purpose, but it also attracts beefalo, koalefants, and volt goats. Does anyone know a way I can accomplish this without the extra mobs? Edited July 23, 2019 by Birdskull Link to comment Share on other sites More sharing options...
. . . Posted July 23, 2019 Share Posted July 23, 2019 Maybe you can do this so only if deers are near you then you get the tag Spoiler --above masterpostinit local function LookForDeer(inst) if inst.components.health:IsDead() or inst:HasTag("playerghost") then return end -- Don't if dead local x, y, z = inst.Transform:GetWorldPosition() local deer = TheSim:FindEntities(x, y, z, 10,{"deer"}) if #deer > 0 then inst:AddTag("saltlick") else inst:RemoveTag("saltlick") end end --inside masterpostinit inst:DoPeriodicTask(1, LookForDeer) Link to comment Share on other sites More sharing options...
Birdskull Posted July 23, 2019 Author Share Posted July 23, 2019 40 minutes ago, Warbucks said: Maybe you can do this so only if deers are near you then you get the tag Hide contents --above masterpostinit local function LookForDeer(inst) if inst.components.health:IsDead() or inst:HasTag("playerghost") then return end -- Don't if dead local x, y, z = inst.Transform:GetWorldPosition() local deer = TheSim:FindEntities(x, y, z, 10,{"deer"}) if #deer > 0 then inst:AddTag("saltlick") else inst:RemoveTag("saltlick") end end --inside masterpostinit inst:DoPeriodicTask(1, LookForDeer) omg, that is a 100x easier than what I was trying to do. Works great! Thanks so much. 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