I want to create something like the followers in Diablo 3, which follows the Hero, and attack nearby enemy units.
The follower should attack nearby enemy units using defualt AI, and should not be affected by what the Hero attacks.
The follower should follow the Hero always being within a minimum range of 10.
Any suggestions as to how I would create something like this.
What exactly should happen when the hero moves away? Summons run to catch up? Rubberband glitchport? (haven't played D3)
For a very simplistic version you could periodically order an a-move on the "hero"(Point, just to be safe...), with a switch/set to instead order a move command if the distance to the target point is too large (LocationRange validator type). The switch can of course also apply a huge movespeed buff or teleport the minion straight to the hero.
With different impact locations and additional searches you could also periodically attack the enemy closest to the hero, prioritise targets "marked" by a special hero ability or define individual zones-of-control around the hero and confine individual minions to within their zone.
Anything that interferes with the standard "attack until dead or out of aggro range" behavior will of course look increasingly ugly/glitchy when triggered more often, via shifting priorities or rapidly moving heroes/targets. Maybe the constant a-move also acts differently than an "idle" unit, in terms of running at a specific opponent when attacked: I think by default units aggro onto the first enemy to hit them and keep attacking, the next a-move order would shift focus onto the closest equal-priority target.
The HotS mission 2 has Raynor follow and protect Kerrigan. I tried to find out how they did it but couldn't find anything useful in the triggers so I created something similar myself.
The follower behaves differently depending on how close he is to the hero (or in my case the center point of a unit group). If he is very close he doesn''t do anything except auto-engage enemies. If he is a bit far away he attack-moves towards a random point around the hero followed by an hold position (after current order). If he is very far away he moves towards a random point around the hero; with this I make sure the follower also flees when the hero is fleeing. All this is made with a few regions and periodic triggers. Follower should have at least the movement speed of the hero.
You can just use Arm Magazine ability with external ammo flag and few tweaks. Also you can add Wander behaviour to ammo unit so it will look more realistic.
Yeah, the way Raynor works, is exactly what I'm looking for.
Hm, well might be a bit too much, as it should work as a summoned unit and for several players at a time (I fear it will cause performance issues). Thanks for the input though.
Yeah, the way Raynor works, is exactly what I'm looking for.
Hm, well might be a bit too much, as it should work as a summoned unit and for several players at a time (I fear it will cause performance issues). Thanks for the input though.
I tried doing that, but there is, as far as I can tell, no way to make it not be affected by the target of the owner.
The raynor works exactly with arm magazine ability you can open that campaign map Campaign/Swarm/ZLab02 and search for Sarah Kerrigan unit. It has "Raynor Lab Magazine" Ability. If you want different behaviour of the follower you should run periodic effect on this unit which will order him to attack the closest targets (or some other conditions you want) instead of caster's target unit.
Arm magazine abil has Effect+ field where you can put some effect's that should be fired on creation or death of the summons. Just run some persistent effect with 0.0625 period. You can use switch effect + issue order as a periodic to define desired conditions and order unit to behave the way you want.
Otherwise use triggers and code AI from scratch which will be probably the same thing as persistent+switch+targetsorts+issueorder approach with data
i do it this way in my latest map.
create main unit, create guard, then call this action with main unit, guard and offsets.
You can tweak the behaviour abit by adjusting the maximum distance (set to 10) and the refresh rate (set to 4)
I want to create something like the followers in Diablo 3, which follows the Hero, and attack nearby enemy units.
The follower should attack nearby enemy units using defualt AI, and should not be affected by what the Hero attacks. The follower should follow the Hero always being within a minimum range of 10.
Any suggestions as to how I would create something like this.
What exactly should happen when the hero moves away? Summons run to catch up? Rubberband glitchport? (haven't played D3)
For a very simplistic version you could periodically order an a-move on the "hero"(Point, just to be safe...), with a switch/set to instead order a move command if the distance to the target point is too large (LocationRange validator type). The switch can of course also apply a huge movespeed buff or teleport the minion straight to the hero.
With different impact locations and additional searches you could also periodically attack the enemy closest to the hero, prioritise targets "marked" by a special hero ability or define individual zones-of-control around the hero and confine individual minions to within their zone.
Anything that interferes with the standard "attack until dead or out of aggro range" behavior will of course look increasingly ugly/glitchy when triggered more often, via shifting priorities or rapidly moving heroes/targets. Maybe the constant a-move also acts differently than an "idle" unit, in terms of running at a specific opponent when attacked: I think by default units aggro onto the first enemy to hit them and keep attacking, the next a-move order would shift focus onto the closest equal-priority target.
The HotS mission 2 has Raynor follow and protect Kerrigan. I tried to find out how they did it but couldn't find anything useful in the triggers so I created something similar myself.
The follower behaves differently depending on how close he is to the hero (or in my case the center point of a unit group). If he is very close he doesn''t do anything except auto-engage enemies. If he is a bit far away he attack-moves towards a random point around the hero followed by an hold position (after current order). If he is very far away he moves towards a random point around the hero; with this I make sure the follower also flees when the hero is fleeing. All this is made with a few regions and periodic triggers. Follower should have at least the movement speed of the hero.
You can just use Arm Magazine ability with external ammo flag and few tweaks. Also you can add Wander behaviour to ammo unit so it will look more realistic.
@Photoloss: Go
I might try something like that :) Thanks
@OutsiderXE: Go
Yeah, the way Raynor works, is exactly what I'm looking for.
Hm, well might be a bit too much, as it should work as a summoned unit and for several players at a time (I fear it will cause performance issues). Thanks for the input though.
@abvdzh: Go
I tried doing that, but there is, as far as I can tell, no way to make it not be affected by the target of the owner.
The raynor works exactly with arm magazine ability you can open that campaign map Campaign/Swarm/ZLab02 and search for Sarah Kerrigan unit. It has "Raynor Lab Magazine" Ability. If you want different behaviour of the follower you should run periodic effect on this unit which will order him to attack the closest targets (or some other conditions you want) instead of caster's target unit.
Arm magazine abil has Effect+ field where you can put some effect's that should be fired on creation or death of the summons. Just run some persistent effect with 0.0625 period. You can use switch effect + issue order as a periodic to define desired conditions and order unit to behave the way you want.
Otherwise use triggers and code AI from scratch which will be probably the same thing as persistent+switch+targetsorts+issueorder approach with data
i do it this way in my latest map.
create main unit, create guard, then call this action with main unit, guard and offsets.
You can tweak the behaviour abit by adjusting the maximum distance (set to 10) and the refresh rate (set to 4)
Make the weapon of the minion able to attack stuff other than the attack target and arm magazine is the easiest way to do it.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg