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

[Spell] How to make a trigger spell MUI

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
497
So the spell is an item spell. The idea of it is that when ever a hero with the item "flaming sword" attacks an enemy, the enemy will take damage over time. Doe how do I make it MUI so that the target does not reset and multiple heroes can have the item. I currently have this:
Flaming Sword Passive
  • Events
    • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacking unit) has an item of type Flaming Sword) Equal to True
        • Then - Actions
          • Set Item_FlamingSword = (Attacked unit)
          • Set Item_FlamingSword_Hero = (Attacking unit)
          • Trigger - Turn on Flaming Sword Passive loop dmg <gen>
          • Countdown Timer - Start Item_FlamingSword_Timer as a One-shot timer that will expire in 10.00 seconds
        • Else - Actions
  • Flaming Sword Passive loop dmg
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item_FlamingSword is A structure) Equal to False
        • Then - Actions
          • Unit - Cause Item_FlamingSword_Hero to damage Item_FlamingSword, dealing 5.00 damage of attack type Chaos and damage type Normal
          • Special Effect - Create a special effect attached to the chest of Item_FlamingSword using Abilities\Spells\Human\FlameStrike\FlameStrikeEmbers.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
  • Flaming Sword Timeout
    • Events
      • Time - Item_FlamingSword_Timer expires
    • Conditions
    • Actions
      • Trigger - Turn off Flaming Sword Passive loop dmg <gen>
Please show me the triggers if you want to help me. Thanks a lot to all who replied!!!
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Your specification of the problem is not clear. Specifically stacking behaviour from one or multiple source units with 1 or multiple source items.

Here are some guide lines for people attempting this problem.

One will likely need 3 triggers.
  1. Item Acquisition/Drop
  2. Unit attacks with sword
  3. Periodic fire damage

And some variables.
  • Wielders : group

The following variables are used by the instancing system to form a basic struct array list.
  • List Head : integer
  • Fire Source : unit array
  • On Fire : unit array
  • Fire Damage : real array
  • Fire Ticks Left : integer array

Trigger 1
When the appropriate items are acquired by a unit you add the unit to a group. If the group was empty you turn on Trigger 2. When the appropriate items are removed from a unit you remove the unit from a group. If the group is now empty you turn off Trigger 2.

This stage is needed to minimize resource overhead from the system as on attack events fire a lot more than item manipulation events and item checking tests are often quite resource intensive.

Trigger 2
If the attacker is in the wielder group then create a new fire instance. This is done at the head of the list and configured appropriately for the item. This means that source, unit on fire, damage and number of ticks need to all be set up. Increment list header by 1 to accommodate new instance. If it was 0 then turn on Trigger 3. Assuming a Trigger 3 frequency of 1 Hz then a tick counter of 10 will suffice. Damage of 5 looking at your current triggers.

This trigger handles setting up the fire on a unit. Each attack creates a separate damage instance meaning it can stack indefinitely (well up to 8,192 times but that is not realistic).​

Trigger 3
Fire every 1 second. Loop through the structure list. For each instance (structure) you deal damage from appropriate source to appropriate target of appropriate damage amount. You then decrement tick counter by 1 for that instance. If tick counter is 0 you then destroy the instance and remove from list. This is done by decrementing head of list and setting all instance variables of the removed instance to those of the head of list. Null (no unit) both fire source and unit on fire for the head of list to prevent unnecessary handle retention. Finally upon removing an instance decrement the current loop position by 1 to iterate over the position again so you do not accidently skip iterating an instance. If there are no instances after the loop ends then turn off Trigger 3.

Simple periodic polling of all instances trigger. Like you see in most MUI GUI spells.​
 
Level 11
Joined
Jun 26, 2014
Messages
497
Your specification of the problem is not clear. Specifically stacking behaviour from one or multiple source units with 1 or multiple source items.

Here are some guide lines for people attempting this problem.

One will likely need 3 triggers.
  1. Item Acquisition/Drop
  2. Unit attacks with sword
  3. Periodic fire damage

And some variables.
  • Wielders : group

The following variables are used by the instancing system to form a basic struct array list.
  • List Head : integer
  • Fire Source : unit array
  • On Fire : unit array
  • Fire Damage : real array
  • Fire Ticks Left : integer array

Trigger 1
When the appropriate items are acquired by a unit you add the unit to a group. If the group was empty you turn on Trigger 2. When the appropriate items are removed from a unit you remove the unit from a group. If the group is now empty you turn off Trigger 2.

This stage is needed to minimize resource overhead from the system as on attack events fire a lot more than item manipulation events and item checking tests are often quite resource intensive.

Trigger 2
If the attacker is in the wielder group then create a new fire instance. This is done at the head of the list and configured appropriately for the item. This means that source, unit on fire, damage and number of ticks need to all be set up. Increment list header by 1 to accommodate new instance. If it was 0 then turn on Trigger 3. Assuming a Trigger 3 frequency of 1 Hz then a tick counter of 10 will suffice. Damage of 5 looking at your current triggers.

This trigger handles setting up the fire on a unit. Each attack creates a separate damage instance meaning it can stack indefinitely (well up to 8,192 times but that is not realistic).​

Trigger 3
Fire every 1 second. Loop through the structure list. For each instance (structure) you deal damage from appropriate source to appropriate target of appropriate damage amount. You then decrement tick counter by 1 for that instance. If tick counter is 0 you then destroy the instance and remove from list. This is done by decrementing head of list and setting all instance variables of the removed instance to those of the head of list. Null (no unit) both fire source and unit on fire for the head of list to prevent unnecessary handle retention. Finally upon removing an instance decrement the current loop position by 1 to iterate over the position again so you do not accidently skip iterating an instance. If there are no instances after the loop ends then turn off Trigger 3.

Simple periodic polling of all instances trigger. Like you see in most MUI GUI spells.​

Ok I see what I have to do but since I am kinda new to it, it's kinda hard to make. Can you post the triggers please, it will be much easier to make then.
 
Level 10
Joined
Apr 4, 2010
Messages
509
Like Ardenian suggested, http://www.hiveworkshop.com/forums/...orials-279/visualize-dynamic-indexing-241896/ is your best go.
It's really well done tutorial and the example spell is pretty similar to yours. It has really good pictures for those who are visual learners.

This is my interpretation of Arrays:

Arrays are like your ID and 'Soul'
Swordsman[1] is holding Sword[1]
Swordsman[2] is holding Sword[2]
Swordsman[3] is holding Sword[3]
The soul of Swordsman 1 is linked to his sword because the Sword has the same soul (number one).
But without the ID, there is only one Sword 'soul' and this soul is jumping around from sword to sword whenever a swordsman attacks, trying to be the soul for three different swords.
So with dynamic indexing, everyone gets a Sword with the same soul as them and everyone who gets attacked is marked with the 'soul' ID.

But if you are still having trouble understanding you can simplify the spell like this:
Just create one group.
When a dude with Flaming Sword attacks, create a dummy and make it cast a spell that applies a buff on the Target, then add the Target to the group.
Then you will have a Periodic Trigger that will damage every in the group every second, if anyone loses, their buff, then kick them out of the group.
Finally, if the group in empty, the turn off the trigger.
 
Level 11
Joined
Jun 26, 2014
Messages
497
Like Ardenian suggested, http://www.hiveworkshop.com/forums/...orials-279/visualize-dynamic-indexing-241896/ is your best go.
It's really well done tutorial and the example spell is pretty similar to yours. It has really good pictures for those who are visual learners.

This is my interpretation of Arrays:

Arrays are like your ID and 'Soul'
Swordsman[1] is holding Sword[1]
Swordsman[2] is holding Sword[2]
Swordsman[3] is holding Sword[3]
The soul of Swordsman 1 is linked to his sword because the Sword has the same soul (number one).
But without the ID, there is only one Sword 'soul' and this soul is jumping around from sword to sword whenever a swordsman attacks, trying to be the soul for three different swords.
So with dynamic indexing, everyone gets a Sword with the same soul as them and everyone who gets attacked is marked with the 'soul' ID.

But if you are still having trouble understanding you can simplify the spell like this:
Just create one group.
When a dude with Flaming Sword attacks, create a dummy and make it cast a spell that applies a buff on the Target, then add the Target to the group.
Then you will have a Periodic Trigger that will damage every in the group every second, if anyone loses, their buff, then kick them out of the group.
Finally, if the group in empty, the turn off the trigger.

I will try that, thanks. Even thought I will try this I will still be very tankful if anyone wants to post some triggers here and there for extra help :grin:

image.png
This was my solution to my problem. What do you think? Is this good?
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Seeing as you never answered my question...
Your specification of the problem is not clear. Specifically stacking behaviour from one or multiple source units with 1 or multiple source items.
Yes it is perfect, since after all we cannot create for you something unless you tell us what you want made.

From an implementation point of view it looks rubbish since you can easily make 1 trigger work for many players. However again that depends how you want the buff to stack which you never told us.

Nice DPI on your display though. My trigger view is usually a tiny fraction of that size.
 

Ardenian

A

Ardenian

This was my solution to my problem. What do you think? Is this good?
Without knowing what you are doing there, I already can tell you it is neither efficient nor good. You should only have one trigger for every category.

See, this is the WEHZ, not the request section. Here we help you, but you have to tell us what is the problem and share details, as Dr Super Good says.
If you just want someone making the triggers for you this is the wrong section, if you are not willy to learn how to do it yourself, reading the linked tutorial and listening to the information Dr Super Good and DEE-BOO gave you.

Anyway, why do you want to trigger it ? You can simply use this ability called 'Slow Poison', make it an item ability ( or use the orb one), create a custom buff so it looks like a flame one, and if you want the damage to stack, enable stacking for damage.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Q: How to make spell ... MUI?
A: USE A F****** SYSTEM!!!

Go download a buff system and make a DoT spell. (simple configuration)
Go add the buff on a target if he is attacked by a unit that has an item of type Flaming Sword.

The second one can be done by either using a DDS or Basic Attack Simulator.
 
Level 11
Joined
Jun 26, 2014
Messages
497
Seeing as you never answered my question...

Yes it is perfect, since after all we cannot create for you something unless you tell us what you want made.

From an implementation point of view it looks rubbish since you can easily make 1 trigger work for many players. However again that depends how you want the buff to stack which you never told us.

Nice DPI on your display though. My trigger view is usually a tiny fraction of that size.

I said that the spell is a passive on-hit. When a Hero has Item he will Burn target for 10 seconds dealing damage to it over time. Only one target is possible to burn at a time. That means every time the hero strikes a new target the last hit target will burn. The problem I had is that for all of the Heros there could be only ONE target on the whole map burning. I had to make the target MUI so there could be multiple targets burning for multiple Heroes and items. The way I solved my problem is that the first triggers I posted I gave them player conditions and duplicated the triggers for every player. GG WP
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Not sure if it is completely bug free but here it is.

It stacks one target per item. Works for up to 8192 items simultaneously. Might perform poorly if a lot of instances are active (eg several hundred) but I doubt you will see that much use. Should support many different items but that functionality has not been tested.
 

Attachments

  • Krakenn99 - Burn Sword - ver1.0.w3x
    18.6 KB · Views: 102
Level 11
Joined
Jun 26, 2014
Messages
497
Not sure if it is completely bug free but here it is.

It stacks one target per item. Works for up to 8192 items simultaneously. Might perform poorly if a lot of instances are active (eg several hundred) but I doubt you will see that much use. Should support many different items but that functionality has not been tested.

Thanks a lot!
 
Status
Not open for further replies.
Top