Creating Unit via loops Problem

0WN3D

New Member
Reaction score
15
I tried to have a skill that creates 6 units around a unit that is 60 degrees apart.( Furion Sprout From DotA but not trees but units) Heres my trigger

Trigger:
  • TreeOfLife
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TreeOfLife
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TreeOfLife for (Casting unit)) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at ((Position of (Target unit of ability being cast)) offset by 600.00 towards ((Real((Integer A))) x 60.00) degrees) facing Default building facing degrees
              • Unit - Add Drain Life to (Last created unit)
              • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
              • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
        • Else - Actions




The problem is that onli 1 unit is created instead of 6. + rep for any help... ( The spell targets Unit)
 

0WN3D

New Member
Reaction score
15
I know ... I know ... leaks... I don't really bother about them because it really takes a while to remove them as you need to type ( RemoveLocation) or something like that... well additional information should be that onli 1 unit is created and it is in 60 degrees of the unit and the distance(more or less) is correct and the spell base is storm bolt...
 

X-maul

AKA: Demtrod
Reaction score
201
uhmm - well you should realy consider removing leaks - you jsut need to type
Code:
RemoveLocation(udg_[COLOR="Red"]VariableName[/COLOR])
othervise your game will start to lag.
 

0WN3D

New Member
Reaction score
15
Triggering Unit did not work... sighz more time to check my trigger and object editors...

Edit: NEW INFO!!! Weirdly, i also cannot trigger it the long way. It also creates onli 1 unit.
Trigger:
  • Then - Actions
    • Unit - Create 1 TreeOfLife for (Owner of (Triggering unit)) at ((Position of (Target unit of ability being cast)) offset by 600.00 towards (2.00 x 60.00) degrees) facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 TreeOfLife for (Owner of (Triggering unit)) at ((Position of (Target unit of ability being cast)) offset by 600.00 towards (3.00 x 60.00) degrees) facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 TreeOfLife for (Owner of (Triggering unit)) at ((Position of (Target unit of ability being cast)) offset by 600.00 towards (4.00 x 60.00) degrees) facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 TreeOfLife for (Owner of (Triggering unit)) at ((Position of (Target unit of ability being cast)) offset by 600.00 towards (5.00 x 60.00) degrees) facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
 

Ashlebede

New Member
Reaction score
43
uhmm - well you should realy consider removing leaks - you jsut need to type
Code:
RemoveLocation(udg_[COLOR="Red"]VariableName[/COLOR])
othervise your game will start to lag.

Ubar syntax error there. Correct code :

JASS:
call RemoveLocation(udg_VariableName)


And yes, it is considerably short to write and easy to remember. It really is no big deal, it's just a habit you should develop, since it reduces lag considerably in the long run (especially if you have triggers that run often).
 

vypur85

Hibernate
Reaction score
803
This is really weird. Try opening a new map and copy the trigger and run it to see if it works. Trigger usually stops half way if there's faulty or weird calls that don't make sense. Yours seem really fine to me.

Perhaps there's another trigger interfering? Unit removal trigger etc?
 

Inflicted

Currently inactive
Reaction score
63
the 'call' part is fairly obvious. I would suggest putting a line to test if the trigger is actually running. Perhaps the condition isn't being matched?

Try remove the condition and retry maybe.

And yeah you have alot of leaks, fix it and show us the new code please.
 

0WN3D

New Member
Reaction score
15
I may seem unexperience to leaks but actually im just lazy... heres the sorta fixed trigger

Loops:
Trigger:
  • TreeOfLife
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TreeOfLife
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TreeOfLife for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set Temp_point = (Position of (Target unit of ability being cast))
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set Temp_point2 = (Temp_point offset by 600.00 towards ((Real((Integer A))) x 60.00) degrees)
              • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
              • Unit - Add Drain Life to (Last created unit)
              • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
              • Custom script: call RemoveLocation(udg_Temp_point2)
          • Custom script: call RemoveLocation(udg_Temp_point)


'Old Fashioned':
Trigger:
  • Actions
    • Set Temp_point = (Position of (Target unit of ability being cast))
    • Set Temp_point2 = (Temp_point offset by 600.00 towards (1.00 x 60.00) degrees)
    • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Custom script: call RemoveLocation(udg_Temp_point2)
    • Set Temp_point2 = (Temp_point offset by 600.00 towards (2.00 x 60.00) degrees)
    • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Custom script: call RemoveLocation(udg_Temp_point2)
    • Set Temp_point2 = (Temp_point offset by 600.00 towards (3.00 x 60.00) degrees)
    • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Custom script: call RemoveLocation(udg_Temp_point2)
    • Set Temp_point2 = (Temp_point offset by 600.00 towards (4.00 x 60.00) degrees)
    • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Custom script: call RemoveLocation(udg_Temp_point2)
    • Set Temp_point2 = (Temp_point offset by 600.00 towards (5.00 x 60.00) degrees)
    • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Custom script: call RemoveLocation(udg_Temp_point2)
    • Set Temp_point2 = (Temp_point offset by 600.00 towards (6.00 x 60.00) degrees)
    • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
    • Unit - Add Drain Life to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Target unit of ability being cast)
    • Custom script: call RemoveLocation(udg_Temp_point2)
    • Custom script: call RemoveLocation(udg_Temp_point)



I will be posting and testing the test map tomorrow and hope any of you all can solve it...
 

vypur85

Hibernate
Reaction score
803
What's with you guys and leaks? It's not even the problem. =.= Almost half the posts are talking about bloody leaks, and they don't even solve or attempt to solve the damn problem. By the way, there're too many Temp_point, they're redundant. You only need to set once in the beginning and remove again at the end. (Due to copy and paste, perhaps?)

Replace the Life Drain with another ability and see if it works (Storm bolt, maybe). Add game text at each interval to see when does the action stops proceeding. Also, attempt to remove the ability addition and ability order, and just create 6 units. See if there are in fact 6 units created. I'm suspecting something is wrong with the Life Drain.

Couldn't be the condition problem, otherwise the 1 unit wouldn't have been created.

Then again, since you're posting the map, I guess we'll just wait. Or am I missing anything here?
 

0WN3D

New Member
Reaction score
15
Heres teh map... There is 2 triggers in it, 1 using loops and the other the old fashion...View attachment Tree Of Life Test Map.w3x

vypur85: I feel slightly that you are right about Life Drain as in the past this trigger ran without problems when the trees do not have enough mana to cast the spell... And you are totally right about copy and paste :p
 

vypur85

Hibernate
Reaction score
803
Code:
Trre Of Life Loops
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to TreeOfLife 
    Actions
        [B]Set unit = (Target unit of ability being cast)[/B]
        Set Temp_point = (Position of (Target unit of ability being cast))
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                Set Temp_point2 = (Temp_point offset by 600.00 towards ((Real((Integer A))) x 60.00) degrees)
                Unit - Create 1 TreeOfLife for (Owner of (Triggering unit)) at Temp_point2 facing Default building facing degrees
                Unit - Add Drain Life  to (Last created unit)
                Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain [B]unit[/B]
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Custom script:   call RemoveLocation(udg_Temp_point2)
        Custom script:   call RemoveLocation(udg_Temp_point)

Add the variable and use it. Apparently the order caused 'Target unit ability being cast' to be somewhat... missing.
 

0WN3D

New Member
Reaction score
15
YAY!! This trigger cr8s all 6 units.... But however.. somehow the trees will no life drain the unit.. they jus stands there.. They are also in range for the spell as i can select and order them to cast spellz.

Edit: Nvm this... my fault.. i set TempUnit = Tempunit
 

0WN3D

New Member
Reaction score
15
nvm my previous post.... in that post i had TempUnit = Tempunit.... soo the life drain didnt work and there is 6 units.... Now i set it to TempUnit = Target Ability being cast and Im bak to square 1.... there is onli 1 unit again:banghead:. Soo i remove the Life drain casting part and it workz perfectly cr8ing 6 units... So i guess something is wrong with lfie drain that it can stop loops..

Soo i decided to post my 'new' trigger that is filled with variables...

Trigger:
  • Trre Of Life Loops
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TreeOfLife
    • Actions
      • Set Temp_Unit = (Target unit of ability being cast)
      • Set Temp_point = (Position of Temp_Unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Temp_point2 = (Temp_point offset by 300.00 towards ((Real((Integer A))) x 60.00) degrees)
          • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
          • Set Temp_Unit2 = (Last created unit)
          • Unit - Add Drain Life to Temp_Unit2
          • Unit - Order Temp_Unit2 to Neutral Dark Ranger - Life Drain Temp_Unit
          • Unit - Add a 5.00 second Generic expiration timer to Temp_Unit2
          • Custom script: call RemoveLocation(udg_Temp_point2)
      • Custom script: call RemoveLocation(udg_Temp_point)
 

cleeezzz

The Undead Ranger.
Reaction score
268
put a debug message after every single line in the loop, see where it stops. also you could put a debug at the last line of the loop to show the value of integer A just in case something is messing with it.

for example, its possible that an action in your loop is firing off an event in another trigger that uses integer A and could potentially mess it up. Try changing it to , For integer variable loop, and use an integer you never use anywhere else.
 

0WN3D

New Member
Reaction score
15
I am pretty sure it is the Order Unit to Lifedrain Target part that is messing up as when i remove it, the trigger can create all 6 units... Currently checking my Integer A

Edit: Nvm.... I found out how to make it work....Heres the trigger in case you all are wondering
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of TreeOfLife for (Triggering unit)) Equal to 1
    • Then - Actions
      • Set Temp_Unit = (Target unit of ability being cast)
      • Set Temp_point = (Position of Temp_Unit)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Temp_point2 = (Temp_point offset by 600.00 towards ((Real((Integer A))) x 60.00) degrees)
          • Unit - Create 1 TreeOfLife for (Owner of (Casting unit)) at Temp_point2 facing Default building facing degrees
          • Unit - Add Drain Life to (Last created unit)
          • Unit Group - Add (Last created unit) to Temp_Group
          • Custom script: call RemoveLocation(udg_Temp_point2)
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Neutral Dark Ranger - Life Drain Temp_Unit
          • Unit Group - Remove (Pick unit) From Temp_Group
      • Custom script: call DestroyGroup(udg_Temp_Group)
      • Custom script: call RemoveLocation(udg_Temp_point)
    • Else - Actions


I think that Lifedrain Stops loops.... Wierd...o_O

:Edit!! Case Reopens.... This trigger onli allows me to cast onli one time then i workz perfectly.. but when i cast it a secnod time, it doesnt drain the life of the unit.. even more weird...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top