• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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