• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Make a creep cast a spell while..

Status
Not open for further replies.
Level 3
Joined
Jul 22, 2017
Messages
30
I want to make a unit cast a spell that is a missile while in combat. This unit has both attack disabled because I want that only attack with the missile. Just like do archers in diablo 2. The point is that I have no idea of how the unit detect the combat while both of his attack are disabled.
 
Level 10
Joined
Apr 18, 2009
Messages
576
Can you explain how you want the missile to work a bit more and why it's so important that its cast is not based on an attack? Why is it important that it's a missile and not just a spell-type attack with some arcane missile model or something?

Is it a projectile that fires in a line and deals areal damage at impact? Is it a projectile that works like a standard firebolt without the stun? etc.

I'd personally code any projectile like this based off of the attack because it makes life easier. I guess you can create systems for combat detection, but how far are you willing to go and have you considered the options? You can set the attack to 0-0 by setting the following fields to zero: Damage Base, Damage Number of Dice and Damage Sides per Die (hold shift and double-click the field to allow negative values). This way you can just use the unit's attack as a trigger for casting a spell.

Edit: Archers in Diablo 2 fires an arrow towards a target point, right? So the arrow will be a projectile which flies in a direction until it hits something?

1) Set the unit attack to 0-0
2) Create a dummy spell which will be cast at the point of the target every time the units attack
3) Every time the dummy spell is fired, create a dummy unit at the caster facing the target point of the spell being cast. This unit will be your projectile and is added to a unit group for projectiles
4) Every x seconds, move every unit in the projectile unit group some range in their facing direction. If there are enemies within some range of the new point where the projectile dummy is moved, deal damage to the first unit in range and kill the projectile. Remove the projectile from the dummy group

Tell me if I understood the missile behaviour right and you want an example map or whatever.
 
Last edited:
Level 3
Joined
Jul 22, 2017
Messages
30
Can you explain how you want the missile to work a bit more and why it's so important that its cast is not based on an attack? Why is it important that it's a missile and not just a spell-type attack with some arcane missile model or something?

Is it a projectile that fires in a line and deals areal damage at impact? Is it a projectile that works like a standard firebolt without the stun? etc.

I'd personally code any projectile like this based off of the attack because it makes life easier. I guess you can create systems for combat detection, but how far are you willing to go and have you considered the options? You can set the attack to 0-0 by setting the following fields to zero: Damage Base, Damage Number of Dice and Damage Sides per Die (hold shift and double-click the field to allow negative values). This way you can just use the unit's attack as a trigger for casting a spell.

Edit: Archers in Diablo 2 fires an arrow towards a target point, right? So the arrow will be a projectile which flies in a direction until it hits something?

1) Set the unit attack to 0-0
2) Create a dummy spell which will be cast at the point of the target every time the units attack
3) Every time the dummy spell is fired, create a dummy unit at the caster facing the target point of the spell being cast. This unit will be your projectile and is added to a unit group for projectiles
4) Every x seconds, move every unit in the projectile unit group some range in their facing direction. If there are enemies within some range of the new point where the projectile dummy is moved, deal damage to the first unit in range and kill the projectile. Remove the projectile from the dummy group

Tell me if I understood the missile behaviour right and you want an example map or whatever.

Well I have no idea of how to detect combat. However the solution you gave to me seems to work. And yes, your idea of what I was searching from a missile is correct. The missile is already done but I haven't idea of how the creep attack. But now as I said your solution works fine. Sorry if my english is bad.
 
Status
Not open for further replies.
Top