• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Pikeman bonus attack

Status
Not open for further replies.
Level 10
Joined
May 25, 2021
Messages
358
Hello,

I would like to create the Pikeman unit type.
My idea is that this type of unit causes bonus damage to:
  1. specific units: Kodo Beasts, Knight, Abomination, Bear, Mountain Giant, ...
  2. large ground units: units that have Collision Size from 32 to above (Collision Size of Human Knights is 32)
Could anyone please help me on writing the two scripts?

Thank you very much!
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,589
Copy and paste the Storm Hammer ability, rename it to Large (Classification), set it's Art Button positions to x: 0, y: -11 (you must hold shift when opening a field to enter negative values), and give the ability to each of your "large" units in the Object Editor.

Then create this trigger:
  • Example
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Pikeman
      • (Level of Large (Classification) for (Damage Target)) Equal to 1
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) + 15.00)
This trigger will make the Pikeman deal 15 bonus damage to units with the Large (Classification) ability.

You can customize the bonus damage to your liking, for example here's 25% bonus damage:
  • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) x 1.25)
There's also the Event "A unit About to take damage", which would allow you to add the bonus damage before Armor calculations if that's desired:
  • Unit - A unit About to take damage
 
Last edited:
Level 23
Joined
Apr 3, 2018
Messages
460
You can't access the functions Uncle listed on older warcraft 3 versions like 1.26.
To make this on 1.26 you would have to use a damage detect system.

 
Level 10
Joined
May 25, 2021
Messages
358
You can't access the functions Uncle listed on older warcraft 3 versions like 1.26.
To make this on 1.26 you would have to use a damage detect system.

Hmm. I have wc3 game version 1.27. I don't know which version of it's world editor.
 
Level 23
Joined
Apr 3, 2018
Messages
460
1.27 is almost the same as 1.26. I think the newer functions require 1.29 or 1.31?, not sure exactly.

You don't really need later versions of the game to do something like damage detection, it's just more difficult. You can read more about it in the resource I linked in the above post. It shows an example of how to use the system in GUI triggers, under one of the spoiler tags.
 
Level 10
Joined
May 25, 2021
Messages
358
1.27 is almost the same as 1.26. I think the newer functions require 1.29 or 1.31?, not sure exactly.

You don't really need later versions of the game to do something like damage detection, it's just more difficult. You can read more about it in the resource I linked in the above post. It shows an example of how to use the system in GUI triggers, under one of the spoiler tags.
Thank you for sharing.

Btw, I don't want to buy & install WC3 Reforged, so which latest version could I get?
 
Level 10
Joined
May 25, 2021
Messages
358
You don't need reforged, you just need to update your install through a launcher.
Screenshot_2.jpg


Hello! As you can see, I have version 1.30e now, but there is still no "Taken Damage" on the list!
 
Level 23
Joined
Apr 3, 2018
Messages
460
Seems to be an omission with the editor interface. I seem to have the same issue on my 1.32 editor.

To circumvent this, you can use custom code to add the event to your trigger by first running another trigger.
You can put this in custom script in a map initialization trigger:
  • Custom script: call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_DAMAGED )
"Untitled_Trigger_001" here is the name of the trigger you want to proc when a unit takes damage. "gg_trg_" is a prefix added when referring to GUI triggers within custom code.
This way, when the map initialization trigger runs, it will execute the custom code, which adds the event "any unit takes damage" to the specified "untitled" trigger. Then when the event procs from a unit taking damage, that "Untitled" trigger will run.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,589
It was added in either version 1.31 or 1.32, I forget exactly but my money is on 1.31 since that patch provided a large number of additions like Lua scripting, unit/ability field functions, custom UI, etc. I don't think we've received much besides "bug fixes" since then, often breaking more than fixing...

As others have mentioned, Damage detection was originally unavailable in GUI (the basic trigger editor interface that you use) so what people did was design systems in Jass (code) that could be used in GUI. Speaking of systems to use, Bribe's Damage Engine is the first that comes to mind as it's the most powerful and up to date system we have available. The only reason I didn't suggest it from the start is because it has a lot of variables and can be intimidating at first. Basically, if you want more control then you should use his system, otherwise, that simple trigger will suffice.

Also, you don't have to purchase Reforged in order to update to the latest patch. All buying Reforged does is unlock the HD graphics. That being said, if you're partial to the old Warcraft 3 menus and like to play custom campaigns (easily, at least) then you may not want to update to the latest patch as it changes things. Obviously you'll need the latest patch if you want to play on BNET, so if you intend to play with others this way then you're pretty much required to update.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
The event for GUI should be in the latest version of Warcraft III.

As long as you own a WC3 RoC CD key (TFT is not even checked anymore) you can download and play Reforged with classic graphics.

If you are still insistent of using a legacy version of WC3 then you will need to find an old version of a damage detection system. Most good damage detection systems have been updated to use the new natives wich will not work on legacy builds of Warcraft III.
 
Status
Not open for further replies.
Top