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

Magic Attack Type or Replacement

Status
Not open for further replies.
Level 7
Joined
Feb 20, 2016
Messages
274
Hello, I want to edit the magic attack type so it isn't considered a magic attack which will allow it to attack magic immune units.

Or would it be easier to make a completely new attack type?

How do I do these edits?



Thanks
 
Level 7
Joined
Feb 20, 2016
Messages
274
Why don't you just remove the magic immunity from the target ? I think you can add it back after the attack, if you wish...

What do you mean by "you can add it back after the attack"? I want units with magic immunity to be immune to abilities but not to magic attacks.

If it's not possible then I'll just remove magic immune abilities from all units that have it.
 
Level 11
Joined
Oct 9, 2015
Messages
721
I think I have two options for you:
First: In the object editor you remove the spell immunity from all the units that use it, then add it back when it is targeted from a spell, you will need to remove it again somehow after you use it:
  • Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Unit - Add Spell Immunity (Neutral Hostile) to (Target unit of ability being cast)
Second option: You remove the spell immunity ability in the object editor, then create a dummy buff for the unit, when an unit casts a spell on it you check to see if the target has this "dummy buff" and if it has you order the casting unit to stop
  • Untitled Trigger 002
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Target unit of ability being cast) has buff Devotion Aura) Equal to True
    • Actions
      • Unit - Order (Triggering unit) to Stop
Also you do this to make the "immune to magic" message (thanks to PurgeandFire):
Make these variables:
Variable Type - Variable Name
Sound Variable - ErrorSound
String Variable - ErrorMessage
Player Variable - ErrorPlayer

This is what it will be using the second option I provided (which I think is easier because you don't have to remove the spell immunity again after you used it )
  • Untitled Trigger 003
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Target unit of ability being cast) has buff Devotion Aura) Equal to True
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • Custom script: if udg_ErrorSound == null then
      • Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
      • Custom script: endif
      • Set ErrorMessage = This unit is immune to magic!
      • Set ErrorPlayer = (Owner of (Triggering unit))
      • Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
      • Custom script: call ClearTextMessages()
      • Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
      • Custom script: call StartSound(udg_ErrorSound)
      • Custom script: endif
 
Level 7
Joined
Feb 20, 2016
Messages
274
Thanks for the reply. I am not good with triggers, I'm stuck. In Condition Text I have now:
Target unit of ability being cast_Equal to_Targeted unit

When I click "Targeted unit" a new window opens where I can choose Preset, Variable or Function. There's no mention of "buff" or "True" in there.
What do I do here?
I have the same issue in Actions. I don't know what to choose.
 
Level 11
Joined
Oct 9, 2015
Messages
721
In the conditions section choose "Boolean Comparison" (first option) instead of "Unit Comparison" then you will look for this: "Unit - Unit has specific buff".
Then in actions you select "Unit" then "Issue order with no target" and order triggering unit to "stop"

I'll try and mount the error message part in a map for you, hang on! In the meanwhile explore the actions and functions in your world editor to get to know it a little better! Be back in a few minutes!

Edit: First of all go to your World Editor Window -> Preferences. There you need allow "Automatic create unknow variables while pasting trigger data", if you haven't done that already.
OR
Create the variables manually if you know how!
Make these variables:
Variable Type - Variable Name
Sound Variable - ErrorSound
String Variable - ErrorMessage
Player Variable - ErrorPlayer
===================================
Okay here's the map with everything ready, you need to create an dummy ability and replace the devotion aura in the trigger with it! you just need to copy it into your map:
 

Attachments

  • Spell Immunity.w3x
    16.9 KB · Views: 25
Last edited:
Level 18
Joined
Nov 21, 2012
Messages
835
I want units with magic immunity to be immune to abilities but not to magic attacks.

use damage table "spells" for your new attack type
223791-albums8824-picture107695.jpg


set your new icon:
223791-albums8824-picture107697.jpg


change attack type description:
223791-albums8824-picture107696.jpg


give new attack for units
223791-albums8824-picture107698.jpg


Now this Furlorg Elder Shaman from this example can attack magic immune units. Its from my map, simple and works 100%
 
Level 11
Joined
Oct 9, 2015
Messages
721
No, I don't think so. you can't create a new attack type, at least no that way, what I think he did was change the normal attack name, icon and properties. for that solution to work you would need to lose one type of attack, therefore, with all respect, I think my solution is better. However if you don't mind losing one type of attack, his solution is more practical as it doesn't involve triggers!
 
Level 7
Joined
Feb 20, 2016
Messages
274
But he has an attack type called Spells in the last screenshot, isn't that the same as "Combat - Damage Bonus Table - Spells"?
And how did he make it be able to damage units immune to abilities?
How would I make the magic attack type be able to damage units immune to abilities?
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
oh you guys are horribly useless at offering advice.

just create a trig that says

if magic attack user attacks magic immuned user

make magic user do damage equal to its own damage but of type hero to magic immuned user.

event
unit attacked

condition
unit attacked of type magic immuned (what ever that units name is)
unit attacking of type magic user (that units name)

action
cause unit magic user to do damage the magic immuned of type heroattack of however Many attack points magic user has.

if your having trouble getting the magic User to attack In the first place, just create another event that fires this trig when magic unit in range of magic immuned

problem solved
 
Level 11
Joined
Oct 9, 2015
Messages
721
You do know that a spell attack type unit can't even begin the attack on a unit that has spell immunity ability, don't you ? AND "unit is attacked" isn't even close to a efficient event detection. You would need a damaged detection system, which would be useless since the attacking unit could't even perform the attack because spell attack type can't begin the attack on spell immunity units. Do the trigger you described and post it here so we can check the results.

My advice for the thread's creator is to stick to my solution until a better one shows up.

PS: Calling someone who is trying to help "horribly useless" doesn't make you useful at all ;)
 
Level 18
Joined
Nov 21, 2012
Messages
835
100% agree with streetpunk in last post. If I were cynical I should ask TheLordOfChaos201 to read 1st line of his post and refer it to himself :D

ok calm down, back to topic
@streetpunk, your 1st option
what with flameStrike, shockwave, and others point-based spells, there is no "target unit of ability being cast"
2nd option
as far as I know buffs won't applied immediatelly and also not dissapear immediately
ok and 3rd options /no triggers/
what I suggest is just give to all unit that suppose to have "magic attack type" in OE instead of "magic" --> "spells". Then those unit will be able to attack all units (normal, magic immune and ethernal->but wont damage ethernal).
Editing "Combat Damage Bonus Table - Spells" is optional. But be aware it will affect not only "spell attack type" in OE but also spells in OE (flame strike, shockwave etc)
In "Game Interface" you can edit 3 fields I show and also field I didnt show with Name - call it for example 'deepMagic attack type'

blizzard mess up with names a little bit thats why it is
WorldEdit Value JASS Value Equivalent
Spells ATTACK_TYPE_NORMAL Spells

that's why you should look up in Game Interface for DAMAGETIP_NORMAL
btw , in triggers you can apply excactly the same type of damage if you use: Spells, Normal
or in jass
ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL



this is 1 time edit, then you just should remember to give in OE units attack-type "spells" if you want them to attack everything
 
Level 11
Joined
Oct 9, 2015
Messages
721
Oh, mine. I didn't even knew there were "magic" and "spell" attack types, I tought there was only one of those. I think they removed "spells" attack type and replaced with "magic" attack type when the expansion came out. ZiBitheWande3r3r solution is definily much better than mine as it doesn't involves trigger and you won't be losing any attack type at all, since the "spell" attack type is a already disabled one, you just need to enable it, change icon and texts configurations.
My advise now is to definly use his solution.
Clap! Clap! for ZiBitheWand3r3r!
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
if you actually read my solution correctly you would see I mentioned a fix to the fact that a magic user won't attack a spell immuned

periodically check to see if a magic user has come in range of the magic immuned

then cause the trig I mentioned to fire.

solution.

now you guys can carry on debating a solution or you can simply user my solution which works.

I've already used it.
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
Then you don't mind showing us the triggers, don't you ? ZiBitheWand3r3r solution's is the best for the time being.

this week end I'll show you the solution. just remind me

ps
does ZiBitheWand3r3r solution even work? remember the hiver wants the magic immuned unit to still be immune to spells yet still be damaged by magic users.

if I read ZiBitheWand3r3r correctly, his solution damages the amount of damage spells do. meaning it's a broken solution.
 
Last edited:
Level 11
Joined
Oct 9, 2015
Messages
721
I think the only fault is that if he changes the damage for that attack type the abilities and spells damage would be affected too, which I don't see much as a fault because the table would work for spell attacks and abilties, I particularly think it is better, making the abilities and spell attacks have the same damage table. If the user don't think it's a nasty fault this solution is very suitable because it's easy to apply. Anyways, will be waiting for that triggers of yours, if it's a better solution it will be acknowledged as such, but next time have more humbleness towards us fellow hivers, who are here only trying to help out of heart and good will.
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
I think the only fault is that if he changes the damage for that attack type the abilities and spells damage would be affected too, which I don't see much as a fault because the table would work for spell attacks and abilties, I particularly think it is better, making the abilities and spell attacks have the same damage table. If the user don't think it's a nasty fault this solution is very suitable because it's easy to apply. Anyways, will be waiting for that triggers of yours, if it's a better solution it will be acknowledged as such, but next time have more humbleness towards us fellow hivers, who are here only trying to help out of heart and good will.

Weeeee!

that's good to hear. I was being to believe the hive was full of hens laying eggs not know that the roaster had done his job.

if I can I'll try and post the solution tonight.
 
Level 12
Joined
Nov 3, 2013
Messages
989
Instead of spell immunity make the unit be target (unit classification) as "ancient" "giant" or something and don't let any activated spell ability have this classification allowed as a target.

Now the unit can't be affected by (casted) spells or take damage either, but you can still attack it with magic and spell attack type (Assuming you don't remove the class from targets allowed on the unit's allowed target in object editor)

Only drawback is that any unit you already have that use this classification would also become immune to spells. However "ancients" only affect NE ancient buildings, and buildings can generally not be targeted by spells anyway.

And unless you actually need wisps to build units, you can even remove the "ancient" classification from any buildings that would otherwise have it.

p.s. even though it's the one I have checked here, you probably can't use "walkable" for your purpose, the options are probably: Ancient, Giant, and Tauren.

4fb55fa50c.png
 
Level 8
Joined
Jan 28, 2016
Messages
486
That's actually a brilliant solution Death Adder.

There are a few limitations with the classifications though. A number of them are not available options under "Stats - Target Types" of attacks and abilities (check the spoiler below), including Giant and Tauren. This means that the hard-coded attacks of a unit cannot distinguish between Giant- or Tauren-type units, and any other units. The same goes for hard-coded spells (except for Spirit Link; this targets Tauren-only units IIRC).

6dcaDBq.jpg


6B9WJ1U.jpg

You can use triggers to work around these limits but you could use the Ancient, Mechanical or Suicidal/Sapper classifications to distinguish units as "dummy immune" as they are valid option in the "Target Types" field. That's assuming you don't need to use any of these classifications in your map as Death Adder also mentioned above.

By the way, you can still use the non-available classifications in triggers even though they are not available in GUI; the trick is to use Jass! Check the code below for an example.

JASS:
function Arcane_Bolt_Conditions takes nothing returns boolean
    if GetSpellAbilityId() == 'A000' then
        if IsUnitType(GetSpellTargetUnit(), UNIT_TYPE_GIANT) == true then
            call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), 200.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
        else
            call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), 100.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
        endif
    endif
    return false
endfunction

//===========================================================================
function InitTrig_Arcane_Bolt takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Arcane_Bolt_Conditions ) )
    set t = null
endfunction
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
Well here is my solution, it's not as great as I remember it but it works.

  • Events
    • Unit - A unit Is issued an order targeting an object
    • Unit - A unit Is attacked
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • And - All (Conditions) are true
          • Conditions
            • (Unit-type of (Target unit of issued order)) Equal to Granite Golem
            • (Unit-type of (Ordered unit)) Equal to Priest
        • And - All (Conditions) are true
          • Conditions
            • (Unit-type of (Attacking unit)) Equal to Granite Golem
            • (Unit-type of (Attacked unit)) Equal to Priest
        • And - All (Conditions) are true
          • Conditions
            • (Unit-type of (Attacked unit)) Equal to Granite Golem
            • (Unit-type of (Attacking unit)) Equal to Priest
  • Actions
    • Game - Display to (All players) the text: Running -----
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • (Unit-type of (Attacked unit)) Equal to Granite Golem
            • (Unit-type of (Attacking unit)) Equal to Priest
      • Then - Actions
        • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Mana of (Attacking unit)) / 9.00) + (Percentage life of (Attacking unit))) damage of attack type Hero and damage type Normal
        • Game - Display to (All players) the text: first
        • Animation - Play (Attacking unit)'s attack animation
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • (Default acquisition range of (Ordered unit)) Greater than or equal to (Distance between (Position of (Ordered unit)) and (Position of (Target unit of issued order)))
            • (Unit-type of (Target unit of issued order)) Equal to Granite Golem
            • (Unit-type of (Ordered unit)) Equal to Priest
      • Then - Actions
        • Unit - Cause (Ordered unit) to damage (Attacked unit), dealing (((Mana of (Attacking unit)) / 9.00) + (Percentage life of (Attacking unit))) damage of attack type Hero and damage type Normal
        • Game - Display to (All players) the text: second
        • Animation - Play (Ordered unit)'s attack animation
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • (Unit-type of (Attacking unit)) Equal to Granite Golem
            • (Unit-type of (Attacked unit)) Equal to Priest
      • Then - Actions
        • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (((Mana of (Attacking unit)) / 9.00) + (Percentage life of (Attacking unit))) damage of attack type Hero and damage type Normal
        • Game - Display to (All players) the text: third
        • Animation - Play (Attacked unit)'s attack animation
      • Else - Actions
 
Level 11
Joined
Oct 9, 2015
Messages
721
TheLordOfChaos201 the issue I'm seeing is that the priest can't begin performing the attack because of the granite golem's spell immunity ability, do you remove this ability when the priest comes into range, then add it back when it leaves range ? I'm not criticizing or anything, I'm just curious and trying to find the best way to execute the solution.
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
na nothing like that

all it does is when you click on the golem, the priest will still run up to it but won't attack until it's in range

when it range I simple use the trig to trigger the first attack

after that the trig automatically makes the priest attack the golem.

simple... it still needs improvements.

the order to attack the golem when attacked, needs to be disabled after the first attack. I should have just added that but I'm not really in the mind set to add that, just got back from work.

also the projectile doesn't show up... easy to add but again tired.

so as you can see it is possible without any broken systems.
 
Level 12
Joined
Nov 3, 2013
Messages
989
so as you can see it is possible without any broken systems.

The irony :xxd:

Terrible band aid "solution" to "fix" solutions with workable drawbacks.

So overlooking the part where you're supposed to make overly complex (and broken, with untold numbers of other bugs instead) triggers for things like the first attack, what will you do to make the Golem immune to spells while it's being attacked by units with magic attack?

How can removing spell immunity even be considered a "solution" for a unit with spell immunity? Might as well not have it in the first place at that point.

Answer to thread would then be "don't have spell immune units in your map"
 
Level 18
Joined
Nov 21, 2012
Messages
835
@Death Adder good job;]
Looks like we got 2 valid solutions now

@TheLordOfChaos201
please run a test before you show your trigger
  • Unit - A unit Is attacked
this wont fire for action
  • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing...
so this never fire:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • And - All (Conditions) are true
  • Conditions
  • (Unit-type of (Attacked unit)) Equal to Granite Golem
  • (Unit-type of (Attacking unit)) Equal to Priest
  • Then - Actions
  • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Mana of (Attacking unit)) / 9.00) + (Percentage life of (Attacking unit))) damage of attack type Hero and damage type Normal
  • Game - Display to (All players) the text: first
  • Animation - Play (Attacking unit)'s attack animation
  • Else - Actions
  • (Default acquisition range of (Ordered unit)) Greater than or equal to (Distance between (Position of (Ordered unit)) and (Position of ...
less then??

imagine mass right click on golem, what will happend?
all it does is when you click on the golem, the priest will still run up to it but won't attack until it's in range
when it range I simple use the trig to trigger the first attack
you don't check periodically, sow how you detect golem in range?

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • And - All (Conditions) are true
  • Conditions
  • (Unit-type of (Attacking unit)) Equal to Granite Golem
  • (Unit-type of (Attacked unit)) Equal to Priest
  • Then - Actions
  • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (((Mana of (Attacking unit)) / 9.00) + (Percentage life of (Attacking unit))) damage of attack type Hero and damage type Normal
  • Game - Display to (All players) the text: third
  • Animation - Play (Attacked unit)'s attack animation
  • Else - Actions
so now priest has magially the same attack speed as golem? :D

come on..
 
Level 11
Joined
Oct 9, 2015
Messages
721
As I stated before, I stand with ZiBitheWand3r3r's solution until a better and more suitable one shows up! It is practical, easy to implemente (even for new users) and have no huge drawbacks (the only possible one is as I stated before, the damage table factor, but I don't think of it as a problem at all)
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
I'm not here to spoon feed you people

I'm just here to show you the solution and for you to make it work.

obviously my trig has a few little errors, but it's not a broken system. you can match the units damage directly to the caster and his attack speed.

the only things that need doing
switch off the react attack after the first attack against the priest
match damage to priests attack points
match sleep to priests attack speed
add projectile to attacks

that's it. now If your too lazy to do that yourself, then I don't care.

I'm just here to give you a Eureka idea, you make it happen. I'm sure as hell am not going to make the whole trig for your. there would be no opportunity for you to learn in that.

what will you do to make the Golem immune to spells while it's being attacked by units with magic attack?

How can removing spell immunity even be considered a "solution" for a unit with spell immunity? Might as well not have it in the first place at that point.

I didn't remove spell immunity at all you jerk!

that's my point. it is a perfect solution because the spell immunity stays as is!
 
Last edited:
Level 7
Joined
Feb 20, 2016
Messages
274
Hey I'm still confused with ZiBitheWand3r3r's solution, he seems to have edited a Spells in the Constants window. And like you said I have to sacrifice one attack type? If I wanted to sacrifice the magic attack type, what column would I have to edit?
 
Level 8
Joined
Jan 28, 2016
Messages
486
Hey I'm still confused with ZiBitheWand3r3r's solution, he seems to have edited a Spells in the Constants window. And like you said I have to sacrifice one attack type? If I wanted to sacrifice the magic attack type, what column would I have to edit?

You need to 'sacrifice' an attack type other than magic because it is hardcoded to not allow attacking magic immune units, so you can't 'sacrifice' Magic attack type to replace itself... if that makes any sense. So in Zibi's solution, he edits the Spells attack type in the Constants to match the bonuses of the Magic type and then gives it to all the units that should have Magic attacks. Additionally, I'm fairly certain that there are no default units that have Spell attacks so this method shouldn't interfere with any ladder units.
 
Level 7
Joined
Feb 20, 2016
Messages
274
I never knew there was a hidden unused Spell attack until now that I'm modding. So Magic attack is hardcoded huh? that sucks. Oh well I''ll use the Spell attack. Thanks for the clarification.
 
Level 11
Joined
Oct 9, 2015
Messages
721
The only drawback pointed on it (spell attack type) is that it would affect the damage table of all abilities and spells, which I don't see as a drawback at all, since I see it fits to have the default attack from magic users to use the same damage table as for spell abilities. I think this thread got a little confusing for our friend warcraftmodding123, so I'll try to clear it for him and complement Dehua's post, you do the following:

Go to Game Interface under "Advanced" and change the Icons and Texts for "Spells" attacks, you can find the instructions on his screenshots (you need to do it because the spell attack type has the "normal" attack type icon and description) -> in the object editor change the attack type of the magic users from "Magic" attack type to "Spells" attack type -> Adjust the Damage Table for Spells attack type in the gameplay constants as you see fit.
 
Level 8
Joined
Jan 28, 2016
Messages
486
Yeah you're right StreetPunk, it would affect spell damage from abilities. Complete forgot about that! In that case, I'd personally go with Death Adder's solution but you could stick with that method as well.
 
Level 7
Joined
Feb 20, 2016
Messages
274
The only drawback pointed on it (spell attack type) is that it would affect the damage table of all abilities and spells, which I don't see as a drawback at all, since I see it fits to have the default attack from magic users to use the same damage table as for spell abilities. I think this thread got a little confusing for our friend warcraftmodding123, so I'll try to clear it for him and complement Dehua's post, you do the following:

Go to Game Interface under "Advanced" and change the Icons and Texts for "Spells" attacks, you can find the instructions on his screenshots (you need to do it because the spell attack type has the "normal" attack type icon and description) -> in the object editor change the attack type of the magic users from "Magic" attack type to "Spells" attack type -> Adjust the Damage Table for Spells attack type in the gameplay constants as you see fit.

Thanks for the explanation. I was thinking that if Spell Attack will alter the abilities damage, maybe I could use the Chaos Attack instead, does it have a hardcoded effect like the Magic Attack? If not I will use that one for my new attack type.
 
Status
Not open for further replies.
Top