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

what is wrong with trigger?

Status
Not open for further replies.
Level 2
Joined
May 26, 2011
Messages
14
hi, i wanna make trigger that will do 2x hero agility every time hero uses spell
i made trigger like this, but it don;t works

Burning Earth
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Burning Earth (Shaman)
Actions
Wait 1.00 seconds
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing ((Real((Agility of (Triggering unit) (Include bonuses)))) x 2.00) damage of attack type Spells and damage type Normal

I also tried other events like
Unit - A unit Starts the effect of an ability
Unit - A unit Begins channeling an ability

it wont work! TNX
 
Level 5
Joined
Sep 1, 2010
Messages
168
It's Simple - using a wait removes every information in a trigger expecpt for the event (in this case - the tirggering unit).
Apart from that - always use the event a unit starts effect of ability- this way the ability will be in cooldown.. with start effect it can be cancelled and still not being paid or in cooldown though triggering.

Now to the solution of your problem:
create a hashtable
save the damaging unit's key in 0 of key of target unit of ability being cast.
(if your ability has different levels save the level as 1 of key of target unit of ability being cast).
Add the targeted unit to a unitgroup (damagetargets).
start a oneshottimer that expires in 1 seconds.

Now make a second trigger
-> event : the previously started timer expires
conditions: none
actions: pick every unit in unit group (damagetargets)
let (load 0 of key of picked unit) deal damage to picked unit (damage equal to certain amount of again load level into a formular), choose your attack type and so on.

Hope this is clear enough, I'm quite tired right now and happy to crawl into bed after this post... ~.~
 
Level 2
Joined
May 26, 2011
Messages
14
i will try this, but what do you think about

Burning Earth
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Burning Earth (Shaman)
Actions
Unit Group - Pick every unit in (Units within 250.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)) and do (Actions)
Loop - Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing ((Real((Agility of (Triggering unit) (Include bonuses)))) x 2.00) damage of attack type Spells and damage type Normal
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Your first post trigger

Just like bear-avatar guy said, using "Wait" action ruins the function call (except for (Triggering unit))

But you can do this:
  • Custom script: local unit Target = GetSpellTargetUnit()
  • Custom script: local unit Caster = GetTriggerUnit()
  • Custom script: call TriggerSleepAction(1.00)
  • Custom script: call UnitDamageTargetBJ( Caster, Target, ( I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, Caster, true)) * 2.00 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
  • Custom script: set Target = null
  • Custom script: set Caster = null
Trigger above shows the trigger uses local variables to make a MUI spell by using Wait


For your second trigger

Since you already uses Unit Group, change the action of damaging target from (Target unit of ability being cast) to (Picked unit).
 
Level 2
Joined
May 26, 2011
Messages
14
TheAtheal, I don't know how to do what you sad. Can you make trigger if its not too much work :)

defskull, I changed second trigger like you sad, but my game starts to lag very much when I cast ability...
Complite mes

EDIT:
Events
Unit - A unit Begins casting an ability
Conditions
((Triggering unit) is A Hero) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ability being cast) Equal to Shadow Step (Assassin)
Then - Actions
Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\MarkOfChaos\MarkOfChaosTarget.mdl
Wait 1.00 seconds
Unit Group - Pick every unit in (Units within 250.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
Loop - Actions
Unit - Cause (Triggering unit) to damage (Picked unit), dealing 300.00 damage of attack type Spells and damage type Normal
Else - Actions
THIS TRIGGER WORKS PERFECTLY!
But, next trigger doesnt. When I activate second trigger my game starts laging extremly!!!
Help pls! Heres second trigger for another spell.
Burning Earth
Events
Unit - A unit Starts the effect of an ability
Conditions
((Triggering unit) is A Hero) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ability being cast) Equal to Burning Earth (Shaman)
Then - Actions
Unit - Cause (Triggering unit) to damage circular area after 1.00 seconds of radius 250.00 at (Position of (Target unit of ability being cast)), dealing ((Real((Agility of (Triggering unit) (Include bonuses)))) x 2.00) damage of attack type Spells and damage type Normal
Else - Actions
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Defskull's option is the best one though.
However, the UnitDamageTargetBJ(...) should be this:

  • Custom script: call UnitDamageTarget(Caster, Target, I2R(GetHeroAgi(Caster, true)) * 2., true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
The rest is correct.

Edit: by the way, right-click the trigger name above "events", then select "copy as text".
On the hive, press CTRL + V and write [trigger][/trigger] around it.
That makes your triggers more clear for everyone.

Your second trigger:
  • Actions
    • Set tempLoc = (Position of (Target unit of ability being cast))
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 250.00 of tempLoc matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((Real((Agility of (Triggering unit) (Include bonuses)))) x 2.00) damage of attack type Spells and damage type Normal
    • Custom script: call RemoveLocation(udg_tempLoc)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
EDIT:
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Ability being cast) Equal to Shadow Step (Assassin)
      • Then - Actions
        • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\MarkOfChaos\MarkOfChaosTarget.mdl
        • Wait 1.00 seconds
        • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
          • Loop - Actions
            • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 300.00 damage of attack type Spells and damage type Normal
      • Else - Actions
THIS TRIGGER WORKS PERFECTLY!
But, next trigger doesnt. When I activate second trigger my game starts laging extremly!!!
Help pls! Heres second trigger for another spell.
  • Burning Earth
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Burning Earth (Shaman)
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage circular area after 1.00 seconds of radius 250.00 at (Position of (Target unit of ability being cast)), dealing ((Real((Agility of (Triggering unit) (Include bonuses)))) x 2.00) damage of attack type Spells and damage type Normal
        • Else - Actions
As said before: use "[trigger] (COPY TRIGGER HERE) [/trigger]"

First of all: put the event "(Ability being cast equal to ...)" in the Conditions-section (so you do not need that if/then/else).

Try using the trigger I have provided before (but then with the circular damage, however: you must still use that tempLoc variable.

There is no reason it lags, unless you've got other triggers running that could cause an infinite loop or something.
Upload your map so I (or anyone else) can take a look.
 
Status
Not open for further replies.
Top