Waypoint Casting system

From Staredit Network Wiki
Jump to: navigation, search

As a general note, this requires the use of Inverted Locations.

How to create one in the editor

  1. Place a caster and 2 units (we'll call them respectively 'stable unit' and 'moving unit')
  2. Center a location over the caster permanently and order the 'moving unit' to move to a destination. Once it reaches that destination, make it patrol between it initial position and this point.
  3. Have a trigger detecting if the 'stable unit' has moved. If so, set a switch (which will represent if a player has casted a spell) and give the 'stable unit' to a "disabling" player (p9, p10 or p11). Also move the 'moving unit' over the caster, wait(0) (very important), and then give the 'moving unit' to the same disabling player.
  4. Use an inverted location to detect when the unit has stopped, which would mean the target has been reached.
  5. Do what you wanted to do when the spell would reach it target and then give back the 'stable unit' to the player and move back the 'moving unit' to it's patrolling area (don't forget to give it back to the player too)

Vital informations

It is highly recommended to...

  1. Use an air unit that CAN attack ground and air units as the 'stable unit' (ex: Wraith)
  2. Use an air unit that CANNOT attack the ground units (and the air too if ever you have air units as enemies) (ex: Scourge)
    • If both units cannot attack ground units, you'll receive an error message if you directly click (in-game) on an enemy.
    • If the 'moving unit' can attack the ground units, if you directly click on an enemy, it'll attack in (which means it will also stop before reaching your it ordered target).
  3. Do not give "disabled" units to the neutral player, give them respectively to the players 9, 10 and 11
    • If you do not do this, some triggers may mess up when someone will leave.
  4. Be sure that the 'stable unit' and the 'moving unit' are disposed far enough from each other
    • Else, you will get a screwed order command because when units are too near to each other, they keep their initial formation while moving instead of going to the targeted point, get it?
  5. Make the path of the 'moving unit' unit long enough
    • Casting a spell when the 'moving unit' is reaching the "point B" will cancel the spell
  6. Use the 'move unit' command to teleport the moving unit that has reached the point B to the point A and order it to move from A to B
    • Else, you get a higher chance of failure when you cast it (will be explained into "Glitches" category).
  7. Make in sort that the 'stable unit', once given to a "disabling player" (p9, p10 and p11), won't move (you can simply use a 'move unit' trigger to keep it on place)
    • If you do not do so, a player setting multiple waypoints would make the 'stable unit' move out and it would screw the whole system.
  8. Do not forget to set limits!
    • Else, the player would be able to send their spell into the area where the 'moving unit' and the 'stable unit' are, which would screw it up.

Glitches (need someone to work on those and fix them)

  1. The 'moving unit' is keeping its initial "inertia" (which is to move to the "Point B") when it is casted (for a very short moment). This means that if you cast it to your left, it will kind of spin a round in the air before starting to move to the point, which reduces it effectiveness...
  2. If you cast the spell when the 'moving unit' reaches the point B, the cast will get canceled...

Cons

  1. There is no instant effect (except if you do it so it affects in radius from the hero). The spells can only: move from the caster to their destination and then effect, effect as long as they are casted (aura), affects unit within a certain range (radius) and affect all through its way until it stops.
    • To have an instant effect, you would need to either use FRAGs or a system like the Dark Swarm detection.

How it works in-game

  1. Select both 'moving unit' and 'stable unit' (you may need to use Shift if they are too far from each other)
  2. Hotkey them
  3. Shift+Click anywhere (OR Double-Click)
  4. Enjoy

The concept

The concept is centered on Starcraft's waypoint system. For those of you who don't know, the waypoint system is essentially a "to-do" list for units. When you order a unit while holding shift, it sets destinations/commands for that unit, which performs each in order. An other important information is that when you move a unit or give it to an other player, it only cancels it actual order, keeping the next orders in memory.

With this in mind, it's easy to figure out how the system actually works:

  • The 'stable unit' would simply act as a "cast detection": if it has moved, it's because the player wants to target something/somewhere.
  • The 'moving unit' had to be in movement when you casted because it is that order that gets canceled by Starcraft so when you move it over the caster, it will directly execute the next order, which is the one you've just done.

Thanks to Lethal_Illusion, Kaias and qPirateKing for thinking of this.