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

Can't make spell MUI

Status
Not open for further replies.
Level 6
Joined
Sep 13, 2013
Messages
155
Why can't I make MUI :goblin_cry:

This is not working correctly:
  • Sunken Army
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sunken Army
    • Actions
      • Set SunkenIndex = (SunkenIndex + 1)
      • Set SunkenTime[SunkenIndex] = 10.00
      • Set SunkenAllies[SunkenIndex] = (Units within 450.00 of (Target point of ability being cast) matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SunkenIndex Equal to SunkenDiscount
        • Then - Actions
          • Custom script: call DestroyGroup(udg_SunkenAllies[udg_SunkenIndex])
        • Else - Actions
      • Unit Group - Pick every unit in SunkenAllies[SunkenIndex] and do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect at (Position of (Picked unit)) using WaterBlast.mdx
          • Special Effect - Destroy (Last created special effect)
          • Unit - Add Sunken to (Picked unit)


  • Sunken Army Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to SunkenIndex, do (Actions)
        • Loop - Actions
          • Set SunkenTime[(Integer A)] = (SunkenTime[(Integer A)] - 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in SunkenAllies[(Integer A)]) Greater than 0
            • Then - Actions
              • Unit Group - Pick every unit in SunkenAllies[(Integer A)] and do (Actions)
                • Loop - Actions
                  • Unit - Add Sunken to (Picked unit)
            • Else - Actions
              • Set SunkenIndex = (SunkenIndex - 1)
              • Set SunkenDiscount = (Integer A)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SunkenTime[(Integer A)] Equal to 0.00
            • Then - Actions
              • Unit Group - Pick every unit in SunkenAllies[(Integer A)] and do (Actions)
                • Loop - Actions
                  • Unit - Remove Sunken from (Picked unit)
                  • Set SunkenIndex = (SunkenIndex - 1)
                  • Custom script: call DestroyGroup(udg_SunkenAllies[udg_SunkenIndex])
            • Else - Actions
The spell is supposed to add a permanent invisiblity to the units in the area and remove it after 10 seconds. It just works correctly for the first group of units you choose, others go invisible forever or till then that you cast this spell on them again.
 
Level 7
Joined
Jun 15, 2010
Messages
218
Im more a guy from the hashtables, but i think i know whats wrong.
You set SunkenIndex -1 when one spell is finished.

But if you do that then it cant find SunkenAllies(2).

So i quess this will help

add this when casting
  • Set SunkenIndex2 = (SunkenIndex2 + 1)
Do this when spell is finished instead of setting SunkenIndex = SunkenIndex -1
  • Set SunkenIndex2 = (SunkenIndex2 - 1)
Then check if there is no other SunkenIndex looping, and if not only then you can set SunkenIndex to 0
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SunkenIndex2 Equal to 0
    • Then - Actions
      • Set SunkenIndex1 = 0
    • Else - Actions
 
Level 5
Joined
Jan 27, 2014
Messages
164
Code:
Sunken Army
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Sunken Army 
    Actions
        Set SunkenIndex = (SunkenIndex + 1)
        Set SunkenTime[SunkenIndex] = 10.00
        Set SunkenAllies[SunkenIndex] = (Units within 450.00 of (Target point of ability being cast) matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True)))
        Unit Group - Pick every unit in SunkenAllies[SunkenIndex] and do (Actions)
            Loop - Actions
                Special Effect - Create a special effect at (Position of (Picked unit)) using WaterBlast.mdx
                Special Effect - Destroy (Last created special effect)
                Unit - Add Sunken  to (Picked unit)



Code:
Sunken Army Loop
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to SunkenIndex, do (Actions)
            Loop - Actions
                Set SunkenTime[(Integer A)] = (SunkenTime[(Integer A)] - 1.00)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        SunkenTime[(Integer A)] Equal to 0.00
                    Then - Actions
                        [u]Set SunkenAllies[(Integer A)] = SunkenAllies[SunkenIndex][/u]
                        [u]Set SunkenTime[(Integer A)] = Set SunkenTime[SunkenIndex][/u]
                        Unit Group - Pick every unit in SunkenAllies[(Integer A)] and do (Actions)
                            Loop - Actions
                                Unit - Remove Sunken  from (Picked unit)
                        [u]Set SunkenIndex = (SunkenIndex - 1)[/u]
                        [u]Custom script:   call DestroyGroup(udg_SunkenAllies[udg_SunkenIndex])[/u]
                    Else - Actions

The underlined stuff are the things that I added/changed. I removed some things as well. You can try and see if it works.
Yeah, I'm more of a hashtable person as well. Makes life easier, imo.
Then again, in your case, you can even use pseudo locals coupled with wait as well.
But that'll be another thing.
 
Use this cool trick.
  • Test
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Custom script: local group udg_g = CreateGroup()
      • Set g = (Units within 800.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to False))
      • Unit Group - Pick every unit in g and do (Actions)
        • Loop - Actions
          • Unit - Add Endurance Aura (Neutral Hostile) to (Picked unit)
      • Wait 10.00 seconds
      • Unit Group - Pick every unit in g and do (Actions)
        • Loop - Actions
          • Unit - Remove Endurance Aura (Neutral Hostile) from (Picked unit)
      • Custom script: call DestroyGroup(udg_g)
      • Custom script: set udg_g = null
 
Level 6
Joined
Sep 13, 2013
Messages
155
Use this cool trick.
  • Test
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Custom script: local group udg_g = CreateGroup()
      • Set g = (Units within 800.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to False))
      • Unit Group - Pick every unit in g and do (Actions)
        • Loop - Actions
          • Unit - Add Endurance Aura (Neutral Hostile) to (Picked unit)
      • Wait 10.00 seconds
      • Unit Group - Pick every unit in g and do (Actions)
        • Loop - Actions
          • Unit - Remove Endurance Aura (Neutral Hostile) from (Picked unit)
      • Custom script: call DestroyGroup(udg_g)
      • Custom script: set udg_g = null




:vw_wtf: too simple but working !!!
Can you give me a list of these useful custom scripts ? Im gonna need them.
and thanks to all. specially -Kobas-
 
:vw_wtf: too simple but working !!!
Can you give me a list of these useful custom scripts ? Im gonna need them.
and thanks to all. specially -Kobas-
I will see can I create tutorial about this.
But you can find all jass code on this site, or google.
for example unit will be:
  • Custom script: local unit udg_VARIABLE_NAME
floating text
  • Custom script: local texttag udg_VARIABLE_NAME
and so on.
 
Status
Not open for further replies.
Top