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

[Trigger] Forked spell

Status
Not open for further replies.
Level 4
Joined
Feb 25, 2010
Messages
73
Greetings people! I'm posting one more time because of the great help that all give me.

So, this time i need to do a spell very near to Forked Lightning. Basically, i want to do, through the triggers (and know if IS possible to do), a spell with the this functionality:

- Unit casts the spell. So, nine lightnings are released over the nearby enemies (like forked lightning).

- Each lightning released do, lets say, 100 damage (So it is 100 damage to nine differents targets). However, unlike Forked Lightning, i want that spell release ALWAYS nine lightnings, independant of the nearby enemies.

- So... If the unit casts the spell and, lets say, there is only 3 enemies nearby, each of they receives 3 lightnings (300 damage in each). In the case of even numbers (lets say³, 2 enemies) they divide like 4 lightnings to the first and 5 lightnings to the others.


Of course, i don't know how i can do it through the triggering, so i need some help. If anybody have some ideas i will like to read them. Thanks people :thumbs_up:
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
1. Set your targets allowed on that spell to 1.
2. Make a unit based off footman.
3. Make a new forked lightning with hero ability unchecked. Targets allowed = 1. Damage equal to your hero's spell damage (for each level). Mana cost of zero each level.
4. Give the new forked lightning to the footman.
5. Create a variable called Dummy
6. The rest needs JASS. Do you know JASS? I can do this for you in JASS, but it won't do you any good if you don't know what I'm talking about.
 
Level 4
Joined
Feb 25, 2010
Messages
73
no, i don't know anything about JASS... =\
in fact, until now i only do things in GUI with the world editor, well, but anything you can do to help will be very well accepted (normally i take the scripts and try to understand)

for now ty ^^
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
OK, once you have your customized footman, make its movement type to fly, then set the range of your new spell to 500 greater than the range of the original forked lightning. Create an integer variable called UnitsHit, a Point variable called Point1 and a boolean variable called Debug.

Try this for a trigger:

  • Lightning Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) equal to (Forked Lightning)
  • Actions
    • Set UnitsHit = 0
    • Set Point1 = (Location of (Triggering Unit))
    • Custom script: loop
      • Trigger - Run (Lightning Loop)
      • Custom script: exitwhen udg_UnitsHit > 9 or Debug == true
    • Custom script: endloop
    • Custom script: call RemoveLocation(udg_Point1)
  • Lightning Loop
  • Events
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Set Debug = true
    • Unit Group - Pick every unit in (units within 500 of (Target unit of ability being cast)) and do multiple actions
      • Loop - Actions
        • Custom script: If IsUnitFogged(GetEnumUnit(), GetOwningPlayer(GetTriggerUnit())) and udg_UnitsHit < 10 then
          • Set Debug = false
          • Set UnitsHit = UnitsHit + 1
          • Unit - Create 1 Footman for (Owner of Triggering Unit) at Point1 Facing 0 degrees
          • Unit - Hide (last created unit)
          • Unit - Add a 2.00 (Generic) expiration timer to (last created unit)
          • Unit - Order (last created unit) to Naga Sea Witch - Forked Lightning (Picked unit)
        • Custom script: endif
This should launch the custom Forked Lightning up to 9 times. If there is only one unit in the range, the custom forked lightning will launch 9 times at that one unit. Let me know how it works.
 
Last edited:
Level 4
Joined
Feb 25, 2010
Messages
73
Sorry for the delay in the response.

I will try use your triggers and, soon as possible, i will tell if works. But very thanks for the help by now :)
 
That's not a "glitch", that's a feature. The only "glitch" with Integer A/B loops is that if a unit is killed, or something similar which starts a trigger, and that trigger uses Integer A/B loops, it fucks up because the other trigger might modify Integer A/B. "for each int A from 0 to UnitsHit" wouldn't work in this case anyway, even if the feature wasn't in place.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
The original code that I gave him was essentially:

  • For each Integer A from 1 to UnitsHit do
    • Loop - Actions
      • Set UnitsHit = UnitsHit + 1
And that UnitsHit modification there doesn't change the loop exit point, at all, because the GUI loop does this in JASS set forLoopAIndexEnd = udg_UnitsHit and that's outside of the loop so modifying udg_UnitsHit within the loop does not change the exit point in the slightest.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Let's dissect this a little more. exitwhen udg_UnitsHit > 9 or Debug == true Is not From 1 to UnitsHit, I changed it to be from 1 to 9 with UnitsHit being the variable increment. And, in case UnitsHit doesn't change, I added the failsafe boolean to prevent an infinite loop. This trigger should work exactly the way I told him.
 
Status
Not open for further replies.
Top