• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

sorry but im a noob at triggering spells can somebody help

Status
Not open for further replies.
Level 2
Joined
Nov 23, 2005
Messages
11
sorry if i posted the same topic as the one below, the spell is counter attack. the idea of my counter attack is a % to block a physical damage and dont take damage at all and counter it with your normal attack/damage + damege of your enemy = counter attack damage.
is it possible to make it with a trigger or is it impossible to make. please help me with this i really need it for my hero knight. all help greatly be appreciated and ill give credit. sory for my english and spelling if its bit croogy. im not english speaker. thnx for those who can help and understand.
 
Level 12
Joined
Apr 29, 2005
Messages
999
This is impossible to make this work with 100% chance of succes. This is the so missing native in WE, to register dealing damage. The way to do it in JASS is to have a trigger registering when a unit learns the ability and then let it create a local trigger for that unit. Now we can register damage dealed to the unit. But there comes the problem, we can't be sure that the damage was dealed by an attack. The event will register any damage dealed to the unit. Including spells and such. The closest thing we can do is to check the distance between the unit and the attacker and then decide if it is in melee range. Then we can check if the attacker was a melee unit. Still we can't be sure. And next problem, we can't get the normal damage vaules from a unit. Unless you look into the object editor at the unit's damage. The you can do the normal damage. But this is very tiresom if many units can have the ability. The you need to have them all stored. Then check which unit type the unit is and then get it's stored damage and make it damage the attacker. If the unit is a hero we can get a similar vaule to it's damage by calculating it's primary attributes and some gameplay constants. However, the damage will not be "correct" if the hero has items that increases it's damage.
 
Level 2
Joined
Nov 23, 2005
Messages
11
what do u mean by frost arrow? u mean base spell? sorry if i cant understand im a slow learner, can you explain more briefly? btw thanks for the help guys i really appreciate it, specially the JASS suggestion. im beginning to learn JASS little by little btw :wink: its a bit to complicated, but im beginning to learn and understand its functions and variables :) Btw im taking B.S.Co.E. course, so this will be no problem at all, ill get used to it!!
Men i hate this computer stuffs, but im starting to like it, maybe ill take and shift next year!! :shock: btw thanks to all who replied and helped!! :D and i hate my grammar too!! :x
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
Daminon said:
This is impossible to make this work with 100% chance of succes. This is the so missing native in WE, to register dealing damage. The way to do it in JASS is to have a trigger registering when a unit learns the ability and then let it create a local trigger for that unit. Now we can register damage dealed to the unit. But there comes the problem, we can't be sure that the damage was dealed by an attack. The event will register any damage dealed to the unit. Including spells and such. The closest thing we can do is to check the distance between the unit and the attacker and then decide if it is in melee range. Then we can check if the attacker was a melee unit. Still we can't be sure. And next problem, we can't get the normal damage vaules from a unit. Unless you look into the object editor at the unit's damage. The you can do the normal damage. But this is very tiresom if many units can have the ability. The you need to have them all stored. Then check which unit type the unit is and then get it's stored damage and make it damage the attacker. If the unit is a hero we can get a similar vaule to it's damage by calculating it's primary attributes and some gameplay constants. However, the damage will not be "correct" if the hero has items that increases it's damage.

Theres another problem, what if he misses, then the counter attack must not be activated.
 
Level 12
Joined
Apr 29, 2005
Messages
999
Ramza said:
Daminon said:
This is impossible to make this work with 100% chance of succes. This is the so missing native in WE, to register dealing damage. The way to do it in JASS is to have a trigger registering when a unit learns the ability and then let it create a local trigger for that unit. Now we can register damage dealed to the unit. But there comes the problem, we can't be sure that the damage was dealed by an attack. The event will register any damage dealed to the unit. Including spells and such. The closest thing we can do is to check the distance between the unit and the attacker and then decide if it is in melee range. Then we can check if the attacker was a melee unit. Still we can't be sure. And next problem, we can't get the normal damage vaules from a unit. Unless you look into the object editor at the unit's damage. The you can do the normal damage. But this is very tiresom if many units can have the ability. The you need to have them all stored. Then check which unit type the unit is and then get it's stored damage and make it damage the attacker. If the unit is a hero we can get a similar vaule to it's damage by calculating it's primary attributes and some gameplay constants. However, the damage will not be "correct" if the hero has items that increases it's damage.

Theres another problem, what if he misses, then the counter attack must not be activated.
The damage registering trigger won't register any missing attacks so there will be no effect from such. So this is no problem.

And by the way if anyone wonder, this method can only work if it is a defensive ability. If it is offensive then we must check if an attacker has the ability. This means that all units on the map must have a damage registering trigger. I have figured out a solution to this but it's weak point is if the attacked has Evason. This can only be fixed if you simulate Evaison in the damage trigger.
 
Level 10
Joined
Apr 9, 2004
Messages
502
Ramza said:
I think u can only do that with JASS, cuz there are no unit damage variables, only damage type etc

Actually, you can make something like this all it requires to check for getting damaged is a GLOBAL VARAIBLE. Now the extent to which i can help is based on how manyn units need this spell. If this ability is limited to a reasonable amount of units (i'm speaking more in terms of up to 12 heroes if required, not more) then you don't need JASS, but otherwise you can't make it multi-instanceable the way you want without JASS.

The reason why you want very few untis is because globals don't work for large groups, and are best used for single units on a map, like heroes, for instance. Normally you can check if the unit already exists but this isn't always the case so instead the unit you create needs to be stored as a global unit variable.

Now with this in mind,the way you could work it out is you'll need a unit group to determine who's attacking you as well as 2 triggers. Any unit who attacks you and is an enemy (and any other conditions) is put in this group. That's the first trigger, very simple.

Now the second is what makes the doging doable. When you take damage, you check if the source came from that unit group. If it did and you were set to dodge, then store that damage taken as a real varaible as well as compensate for the damage taken (set ur hero's health to [his health + damage taken]). That's it for storing damage.

Now to damage you need two triggers for this to work. The firsdt detecs when you attack a unit. Then you store the attacked unit as a global Also you have to add the event to the second trigger that that unit (as the global variable) takes damage.

The second trigger detects when they get damaged and (if dmaaged by you) you ghet a dummy to deal the extra counter damage and turn off this damaging trigger.

Another thing is with each attack you should disable the dmaage trigger first then reenable it and disbale it after delaing dmaage to make sure that it refrshes and works, even when you miss.

From this point what you should get is an ability that will take all the dmaage you've dodged before the last time you attacked and deal it to the unit you attack, that is, if you don't miss. If you want to counter as they attack, there's no real good way to do it as you can't just get ur hero to attack and damage as they do and as such you won't deal the damage they'd normally deal. If you want her to counter exactly the same time, then you'll need set damage amount. The best you could do is check their dice and die values as well as their main attribute and base attack and deal that, but of course that doesn't account for any items they might have. There's no 100% working way but mine will do everything, just only on the next attack. So there's not way to detect what damage you'd do from 1 single attack so the best i can do is have your guy deal the damage on his next attack.

That's the best i could do for you.
 
Level 12
Joined
Apr 29, 2005
Messages
999
Drain Pipe said:
Now the second is what makes the doging doable. When you take damage, you check if the source came from that unit group. If it did and you were set to dodge, then store that damage taken as a real varaible as well as compensate for the damage taken (set ur hero's health to [his health + damage taken]). That's it for storing damage.
And which trigger is registering damage here? At this stage there is only a trigger registering damage.

And Drain Pipe, remember what I told you? You must be sure that the attack was succesfull! You can't just hope that an started attack was finnished and the damage dealed. If the attack is interupted it there won't be any damage dealed. This will screw everthing.
 
Level 7
Joined
May 16, 2004
Messages
355
Well I have a way, its not pretty and it means totally triggering every spell. But it has potential to work.

It would require absolutely EVERY spell to actually be cast by dummy units. This is so that you can detect "Unit Takes Damage" and just filter out the dummy unit damage.

It wouldn't be pretty but if you are early in the development of the map it is feasible.

Do note though that the following count as "Damage Taken"

1) Get a negative buff placed on you
2) Getting a negative spell cast on you

So this means you would also need to filter out damages lower than or equal to 0.
 
Status
Not open for further replies.
Top