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

[Trigger] Is taken damage from an attack and triggered evasion.

Status
Not open for further replies.
Level 16
Joined
Jun 24, 2009
Messages
1,409
Question one:
A few days ago I've found a very good system by Weep. I thought it's just an is unit already attacked detection system so I can easily make next attack spells. Yesterday I've found out that it detects ALL damage taken. So it bugs the map's next attack spells. I can't find any system that detects if a unit is taken damage from a single attack and not from a spell or dot or aura.
Could someone show me one that is GUI friendly?

Question two:
As I know the war3 evasion isn't so accurate. If I write 3.75% evasion it will be 5% for war3. If I write 12.1% it will be 10% and so on. How can I trigger an evasion that will really work like the war3 one so it won't disable non-combat consumables?

Question three:
How can I disable the resource sending in allies window?
 
Last edited:
Level 17
Joined
Jul 17, 2011
Messages
1,864
1. For the damage detection system you could use just a different unit for each damage type, for example:
A unit begins casting an ability
set a variable to "Target Unit of Ability Being Cast"
then you have another trigger which uses "variable set for target unit Takes Damage"
as an event
a unit is attacked
set another variable equal to the attacked unit
variable set for attacked unit takes damage
it is really dependent on what u need this system for; just to display text or to damage a unit

2.The evasion passive is accurate in my opinion but you could use something with random numbers like:
a unit is attacked
attacked unit belongs to a player
set a variable to a random number between 1 and something <= the higher this is the less likely it is to happen so if its random number between 1 and 5 there will be a 20% chance, if its a random number 1 and 10 there will be a 10% chance, if its a random number between 1 and 20 there will be a 5% change Just divide 1 by a number and move the point two units to the right
then another condition
if variable equal to a specific number (like 2 ) order attacking unit to stop
but i still think you should use normal wc3 evasion :D

3. to disable trading just go to ally priorities in scenario tab and set ally priority for all players to NONE
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
1. For the damage detection system you could use just a different unit for each damage type, for example:
A unit begins casting an ability
set a variable to "Target Unit of Ability Being Cast"
then you have another trigger which uses "variable set for target unit Takes Damage"
as an event
a unit is attacked
set another variable equal to the attacked unit
variable set for attacked unit takes damage
it is really dependent on what u need this system for; just to display text or to damage a unit

2.The evasion passive is accurate in my opinion but you could use something with random numbers like:
a unit is attacked
attacked unit belongs to a player
set a variable to a random number between 1 and something <= the higher this is the less likely it is to happen so if its random number between 1 and 5 there will be a 20% chance, if its a random number 1 and 10 there will be a 10% chance, if its a random number between 1 and 20 there will be a 5% change Just divide 1 by a number and move the point two units to the right
then another condition
if variable equal to a specific number (like 2 ) order attacking unit to stop
but i still think you should use normal wc3 evasion :D

3. to disable trading just go to ally priorities in scenario tab and set ally priority for all players to NONE

1. Erm, what? I can't really understand that. And the system is for detecting if a unit already made the attack.
2. This is not a solution.... The war3 critical strike only support values of the multiples of 5 given. So no matter if you write 4% it will be 5. As I know it's the same at the evasion. So no, it isn't accurate.
3. Thanks.
 
You're going to have to consult Bribe on that one :eek:

It will only differentiate between attacks and spell damage if all the damage dealt by your spells is triggered.

If you're using JNGP for some odd reason, this is a quickfix:

JASS:
function HookDamage takes unit source, unit target, real amount, boolean b1, boolean b2, attacktype at, damagetype dt, weapontype wt returns boolean
    set udg_DamageEventType = 1
endfunction

hook UnitDamageTarget HookDamage

I have no idea how he handles spell-damage checks.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Maker sure you have JassHelper 0.A.2.B (http://www.wc3c.net/showthread.php?t=88142). Make a new trigger, convert to custom text, replace the contents with this:

JASS:
function DamageEngine_HookSpell takes unit source, unit target, real amount, boolean b1, boolean b2, attacktype at, damagetype dt, weapontype wt returns boolean
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

function DamageEngine_HookSpellBJ takes unit c, unit t, real amt, attacktype attype, damagetype dmgtype returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

hook UnitDamageTarget DamageEngine_HookSpell
hook UnitDamageTargetBJ DamageEngine_HookSpellBJ
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
When you hook a function (it can be a native (purple) or BJ (red)), the function that you point to (in my case, DamageEngine_HookSpell and DamageEngine_HookBJ) will run before the native/BJ is called.

The intended use for DamageEventType is to set the damage type right before dealing triggered damage. So by using hooks, the hooks will do it for you automatically without you having to go in and change all your triggers.

The only downside is that object-editor damage from spells will count as physical damage. So you have to trigger all the spell damage.
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
Well that´s not a problem since the object editor spells are cast by dummies and until the dummies don´t have the buff nothing happens. Now I´m just using this system to properly trigger next attack spells. However, this might be a downside when I make the rest of the systems ofthe map.

Edit:
When I add it, I get these errors.
2lal1d.gif

1ko4p.gif
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
That's what happens when Macs don't allow JNGP to compile (using a Mac here at work).

Do this instead:

JASS:
function DamageEngine_HookSpell takes unit source, unit target, real amount, boolean b1, boolean b2, attacktype at, damagetype dt, weapontype wt returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

function DamageEngine_HookSpellBJ takes unit c, unit t, real amt, attacktype attype, damagetype dmgtype returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

hook UnitDamageTarget DamageEngine_HookSpell
hook UnitDamageTargetBJ DamageEngine_HookSpellBJ
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
This would fix that problem:

JASS:
function DamageEngine_HookSpell takes unit source, widget target, real amount, boolean b1, boolean b2, attacktype at, damagetype dt, weapontype wt returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

function DamageEngine_HookSpellBJ takes unit c, unit t, real amt, attacktype attype, damagetype dmgtype returns nothing
    set udg_DamageEventType = udg_DamageTypeSpell
endfunction

hook UnitDamageTarget DamageEngine_HookSpell
hook UnitDamageTargetBJ DamageEngine_HookSpellBJ
 
Status
Not open for further replies.
Top