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

Item Spell to unit spell techtree requirement problem.

Status
Not open for further replies.
Level 9
Joined
Apr 22, 2020
Messages
430
Hello guys i have a problem with an item spell here in the world editor, i have created the orb of corruption item spell into a unit spell which decreases the enemy units armor with each attack and i have also given this spell a techtree requirement which it will not be available until it is researched. But when i tested it ingame, the unit have the spell activated because when i attack an enemy unit the armor reduction applies, them which is quite wierd because i have given the ability a techtree requirement but the ability is still in the unit even if i had not researched it's techtree requirement yet. Can someone help me solve this problem?
 
Last edited:
Level 20
Joined
Apr 12, 2018
Messages
494
You could try to get around this by putting Orb of Corruption in a Spellbook and have the Tech Requirement on the spellbook.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,536
A solution that comes to mind:

Hide the Orb of Corruption ability by setting it's Art - Button Position - Normal (X) to 0, and Art - Button Position - Normal (Y) to -11.

Create a new ability based on Storm Hammers. Edit this abilities name/icon/tooltip to look like your Orb of Corruption ability. Give this ability the Tech Tree requirement.

Add the new ability to your Unit in the Object Editor.

Then through triggers, we're going to add the Armor Reduction ability to your Unit:
  • Add Corruption 1
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Current research level of Corruption (Tech) for (Owner of (Triggering unit))) Greater than 0
    • Actions
      • Unit - Add Corruption Armor Reduction (Hidden) to (Triggering unit)
  • Add Corruption 2
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Corruption (Tech)
    • Actions
      • Set VariableSet TempGroup = (Units owned by (Triggering player) of type Footman)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Add Corruption Armor Reduction (Hidden) to (Picked unit)
      • Custom script: call DestroyGroup (udg_TempGroup)
Replace Footman with your Unit-Type, and replace Corruption (Tech) with your Research.
 

Attachments

  • Corruption Example.w3m
    17.8 KB · Views: 10
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
A solution that comes to mind:

Hide the Orb of Corruption ability by setting it's Art - Button Position - Normal (X) to 0, and Art - Button Position - Normal (Y) to -11.

Create a new ability based on Storm Hammers. Edit this abilities name/icon/tooltip to look like your Orb of Corruption ability. Give this ability the Tech Tree requirement.

Add the new ability to your Unit in the Object Editor.

Then through triggers, we're going to add the Armor Reduction ability to your Unit:
  • Add Corruption 1
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Current research level of Corruption (Tech) for (Owner of (Triggering unit))) Greater than 0
    • Actions
      • Unit - Add Corruption Armor Reduction (Hidden) to (Triggering unit)
  • Add Corruption 2
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Corruption (Tech)
    • Actions
      • Set VariableSet TempGroup = (Units owned by (Triggering player) of type Footman)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Add Corruption Armor Reduction (Hidden) to (Picked unit)
      • Custom script: call DestroyGroup (udg_TempGroup)
Replace Footman with your Unit-Type, and replace Corruption (Tech) with your Upgrade.
So does this trigger also applies to the Orb of Frost item spell? Because it also has the same problem for the Orb of Corruption.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,536
So does this trigger also applies to the Orb of Frost item spell? Because it also has the same problem for the Orb of Corruption.
You need to create new triggers for each Ability.

It's a pretty simple concept. The first trigger adds the ability when the unit is created (enters the map), and the second trigger adds the ability to all existing units upon finishing the Research.

The Event A unit enters (Playable map area) happens when a unit is trained, summoned, sold, etc... So it will add the ability to any newly created Units as long as the Research is finished.

Some of your Units may have already entered the map before you finished the Research. That's where the second trigger comes in, picking every unit of the desired Unit-Type and adding the ability to them.
 
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
You need to create new triggers for each Ability.

It's a pretty simple concept. The first trigger adds the ability when the unit is created (enters the map), and the second trigger adds the ability to all existing units upon finishing the Research.

The Event A unit enters (Playable map area) happens when a unit is trained, summoned, sold, etc... So it will add the ability to any newly created Units as long as the Research is finished.

Some of your Units may have already entered the map before you finished the Research. That's where the second trigger comes in, picking every unit of the desired Unit-Type and adding the ability to them.
Thank you so much again Uncle! The trigger works perfectly.
 
Status
Not open for further replies.
Top