Aquaterion Posted April 14, 2016 Share Posted April 14, 2016 Basically, the follower walks to the target, and does nothing. It seems to brain part of it is working, but for some reason its not attacking. I can't post code atm but If anyone has any clue what it could be, let me know. Link to comment Share on other sites More sharing options...
DarkXero Posted April 14, 2016 Share Posted April 14, 2016 Does your follower stategraph have a CommonHandlers.OnAttack(), or a EventHandler("doattack", function(inst, data) inst.sg:GoToState("attack", data.target) end) ? ChaseAndAttack behaviour doesn't generate an attack action. Instead, it uses the TryAttack function of the combat component, pushing the doattack event. Link to comment Share on other sites More sharing options...
Aquaterion Posted April 14, 2016 Author Share Posted April 14, 2016 I don't believe it has an eventhandler for doattack, I'll try it out when I can, thanks for the info. Link to comment Share on other sites More sharing options...
Aquaterion Posted April 15, 2016 Author Share Posted April 15, 2016 It does attack now, but it does no damage, just the attack animation Link to comment Share on other sites More sharing options...
DarkXero Posted April 15, 2016 Share Posted April 15, 2016 If you have inst.components.combat:SetRange(attack, hit) then verify that hit is greater or equal than attack. Which means that attacks will start and finish outside the hit range. If you don't have a inst.components.combat:SetDefaultDamage(100) then the damage will be 0, which would look like the attack doesn't do anything. There's also the possibility that you are screwing up something in your stategraph attack state. Link to comment Share on other sites More sharing options...
Aquaterion Posted April 15, 2016 Author Share Posted April 15, 2016 (edited) 1 hour ago, DarkXero said: If you have inst.components.combat:SetRange(attack, hit) then verify that hit is greater or equal than attack. Which means that attacks will start and finish outside the hit range. If you don't have a inst.components.combat:SetDefaultDamage(100) then the damage will be 0, which would look like the attack doesn't do anything. There's also the possibility that you are screwing up something in your stategraph attack state. I have both of those so that probably isn't the issue. As for stategraph, the follower i'm making is a "character" so I'm using SGWilson's stategraph. I added the evenlistener for "doattack" that you mentioned earlier in the follower's .lua. The follower can change the item in its EQUIPSLOTS.HANDS but it doesn't seem like having nothing or anything in its hand changes anything. The follower seems to give up attacking after 1 attack too Edited April 15, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
DarkXero Posted April 15, 2016 Share Posted April 15, 2016 27 minutes ago, Aquaterion said: I have both of those so that probably isn't the issue. As for stategraph, the follower i'm making is a "character" so I'm using SGWilson's stategraph. I added the evenlistener for "doattack" that you mentioned earlier in the follower's .lua. The follower can change the item in its EQUIPSLOTS.HANDS but it doesn't seem like having nothing or anything in its hand changes anything. The follower seems to give up attacking after 1 attack too Of course. wilson stategraph has an attack state that relies on having an ACTIONS.ATTACK used to reach the attack state. You can use SGshadowwaxwell, that is like a character, but uses the doattack event (via CommonHandlers.OnAttack()). Or if you want to keep the wilson stategraph, something like: EventHandler("doattack", function(inst, data) if inst.components.health and not inst.components.health:IsDead() and (not inst.sg:HasStateTag("busy") or inst.sg:HasStateTag("hit")) then local buffered_attack = BufferedAction(inst, data.target, ACTIONS.ATTACK) inst:PushBufferedAction(buffered_attack) end end) which on the doattack event, it triggers an attack action for the actionhandler. Link to comment Share on other sites More sharing options...
Aquaterion Posted April 15, 2016 Author Share Posted April 15, 2016 (edited) The function you provided didn't seem to work. While I wouldn't mind using the SGshadowwaxwell which I didn't know they already put in, would some things be missing, such as "equip animation"? I think I got it to work, not sure what fixed it as I did multiple changes at once, but I copied shadowwaxwell's way of fighting and removed the first thing you told me to add; inst.sg:GoToState(...) Edited April 15, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
Aquaterion Posted April 18, 2016 Author Share Posted April 18, 2016 (edited) I'm still having issues with this follower, I even copied the shadow maxwell brain and only changed the IFNode conditions, their attacks get cancelled too early most times and they try to move into the target, I even let in the dance thing and when I dance, they just walk to me, push me a bit, and dont dance at all. Most times when attacking they do 1 swing and start following again, as if they forgot they were in combat, and after a second or two, they remember again and go try do another swing and repeat the process. Any Idea what could be wrong @DarkXero ? I do have a KeepTargetFunction and RetargetFunction for the combat component. Edited April 18, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
DarkXero Posted April 19, 2016 Share Posted April 19, 2016 (edited) 3 hours ago, Aquaterion said: I even copied the shadow maxwell brain and only changed the IFNode conditions, their attacks get cancelled too early most times and they try to move into the target, I even let in the dance thing and when I dance, they just walk to me, push me a bit, and dont dance at all. Because SGwilson doesn't handle the dance event pushed by shadowwaxwellbrain for dancing. Unlike SGshadowwaxwell. 3 hours ago, Aquaterion said: Most times when attacking they do 1 swing and start following again, as if they forgot they were in combat, and after a second or two, they remember again and go try do another swing and repeat the process. SGwilson's attack state has on the onexit function (that runs after they exit the state): inst.components.combat:SetTarget(nil) Which means they forget the target until next retargeting done by the combat component. Edited April 19, 2016 by DarkXero Link to comment Share on other sites More sharing options...
Aquaterion Posted April 19, 2016 Author Share Posted April 19, 2016 So I'm better off making a new stategraph then 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