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

Spell: Portal

Status
Not open for further replies.
Level 22
Joined
Feb 3, 2009
Messages
3,292
Hello, I'm not sure on how I would create a spell like this:

Caster target's a point, then it creates a portal 250 distance away from caster infront of him and 1 at target point of ability casted, and then it should set way gate ability to eachother, so each of them teleports units to the other one. The portals last 15 seconds.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Erm simple... Unit starts the effect of an ability, Set CastingPoint = point of ability being cast, Set Portal1 = position of unit with offset 250 and polar offset (facing angle of (Triggering unit)), Create 1 portal at casting point, Create 1 portal at Portal1, set both portals to a variable, and the custom script for removing point leaks. Trigger 2 = Unit comes within range of portal1, Move unit to portal2
 
Yea, that's what I meant with Portal, I'll edit waygate :)

But I hope someone will do this, as I need it MUI, and I'm not capable of making it MUI myself.

well, you cannot set the waygate as a target but you can set the waygate's position to be the target...


  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • Ability being cast is equal to Portal
  • Actions
    • Set Point1 = TargetPointOfAbilityBeingCast
    • Set Point2 = PositionOfTriggeringUnit
    • Set Point3 = Point2 offset by 250 towards Angle From Point1 to Point2
    • Unit - Create 1 waygate for OwnerOfTriggeringUnit at Point1 facing
    • Neutral Building - Enable Last Created Unit
    • Neutral Building - Set Last Created Unit Destination to Point 3
    • Unit - Add a X second Generic expiration timer to Last Created Unit
    • Unit - Create 1 waygate for OwnerOfTriggeringUnit at Point3 facing
    • Neutral Building - Enable Last Created Unit
    • Neutral Building - Set Last Created Unit Destination to Point 1
      • Unit - Add a X second Generic expiration timer to Last Created Unit
    • Custom Script: call RemoveLocation(Point1)
    • Custom Script: call RemoveLocation(Point2)
    • Custom Script: call RemoveLocation(Point3)
I'm not sure if this will work okay since I'm not sure if LifeTimers affect buildings and I'm not sure if waygates can still transfer you to the point after I called RemoveLocation... If it will not teleport you or will not get destroyed after a set time, you can use a hashtable to save the locations and also a counter of how many seconds the portal still has and use a periodic looping trigger...
 
It's very easy with the waygate ability. The following is totally MUI:
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dark Portal
    • Actions
      • Set P_Points[1] = (Position of (Triggering unit))
      • Set P_Points[2] = (Target point of ability being cast)
      • Set P_Points[3] = (P_Points[1] offset by 250.00 towards (Angle from P_Points[1] to P_Points[2]) degrees)
      • Unit - Create 1 Portal for Neutral Passive at P_Points[2] facing (Angle from P_Points[2] to P_Points[1]) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to (Owner of (Triggering unit))
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to P_Points[1]
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Portal for Neutral Passive at P_Points[3] facing (Angle from P_Points[1] to P_Points[2]) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to (Owner of (Triggering unit))
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to P_Points[2]
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_P_Points[1])
      • Custom script: call RemoveLocation (udg_P_Points[2])
      • Custom script: call RemoveLocation (udg_P_Points[3])
In case you want a different effect, you will need hashtable.


Edit: Ooops, sorry, I had this page opened for an hour now and didn't see the new replies!
 
It's very easy with the waygate ability. The following is totally MUI:
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dark Portal
    • Actions
      • Set P_Points[1] = (Position of (Triggering unit))
      • Set P_Points[2] = (Target point of ability being cast)
      • Set P_Points[3] = (P_Points[1] offset by 250.00 towards (Angle from P_Points[1] to P_Points[2]) degrees)
      • Unit - Create 1 Portal for Neutral Passive at P_Points[2] facing (Angle from P_Points[2] to P_Points[1]) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to (Owner of (Triggering unit))
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to P_Points[1]
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Portal for Neutral Passive at P_Points[3] facing (Angle from P_Points[1] to P_Points[2]) degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Grant shared vision of (Last created unit) to (Owner of (Triggering unit))
      • Unit - Add Waygate ability to (Last created unit)
      • Neutral Building - Set (Last created unit) destination to P_Points[2]
      • Neutral Building - Enable (Last created unit)
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_P_Points[1])
      • Custom script: call RemoveLocation (udg_P_Points[2])
      • Custom script: call RemoveLocation (udg_P_Points[3])
In case you want a different effect, you will need hashtable.


Edit: Ooops, sorry, I had this page opened for an hour now and didn't see the new replies!

yeah, the same trigger... ^^
 
Here's some jass natives, which might get handy.

JASS:
native WaygateGetDestinationX       takes unit waygate returns real
native WaygateGetDestinationY       takes unit waygate returns real
native WaygateSetDestination        takes unit waygate, real x, real y returns nothing
native WaygateActivate              takes unit waygate, boolean activate returns nothing
native WaygateIsActive              takes unit waygate returns boolean

Examble:
Help: Insert the function to map script, it helps a lot. If you use full jass, then just add it there.

Function
JASS:
function SetupPortal takes unit port1, unit port2, boolean cake returns nothing

  local real x
  local real y

  // AbilityAdd

  if cake == true then

    call UnitAddAbility( port1, 'Awrp' )
    call UnitAddAbility( port2, 'Awrp' )

  elseif cake == false then

    call UnitRemoveAbility( port1, 'Awrp' )
    call UnitRemoveAbility( port2, 'Awrp' )

  endif
  
  // For WP 1
  
  set x = GetUnitX( port2 )
  set y = GetUnitY( port2 )
  call WaygateSetDestination( port1, x, y )
  call WaygateActivate( port1, cake )
    
  // For WP 1
  
  set x = GetUnitX( port1 )
  set y = GetUnitY( port1 )
  call WaygateSetDestination( port2, x, y )
  call WaygateActivate( port2, cake )

endfunction
The Call
JASS:
// Enable
call SetupPortal( mywp1, mywp2, true )
// Disable
call SetupPortal( mywp1, mywp2, false )


I hope this was helpful. :)

OnEdit: Spelling fixes
OnEdit2: Added AddAbility
 
Last edited:
Status
Not open for further replies.
Top