• 🏆 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] Insta kill spell

Status
Not open for further replies.

sentrywiz

S

sentrywiz

I have a conundrum that evades me so far.

I put a damage detection system in my map. i did so to prevent the "unit is attacked" event triggering abuse where you can spam stop and the triggered effects from items and spells will still go off.

Now here is my problem. i have an item that allows single target spells to deal either 5% or 10% of enemy's max hp as spell damage on cast. this had no problem before, but ever since i added the dds, it now has a chance to insta kill someone with a spell, and this only occurs with a triggered curse spell that also deals triggered spell damage on cast according to its level.

all the other single target spells don't do this. i guess its because the damage from them is native and not triggered.

but i need more eyes on this, so if you see something give me a reply.
thanks!

p.s - none of the bots in my map have the magic boost ability so it somehow glitches with that and % of max hp yet they still trigger an insta kill without it. it may be part of the problem, just saying that none of my bot testers have this ability and thus their magic boost is always 0.00


  • SHOW DAMAGE
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_damageType Equal to PDD_PHYSICAL
          • Or - Any (Conditions) are true
            • Conditions
              • (PDD_source is A Hero) Equal to True
              • (Unit-type of PDD_source) Equal to Dummy
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Player_Crit_Damage[(Player number of (Owner of PDD_source))] Greater than 1.00
              • (Random integer number between 1 and 100) Less than or equal to 15
            • Then - Actions
              • Set PDD_amount = (PDD_amount x Player_Crit_Damage[(Player number of (Owner of PDD_source))])
              • Floating Text - Create floating text that reads ((String((Integer(PDD_amount)))) + !) above PDD_target with Z offset 0.00, using font size 11.00, color (100.00%, 10.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
            • Else - Actions
              • Floating Text - Create floating text that reads (String((Integer(PDD_amount)))) above PDD_target with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PDD_damageType Equal to PDD_SPELL
              • Or - Any (Conditions) are true
                • Conditions
                  • (PDD_source is A Hero) Equal to True
                  • (Unit-type of PDD_source) Equal to Dummy
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Player_Magic_Boost[(Player number of (Owner of PDD_source))] Greater than 0.00
                  • (Random real number between 1.00 and 100.00) Less than or equal to 25.00
                • Then - Actions
                  • Set PDD_amount = (PDD_amount + (PDD_amount x Player_Magic_Boost[(Player number of (Owner of PDD_source))]))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Player_Magic_Res[(Player number of (Owner of PDD_target))] Greater than 0.00
                    • Then - Actions
                      • Set PDD_amount = (PDD_amount - (PDD_amount x Player_Magic_Res[(Player number of (Owner of PDD_target))]))
                    • Else - Actions
                  • Floating Text - Create floating text that reads ((String((Integer(PDD_amount)))) + !) above PDD_target with Z offset 0.00, using font size 11.00, color (99.00%, 25.00%, 52.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 150.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Player_Magic_Res[(Player number of (Owner of PDD_target))] Greater than 0.00
                    • Then - Actions
                      • Set PDD_amount = (PDD_amount - (PDD_amount x Player_Magic_Res[(Player number of (Owner of PDD_target))]))
                    • Else - Actions
                  • Floating Text - Create floating text that reads (String((Integer(PDD_amount)))) above PDD_target with Z offset 0.00, using font size 9.00, color (82.00%, 47.00%, 78.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 150.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
            • Else - Actions



  • Cigarce Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Cigarce [E]
          • (Ability being cast) Equal to Cigarce [Q]
          • (Ability being cast) Equal to Cigarce [W]
    • Actions
      • Set temp_loc = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Smoke for (Owner of (Triggering unit)) at temp_loc facing Default building facing degrees
      • Set temp_unit = (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to temp_unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Cigarce [Q]
        • Then - Actions
          • Set temp_real = (Real(((Level of Cigarce [Q] for (Triggering unit)) x 30)))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Cigarce [W]
            • Then - Actions
              • Set temp_real = (Real(((Level of Cigarce [W] for (Triggering unit)) x 30)))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Cigarce [E]
                • Then - Actions
                  • Set temp_real = (Real(((Level of Cigarce [E] for (Triggering unit)) x 30)))
                • Else - Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing temp_real damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation ( udg_temp_loc )



  • Upaljach Ognena Pat
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Triggering unit) has an item of type Upaljach) Equal to True
          • ((Triggering unit) has an item of type Ognena Patika) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Flasha [E]
          • (Ability being cast) Equal to Flasha [Q]
          • (Ability being cast) Equal to Flasha [W]
          • (Ability being cast) Equal to Molotov Koktel [E]
          • (Ability being cast) Equal to Molotov Koktel [Q]
          • (Ability being cast) Equal to Molotov Koktel [W]
          • (Ability being cast) Equal to Pcovka [E]
          • (Ability being cast) Equal to Pcovka [Q]
          • (Ability being cast) Equal to Pcovka [W]
          • (Ability being cast) Equal to Cigarce [Q]
          • (Ability being cast) Equal to Cigarce [E]
          • (Ability being cast) Equal to Cigarce [W]
          • (Ability being cast) Equal to Grch Voda [E]
          • (Ability being cast) Equal to Grch Voda [Q]
          • (Ability being cast) Equal to Grch Voda [W]
          • (Ability being cast) Equal to Pijandura [R]
          • (Ability being cast) Equal to Sadist [R]
          • (Ability being cast) Equal to Krsh [R]
          • (Ability being cast) Equal to Shpongle [R]
    • Actions
      • Set Upaljach_Unit = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Ognena Patika) Equal to True
        • Then - Actions
          • Set Upaljach_Damage = ((Max life of Upaljach_Unit) x 0.10)
          • Set Upaljach_DamageInt = (Integer(Upaljach_Damage))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) has an item of type Upaljach) Equal to True
            • Then - Actions
              • Set Upaljach_Damage = ((Max life of Upaljach_Unit) x 0.05)
              • Set Upaljach_DamageInt = (Integer(Upaljach_Damage))
            • Else - Actions
      • Unit - Cause (Triggering unit) to damage Upaljach_Unit, dealing Upaljach_Damage damage of attack type Spells and damage type Normal
      • Special Effect - Create a special effect attached to the origin of Upaljach_Unit using Abilities\Spells\Other\Doom\DoomDeath.mdl
      • Special Effect - Destroy (Last created special effect)
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You would have to search more into the root of the problem.
Make a text message displaying who dealt how much damage to who when a unit is damaged.
This will show you if the damage is coming from multiple small attacks or from one big one.

Also place text messages at every single UnitDamageTarget action to see what action gets looped so badly.

I would do it but I havent got the map.
 

sentrywiz

S

sentrywiz

What type of damage kills the unit? What kind of values can magic boost have?

It's spell damage that kills the unit. also magic boost has values of 0.15 and gains 0.05 per level of ability, going to max of 0.35 extra magic damage per spell damage dealt.

Just to let you know, that while using other spells and having magic boost, it works pretty well even with the item. Like for example, spell does 50 damage, and extra 75 with the item (10% of max hp) and the magic boost adds a 25% chance for both spell damage to be increased by 35%.

You would have to search more into the root of the problem.
Make a text message displaying who dealt how much damage to who when a unit is damaged.
This will show you if the damage is coming from multiple small attacks or from one big one.

Also place text messages at every single UnitDamageTarget action to see what action gets looped so badly.

I would do it but I havent got the map.

Good point. i forgot to test with messages :p
It seems like a simple fix, but something about the dds messed up with the spell. that or my trigger was bad, but it worked without the dds, so the dds just showed that to me.
 

sentrywiz

S

sentrywiz

Some DDS alter the Max life of the unit so using GetUnitState(u, UNIT_STATE_MAX_LIFE) may return inaccurate result. If you are using PDD by LFH, use GetUnitMaxLife API

That might be the case. so how do i get the Getunitmaxlife? i'm not too fond of jass.
 

sentrywiz

S

sentrywiz

  • Set Upaljach_Damage = ((Max life of Upaljach_Unit) x 0.05)
-->
  • Custom script: set udg_Upaljach_Damage = GetUnitMaxLife(udg_Upaljach_Unit)*0.05
This will only compile if you are using Physical Damage Detection by looking_for_help

You read my mind. i was just gonna post that i'm using dds by looking_for_help and ask how to call this function. Great thanks! I'll give it a go, i expect that THAT is what's causing my problems

UPDATE: I'm getting a "Expected a name" error on compile and the trigger is disabled.
 

sentrywiz

S

sentrywiz

Hmm, I don't know why it wouldn't compile. Are you using JNGP? If no, try placing PDD in map header and test if it will now compile. If you are using JNGP, put the PDD in a library.

I'm not using jngp. What is pdd?

I should copy the entire dds code in the map header?
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
You read my mind. i was just gonna post that i'm using dds by looking_for_help and ask how to call this function. Great thanks! I'll give it a go, i expect that THAT is what's causing my problems

UPDATE: I'm getting a "Expected a name" error on compile and the trigger is disabled.

With Shadow Flux's suggestion, that SHOULD have compiled. Please post your update triggers for us and follow Maker's recent suggestion.
 

sentrywiz

S

sentrywiz

When i copy the dds inside the map header, it throws like 357 errors.
I assume the map header is the "custom script code" when i click the "mapname.w3x" at the top of the trigger list.

Also i checked if the var name was wrong. but as you can see, i set it before the custom scripts to 0.00 and the name is exactly the same.


  • Upaljach Ognena Pat
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Triggering unit) has an item of type Upaljach) Equal to True
          • ((Triggering unit) has an item of type Ognena Patika) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Flasha [E]
          • (Ability being cast) Equal to Flasha [Q]
          • (Ability being cast) Equal to Flasha [W]
          • (Ability being cast) Equal to Molotov Koktel [E]
          • (Ability being cast) Equal to Molotov Koktel [Q]
          • (Ability being cast) Equal to Molotov Koktel [W]
          • (Ability being cast) Equal to Pcovka [E]
          • (Ability being cast) Equal to Pcovka [Q]
          • (Ability being cast) Equal to Pcovka [W]
          • (Ability being cast) Equal to Cigarce [Q]
          • (Ability being cast) Equal to Cigarce [E]
          • (Ability being cast) Equal to Cigarce [W]
          • (Ability being cast) Equal to Grch Voda [E]
          • (Ability being cast) Equal to Grch Voda [Q]
          • (Ability being cast) Equal to Grch Voda [W]
          • (Ability being cast) Equal to Pijandura [R]
          • (Ability being cast) Equal to Sadist [R]
          • (Ability being cast) Equal to Krsh [R]
          • (Ability being cast) Equal to Shpongle [R]
    • Actions
      • Set Upaljach_Unit = (Target unit of ability being cast)
      • Set Upaljach_Damage = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Ognena Patika) Equal to True
        • Then - Actions
          • Custom script: set udg_Upaljach_Damage = GetUnitMaxLife(udg_Upaljach_Unit)*0.10
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) has an item of type Upaljach) Equal to True
            • Then - Actions
              • Custom script: set udg_Upaljach_Damage = GetUnitMaxLife(udg_Upaljach_Unit)*0.05
            • Else - Actions
      • Unit - Cause (Triggering unit) to damage Upaljach_Unit, dealing Upaljach_Damage damage of attack type Spells and damage type Normal
      • Special Effect - Create a special effect attached to the origin of Upaljach_Unit using Abilities\Spells\Other\Doom\DoomDeath.mdl
      • Special Effect - Destroy (Last created special effect)


The errors are:
Line 933: Expected a name
Line 936: Expected a name
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
So it looks like the custom max life function throws the error. Your trigger is compiled before the damage detection system, thus the max life function is not recognized.

If you are using jngp, you could wrap the damage detection system into a library with library and endlibrary keywords.
 

sentrywiz

S

sentrywiz

So it looks like the custom max life function throws the error. Your trigger is compiled before the damage detection system, thus the max life function is not recognized.

If you are using jngp, you could wrap the damage detection system into a library with library and endlibrary keywords.

I'm not using any JNGP. But I guess you're right. Does it matter that the dds is in the last folder of the trigger list? Maybe if i move it up, it will go "higher" in priority. EDIT: Nope, that did nothing, as expected.

Idk what to say, but here - i'll upload the map and those of you that wish to see and try for themselves go right ahead. Just a notice though, the map isn't public anywhere and some of the stuff aren't working because I haven't had time to update them. Please leave everything as is and try and see why the dds isn't working for me.
 
Last edited by a moderator:
Level 22
Joined
Feb 6, 2014
Messages
2,466
Do it like this...
It will take time to upload the map so I just screenshot what I did..
Damage Event is at the header file and the Damage Event Trigger is no longer needed since it is already in the header

147698d1440203719-insta-kill-spell-no-error.jpg

 

Attachments

  • no error.jpg
    no error.jpg
    304.5 KB · Views: 159

sentrywiz

S

sentrywiz

Damn. so all i didn't do was disable the dds.

works as you explained it now. +rep

will test now

UPDATE:

the damage text doesn't show now. my guess is the dds event doesn't work now.
this is a huge issue now, its like I don't even have a dds and its just back to being a map without a dds.
 
Last edited by a moderator:

sentrywiz

S

sentrywiz

I will try to look into it.

EDIT: Oh my bad, it will not work (because the Trigger was not initialized), but this one does. Do what I did in this map.

EDIT:
If i understand correctly, i am to copy the damage event trigger into my map?
if not, then please explain further.
 

sentrywiz

S

sentrywiz

Well the color codes I've put into the show damage trigger don't work now. everything is displayed in white color. did you change something with that?

But other than that, everything seems to be in order :)
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
Well the color codes I've put into the show damage trigger don't work now. everything is displayed in white color. did you change something with that?

But other than that, everything seems to be in order :)

No i didn't erase anything, I just transferred some parts to the header. Anyway, the test map I uploaded has a color displayed damage so I suggest checking your map's color code value because that might be the causing the problem.
 

sentrywiz

S

sentrywiz

Well i see nothing "different" in the test map than what i did. only i display it in a floating text instead of game messages and use the RGB values on a floating text like this:

  • Floating Text - Create floating text that reads (String((Integer(PDD_amount)))) above PDD_target with Z offset 0.00, using font size 9.00, color (82.00%, 47.00%, 78.00%), and 0.00% transparency
I don't know what happens, but it can't be from me. it has to be something you changed or added that causes mine to malfunction.
 

sentrywiz

S

sentrywiz

I wouldn't recommend putting the library code into the map header. Instead follow the steps explained here to ensure the DDS is placed in the correct order into the map.

I did all that, getting the same errors (and a new "expected function name") because I made new triggers using some functions that set life.

:/
 

sentrywiz

S

sentrywiz

Yes here. I removed it because i thought it was done.
 

Attachments

  • FORUM.w3x
    3.2 MB · Views: 50

sentrywiz

S

sentrywiz

EDIT:

Just to say, that by using what shadow flux said, i am able to color the damage text now by using color codes before the amount. So that is good :)

But now something else is as confusing. the spells all work as intended, but sometimes the events don't fire for random heroes for random durations. its like the trigger is off for someone in random times. during that time, spells heal instead of dealing damage. no idea why
 
Last edited by a moderator:
Level 14
Joined
Dec 12, 2012
Messages
1,007
EDIT:

Just to say, that by using what shadow flux said, i am able to color the damage text now by using color codes before the amount. So that is good :)

Yes, because the map you uploaded just compiles fine. You have to add of course the color codes to the texttag, because coloring text is not the job of the system (it was just used in the textmap as an example application).


But now something else is as confusing. the spells all work as intended, but sometimes the events don't fire for random heroes for random durations. its like the trigger is off for someone in random times. during that time, spells heal instead of dealing damage. no idea why

Well the map is not really small, so its hard to say whats causing that problem. From what I saw by a first look is that in the "Strafciger Pistol na Voda" trigger, you have a condition in the event. You should move that condition into an if, because otherwise the event might not be fired.


EDIT: Just to clarify this, its also fine to put the system code into the map header. That will work. However, IMO its always good practise to keep the map header clean because putting a library there just to resolve dependencies will get problematic when you are using multiple libraries and want to put them all into the map header. Its best to have them seperated into their own trigger pages.
 

sentrywiz

S

sentrywiz

Yes, because the map you uploaded just compiles fine. You have to add of course the color codes to the texttag, because coloring text is not the job of the system (it was just used in the textmap as an example application).




Well the map is not really small, so its hard to say whats causing that problem. From what I saw by a first look is that in the "Strafciger Pistol na Voda" trigger, you have a condition in the event. You should move that condition into an if, because otherwise the event might not be fired.


EDIT: Just to clarify this, its also fine to put the system code into the map header. That will work. However, IMO its always good practise to keep the map header clean because putting a library there just to resolve dependencies will get problematic when you are using multiple libraries and want to put them all into the map header. Its best to have them seperated into their own trigger pages.

The map is big in size because of imports. i understand that its nobody's job to decipher my jumble mess of trigger codes and logic, so i apologize for that. also i tried to make it simple for anyone looking at the map by moving the DDS and spell triggers to the top.

the trigger you mentioned. idk where is the problem. this is how it was and still is:

  • Strafciger Spell
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • PDD_damageType Equal to PDD_PHYSICAL
      • (PDD_source is an illusion) Not equal to True
      • (Unit-type of PDD_source) Not equal to Dummy
      • (PDD_source has an item of type Strafciger) Equal to True
      • (Random integer number between 1 and 100) Less than or equal to 12
    • Actions
      • Set temp_loc = (Position of PDD_source)
      • Unit - Create 1 Dummy for (Owner of PDD_source) at temp_loc facing Default building facing degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Strafciger Dummy to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire PDD_target
      • Custom script: call RemoveLocation ( udg_temp_loc )
I haven't put a condition inside the event. i didn't know you can even do that.

though you gave me an idea. instead of having these fire separately each time any unit deals damage, i can only have them run inside the show damage trigger. that way they will only fire when a hero deals damage.
 

sentrywiz

S

sentrywiz

Yes, the conditions are all in the event condition 'Conditions' ;)
Move them to an if-Condition in the 'Actions' section of the event.

EDIT:
strafciger spell is no problem really. it works as i want it.

a problem now is that sometimes the dds doesn't work for some units. like floating text doesn't pop above its head and spell damage seems to heal the unit instead of damage it. do you know why?

i have a crazy theory. your dds + Envenomed Weapons passive (that NEVER damages a unit below 1 health with its poison damage) seem to malfunction. the poison continues to damage a unit and it will kill it, even though without your dds this will never happen. can this cause a malfunction, because i revive the hero that will for example die from poison damage. can it SOMEHOW make that hero immune to spell damage until killed again without the poison? or maybe the dds doesn't register this hero somehow?

this is the only theory that i have, because i don't use complex spells that can malfunction somewhere. 90% of the spells (active and passive) are native and not triggered in some big way. the biggest triggered damage i have is that 5-10% of max hp, which now works as i want it.
 
Status
Not open for further replies.
Top