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

Need some help with a trigger...

Status
Not open for further replies.
Level 4
Joined
May 2, 2009
Messages
69
Hey everyone. Not quite sure if I'm in the right section or not, but I need to know if someone can help me with a trigger added to a custom spell.
This may take a while to read, so those of you who are impatient, be ready to get bored. :hohum:
First of all, the explaination of the spell. It is a very simple idea, with a complex trigger added for effect. It is called Execution, and it's base spell is Finger of Pain. All the effects are taken out so it is a melee ranged spell that has no art or data on it. Now the point was to have the caster use a slow motion attack that when completed it automatically kills the enemy. (It is balanced, it can only be used on low leveled enemies.) Now the problem is I learned triggering without tutorials and know several, strange ways of getting things done. So I feel like I've made this harder than it needs to be. I want to have a maximum of 3 units that have the ability, and I got the spell to work, but I can't have it so they can all use it at the same time. It works fine, but it looks crappy because one or two of the spells end up killing the target before effects are done. Anyhow, here is my triggering, plz point out, if you can, my errors and tell me how to fix it.
  • Execution 1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Ability being cast) Equal to Execution - Orc) and ((Casting unit) Equal to Avengers[1])
    • Actions
      • Set ExCaster[1] = (Casting unit)
      • Set ExTarget[1] = (Target unit of ability being cast)
      • Unit - Pause ExTarget[1]
      • Unit - Make ExTarget[1] Invulnerable
      • Unit - Pause ExCaster[1]
      • Unit - Make ExCaster[1] Invulnerable
      • Special Effect - Create a special effect at (Position of ExTarget[1]) using Abilities\Spells\Items\OrbCorruption\OrbCorruptionSpecialArt.mdl
      • Wait 1.00 seconds
      • Animation - Change ExCaster[1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Unit - Create 1 Execution Dummy for (Owner of ExCaster[1]) at (Position of ExCaster[1]) facing (Facing of ExCaster[1]) degrees
      • Set Executer[1] = (Last created unit)
      • Special Effect - Create a special effect at (Position of ExCaster[1]) using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Animation - Change Executer[1]'s animation speed to 20.00% of its original speed
      • Animation - Change ExTarget[1]'s animation speed to 20.00% of its original speed
      • Wait 1.00 seconds
      • Animation - Play Executer[1]'s attack animation
      • Wait 2.50 seconds
      • Unit - Remove Executer[1] from the game
      • Animation - Change ExCaster[1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Unit - Make ExCaster[1] Vulnerable
      • Unit - Pause ExCaster[1]
      • Unit - Make ExTarget[1] Vulnerable
      • Wait 1.00 seconds
      • Special Effect - Create a special effect at (Position of ExTarget[1]) using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
      • Unit - Kill ExTarget[1]
If it is confusing, here is my "legend":

Execution Dummy - A dummy unit for my caster
Avenger - Casting unit type
ExCaster - Variable for casting unit (Made array = 3 for 3 units.)
ExTarget - Variable for target unit (-Same as above-)
Executer - Variable for dummy unit (-Same as above-)

Now I have also given thought to the fact that it may be a problem with my trigger to set variables.
  • Avenger Class
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Avenger - Orc
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Avengers[1] Equal to No unit
        • Then - Actions
          • Set Avengers[1] = (Trained unit)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Avengers[1] Not equal to No unit) and (Avengers[2] Equal to No unit)
        • Then - Actions
          • Set Avengers[2] = (Trained unit)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Avengers[1] Not equal to No unit) and (Avengers[2] Not equal to No unit)
        • Then - Actions
          • Set Avengers[3] = (Trained unit)
        • Else - Actions
          • Do nothing
So it may be there... I haven't had the time to give much more thought to it. If you have the answer, I'm anxious to hear it! :thumbs_up:
 
Level 11
Joined
Jul 2, 2008
Messages
601
You use waits in your trigger. Now look:

The first unit starts the effect of ability, then the second starts two seconds later - what does this mean? This mean, that the trigger will be played correct only for the second unit, cause all the variables will be reset to him.

Also I can't get any point in making such a setting trigger, what does it do? The seconds and third condition WILL NEVER HAPPEN! Because it'll be set in the first If/Then/Else if it doesn't have any unit and won't be reset at all, if there is still unit in this variable.

For you, if you have just three units with such an ability and you don't know yourself how to fix that, I can suggest just one thing: At map initialization set this three variables to the needed units (Or somewhere in game - that's not matter at all, just make this variables fixed units. Or don't use them at all (variables)!) And create three triggers with such an actions - for each of units needed. :)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
1. You need to destroy those special effects, they are leaking.
2. You need to remove the locations after you don't need them anymore, they are leaking.

Set them to a variable, use them, and clean the leak. Example:

  • Untitled Trigger 021
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light
    • Actions
      • Custom script: local location loc = GetUnitLoc(GetTriggerUnit()) // saves the loc to a variable
      • Custom script: local real r = GetUnitFacing(GetTriggerUnit()) // saves the facing of unit
      • Wait 4.00 seconds
      • Custom script: call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), loc, r ) // creates a footman, 'hfoo' is the code for that.
      • Custom script: call RemoveLocation(loc) // removes the location, no leaks.
^That creates local locations, so if other units cast the spell, it won't get messed up.

3. I don't think you need to set the caster and target to a variable, just use "triggering unit" and "target unit of ability being cast". Setting them to a variable is OK though.
4. Don't you want to unpause the caster at the end, not pause him?
5.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Target unit of ability being cast) is dead) Equal to True
    • Then - Actions
    • Else - Actions
With this you can branch the trigger, and skip things if the target is already dead.
 
Level 4
Joined
May 2, 2009
Messages
69
Hmm... Great advice, from all of you, but those of you that said to make variables in map initialization, I can't because they aren't heroes, they are normal units that you train in a barracks-type building, although you can only have 3 of them at a time. My first thought was to simple make it so when a unit of type Avenger, it will do the trigger, but then I couldn't have all three use it at the same time... I suppose I could make them heroes, but I'd rather not...
 
Level 11
Joined
May 31, 2008
Messages
698
To limit it to 3:
Time elapsed is 1 second (only cuz im not sure if this works on init)
Pick all players
Limit training of Avenger for picked player to 3 (Player - Limit training of unit type)

Thats all u need to only allow 3 of them.

For the ability, just go to the units model (you can place one in ur map and then select it)
Then you look to the left side where it is showing the units animation.
Click one of the little arrows until it shows the units attack animation
It should say something like "Animation: Attack-1(0.967s)" that is the duration of the animation
So when the unit casts the spell do this
Set triggering units animation speed to 20%
Play triggering units attack animation
Wait 4.835 seconds (this is the attack animation duration times 5, you must multiply the duration of your units animation times 5, this is just an example)
reset triggering units animation
set triggering units animation speed to 100%
then do an if/then/else
if the target of ability cast is within 150 away from the triggering unit
then kill the target unit of ability cast
and tht shud be all you need
sorry i didnt really do this detailed at all, im just giving the basic idea of what i wud do.
 
Level 4
Joined
May 2, 2009
Messages
69
Ok, so that helped a lot more than my first, but now around the last three actions it doesn't recognize that I want to kill the target of the ability being cast.
 
Level 15
Joined
Sep 3, 2006
Messages
1,738
Save it into a variable or use triggering unit. After you use a Wait, 'target of ability being cast' gets re-written. The only things that exist after a wait are triggering unit (which I don't think works in your situation) and variables (which are faster anyway).
 
Level 11
Joined
May 31, 2008
Messages
698
Set Target[PlayerNumber(owner of triggering unit)] = Target unit of ability cast
Do that in the beginning of the trigger and where you used Target Unit of ability cast just replace it with the variable. You need the array because of the wait.
 
Level 4
Joined
May 2, 2009
Messages
69
Ok after a while of trying to work out what you guys have been giving me, I was able to fix it. And learn a lot more about triggering than I thought I knew... + Rep!
 
Status
Not open for further replies.
Top