Lazzary Posted June 12, 2020 Share Posted June 12, 2020 (edited) Hello everybody, I need help with something new. I am thinking of implementing an AOE based attack on my character. Like an example would be Abigail, I want some kind of Abigail's attack everytime my character hits something. And it will deal full damage at the enemy I'm attacking and like 30% to all enemies that are around my character. I looked through Abigail's files, but I didn't really see anything helpful, and I think NPCs have different codes than playable characters. So, can anybody help me? Edited June 12, 2020 by Lazzary Link to comment https://forums.kleientertainment.com/forums/topic/118971-aoe-attacks/ Share on other sites More sharing options...
pickleplayer Posted June 12, 2020 Share Posted June 12, 2020 (edited) I think Abigail's AOE is more of a health drain than an actual "attack." I think a better place to start would be to look into special attack abilities that characters have. Wigfrid's file (which is wathgrithr.lua for some reason) has a "heal on hit" mechanic would be a great starting point, since the "battleborn_onattack" function has pretty much all the data you'd need there already, minus spreading damage out to nearby enemies. For splash damage, groundpounder.lua has some basics about damaging nearby entities in it. Something like this is a basic start local x, y, z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x, y, z, 3, nil) for i, v2 in ipairs(ents) do if v2 ~= self.inst and v2:IsValid() and v2.components.health ~= nil and not v2.components.health:IsDead() and self.inst.components.combat:CanTarget(v2) then self.inst.components.combat:DoAttack(v2, nil, nil, nil, self.groundpounddamagemult) end end This was mostly just copied and pasted scraps from that file, so you'd have to replace any of those variables with whatever they would be in your case Edited June 12, 2020 by pickleplayer Link to comment https://forums.kleientertainment.com/forums/topic/118971-aoe-attacks/#findComment-1342226 Share on other sites More sharing options...
Lazzary Posted June 13, 2020 Author Share Posted June 13, 2020 Okay, that makes sense. But before I actually made another post to help with my mod character, and the thing is I kind of found another variable that would steal health and hunger from enemies. Or better said, get the health and hunger based on the damage dealt to said enemies. inst:ListenForEvent("onhitother", function(inst, data) if not inst.components.health:IsDead() then inst.components.hunger:DoDelta(data.damageresolved * 0.05) -- Hunger lifesteal, to give logic to her eating her enemies. inst.components.health:DoDelta(data.damageresolved * 0.03) end It's this one right here. Can't I like do something with this? Like when I hit somebody, it'll activate more attacks, on people around me. I showed this off just because you mentioned something about Wigfrid's lifesteal, which I think is this piece of code right here. And also. I looked a bit lower and I found this. local function OnAttack(inst, player) inst.components.combat:SetAreaDamage(20, 1) end Can this actually help me in anyway? Link to comment https://forums.kleientertainment.com/forums/topic/118971-aoe-attacks/#findComment-1342337 Share on other sites More sharing options...
pickleplayer Posted June 15, 2020 Share Posted June 15, 2020 On 6/13/2020 at 4:06 AM, Lazzary said: local function OnAttack(inst, player) inst.components.combat:SetAreaDamage(20, 1) end Can this actually help me in anyway? Give it a try and see what happens! Don't be afraid to get messy with things that may or may not work. Trying things out and running them in-game to see what they do is the best way to learn how to mod. There's a good chance that what you have is a step in the right direction. Link to comment https://forums.kleientertainment.com/forums/topic/118971-aoe-attacks/#findComment-1342897 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