• 🏆 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!

[Solved] Scripted Attack

Status
Not open for further replies.
Level 7
Joined
Mar 24, 2008
Messages
184
Hello,
I have a doubt that's been killing me. Is there any way to intercept a unit attacking another and replace the damage that would normally deal with a scripted damage?

I'm not asking for a damage detection system, i know their existance and i know how to use them, i'm asking to something like this:

I have a unit (let's call it A) selected and i order it to attack another unit (B)
A starts to attack, but instead i intercept the attack action and do something scripted.

I've already tried to give the unit a dummy skill to be casted when it attacks (with the unit is being attacked trigger), but i don't like it (it doesn't stay focused on the attacked unit since it stops the attack, also it acts weird with animations)

I've already tried to just script the stuff on the trigger (for testing purpose, i just made it use a dummy unit with a dummy skill that should emulate an attack), it works almost nicely, but there are 2 problems:

1. If A or B move, it doesn't always work...if A moves, the script may start even if A didn't attack, instead if B moves the attack may start but the script no.

2. Even if i put the same projectile speed, the attack and the skill are casted in different moments. This is a problem with workers, since they run away when attacked, but they don't run away when targeted by the skill, hence sometimes they run away before the skill projectile hits them, and sometimes they run away after the projectile hits them.
This shouldn't be a problem most of the times (the final version should be using Vexorian's xe system to do stuff instead of a dummy skill, and i've tested with extremely low speed), but it's still annoying.

So, the question is: is there any way to flawlessy intercept an attack, do something scripted and make it act as it was the unit's attack?

Also, do you think it's a good idea to script all the damage dealt by the heroes of your map (i'm making a single player RPG) and some (not all of them) monsters, in order to have more control over the damage, instead of using a damage detection system?

I'm able to use systems, vJASS, JASS, whatever, so i'm not afraid of doing complicated stuff :smile:
 
Status
Not open for further replies.
Top