• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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
 
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))
 
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.
Back
Top