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

Disarm System v1.0.4

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Disarm System v1.0.4

Disabled enemy unit's attack for a duration

By
ukn0wnD3str0y3r (Hive)
GnE.MaP-Cr3at0r (Garena)

How to Import:
-Copy all the trigger, dummy ability
-Copy all the trigger in the same time by going to Files->Prefences->General->Automatically create unknown variables while pasting trigger data
-Copy all these things into your map and remember give me credits :D Hope you like it!



Configurations:
Disarm_DummyAbility - Dummy Ability of Disarm
Disarm_Duration - Duration of Disarm
Disarm_Caster - Triggering Unit
Disarm_Target - Affected Unit




  • Disarm Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Disarm_DummySpell = Cargo Hold (Orc Burrow)
      • Set Disarm_Duration = 0.00
      • Set Disarm_Loop = 0.03
      • Set Disarm_Effect = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
  • Disarm Normal Att
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is A Hero) Equal to True
    • Actions
      • -------- Start of the Configuration --------
      • Set Disarm_Caster = (Attacking unit)
      • Set Disarm_Target = (Attacked unit)
      • Set Disarm_Duration = 2.00
      • -------- End of the Configuration --------
      • Trigger - Run Disarm Start <gen> (checking conditions)
  • Disarm Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frost Nova
    • Actions
      • Set Disarm_Caster = (Triggering unit)
      • Set Disarm_Target = (Target unit of ability being cast)
      • Set Disarm_Duration = 3.00
      • Trigger - Run Disarm Start <gen> (checking conditions)
  • Disarm Start
    • Events
    • Conditions
    • Actions
      • Set DS_X = (DS_X + 1)
      • Set DS_Unit1[DS_X] = Disarm_Caster
      • Set DS_Unit2[DS_X] = Disarm_Target
      • Set DS_Duration[DS_X] = Disarm_Duration
      • Special Effect - Create a special effect attached to the overhead of DS_Unit2[DS_X] using Disarm_Effect
      • Set DS_Effect[DS_X] = (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Disarm_DummySpell for DS_Unit2[DS_X]) Equal to 0
        • Then - Actions
          • Unit - Add Disarm_DummySpell to DS_Unit2[DS_X]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DS_X Equal to 1
        • Then - Actions
          • Trigger - Add to Disarm Timer <gen> the event (Time - Every Disarm_Loop seconds of game time)
        • Else - Actions
  • Disarm Timer
    • Events
    • Conditions
    • Actions
      • For each (Integer DS_Y) from 1 to DS_X, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Disarm_DummySpell for DS_Unit2[DS_X]) Greater than 0
              • DS_Duration[DS_Y] Greater than 0.00
            • Then - Actions
              • Set DS_Duration[DS_Y] = (DS_Duration[DS_Y] - Disarm_Loop)
            • Else - Actions
              • -------- De-indexing the disarm --------
              • Unit - Remove Disarm_DummySpell from DS_Unit2[DS_Y]
              • Special Effect - Destroy DS_Effect[DS_Y]
              • Set DS_Unit1[DS_Y] = DS_Unit1[DS_X]
              • Set DS_Unit2[DS_Y] = DS_Unit2[DS_X]
              • Set DS_Duration[DS_Y] = DS_Duration[DS_X]
              • Set DS_Duration[DS_X] = Disarm_Duration
              • Set DS_Effect[DS_Y] = DS_Effect[DS_X]
              • Set DS_X = (DS_X - 1)
              • Set DS_Y = (DS_Y - 1)
              • -------- Turn off Trigger --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DS_X Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions




-Added a new trigger to run the disarm
-Now you can add disarm easily



-Fixed minor things of Disarm System
-Testing Dummy now have 100000 hp



-Remove the 'DS_DurationCurrent' Variables
-Loop changed from +.03 to -.03
-Added another hero to show that this system is MUI



-Remove Dummy Caster and Dummy Spell
-Remove dummy buff variable
-Changed disarm spell into Cargo Hold



-Initial Release




-Callahan (Thanks him for telling me adding cargo hold will also disarm)


Gives me credits if you use this :) it doesn't matter which name you give credits :)


Bonus Note

Any wrong to this system please tell me to fix it! :)
Keywords:
Disarm, System, Disabled, Attack, Spell
Contents

Disarm System v1.0.4 (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. IcemanBo: http://www.hiveworkshop.com/forums/spells-569/disarm-system-v1-0-4-a-260483/index4.html#post2638876 15:54, 10th Jan 2015 IcemanBo...
Level 13
Joined
Jul 16, 2012
Messages
679
In example of your Normal Attack Trigger is not good method

Why? is not totally detect the damage
only a event if the unit try to attack you

so no damage detection here...

In Hiveworkshop have GUI DDS
So you can use this..

Should be remove this...
  • Set DS_Unit1[DS_X] = No unit
  • Set DS_Unit2[DS_X] = No unit
  • Set DS_Dummy[DS_X] = No unit
This method... the variable replace to another variable

if the first variable is done, the first variable become a second variable

so dont null it
 
In example of your Normal Attack Trigger is not good method

Why? is not totally detect the damage
only a event if the unit try to attack you

so no damage detection here...

In Hiveworkshop have GUI DDS
So you can use this..
Nothing prevent the user from using GDD event with his system.People should stop critisizing example trigger as it is useless.
Only core triggers matters like loop , init and configuration.

Why do they need cargo hold?
The ability disable attack of the unit that has it.
You could temporarly give cargo hold to the targeted unit.
Right now this system is a dummy cast silence system which is simple and specific but since you make the effect duration triggered it turns out complicated for what it is.
Especially that you can set the duration in object editor and wont need loop trigger that way.
 
Level 9
Joined
Feb 15, 2013
Messages
372
In example of your Normal Attack Trigger is not good method

Why? is not totally detect the damage
only a event if the unit try to attack you

so no damage detection here...

In Hiveworkshop have GUI DDS
So you can use this..

Should be remove this...
  • Set DS_Unit1[DS_X] = No unit
  • Set DS_Unit2[DS_X] = No unit
  • Set DS_Dummy[DS_X] = No unit
This method... the variable replace to another variable

if the first variable is done, the first variable become a second variable

so dont null it

The normal attack example is just an example that show the disarm system works so if other user wanted customize it with GDD or DDS also can done it easily... it just an example :)

Callahan said:
The ability disable attack of the unit that has it.
You could temporarly give cargo hold to the targeted unit.
Right now this system is a dummy cast silence system which is simple and specific but since you make the effect duration triggered it turns out complicated for what it is.
Especially that you can set the duration in object editor and wont need loop trigger that way.

I wanted people to set the disarm duration by they own that they like it. Example he wants it to be random number between .33 to .66 to be the duration and so... people can done the duration by himself :)
 
Level 9
Joined
Feb 15, 2013
Messages
372
Umm... can I ask if at every starting trigger i don't use dummy caster and changed it to add "Cargo Hold" to the targeted unit and remove at the end of loop trigger. Will this still be a disarm too?

EDIT: Owh, its work i solved it, so should i remove the dummy caster and change to cargo hold in next verison?
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
You can do this without any dummy units or spells. Use this script:
  • Custom script: call UnitRemoveAbility(u, 'AAtk')
When duration ends, regain the attack ability:
  • Custom script: call UnitAddAbility(u, 'AAtk')
So far, I can't spot any disadvantage out of it.

I suggest you to make this a bit more elegant: user don't need to re-create dummy units everytime they want to disarm. How?
  • Then - Actions
    • Set DS_X = (DS_X + 1)
    • Set DS_Unit1[DS_X] = Disarm_Caster
    • Set DS_Unit2[DS_X] = Disarm_Target
    • -------- The Disarm Boolean. True = stacking, False = no stacking --------
    • -------- Create the dummy unit and cast the disarm --------
    • Unit - Create 1 Disarm_Dummy for (Owner of DS_Unit1[DS_X]) at (Position of DS_Unit2[DS_X]) facing Default building facing degrees
    • Set DS_Dummy[DS_X] = (Last created unit)
    • Unit - Add Disarm_DummySpell to DS_Dummy[DS_X]
    • Unit - Add a 1.00 second Generic expiration timer to DS_Dummy[DS_X]
    • Unit - Order DS_Dummy[DS_X] to Neutral Dark Ranger - Silence (Position of DS_Unit2[DS_X])
    • -------- Duration of Disarm --------
    • Set DS_Duration[DS_X] = Disarm_Duration
    • Set DS_DurationCurrent[DS_X] = Disarm_DurationCurrent
    • -------- Start the Loop --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DS_X Equal to 1
      • Then - Actions
        • Trigger - Turn on Disarm Timer <gen>
      • Else - Actions
Move the whole block to another trigger (this is going to be your disarm trigger). Then create another non-array variables. This is just an example how user can disarm a unit:
  • set "duration" = 3.00
  • set "target" = (Attacked unit)
  • Custom script: call TriggerEvaluate(your disarm trigger)
Everytime user evaluates your trigger, a new instance of disarm is created, DS_Duration will inherits variable "duration" and DS_Unit (or the target) will inherits variable "target". Using this way, you just need one dummy caster for the whole game (created at map init), and neat and more convincing.

Hope you understand. However, you also missed some:
- (Position of (....)) leaks
- DS_Unit1 is unneeded
- You can only use one "duration" variable. Substract it by 0.03, when reaches 0 => recycle your variables
- Your periodical trigger is not based on variable Disarm_Loop
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Custom script: call UnitRemoveAbility(u, 'AAtk')
When duration ends, regain the attack ability:
Custom script: call UnitAddAbility(u, 'AAtk')

So far, I can't spot any disadvantage out of it.

That only disables attack but does not re-enable it. And it's also not 'AAtk' but 'Aatk'.


@OP: Don't use it, doesn't work.
 
Level 9
Joined
Feb 15, 2013
Messages
372
You can do this without any dummy units or spells. Use this script:
  • Custom script: call UnitRemoveAbility(u, 'AAtk')
When duration ends, regain the attack ability:
  • Custom script: call UnitAddAbility(u, 'AAtk')
So far, I can't spot any disadvantage out of it.

I suggest you to make this a bit more elegant: user don't need to re-create dummy units everytime they want to disarm. How?
  • Then - Actions
    • Set DS_X = (DS_X + 1)
    • Set DS_Unit1[DS_X] = Disarm_Caster
    • Set DS_Unit2[DS_X] = Disarm_Target
    • -------- The Disarm Boolean. True = stacking, False = no stacking --------
    • -------- Create the dummy unit and cast the disarm --------
    • Unit - Create 1 Disarm_Dummy for (Owner of DS_Unit1[DS_X]) at (Position of DS_Unit2[DS_X]) facing Default building facing degrees
    • Set DS_Dummy[DS_X] = (Last created unit)
    • Unit - Add Disarm_DummySpell to DS_Dummy[DS_X]
    • Unit - Add a 1.00 second Generic expiration timer to DS_Dummy[DS_X]
    • Unit - Order DS_Dummy[DS_X] to Neutral Dark Ranger - Silence (Position of DS_Unit2[DS_X])
    • -------- Duration of Disarm --------
    • Set DS_Duration[DS_X] = Disarm_Duration
    • Set DS_DurationCurrent[DS_X] = Disarm_DurationCurrent
    • -------- Start the Loop --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DS_X Equal to 1
      • Then - Actions
        • Trigger - Turn on Disarm Timer <gen>
      • Else - Actions
Move the whole block to another trigger (this is going to be your disarm trigger). Then create another non-array variables. This is just an example how user can disarm a unit:
  • set "duration" = 3.00
  • set "target" = (Attacked unit)
  • Custom script: call TriggerEvaluate(your disarm trigger)
Everytime user evaluates your trigger, a new instance of disarm is created, DS_Duration will inherits variable "duration" and DS_Unit (or the target) will inherits variable "target". Using this way, you just need one dummy caster for the whole game (created at map init), and neat and more convincing.

Hope you understand. However, you also missed some:
- (Position of (....)) leaks
- DS_Unit1 is unneeded
- You can only use one "duration" variable. Substract it by 0.03, when reaches 0 => recycle your variables
- Your periodical trigger is not based on variable Disarm_Loop

Thanks for your advices ^^ but isn't it same if i add duration .03 and subtract .03?

Oh wait, i think i get something... if subtract then i can remove one variable "DS_DurationCurrent"?

EDIT: oh yah, and now i removed the dummy caster and replace it by Cargo Hold ability ^^
 
Level 9
Joined
Feb 15, 2013
Messages
372
Currently the system may cause wrong results, if a unit gets targeted again, while it's already a target by an other instance.

If duration1 ends, the unit's attack will be enabled again, even duration2 is still running.

Thanks for your advice! i'll fix right after that, so is there anymore problem? except the loop

EDIT: and can i ask the ITE need to put at before duration subtract or after duration == 0?
 
Null the effect[lastIndex] in your deindex part.

"Time - Every 0.03 seconds of game time" is hardcoded. Use the variable, that is initialiszed in your Setup trigger instead of "0.03".

When the target's attack is already disabled before it should get indexed (+ is NOT already indexed by your system), then it should not be indexed at all, as it would bring unwanted results. (you would enable attack, even the user disabled it by default maybe)
 
Level 9
Joined
Feb 15, 2013
Messages
372
Null the effect[lastIndex] in your deindex part.

"Time - Every 0.03 seconds of game time" is hardcoded. Use the variable, that is initialiszed in your Setup trigger instead of "0.03".

When the target's attack is already disabled before it should get indexed (+ is NOT already indexed by your system), then it should not be indexed at all, as it would bring unwanted results. (you would enable attack, even the user disabled it by default maybe)

So changed to Time - Every (Disarm_Loop) seconds of game time?

Set DS_Effect[DS_Y] = DS_Effect[DS_X]?

Put ITE into the loop?
If-
level of cargo hold of unit = 0
Then-
/Do the de-index
Else-
-

Is it like that?
 
Make the attachment point configurable.

Make the user decide his own event. Just provide a trigger that will run for registration.
Example:
  • Set DisarmUnit = TriggeringUnit
  • Set Duration = 5.00
  • Trigger - Run Registration
User won't have to bother with system itself. All will be done automatically.

If unit gets registered again while it's already an instance, you have to use the bigger duration of course.

Only remove the dummy spell, if the unit has not had it before registration.

Needs Fix
 
The usage looks simple now. It's definitly better. :)

But atm it doesn't work good for me. After second attack the enemy stays disarmed.

I suggest you to import a UnitIndexer and only update Duration[custom value of unit] on registration.

- Only register one unit per registration. And only one unit is needed in your examples. Not both
- The DisarmSpell, and DisarmAttck triggers are only example. Move them out of the system folder, or mark them as examples.
- Only create the effect if unit is not registered yet.

Needs Fix
 
Well, the main problem is the system doesn't work correctly at the moment.

And I see further potential problems with it that a unit can be registered multiple times at same time. So you clearly have to check onDeindex if you already should enable attack again or not.

So it's easier if one unit is only registered maximum once, and you only update Duration[UnitIndex] onRegistration.

CustomValue is an integer you can bind to a unit. A Unit indexer gives every unit on map a specific CustomValue, so you can use it for your needs.
 
Top