• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Ultimate type spell, Unit remove problem Trigga

Status
Not open for further replies.
Level 6
Joined
Oct 4, 2011
Messages
226
Hi this ability is based on thunderclap, what i want to do with it is have a wide 1000 aoe effect, and do some base damage (easy) and then create a unit for the casting unit at the point of every enemy caught in the aoe, the summoned unit then is ordered to attack the unit it was summoned for. but then my trigger to remove the units summoned will not work and i don't know how to fix this. Thanks for any help.

  • SKELLYULT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ultimate
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ultimate for (Casting unit)) Equal to 1
        • Then - Actions
          • Set SKELLYULT_UNITG = (Units within 1000.00 of (Position of (Casting unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False))))
          • Unit Group - Pick every unit in SKELLYULT_UNITG and do (Actions)
            • Loop - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Mind
              • Unit - Create 1 Rifleman for (Owner of (Casting unit)) at (Position of (Picked unit)) facing (Angle from (Position of (Last created unit)) to (Position of (Picked unit))) degrees
              • Unit Group - Add (Last created unit) to SkellyUltSummoned_UnitG
              • Unit - Order (Last created unit) to Attack (Picked unit)
              • Wait 1.75 seconds
              • Unit Group - Pick every unit in SkellyUltSummoned_UnitG and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
              • Custom script: call DestroyGroup(udg_SKELLYULT_UNITG)
              • Custom script: call DestroyGroup(udg_SkellyUltSummoned_UnitG)
        • Else - Actions
 
Level 8
Joined
Dec 9, 2009
Messages
397
Well, for 1 remove the wait, waits are BAD, your trigger would not work right if 2 people casted it.

So, remove the wait, and in the loop add:
  • Unit - Add a 1.75 second Generic expiration timer to (Last created unit)
You also have your 2nd loop is in your 1st, not that you need the 2nd anymore.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi this ability is based on thunderclap, what i want to do with it is have a wide 1000 aoe effect, and do some base damage (easy) and then create a unit for the casting unit at the point of every enemy caught in the aoe, the summoned unit then is ordered to attack the unit it was summoned for. but then my trigger to remove the units summoned will not work and i don't know how to fix this. Thanks for any help.

Trigger...

Here's some things you should look at:

Whenever you use a 'Point' or 'Location'... Declare it into a variable (Point type), use it in the action, and then remove the point using call RemoveLocation(udg_YourPointVariableName)

1) You leak a point:
-> (Position of Casting Unit)
-> (Position of (Picked Unit)).
-> Both facing angles points leaks.

2) The Reason why your units aren't removed is because you used a 'Wait' action inside a loop. If you read the 'Pick every unit' information, you'll notice the warning about not doing this, so, NEVER use 'Wait' actions inside any kind of loop.

To solve this, Use 'Unit - Add expiration timer' to 'Last created unit', and you wont have to create a group for those summoned units, they will just die when the expiration timer comes to 0. Give them enough time to attack, or do what they're ordered to do.

Your trigger should look something like this:

  • SKELLYULT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ultimate
      • (Level of Ultimate for (Casting unit)) Equal to 1
    • Actions
      • Set U = Casting Unit
      • Set POINT1 = Position of U
      • Set P = Owner of U <- Player Variable
      • Set Group = (Units within 1000.00 of POINT1 matching ((((Matching unit) belongs to an enemy of P Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False))))
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Set U2 = Picked Unit
          • Set POINT2 = Position of U2
          • Unit - Cause U to damage U2, dealing 50.00 damage of attack type Spells and damage type Mind
          • Unit - Create 1 Rifleman for P at POINT2 facing U2
          • Unit - Add a Generic expiration timer to (Last Created Unit) that will expire in 2 seconds
          • Unit - Order (Last created unit) to Attack U2
          • Custom script: call RemoveLocation(udg_POINT2)
      • Custom script: call DestroyGroup(udg_Group)
      • Custom script: call RemoveLocation(udg_POINT1)
[WARNING] -> You don't have to create a specific group for each trigger you have involving a group. If you give a value to a variable, that value will exist only within that trigger. So, you can use 'Group' in 700 triggers at the same time, since each trigger will give 'Group' a different value, and will work with that value.

Also, why are you creating a unit facing a point, if you can create a unit facing a unit? (as long as I know :p) (Sorry, I don't have the editor open). If you can't, don't mind about that, the unit is ordered to attack and it will do it almost instantly. In the worst cases, create the unit facing 'POINT2' =)

You can improve the trigger a bit setting 'Picked unit' and 'Owner of U' into variables, and use those variables instead. Every time you see '()' you are doing an action... So, Less '()' means Less actions, which means less system required to do the actions, which means, more efficiency, less lag.

BTW; These kind of Unit and Player variables don't leak, so, there's no need (nor method) to remove them.
 
Spartipilo, script can still be improved. Second condition is completely worthless - if unit casts ability, you can be 100% sure it actually has that ability at least on level 1 ;P
(Casting unit) -> (Triggerin unit)
bj_wantDestroyGroup instead of manual group creation/destroy
(Owner of someunit) -> (Triggering player)

  • SKELLYULT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ultimate
    • Actions
      • Set U = (Triggering unit)
      • Set POINT1 = Position of U
      • Set P = (Triggering player)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 1000.00 of POINT1 matching ((((Matching unit) belongs to an enemy of P Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)))) and do (Actions)
        • Loop - Actions
          • Set U2 = (Picked Unit)
          • Set POINT2 = Position of U2
          • Unit - Cause U to damage U2, dealing 50.00 damage of attack type Spells and damage type Mind
          • Unit - Create 1 Rifleman for P at POINT2 facing U2
          • Unit - Add a Generic expiration timer to (Last Created Unit) that will expire in 2 seconds
          • Unit - Order (Last created unit) to Attack U2
          • Custom script: call RemoveLocation(udg_POINT2)
      • Custom script: call RemoveLocation(udg_POINT1)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
OH MY GOD! Can 'owner of unit' be changed for TRIGGERING PLAYER?!... [Extasis] I guess just when the Triggering unit is owned by the triggering player.
 
Status
Not open for further replies.
Top