1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Problem with casting spell multiple time and with slowing units

Discussion in 'Triggers & Scripts' started by MatiS, Aug 31, 2015.

  1. MatiS

    MatiS

    Joined:
    Feb 23, 2015
    Messages:
    208
    Resources:
    29
    Models:
    27
    Packs:
    2
    Resources:
    29
    Hi
    I've made simple, theoretically spammable CC ability for my hero, but I have two. or even three, problems with it. When I cast spell multiple times in short time, sometimes nothing happens, and sometimes effect stays there forever. Also, after casting spell more than 4/5 times, it stops slowing units. Second thing is that after I added custom script which destroys group, the group is destroyed permanently and spell is broken forever. Also, when I set unit's movement speed to 0 X default movement speed, unit is slowed, but can move.
    Triggers

    • WebConfiguration
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set WebAbility = Web
        • Set WebRadius[1] = 150.00
        • Set WebRadius[2] = 150.00
        • Set WebRadius[3] = 150.00
        • Set WebMultiplier[1] = 0.40
        • Set WebMultiplier[2] = 0.20
        • Set WebMultiplier[3] = 0.00
        • Set WebTime[1] = 5.00
        • Set WebTime[2] = 5.00
        • Set WebTime[3] = 5.00

    • WebCast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equals to WebAbility
      • Actions
        • Set WebIndex = (WebIndex + 1)
        • Set WebCaster[WebIndex] = (Triggering unit)
        • Set WebPoint[WebIndex] = (Target point of ability being cast)
        • Set WebLevel[WebIndex] = (Level of WebAbility for WebCaster[WebIndex])
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • WebIndex Equals to 1
          • Then - Actions
            • Trigger - Turn on WebLoop <gen>
          • Else - Actions

    • WebLoop
      • Events
        • Time - Every 0.10 seconds of game time
      • Conditions
      • Actions
        • For each (Integer WebLoop) from 1 to WebIndex, do (Actions)
          • Loop - Actions
            • Set WebCounter[WebLoop] = (WebCounter[WebLoop] + 1.00)
            • Unit Group - Pick every unit in WebGroup[WebLoop] and do (Actions)
              • Loop - Actions
                • Unit - Set (Picked unit) movement speed to (Default movement speed of (Picked unit))
                • Unit Group - Remove (Picked unit) from WebGroup[WebLoop]
            • Custom script: call DestroyGroup (udg_WebGroup[udg_WebLoop])
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • WebCounter[WebLoop] Equals to 1.00
              • Then - Akcje
                • Special Effect - Create a special effect at WebPoint[WebLoop] using Abilities\Spells\NightElf\Immolation\ImmolationTarget.mdl
                • Set WebEffect[WebLoop] = (Last created special effect)
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • WebCounter[WebLoop] Mniejsze (10.00 x WebTime[WebLevel[WebLoop]])
              • Then - Actions
                • Unit Group - Add all units of (Units within WebRadius[WebLevel[WebLoop]] of WebPoint[WebLoop] matching (((Matching unit) is Ground Unid) Equals to YES)) to WebGroup[WebLoop]
                • Unit Group - Pick every unit in WebGroup[WebLoop] and do (Actions)
                  • Loop - Actions
                    • Unit - Set (Picked unit) movement speed to (WebMultiplier[WebLevel[WebLoop]] x (Default movement speed of (Picked unit)))
              • Else - Actions
                • Special Effect - Destroy WebEffect[WebLoop]
                • Custom script: call RemoveLocation(udg_WebPoint[udg_WebLoop])
                • Set WebCounter[WebLoop] = 0.00
                • Set WebCaster[WebLoop] = WebCaster[WebIndex]
                • Set WebCounter[WebLoop] = WebCounter[WebIndex]
                • Set WebEffect[WebLoop] = WebEffect[WebIndex]
                • Set WebGroup[WebLoop] = WebGroup[WebIndex]
                • Set WebLevel[WebLoop] = WebLevel[WebIndex]
                • Set WebPoint[WebLoop] = WebPoint[WebIndex]
                • Set WebIndex = (WebIndex - 1)
                • Set WebLoop = (WebLoop - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • WebIndex Equals to 0
                  • Then - Actions
                    • Trigger - Turn off WebLoop <gen>
                  • Else - Actions

    I would be grateful for help :-D.
     
  2. DEE-BOO

    DEE-BOO

    Joined:
    Apr 4, 2010
    Messages:
    505
    Resources:
    1
    Icons:
    1
    Resources:
    1
    • Unit Group - Pick every unit in WebGroup[WebLoop] and do (Actions)


    Where is your Web group? You don't create a group anywhere.
     
  3. ivofena

    ivofena

    Joined:
    Jan 17, 2014
    Messages:
    129
    Resources:
    0
    Resources:
    0
    1. In the trigger "WebCast", you missed setting up the variable "WebCounter". The first time it works because its default value is 0, but after that, since you don't set it to 0 from the cast trigger or reset it when deindexing, it will always increase.

    2. Instead of destroying the group right from the beginning, just empty it. Destroy it when deindexing. Oh, and when adding units to it you could use:
    • Set Your_Group_Variable = (Units in (Region) matching (Condition))
     
    Last edited: Sep 1, 2015
  4. MatiS

    MatiS

    Joined:
    Feb 23, 2015
    Messages:
    208
    Resources:
    29
    Models:
    27
    Packs:
    2
    Resources:
    29
    Thanks, it worked :-D.

    This removes units from group that is created later. First time loop runs there is no group, so this line doesn't do anything.

    There is still one issue - when ability has level 3, it should immobilise affected units, but they're only slowed. I don't understand why, 'cause I set it's moving speed to 0.
     
  5. ivofena

    ivofena

    Joined:
    Jan 17, 2014
    Messages:
    129
    Resources:
    0
    Resources:
    0
    In the World Editor click "Advanced" and then "Gameplay Constants...", find the field "Movement - Unit Speed - Minimum", (Default value should be 150) if you set it to 0 your spell should work fine.
     
  6. MatiS

    MatiS

    Joined:
    Feb 23, 2015
    Messages:
    208
    Resources:
    29
    Models:
    27
    Packs:
    2
    Resources:
    29
    It works! Thank you a lot, I can finally finish this hero :-D.
     
  7. ivofena

    ivofena

    Joined:
    Jan 17, 2014
    Messages:
    129
    Resources:
    0
    Resources:
    0
    No problem, glad I can help.