Need help with this Eclipse(DotA) template

ChickenWithOkra

New Member
Reaction score
0
I got this Eclipse template which i tried to edit, as far as i know, it works properly, but I don't know how to make it MUI.

Here's the code:

Trigger:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set EclipseHashtable = (Last created hashtable)
      • Hashtable - Save 5.40 as 0 of 0 in EclipseHashtable

Trigger:
  • Eclipse
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Trigger - Add to Add Unit <gen> the event (Unit - A unit comes within 512.00 of EclipseCaster)
      • Set Eclipse = True
      • Set EclipseCaster = (Triggering unit)
      • Set EclipsePoint = (Position of (Triggering unit))
      • Set EclipseGroup = (Units within 512.00 of EclipsePoint matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Set EclipseTimer = (Load 0 of 0 from EclipseHashtable)
      • Unit Group - Pick every unit in EclipseGroup and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to 0
      • For each (Integer A) from 1 to ((Level of Breath of Fire (Neutral Hostile) (Neutral Hostile) for (Triggering unit)) x (2 + 2)), do (Actions)
        • Loop - Actions
          • Set EclipseTarget = (Random unit from EclipseGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of EclipseTarget) Greater than or equal to 4
            • Then - Actions
              • Unit Group - Remove EclipseTarget from EclipseGroup
              • Set EclipseTarget = (Random unit from EclipseGroup)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EclipseTimer Greater than 0.00
                • Then - Actions
                  • Set EclipseTimer = (EclipseTimer - 0.45)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (EclipseGroup is empty) Equal to True
                    • Then - Actions
                      • Special Effect - Create a special effect at ((Position of (Triggering unit)) offset by (Random real number between 300.00 and 512.00) towards (Random angle) degrees) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Special Effect - Create a special effect attached to the origin of EclipseTarget using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause (Triggering unit) to damage EclipseTarget, dealing ((Real((Level of Eclipse (Neutral Hostile 1) (Neutral Hostile 1) for (Triggering unit)))) x 100.00) damage of attack type Spells and damage type Divine
                  • Unit - Set the custom value of EclipseTarget to ((Custom value of EclipseTarget) + 1)
                  • Wait 0.45 seconds
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (EclipseTarget is dead) Equal to True
                    • Then - Actions
                      • Unit Group - Remove EclipseTarget from EclipseGroup
                    • Else - Actions
                • Else - Actions
                  • Hashtable - Clear all child hashtables of child 0 in EclipseHashtable
      • Custom script: call DestroyGroup(udg_EclipseGroup)
      • Custom script: call RemoveLocation(udg_EclipsePoint)
      • Set Eclipse = False

Trigger:
  • Add Unit
    • Events
    • Conditions
      • ((Triggering unit) belongs to an enemy of (Owner of EclipseCaster)) Equal to True
      • Eclipse Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to EclipseGroup

Edit: Added some missing code.

Credits by: Exide
 
Last edited:

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Well you could start by changing all the variables into arrays, then vary the array index using something like a local integer or the custom value of the casting unit. So every cast would have its own unique index.

Also, "wc3" tags work better than "code" tags for posting triggers.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Although I do not know what this trigger is supposed to actually do I can already see several flaws there.
Especially this line:
Code:
Trigger - Add Add Unit <gen> the event (Unit - a unit comes within 512 of EclipseCaster)
Makes me wanna puke. Never do this. Never ever.
First of all, it will not do what you want. Then, it will leak both a point as well as an event, and finally your map will crash at some point because there is a limit on the number of events a trigger can have if memory serves me right.

The next problem is that you are referencing the variable EclipseCaster before you set it to any value. I assume that this is also not what you want.


Maybe you just tell us what your ability is supposed to do and maybe then we can provide you with better advice.
 

ChickenWithOkra

New Member
Reaction score
0
Thank you very much for replying, and i'm very sorry for the code, it's very confusing and i dont know how to add wc3 tags, i'm very newb to this forums. Also, forgot to add some things to my post like the timer variable, i'll be editing it as soon as possible.

Well you could start by changing all the variables into arrays, then vary the array index using something like a local integer or the custom value of the casting unit. So every cast would have its own unique index.

Well I tried indexing once or twice, but i kinda gave up since i found this system quite complex to understand, considering i'm very new to warcraft 3 programming. I think i'll read more tutorials about this, since it seems like it'll be great help in the future.

Although I do not know what this trigger is supposed to actually do I can already see several flaws there.
Especially this line:
Code:
Trigger - Add Add Unit <gen> the event (Unit - a unit comes within 512 of EclipseCaster)

Makes me wanna puke. Never do this. Never ever.
First of all, it will not do what you want. Then, it will leak both a point as well as an event, and finally your map will crash at some point because there is a limit on the number of events a trigger can have if memory serves me right.

The next problem is that you are referencing the variable EclipseCaster before you set it to any value. I assume that this is also not what you want.

I hadn't considered this, and if it weren't for you i think it'd probably be months till i would lol. I saw the flaw in the event, and just realized that it wouldn't add every needed unit into the unit group. And I guess i should've seen earlier that i should've specified the EclipseCaster thingy earlier than adding the event. My bad XD. I'll check into my code other flaws, and I'll try to turn the Add Unit trigger into a if/then/else action.

Maybe you just tell us what your ability is supposed to do and maybe then we can provide you with better advice.

I'm very sorry about that, i hope you can forgive me, my codes are really messy there. To start with, i'm trying to copy Luna Moonfang's Spell Eclipse from DotA for learning purposes. When the spell is cast, 12 beams will fall from the sky, with periodic delay, into enemy's units. Each beam will deal some fixed amount of damage, and each enemy unit can only be hit up to four times. However, when there are no units in the area of effect, or all units in EclipseGroup have already been hit 4 times, the beams will fall on random points in an area around the caster, dealing no actual damage, only for visual effects. Also, the effects lasts for 5.40 seconds.

Thank you very much for replying, I'll do my best to fix this skill so it works properly, i'll try and test the indexing thing, and if it works i'll post it for you guys. Thanks for the replies.
 
Last edited:

Accname

2D-Graphics enthusiast
Reaction score
1,462
I hadn't considered this, and if it weren't for you i think it'd probably be months till i would lol. I saw the flaw in the event, and just realized that it wouldn't add every needed unit into the unit group. And I guess i should've seen earlier that i should've specified the EclipseCaster thingy earlier than adding the event. My bad XD. I'll check into my code other flaws, and I'll try to turn the Add Unit trigger into a if/then/else action.
The problem is adding events dynamically. Never do this. Dont even use that action unless you do it at map initialization or something like this.
In the end you will end up with a trigger which has a thousand events, and worst of all, they will probably all be the same event. So your trigger will run thousands upon thousands of times each time a unit gets within range.

I'm very sorry about that, i hope you can forgive me, my codes are really messy there. To start with, i'm trying to copy Luna Moonfang's Spell Eclipse from DotA for learning purposes. When the spell is cast, 12 beams will fall from the sky, with periodic delay, into enemy's units. Each beam will deal some fixed amount of damage, and each enemy unit can only be hit up to four times. However, when there are no units in the area of effect, or all units in EclipseGroup have already been hit 4 times, the beams will fall on random points in an area around the caster, dealing no actual damage, only for visual effects. Also, the effects lasts for 5.40 seconds.

Here is what you should do:
1) Have a hashtable to save how often a unit was hit by which caster
2) Use the same hashtable to save how many beams were fired for the caster (1 beam every 0.45 seconds, 12 beams == 5.40 seconds)
3) Use a periodic trigger to fire the beams; in this trigger pick all units around the caster within range, pick a suitable target and then cast the beam
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Just made the map and attached it to this post.
Was quite fun to get back to the editor again. I added plenty of comments, I hope they will help you understand the triggers.
 

Attachments

  • CustomStarfall.w3x
    23.6 KB · Views: 304

ChickenWithOkra

New Member
Reaction score
0
Just made the map and attached it to this post.
Was quite fun to get back to the editor again. I added plenty of comments, I hope they will help you understand the triggers.

Wow, that was pretty neat of you, thanks! I read the triggers and they're very well explained, although I still don't quite understand the use of hashtables, but i was able to make a instant cast version of it and it was awesome! I really owe you one.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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