1. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  2. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  3. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice

[Trigger] Swap spell randomly doesn't work

Discussion in 'Triggers & Scripts' started by doom_sheep, Feb 24, 2010.

  1. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    738
    Resources:
    0
    Resources:
    0
    • ToG Enter
      • Events
        • Unit - A unit enters (Playable map area)
      • Conditions
        • ((Entering unit) is an illusion) Equal to True
        • (Unit-type of (Entering unit)) Equal to Guy
      • Actions
        • Set ToG[(Player number of (Owner of (Entering unit)))] = (Entering unit)

    • ToG Swap
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to TheOtherGuy
        • (ToG[(Player number of (Owner of (Casting unit)))] is alive) Equal to True
      • Actions
        • Set TempPoint = (Position of (Casting unit))
        • Set TempUnit2 = ToG[(Player number of (Owner of (Casting unit)))]
        • Set TempPoint2 = (Position of TempUnit2)
        • Unit - Turn collision for TempUnit2 Off
        • Unit - Turn collision for (Casting unit) Off
        • Unit - Move TempUnit2 instantly to TempPoint
        • Unit - Move (Casting unit) instantly to TempPoint2
        • Unit - Turn collision for (Casting unit) On
        • Unit - Turn collision for TempUnit2 On


    Illusion is created by mirror image. Switch is based on wind walk.

    in all simpleness, the spell is supposed to switch the unit with his illusion. it sometimes works as intended but most of the time does nothing as the spell is cast.

    its not MUI. it used to be before i remade it in hopes of fixing it but it still doesn't work most of the time.
     
  2. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    From the looks of it there is nothing wrong with it. You should put some debug messages in your code to figure out exactly why the unit is not moving as you intended.
     
  3. skamigo

    skamigo

    Joined:
    May 22, 2009
    Messages:
    265
    Resources:
    4
    Maps:
    4
    Resources:
    4
    you can use triggering unit instead of entering unit but I guess it woudn't change anything

    I'm guessing the ability is instant? You could make it target the illusion and have the condition: Target unit of ability being cast equal to ToG(Number of Owner of (casting/triggering unit)
     
  4. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    877
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    Hmm. As I see it, the spell is instant but the unit creation can be slighty delayed. If so, it would lead to the unit you're looking for to be moved is non-existent.

    Another thing that comes to my mind is that "TheOtherGuy" might be equal to "null". If so the trigger will never fire.

    ++ Since the creation might be delayed the trigger will not fire because the illusion has to enter the map to make the trigger "ToG Swap" fire.


    If you'd give me some mins I could try and fix something up. Might be a bit hard for me to do, have to install Wc3 again then, but I could try and write a vJass or Jass or maybe GUI code real fast in the text.


    ~Dynasti
     
  5. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    First of all, there is no delay.

    Second of all, even if there was delay, it would only cause a problem if he were trying to cast the spell immediately once the illusion is created, which doesn't make any sense since a spell can be cast at any given time during the game.
     
  6. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    877
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    If ToG swap is run before ToG Enter that may be the cause.
     
  7. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    738
    Resources:
    0
    Resources:
    0
    why?
     
  8. Dynasti

    Dynasti

    Joined:
    Oct 18, 2007
    Messages:
    877
    Resources:
    4
    Maps:
    2
    Spells:
    1
    Tutorials:
    1
    Resources:
    4
    because
    • Set ToG[(Player number of (Owner of (Entering unit)))] = (Entering unit)
    needs to be something before ToG swap can work.
     
  9. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    738
    Resources:
    0
    Resources:
    0
    obviously it doesnt work when the illusion doesn't exist.
     
  10. Lambdadelta

    Lambdadelta

    Joined:
    Jul 6, 2009
    Messages:
    730
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Unit - A unit Spawns a summoned unit
    (Summoned unit) <-- Event Response for that.

    Dunno. Play around with this, it works.
     

    Attached Files:

    Last edited: Feb 26, 2010
  11. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    738
    Resources:
    0
    Resources:
    0
    i know. the problem is that it sometimes works and sometimes doesnt, following no pattern. i have low hopes on finding anything that way.
     
  12. doom_sheep

    doom_sheep

    Joined:
    Oct 18, 2008
    Messages:
    738
    Resources:
    0
    Resources:
    0
    wait what.

    i tested your map. first it worked but when i used mirror image again it stopped working.