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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  4. The Lich King has a new champion. The results for the 19th Icon Contest are here!
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. 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.

Keeping Two Units Together Within a Boundry

Discussion in 'World Editor Help Zone' started by Lee_Go, Aug 26, 2009.

  1. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    I'm wondering how I can get my two characters to not be able to leave a certain distance away from each other. I.e. "Bob cant get 500.00 spaces away from Jim without being teleported back to Jim." Help!
     
  2. FlowerofSpeech

    FlowerofSpeech

    Joined:
    May 1, 2009
    Messages:
    215
    Resources:
    0
    Resources:
    0
    Events
    Unit A is within 800 range of Unit B
    Actions
    Move Unit A to position of Unit B offeset by x,y
    Display text "lol you can't separate those doods, guys"

    something like that

    If you want an effect, the easiest way would be to give Unit A a blink ability and have it cast it at the position of B (then removing the ability immediately after), though that could be a potential point of abuse.

    The above should work fine though, if you don't mind the fact there isn't any SFX, just a message telling the player not to do that.

    You could also do it with an aura, if a unit leaves the range of the aura, he's teleported back to the unit.

    ...The messiest way would be to create a rather large region and place it at the position of your hero, make a trigger move the region to the position of Unit B every 0.5-1 seconds, if Unit A leaves that region, teleport him back to the center of the region. That's just an idea though, now that I think of it, something like that wouldn't probably work.
     
  3. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    Thanks man for the aura idea, but the unit A getting to certain range of unit B doesnt work because if A is already inside that range he can leave that range and will only be teleported back to unit B if he leaves the range then comes back into the range. Oh and the region thing also has kind of same problem, idk its screwed also but i'll try aura thing, ty.


    (EDIT) Only event i can find corresponding is unit begins effect of an ability or unit unit notices a target in range, but then again im falling off my seat tired so... not really thinking about it hard.
     
  4. JansiGX

    JansiGX

    Joined:
    Dec 8, 2007
    Messages:
    290
    Resources:
    7
    Maps:
    7
    Resources:
    7
    Here is a simple way
    • Events
      • Time - Every 0.10 seconds of game time
      • Conditions
      • Actions
        • Set point1 = (Position of (Triggering unit))
        • Set point2 = (Position of (Triggering unit))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Distance between point1 and point2) Greater than or equal to 500.00
          • Then - Actions
            • Unit - Move (Triggering unit) instantly to point1
          • Else - Actions
        • Custom script: call RemoveLocation(udg_point1)
        • Custom script: call RemoveLocation(udg_point2)


    condition for if then else can be found in Real Comparison. Look for Math - Distance between points.

    If you don't know what means fixing leaks you can ignore last 2 lines
     
  5. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    Cool, this is what i've been looking for, thank you man.