• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Shared Portal Scroll

Status
Not open for further replies.
Level 18
Joined
Jul 3, 2010
Messages
536
SummaryMake it so that a Scroll of Town Portal used by a player will teleport not only that player's units, but its allies as well.

I already made up my mind about this, so I will update my Sentinel maps to contain this change and any further release will have it as well.
However, I'm also suggesting to The-Spoon that he updates his maps.

This change can actually be done very quickly: For once, Blizzard's events and even position handling are not all over the place, this allows for this quick and simple method:
  • Portal Scroll CAST
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Item Town Portal
    • Actions
      • Set TempPoint[1] = (Position of (Casting unit))
      • Set TempGroup[1] = (Units within 1100.00 of TempPoint[1])
      • Unit Group - Pick every unit in TempGroup[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
              • (Owner of (Picked unit)) Not equal to (Owner of (Casting unit))
              • ((Picked unit) belongs to an ally of (Owner of (Casting unit))) Equal to True
            • Then - Actions
              • Set TempPoint[2] = (Position of (Picked unit))
              • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
              • Custom script: call RemoveLocation(udg_TempPoint[2])
              • Set TempPoint[2] = (Target point of ability being cast)
              • Unit - Move (Picked unit) instantly to TempPoint[2]
              • Custom script: call RemoveLocation(udg_TempPoint[2])
              • Set TempPoint[2] = (Position of (Picked unit))
              • Special Effect - Create a special effect at TempPoint[2] using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
              • Custom script: call RemoveLocation(udg_TempPoint[2])
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint[1])
      • Custom script: call DestroyGroup(udg_TempGroup[1])
Short explanation: Position of casting unit actually picks the position from which the caster teleports, this allows one to pick the unit's around that point. Target point of ability being cast is where you targeted the Town Portal, but it teleports you there anyway. (Unless it's not pathable, then it teleports you to the nearest pathable point.) We simply pick all units around casting unit, move them to target point of cast, the move trigger also moves units from not pathable points to nearest pathable ones. Creating an effect at the position of the picked unit before and after the move unit line will make it look like the Scroll moved them. That's pretty much it.
There are still two minor things I'm working on:
  • If you target inside a structure, sometimes the place where the caster and his units are teleported slightly differ from the point where the move trigger moves its ally's units. For example, if you target exactly onto a Castle, all of the caster's units are ported to the bottom-right corner of the Castle, while allied units are ported directly in front of it.
  • Town Portal will only teleport the caster's workers if they are idle but will teleport allied workers every time.
I will update this thread if I come up with a solution to one of these.
 
Status
Not open for further replies.
Top