Got stuck in the middle of an ability...

Kazuga

Let the game begin...
Reaction score
110
Hi there, I got this idea (sort of inspired by the what I think is a dota spell that summons trees to entrap a target), when you use this ability you will be surounded by trees (wich didn't work really when I used real trees cause they apeared at wrong locations of the hero), when these trees are created working as a shield the hero will be healed and gain mana for a short period of time. Then the trees will die and treants will spawn.

Anyway here is the current unworking trigger:
Code:
Ultimate nature protection
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Ultimate nature protection 
    Actions
        Set UltimateNatureProtCaster = (Casting unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
                Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching (((Picked unit) is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s birth animation
                Unit - Add Life Regeneration Aura (Neutral) to UltimateNatureProtCaster
                Unit - Add Mana Regeneration (Neutral) to UltimateNatureProtCaster
                Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\Tranquility\TranquilityTarget.mdl
                Set UltimateNatureProtSpec = (Last created special effect)
                Wait ((Real((Level of Ultimate nature protection  for UltimateNatureProtCaster))) x 2.00) seconds
                Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching (((Picked unit) is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s death animation
                        Wait 1.50 seconds
                        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
            Else - Actions
Anyone have any idea how to fix this? (By the way I noticed that you can't play a model filed unit animation, atleast not the birth and death animation from a tree when it's a unit).
Oh and btw, the things that doesn't work (just thought I might tell you that^^) is the animations and the creation of the ents (wich at the same time removes the "trees").

Edit: Also, I know that it's only 3 trees that are created atm and they will never be able to suround him since they are so few but it's still in test state since it doesn't work

Help would be real apriciated!

/Greatest wishes: Kazuga
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Hi there, I got this idea (sort of inspired by the what I think is a dota spell that summons trees to entrap a target), when you use this ability you will be surounded by trees (wich didn't work really when I used real trees cause they apeared at wrong locations of the hero), when these trees are created working as a shield the hero will be healed and gain mana for a short period of time. Then the trees will die and treants will spawn.

Anyway here is the current unworking trigger:
Code:
Ultimate nature protection
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Ultimate nature protection 
    Actions
        Set UltimateNatureProtCaster = (Casting unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
                Unit Group - Pick every unit in (Units within 512.00 of [B](Position of UltimateNatureProtCaster)[/B] matching (([B](Picked unit)[/B] is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s birth animation
                Unit - Add Life Regeneration Aura (Neutral) to UltimateNatureProtCaster
                Unit - Add Mana Regeneration (Neutral) to UltimateNatureProtCaster
                Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\Tranquility\TranquilityTarget.mdl
                Set UltimateNatureProtSpec = (Last created special effect)
                Wait ((Real((Level of Ultimate nature protection  for UltimateNatureProtCaster))) x 2.00) seconds
                Unit Group - Pick every unit in (Units within 512.00 of [B](Position of UltimateNatureProtCaster)[/B] matching (([B](Picked unit)[/B] is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s death animation
                        Wait 1.50 seconds
                        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
            Else - Actions
Anyone have any idea how to fix this? (By the way I noticed that you can't play a model filed unit animation, atleast not the birth and death animation from a tree when it's a unit).

Help would be real apriciated!

/Greatest wishes: Kazuga

Check bolded parts, especially the (Picked unit) ,they should be (Matching Unit).

Edit: The "position of..." is just point leaks. Easily fixed.
 

Kazuga

Let the game begin...
Reaction score
110
Changed the (picked) to (matching) as you said, but it still doesn't work so it has to be something more...
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Code:
Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching (((Picked unit) is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s death animation
                       [B] Wait 1.50 seconds[/B]
                        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
            Else - Actions

I'm pretty sure you can't have waits inside a Unit-Group loop.

Edit: Sorry for double posting, though I editted my last reply.
 

Kazuga

Let the game begin...
Reaction score
110
This.
Oh and btw, the things that doesn't work (just thought I might tell you that^^) is the animations and the creation of the ents (wich at the same time removes the "trees").

Really anoying cause this should be one of those things that are real easy to make...

I'm pretty sure you can't have waits inside a Unit-Group loop.
Hm what do I do then? Want the trees to "die" when the treants are created.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Could you post your current trigger, that way I'll see easier what might be wrong etc.
 

Kazuga

Let the game begin...
Reaction score
110
Code:
Ultimate nature protection
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Ultimate nature protection 
    Actions
        Set UltimateNatureProtCaster = (Casting unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
                Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching (((Matching unit) is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s birth animation
                Unit - Add Life Regeneration Aura (Neutral) to UltimateNatureProtCaster
                Unit - Add Mana Regeneration (Neutral) to UltimateNatureProtCaster
                Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\Tranquility\TranquilityTarget.mdl
                Set UltimateNatureProtSpec = (Last created special effect)
                Wait ((Real((Level of Ultimate nature protection  for UltimateNatureProtCaster))) x 2.00) seconds
                Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching (((Matching unit) is in (Units of type Tree)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s death animation
                        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
            Else - Actions
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
I can't seem to find much more of a problem, try what Flare said. Just a few things, why don't you fix the point leaks, and why do you set the special effect into a variable without removing it afterwards?
 

Kazuga

Let the game begin...
Reaction score
110
Code:
Ultimate nature protection
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Ultimate nature protection 
    Actions
        Set UltimateNatureProtCaster = (Casting unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
                Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching ((Unit-type of (Matching unit)) Equal to Tree)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s birth animation
                Unit - Add Life Regeneration Aura (Neutral) to UltimateNatureProtCaster
                Unit - Add Mana Regeneration (Neutral) to UltimateNatureProtCaster
                Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\Tranquility\TranquilityTarget.mdl
                Set UltimateNatureProtSpec = (Last created special effect)
                Wait ((Real((Level of Ultimate nature protection  for UltimateNatureProtCaster))) x 2.00) seconds
                Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching ((Unit-type of (Matching unit)) Equal to Tree)) and do (Actions)
                    Loop - Actions
                        Animation - Play (Picked unit)'s death animation
                        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
            Else - Actions
Hm no diffrence... Trees are created but nothing else happends...
I can't seem to find much more of a problem, try what Flare said. Just a few things, why don't you fix the point leaks, and

>why do you set the special effect into a variable without removing it afterwards?
I will when I get this to work :p.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Try to kill the Tree units and create the Treants at their location, just to see if that's the problem. Or you can add a few "error-check" messages randomly in the trigger, just to see where it stops working.
 

Kazuga

Let the game begin...
Reaction score
110
Everything except:
Code:
Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching ((Unit-type of (Matching unit)) Equal to Tree)) and do (Actions)
    Loop - Actions
        Unit - Kill (Picked unit)
        Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
        Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
        Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
works...
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Everything except:
Code:
Unit Group - Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching ((Unit-type of (Matching unit)) Equal to Tree)) and do (Actions)
    Loop - Actions
        Unit - Kill (Picked unit)
        Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
        Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
        Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
        Unit - Replace (Picked unit) with a Treant using The old unit's relative life and mana
works...

Try

Actions
Pick every unit in (Units within 512.00 of (Position of UltimateNatureProtCaster) matching ((Unit-type of (Matching unit)) Equal to Tree)) and do (Actions)
Loop - Actions
Set UltimateNatureProtTreeLoc = Position of picked unit
Kill picked unit
Create 1 treant for owner of Caster at UltimateNatureProtTreeLoc
call RemoveLocation (udg_UltimateNatureProtTreeLoc)
--------------------------------------------------------
Dunno if it'll make a difference but it's worth a try.
 

Kazuga

Let the game begin...
Reaction score
110
Heh got it to work by doing this:
Code:
Ultimate nature protection
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Ultimate nature protection 
    Actions
        Set UltimateNatureProtCaster = (Casting unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
                Unit - Add a ((Real((Level of Ultimate nature protection  for (Casting unit)))) x 2.00) second Generic expiration timer to (Last created unit)
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
                Unit - Add a ((Real((Level of Ultimate nature protection  for (Casting unit)))) x 2.00) second Generic expiration timer to (Last created unit)
                Unit - Create 1 Tree for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
                Unit - Add a ((Real((Level of Ultimate nature protection  for (Casting unit)))) x 2.00) second Generic expiration timer to (Last created unit)
                Unit - Add Life Regeneration Aura (Neutral) to UltimateNatureProtCaster
                Unit - Add Mana Regeneration (Neutral) to UltimateNatureProtCaster
                Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\Tranquility\TranquilityTarget.mdl
                Set UltimateNatureProtSpec = (Last created special effect)
                Wait ((Real((Level of Ultimate nature protection  for UltimateNatureProtCaster))) x 2.00) seconds
                Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 0.00 degrees) facing Default building facing degrees
                Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 45.00 degrees) facing Default building facing degrees
                Unit - Create 1 Treant for (Owner of UltimateNatureProtCaster) at ((Position of UltimateNatureProtCaster) offset by 100.00 towards 90.00 degrees) facing Default building facing degrees
            Else - Actions
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
You could shorten the trigger a lot by using Integer loops though etc:

For each Integer 0 to 2 do actions
Set UltimateOffset = Position of Caster at offset of 100 towards (45 * Integer A) degrees
Create 1 tree for owner of Caster at UltimateOffset facing default building
Set UltimateTree[Integer A] = Last Created unit
Add a ((Real((Level of Ultimate nature protection for (Casting unit)))) x 2.00) second Generic expiration timer to (Last created unit)
call RemoveLocation (udg_UltimateOffset)
------------------------------------------------------
Good thing you got it to work though. Now all that's left is the memory leaks eh?
 

Kazuga

Let the game begin...
Reaction score
110
Well it would short the time in making the trigger, but is it worth putting effort changing it? I mean does it make it less leaky (if it now leaks)?
Also, I have got a problem with the trees, they spawn correctly and everything but you can walk right through them. They are based on a normal peasent and all I changed was unit classification, unit speed and model file. What should I do to make people unable to walk through?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top