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

Duel/Temporary teleport like spell thing

Status
Not open for further replies.
Level 3
Joined
Oct 15, 2007
Messages
43
What I have is supposed to take units into a small arena thing for some time then move them back to where it was cast (assuming no one died).

  • Actions
    • Set TempLoc02 = (Position of Caster)
    • Region - Center Closed Space Area <gen> on (Position of ClosedSpaceCaster)
    • Wait 5.00 seconds
    • Unit Group - Pick every unit in (Units in Closed Space Area <gen>) and do (Actions)
      • Loop - Actions
        • Set Target = (Picked unit)
        • Unit - Move Target instantly to (Center of Closed Space 1 <gen>)
    • Wait 5.00 seconds
    • Unit Group - Pick every unit in (Units in Closed Space 1 <gen>) and do (Actions)
      • Loop - Actions
        • Set Target = (Picked unit)
        • Unit - Move Target instantly to (Center of Closed Space Area <gen>)

Currently the trigger is stuck on the first loop, my questions would be how do I break the loop after it is used once, and how would I stop any leaks? (tutorial I read was in jass :hohum: )
 
Level 11
Joined
Dec 11, 2007
Messages
888
  • Actions
    • Set TempLoc02 = (Position of Caster)
    • Region - Center Closed Space Area <gen> on (Position of ClosedSpaceCaster)
    • Wait 5.00 seconds
    • Unit Group - Pick every unit in (Units in Closed Space Area <gen>) and do (Actions)
      • Loop - Actions
        • If/Then/Else
          • Conditions:
            • TempBoolean equal to true
          • Then:
            • Set Target = (Picked unit)
            • Unit - Move Target instantly to (Center of Closed Space 1 <gen>)
            • Set TempBoolean equal to false
    • Wait 5.00 seconds
    • Unit Group - Pick every unit in (Units in Closed Space 1 <gen>) and do (Actions)
      • Loop - Actions
        • Set Target = (Picked unit)
        • Unit - Move Target instantly to (Center of Closed Space Area <gen>)
set default value of TempBoolean to true
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
And for cleaning leaks, you insert this before each Pick every unit line:

  • Custom script: set bj_wantDestroyGroup = true
And you just do this at the end:

  • Custom script: call RemoveLocation(udg_TempLoc02)
You have a leak there:

  • Region - Center Closed Space Area <gen> on (Position of ClosedSpaceCaster)
It should be:

  • Set TempLocBlah = (Position of ClosedSpaceCaster)
  • Region - Center Closed Space Area <gen> on TempLocBlah
And in the end of the code (before or after that previous RemoveLocation line, it doesn't matter):

  • Custom script: call RemoveLocation(udg_TempLocBlah)
 
Level 3
Joined
Oct 15, 2007
Messages
43
Ah thanks, I had thought about using If/then but didn't quite think how to work it.

Edit, New problem working on, the problem being that the event is every .02 seconds checks for trigger (much like knockback that I read) however this creates a problem since the unit is sent back to the same region that sent it out, creating a broken loop. I'll post if I have any more problems.
 
Last edited:
Level 3
Joined
Oct 15, 2007
Messages
43
Ok this works, however the regions don't work, but before I add leak killers in there I still have one problem with it. It seems that the regions do not wish to stay where they were allocated the first time, this wouldn't be a problem if it was, say, a normal duel type thing. However I wanted effected units to return to the original location of casting after a brief duration.

  • Duel Area 1 Closed Space
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set ClosedSpaceLocSave = (Position of ClosedSpaceCaster)
      • Region - Center Closed Space Area <gen> on ClosedSpaceLocSave
      • Region - Center ReturnRegion <gen> on (Center of Closed Space Area <gen>)
      • Wait 5.00 seconds
      • Unit Group - Pick every unit in (Units in Closed Space Area <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempBoolean Equal to True
            • Then - Actions
              • Set Target = (Picked unit)
              • Unit - Move Target instantly to (Center of Closed Space 1 <gen>)
              • Region - Center Closed Space Area <gen> on (Center of DeadRegion <gen>)
              • Set TempBoolean = False
            • Else - Actions
      • Wait 10.00 seconds
      • Unit Group - Pick every unit in (Units in Closed Space 1 <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempBoolean Equal to False
            • Then - Actions
              • Set Target = (Picked unit)
              • Unit - Move Target instantly to (Center of ReturnRegion <gen>)
              • Set TempBoolean = True
            • Else - Actions
      • Trigger - Turn off Duel Area 1 Closed Space <gen>

I try to make another region stack on where the original casting was, then get rid of the old region by moving it elsewhere, but doing this I learned that the regions are constantly following the caster instead of staying at point of casting.

Thus I had interesting things such as portal flickering to stuck unit in a trigger loop.

Also "closed space caster" is a variable from the working trigger. It acts much like "caster" though I didn't want to overlap varibles.

Oh one more thing it seems the thing only effects one character rather than everyone, so I think the region resizes itself somehow... so right now it's all problems with regions, as I recently noticed it only has problems if the caster itself goes into the spell... :hohum:
 
Level 3
Joined
Oct 15, 2007
Messages
43
Ok to better clarify my problem, it is only moving MY units into the duel area thing and not my enemies as well.
 
Level 3
Joined
Oct 15, 2007
Messages
43
Not to be rude or anything but could you explain a little better as to how that would fix my problem? I'm not really sure what it could do to help me, thus not sure where I could put Player Controller thing.

That and Not too good with conditions...
 
Level 24
Joined
May 9, 2007
Messages
3,563
  • Your Trigger
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Owner of (Triggering unit))
            • Then - Actions
              • Do Actions
            • Else - Actions
              • Do nothing
Don't actually use the Do Nothing. Just leave it blank.

Do you get it? Also add "BJ_wantDestroyGroup = true" before everything.
 
Status
Not open for further replies.
Top