• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Maybe I'm stupid, but why doesn't this work?

Level 3
Joined
Apr 16, 2025
Messages
27
The gist of it is this: a hero uses an ability and after three seconds they are given a rune. It doesn't matter which one. I've tried two methods, but they both fail about 10% of the time.

1: Simply issuing a rune after three game seconds.

2: I set the hero to a unit variable. = When I press the ability, a 3 second timer starts, which I also set to a variable. = I create a new trigger: when the timer (this one) expires, give the rune to (this one) the hero. AND IT DOESN'T WORK 10% OF THE TIME! What am I doing wrong?

(sorry, I don't know how to insert triggers here)
 
Level 3
Joined
Apr 16, 2025
Messages
27
This should basically do what you want:
  • Give Item after 3 sec
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Wait 3.00 seconds
      • Hero - Create Tome of Experience and give it to (Triggering unit)
I have the same code, only the waiting time is game-like, which eliminates errors due to the pause. And it only works in 90% of cases.
 
Level 3
Joined
Apr 16, 2025
Messages
27
Can you post your trigger(s)? There's a link in my signature on how to do it.
JASS:
function Trig_TRIGGER_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'Absk' ) ) then
return false
endif
return true
endfunction

function Trig_TRIGGER_Actions takes nothing returns nothing
call PolledWait( 3.00 )
call UnitAddItemByIdSwapped( 'rres', udg_MoonGlaive )
endfunction

//===========================================================================
function InitTrig_TRIGGER takes nothing returns nothing
set gg_trg_TRIGGER = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_TRIGGER, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_TRIGGER, Condition( function Trig_TRIGGER_Conditions ) )
call TriggerAddAction( gg_trg_TRIGGER, function Trig_TRIGGER_Actions )
endfunction

MoonGlaive is a unit that is pre-entered into a variable.

I converted it to jass because my editor has a different language than English.

I'm far from a beginner, I can manipulate the damage engine system quite well, but at such a stupid moment something doesn't work right. Tried through the timer = the same thing.
 
Last edited:
Level 3
Joined
Apr 16, 2025
Messages
27
what unit is udg_MoonGlaive at the time the wait finishes?
One way to find out would be to write name of the unit inside udg_MoonGlaive as game message.
Also, what happens if you replace udg_MoonGlaive for GetTriggerUnit()?
I tried both options, and ended up adding the unit to the variable, but the result was the same. The unit inside the variable is set once when choosing a hero. And in general, as I already said, in 90% of cases the trigger works correctly, it's just that sometimes for some mysterious reason they fire blanks.I also have a trigger in the map that removes runes to avoid leaks, but this is unlikely because of this, since I set the issuance of 5 runes, but sometimes it also does not work.


In fact, in a single player game I didn't notice any problems, but in a 4 player game, yes, it happens.
In other words, this error only occurs during online play.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,911
I tried both options, and ended up adding the unit to the variable, but the result was the same. The unit inside the variable is set once when choosing a hero. And in general, as I already said, in 90% of cases the trigger works correctly, it's just that sometimes for some mysterious reason they fire blanks.I also have a trigger in the map that removes runes to avoid leaks, but this is unlikely because of this, since I set the issuance of 5 runes, but sometimes it also does not work.


In fact, in a single player game I didn't notice any problems, but in a 4 player game, yes, it happens.
Disable the trigger that removes runes, I'm almost certain that's the problem.
 
Level 3
Joined
Apr 16, 2025
Messages
27
Can you post your trigger(s)? There's a link in my signature on how to do it.
I struggled for a long time trying to figure out why it wasn't working. I tried all the options. And today I found out that if a spell placed in a rune requires mana, and you don't have this mana, then the spell won't work.

This probably only applies to point spells, like Cripple (175 mana cost), because there were no problems with spells like Roar. I could be wrong. I found this out by setting the mana cost to 1000. The rune stopped working because the hero doesn't have that much mana.

This doesn't take away mana from the unit.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,911
I struggled for a long time trying to figure out why it wasn't working. I tried all the options. And today I found out that if a spell placed in a rune requires mana, and you don't have this mana, then the spell won't work.

This probably only applies to point spells, like Cripple (175 mana cost), because there were no problems with spells like Roar. I could be wrong. I found this out by setting the mana cost to 1000. The rune stopped working because the hero doesn't have that much mana.

This doesn't take away mana from the unit.
I see, that's an odd issue.

That's why it's important to disable/zero out any field that you aren't using, whether that be a on a Unit, Item, Ability, etc. I often see people make this sort of mistake with Dummy abilities -> "Why won't my Dummy cast X?", and it's because they forgot to remove the Mana Cost, remove a Requirement, or set Cast Range high enough. When it comes to Warcraft 3 it's best to avoid assumptions and try to eliminate all of the little edge cases.
 
Last edited:
Top