1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. The results are out! Check them out.
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Connected Units

Discussion in 'Triggers & Scripts' started by Saishy, Feb 2, 2009.

  1. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    I'm doing a spell that needs to have a set of positioned traps, but I want do when you destroy one trap, all the other are destroyed as well. And you can put as many set (One set is 5 traps) you want, and need to be MUI.

    But I can't think a way to know which traps are of the same set :(
    Also, I forgot the ability that creates a line of light between units, someone remember?

    Thanks in advance ^^
     
  2. Ciebron

    Ciebron

    Joined:
    Apr 6, 2008
    Messages:
    760
    Resources:
    2
    Spells:
    2
    Resources:
    2
    save them in a unit array then loop it to destroy them

    Code (vJASS):
    loop
        exitwhen i >= Dat.TotalTraps
        //damaging stuff
        call KillUnit(Dat.Trap[i])
        set i = i + 1
    endloop
     
  3. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    *sob*

    I think you didn't understand. I have a spell that summon 5 traps. Those traps make a circular shape, when someone enter inside they explode, they are also invisible.

    But, if someone buy a gem they can destroy one trap, so the other 4 become useless, I wanna destroy them since they will do nothing.

    How to detect if one trap was destroy, so I can destroy the other? (MUI please)
     
  4. Soga-

    Soga-

    Joined:
    Jul 20, 2008
    Messages:
    374
    Resources:
    0
    Resources:
    0
    Needs more info:

    Does the spell drop all traps within a set at once, or as long as you've got 4 or fewer traps, the new trap created belongs to that set?
     
  5. peq

    peq

    Joined:
    May 13, 2007
    Messages:
    171
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Just attach the struct which includes the other traps to every trap and then use Ciebrons code if a trap dies (generic unit event).
     
  6. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    All traps are created at the same time.

    Edit: I'm using a global group array with a integer index, setting all the traps to the same custom value to match the group index... If anyone have a better idea, call me xD
     
    Last edited: Feb 2, 2009