• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Looping spell for more than one hero at the time

Status
Not open for further replies.

foe

foe

Level 2
Joined
Oct 22, 2019
Messages
6
Hi! So i'm pretty new at this, attempting to create a spell that sets an area and gives all friendly units in the area an ability, updating constantly so it can tell whether a unit leaves or enters the area. The problem I'm currently facing however is that currently only one hero can cast the spell at a time, otherwise it'll break. My goal is to allow multiple heroes to cast it at the same time.
Thanks in advance! :)
upload_2019-10-29_13-11-20.png

upload_2019-10-29_13-11-46.png

upload_2019-10-29_13-12-3.png


Bear in mind I'm fairly new at this, I'm sure the spell could be done much easier, feel free to share any improvements, it'll be much appreciated :D
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
The ‘Do Nothing’ command is useless and should never be used. You can simply leave the Else actions blank. Similarly single-line ifs have no advantage over the multiple actions ifs, which IMO are easier to read.

This is the method you need to adopt: Visualize: Dynamic Indexing

To do that basically you just need to make all your variables into arrays and change the logic for turning the other triggers on/off. Instead of always doing it you’ll only do it if the active instance count is 1 (on) or 0 (off).

Your method for this spell is fine and is how I would do it.
 
Status
Not open for further replies.
Top