HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Elemental Resistance

07-14-2005, 12:09 AM#1
SuperDuperGuy
Here's a solution to having Elemental resistance. It requires a trigger for every unit. I have no idea how it will scale, it depends on how WC3 handles trigger detection.

What you do is create new buffs called fire, ice, lightning, ect. Have every fire spell add a fire buff, ice spell add ice buf ect. Have the buf only last a moment. Then for every creature create a takes damage trigger. (is there one for generic unit event?) You really only need one function, then use the register for unit event for every unit after they are created.

In the function to detect what buf they have, and use the "Unit Custom Value" to encode what resistance each unit has. Apply more damage if the unit has a element weakness, reduce if strength.

Think this is doable? I'm not sure what kind of behavior it will have if too many different kinds of attacks are dealt at once.

This sound like it would work well?
07-14-2005, 12:17 AM#2
PlasticAngel
Try it.
07-14-2005, 12:34 AM#3
Ignitedstar
Yes, try it. I think it would work and it sounds like a good plan. If it doesn't then tell that it doesn't.
07-14-2005, 01:55 AM#4
shadow1500
obviosuly there is no way to find the source of the damage, if someone casts entangling roots and shadow strike there is no way to tell what kind of damage it was, the unit has both buffs.

but here is an idea that might work, damage is a real so u cud have shadow strike do 15.01 damage and roots do 15.02.
if u know if a damage was not an attack then u can find what type of damage it was.
07-14-2005, 05:34 AM#5
SuperDuperGuy
Whats with the "Unit - Damage Target" action. It seems that attack types are in there, and damage types, which i see no effect on gameplay. Another failed to add feature to the game?

I tested this trigger out with 2000 units, 1000 on one team, 1000 on another to get alot of attacks going at once, and there was siginificant slowdown. But having 1000 vs 1000 slowed down a bit even without them. As long as there isnt too much happening at once, this seems to be a good way to go about doing things.

One more thing about buffs.... They seem to be exactly the same as effects, except effects don't show up on the interface in the game. They have nothing todo with the accual effect on the unit it seems. The effect seems to be entirely determined by the ability, and the bufs/effects just do the art. This is a very, very useful piece of information. I stumbled across this tring to make all fire attacks set anyone with drunken haze on fire.

I think the best solution for elemental damage is to change the bufs of the spells i want to have elemental damage, and allow the durration to stay with extra effects (firebot stun) then I will just have units weak to fire have lowered armor to all attacks if they are on fire, it might seem weird to have units have reduced damage with all attacks with resistance however....

Better yet, have a trigger that just deals damage over time if they have an element buf that they are weak to, and reduce it if they are strong.
07-14-2005, 09:58 AM#6
Anitarf
The point is, you can' really reduce damage on "damage is dealt" event, because then damage is already dealt, so you can only add to it but you can't really decrease it, only remedy it's effects (which won't do you any good if the unit is already dead by then). My suggestion is, if you want such a custom magic system feature, then trigger all the spell effects.
07-14-2005, 05:41 PM#7
SuperDuperGuy
Quote:
Originally Posted by Anitarf
The point is, you can' really reduce damage on "damage is dealt" event, because then damage is already dealt, so you can only add to it but you can't really decrease it, only remedy it's effects (which won't do you any good if the unit is already dead by then). My suggestion is, if you want such a custom magic system feature, then trigger all the spell effects.


There's no trigger to detect when a missle hits though, is there?
07-14-2005, 06:25 PM#8
shadow1500
the event - unit takes damage is acctualy activated before the unit takes the damage.
try this:
Code:
dmg test
    Events
        Unit - Footman 0000 <gen> Takes damage
    Conditions
    Actions
        Game - Display to (All players) the text: (String((Life of Footman 0000 <gen>)))
        Wait 0.10 seconds
        Game - Display to (All players) the text: (String((Life of Footman 0000 <gen>)))
07-14-2005, 11:13 PM#9
Anitarf
Quote:
Originally Posted by shadow1500
the event - unit takes damage is acctualy activated before the unit takes the damage.
try this:
Code:
dmg test
    Events
        Unit - Footman 0000 <gen> Takes damage
    Conditions
    Actions
        Game - Display to (All players) the text: (String((Life of Footman 0000 <gen>)))
        Wait 0.10 seconds
        Game - Display to (All players) the text: (String((Life of Footman 0000 <gen>)))
Ok, but that still doesn't help much, if the target is on full hp then adding anything before damage is dealt won't do anything the same way as adding it after the damage wouldn't do if the unit was nearly dead. In any event, if a spell would deal as much damage as you had hp, it would kill you no matter what your resistance were, because you couldn't reduce damage, you could just add hp before/after it was dealt.

Triggering the entire spell system alows you to get exactly what you want. Trigered combat/spell systems aren't that hard to do. My next project has a completely triggered combat system down to triggered armor that mimics that of starcraft, and it was probably the easiest thing to do in the entire map.
07-15-2005, 03:05 AM#10
SuperDuperGuy
Quote:
Originally Posted by Anitarf
Ok, but that still doesn't help much, if the target is on full hp then adding anything before damage is dealt won't do anything the same way as adding it after the damage wouldn't do if the unit was nearly dead. In any event, if a spell would deal as much damage as you had hp, it would kill you no matter what your resistance were, because you couldn't reduce damage, you could just add hp before/after it was dealt.

Triggering the entire spell system alows you to get exactly what you want. Trigered combat/spell systems aren't that hard to do. My next project has a completely triggered combat system down to triggered armor that mimics that of starcraft, and it was probably the easiest thing to do in the entire map.

Plus the damage is already determined, so you can't change a units stats and have it take effect. I'm not sure how you would make firebolt type spells with triggers. How do you detect when the projectile hits?

P.S. What blizzard needs to do is just make a new warcraft engine, designed souly for making mods and stuff and fix all these little quirks. I would by it. Even if they didnt bother making a main game with it, with warcraft III the main game isnt even that good.
07-15-2005, 09:39 AM#11
Anitarf
Well, you could make the firebolt do a symbolic ammount of damage (like 1) and then use the unit takes damage event. If the damage dealt is low enough and the unit type of damage source is equal to the unit that has firebolt then you got yourself a firebolt hit detection, now just do the rest of the damage with the trigger. (if the damage is reduced below 1 by the defender's resistance, make it 2 or just don't deal it, just in case so the trigger doesn't go into an infinite loop :) )
07-15-2005, 06:41 PM#12
shadow1500
u guys cant think out of the box can u, u add an abillity based off item max life bonus for 1000 life, even if the spell did 1000 dmg u can add the ability, add the life corresponding to the resistance , wait for dmg to get done then remove the ability, thats how i did my Power Word: Shield spell.

here is an example
say footman have 50% resistance
Code:
dmg test
    Events
        Unit - Footman 0000 <gen> Takes damage
    Conditions
    Actions
        Unit - Add Ability Dead Fixer to Triggering Unit
        Unit - Set life of Triggering unit to (Life of Triggering Unit + (Damage taken x 0.50))
        Wait 0.01 seconds
        Unit - Remove Ability Dead Fixer from Triggering Unit
07-15-2005, 06:54 PM#13
Anitarf
Well, you could have written that at the start. Oh, btw, you might want to fix that line where you set the life, it's a bit wrong. also, if the damage were enough to kill the target, it probably wouldn't give any bounty this way because it would die from loosing the life bonus ability instead of damage... but that can be fixed with an if/then/else statement. A bigger problem might be how real life scales along with max life...
07-15-2005, 07:26 PM#14
shadow1500
trust me it works, i made a spell based on that and there is no problem.
07-15-2005, 10:42 PM#15
SuperDuperGuy
Here we go: Make all element type spells do the same about of damage. And have them put a buff on that is lit, ice, fire, ect. Then on unit takes damage, the buff will be removed, and a spell that deals damage will be cast on them by a dummy unit. depending on the units resistance type, a stronger version will be cast on them. This way, when a unit is damaged, one trigger will hurt them with fire, and remove that buff, then the next one will do the lit one, or ice one. doesnt matter exactly which does which. I think this will catch every hit, without mistaking anything. cause the buff and damage happen at the same time i think.

EDIT: even if spell deals 0 damage, its unit take damage is still triggered. so i just need to make everything deal 0 damage.