• 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.

Destroying LightningEffect.

Status
Not open for further replies.
Level 4
Joined
Feb 2, 2009
Messages
71
I'm trying to make a system which goes like this.
Whenever a structure is built within 500 range of another structure, a lightning effect is created between them, lets call it a Link.
I've come this far.

But when one of the linked structures is destroyed, the Link must also be destroyed.
 
Level 11
Joined
Nov 15, 2007
Messages
800
You need an indexing array for lightning effects which matches the custom value of the structures, then when one of the structures dies it destroys the lightning effects with the appropriate array.

Edit: If you don't know how to do this, there are tutorials. It's a lot to explain when there are already sources.
 
Level 4
Joined
Feb 2, 2009
Messages
71
You need an indexing array for lightning effects which matches the custom value of the structures, then when one of the structures dies it destroys the lightning effects with the appropriate array.
Ye, I've thought about that. But the problem occurs when several buildings are connected in a row.

Works:
Building1[1] <- Not an array, but the customValue of the unit
Lightning[1] <- An array of lightnings with the same index as the customvalue of the two buildings connected.
Building2[1] <- Same as the other building.

Does not work:
Building1[2]
Lightning[2]
Building2[2]
Lightning[?] <- I can't have the same index on this one, as there already is a lightning with index 2.
Building2[?]
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
In your trigger which adds the lightning do this:
  • set integer_variable = integer_variable + 1
  • set lightning_effect[integer_variable] = last created variable
  • set building1[integer_variable] = ...
Now you should also do this:
  • Events - A unit dies
  • Condtition - Unit type equal to structure equal to true
  • Actions
    • - For each integer A from 1 to integer_variable do actions
      • - If any condition is true
        • - Triggering unit equal to building1[integer A]
        • - Triggering unit equal to building2[integer A]
      • - Then
        • - DestroyLightning[integer_variable]
Easy as cake, though i am not sure for DestroyLightning function, is the function named like that.
 
Status
Not open for further replies.
Top