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

[Trigger] Wont work in game, why?

Status
Not open for further replies.
Level 4
Joined
Jan 21, 2009
Messages
57
I made a trigger that, when a skill (infect) is casted upon a unit it will "infect" them and after 10 seconds the owner of the casting unit gains control over the unit and if its a hero they get defeated aswell.

Heres the Trigger, the skill is based from Bloodlust
  • Infect Unit
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Infect
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: (|cffffcc00 + ((Name of (Owner of (Target unit of ability being cast))) + 's|r |cff808040hero has been infected! He will lose all control of his Hero in 10 seconds|r))
          • Game - Display to (Player group((Owner of (Casting unit)))) the text: |cffff0000Virus suc...
          • Wait 10.00 seconds
          • Game - Display to (Player group((Owner of (Casting unit)))) the text: |cffff0000Unit succ...
          • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
          • Unit - Add Infected to (Target unit of ability being cast)
          • Unit - Add Infect to (Target unit of ability being cast)
          • Game - Display to (All players) the text: (|cffff0000 + ((Name of (Owner of (Target unit of ability being cast))) + has been infected and has been defeated.|r))
          • Game - Defeat (Owner of (Target unit of ability being cast)) with the message: You have been Infec...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Game - Display to (Player group((Owner of (Target unit of ability being cast)))) the text: |cffffcc00One of yo...
              • Game - Display to (Player group((Owner of (Casting unit)))) the text: |cffff0000Virus suc...
              • Cinematic - Ping minimap for (Player group((Owner of (Target unit of ability being cast)))) at (Position of (Target unit of ability being cast)) for 2.00 seconds
              • Wait 10.00 seconds
              • Game - Display to (Player group((Owner of (Casting unit)))) the text: |cffff0000Unit succ...
              • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
              • Unit - Add Infected to (Target unit of ability being cast)
              • Unit - Add Infect to (Target unit of ability being cast)
            • Else - Actions
EDIT: Re-tested it and tried changing
  • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
to
  • Custom Script: call SetUnitOwner( GetSpellTargetUnit(), GetOwningPlayer(GetSpellAbilityUnit()), true )
Still doesn't work, hope one of you can help me D: (Thats the part thats not working btw)

- SuperCoke
 
Level 9
Joined
Oct 11, 2009
Messages
477
Try removing the second loop at the bottom... I think it is the one that preventing the following actions to work.

  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
      • Then - Actions
Anyway mind cleaning the leak?

Here is the leak:
  • Cinematic - Ping minimap for (Player group((Owner of (Target unit of ability being cast)))) at (Position of (Target unit of ability being cast)) for 2.00 seconds
This part: (Position of (Target unit of ability being cast))
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
The best way would be using local variable, that should work. Create unit variables called "TempTarget" and "TempCaster"
  • Actions
    • Custom script: local unit target = GetSpellTargetUnit()
    • Custom script: local unit caster = GetSpelAbilityUnit()
    • ------ blah blah blah something here ------
    • Wait 10.00 seconds
    • Custom script: set udg_TempTarget = u
    • Custom script: set udg_TempCaster = caster
    • ------ Just call these after each wait ------
    • ------ From now on, use TempTarget and TempCaster instead of the functions ------
    • ------ End of the trigger ------
    • Custom script: set target = null
    • Custom script: set caster = null
 
Status
Not open for further replies.
Top