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

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 38
Joined
Feb 27, 2007
Messages
4,951
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