• 🏆 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] Problem with casting spell multiple time and with slowing units

Status
Not open for further replies.
Level 20
Joined
Feb 23, 2015
Messages
243
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.

  • 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.
 
Level 5
Joined
Jan 17, 2014
Messages
131
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:
Level 20
Joined
Feb 23, 2015
Messages
243
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))

Thanks, it worked :-D.

  • Unit Group - Pick every unit in WebGroup[WebLoop] and do (Actions)
Where is your Web group? You don't create a group anywhere.

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.
 
Level 5
Joined
Jan 17, 2014
Messages
131
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.

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.
 
Status
Not open for further replies.
Top