Near4422 Posted March 2, 2021 Share Posted March 2, 2021 Hey there, I am wondering if there's a way to gain monsters attention? I do have a damage aura around my custom character that deals damage to monsters around every couple of seconds, but it doesn't bother the monsters themselfs. I mean - if a players sets aura range high enough - he can be dealing damage to them without them noticing - I'd like to change that. Anyone got the idea how to make it? Link to comment Share on other sites More sharing options...
IronHunter Posted March 2, 2021 Share Posted March 2, 2021 You just need to push the monsters target to your character. I believe in combat component there's a suggesttarget function. 1 Link to comment Share on other sites More sharing options...
Near4422 Posted March 2, 2021 Author Share Posted March 2, 2021 (edited) I've no idea what am I looking for while scrolling through the combat.lua to be honest. Or actually how to use it. Edited March 2, 2021 by Near4422 Link to comment Share on other sites More sharing options...
IronHunter Posted March 2, 2021 Share Posted March 2, 2021 33 minutes ago, Near4422 said: I've no idea what am I looking for while scrolling through the combat.lua to be honest. Or actually how to use it. If you can post the code for your damage aura. I can show you how to make a simple addition to taunt their aggro. 1 Link to comment Share on other sites More sharing options...
Near4422 Posted March 2, 2021 Author Share Posted March 2, 2021 local function DMGaura(inst) local x,y,z = inst.Transform:GetWorldPosition() local pt = inst:GetPosition() local range = TUNING.LIFESTEAL_RANGE -- range of ability local DMG = -TUNING.LIFESTEAL_DAMAGE -- Damage dealt to enemies around per tick local HP = TUNING.LIFESTEAL_HEAL -- HP restored per tick local tagz = {"monster"} local canttagz = {"scarecrow"} local check = TheSim:FindEntities(pt.x,pt.y,pt.z, range, tagz, canttagz) for _,ent in ipairs(check) do if not ent.components.health:IsDead() and ent.prefab == "spider" or ent.prefab == "spider_hider" or ent.prefab == "spider_spitter" or ent.prefab == "deerclops" or ent.prefab == "hound" or ent.prefab == "firehound" or ent.prefab == "icehound" or ent.prefab == "houndfire" or ent.prefab == "houndbone" or ent.prefab == "houndmound" or ent.prefab == "krampus" or ent.prefab == "mosquito" or ent.prefab == "crawlinghorror" or ent.prefab == "terrorbeak" or ent.prefab == "spider_warrior" or ent.prefab == "spiderqueen" or ent.prefab == "tallbird" or ent.prefab == "tentacle" or ent.prefab == "dragonfly" or ent.prefab == "klaus" or ent.prefab == "bearger" or ent.prefab == "stalker" or ent.prefab == "antlion" or ent.prefab == "bunnyman" or ent.prefab == "pigman" or ent.prefab == "merm" or ent.prefab == "walrus" or ent.prefab == "little_walrus" or ent.prefab == "leif" then ent.components.health:DoDelta(DMG) SpawnPrefab("toadstool_cap_releasefx").Transform:SetPosition(ent.Transform:GetWorldPosition()) inst.components.health:DoDelta(HP) SpawnPrefab("wortox_portal_jumpin_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end end local function maincheck(inst) if not inst.components.health:IsDead() and not inst:HasTag("playerghost") and not inst:HasTag("playermonster") then DMGaura(inst) end end -- 1 time interval between every tick (seconds-ish, it's not 100% accurate) inst:DoPeriodicTask(2, maincheck, nil, inst) Link to comment Share on other sites More sharing options...
IronHunter Posted March 3, 2021 Share Posted March 3, 2021 (edited) Spoiler 2 hours ago, Near4422 said: local function DMGaura(inst) local x,y,z = inst.Transform:GetWorldPosition() local pt = inst:GetPosition() local range = TUNING.LIFESTEAL_RANGE -- range of ability local DMG = -TUNING.LIFESTEAL_DAMAGE -- Damage dealt to enemies around per tick local HP = TUNING.LIFESTEAL_HEAL -- HP restored per tick local tagz = {"monster"} local canttagz = {"scarecrow"} local check = TheSim:FindEntities(pt.x,pt.y,pt.z, range, tagz, canttagz) for _,ent in ipairs(check) do if not ent.components.health:IsDead() and ent.prefab == "spider" or ent.prefab == "spider_hider" or ent.prefab == "spider_spitter" or ent.prefab == "deerclops" or ent.prefab == "hound" or ent.prefab == "firehound" or ent.prefab == "icehound" or ent.prefab == "houndfire" or ent.prefab == "houndbone" or ent.prefab == "houndmound" or ent.prefab == "krampus" or ent.prefab == "mosquito" or ent.prefab == "crawlinghorror" or ent.prefab == "terrorbeak" or ent.prefab == "spider_warrior" or ent.prefab == "spiderqueen" or ent.prefab == "tallbird" or ent.prefab == "tentacle" or ent.prefab == "dragonfly" or ent.prefab == "klaus" or ent.prefab == "bearger" or ent.prefab == "stalker" or ent.prefab == "antlion" or ent.prefab == "bunnyman" or ent.prefab == "pigman" or ent.prefab == "merm" or ent.prefab == "walrus" or ent.prefab == "little_walrus" or ent.prefab == "leif" then ent.components.health:DoDelta(DMG) SpawnPrefab("toadstool_cap_releasefx").Transform:SetPosition(ent.Transform:GetWorldPosition()) inst.components.health:DoDelta(HP) SpawnPrefab("wortox_portal_jumpin_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) if ent.components.combat then ent.components.combat:SuggestTarget(inst) end end end end local function maincheck(inst) if not inst.components.health:IsDead() and not inst:HasTag("playerghost") and not inst:HasTag("playermonster") then DMGaura(inst) end end -- 1 time interval between every tick (seconds-ish, it's not 100% accurate) inst:DoPeriodicTask(2, maincheck, nil, inst) --all you need to do is place this inside your DMGaura function's for loop's after you check to make sure the ent is valid. if ent.components.combat then ent.components.combat:SuggestTarget(inst) end Edited March 3, 2021 by IronHunter 1 Link to comment Share on other sites More sharing options...
Near4422 Posted March 3, 2021 Author Share Posted March 3, 2021 Oh so it's components then... I was trying to reach the 'combat' part in so many weird ways but didn't actually think it needs to be called by components. Thank you so much! 1 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