HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Arrival Path question  (Read 2818 times)

LuisTorralva

  • General Accounts
  • *
  • Posts: 15
    • View Profile
[Resolved] Arrival Path question
« on: Jun 27, 11, 04:05:35 AM »

been learning on the path system and had a comment for arrival path.

first,   i dont think this is s bug, but i noticed that every  time i do a change to arrival path position, the changes wont be effective until you shut down the current play instance and create a new one so changes in arrival path take place, otherwise it wont,   you may see the current changes only in edit mode, tho.

anyways, this was not my question for this thread, just a comment if this was initially designed like that.

my actual question is how do i set arrival path rotation to face certain direction after player arrives to the area??

I tried rotating the arrival path gizmo to face the direction i want but when player arrives it always arrives at rotation 0,0,0

thanks in advanced.

« Last Edit: Oct 26, 12, 05:03:38 PM by HE-Cooper »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Arrival Path question
« Reply #1 on: Jun 27, 11, 06:35:20 PM »

We did something like that.

The $ACCOUNT system node (server) by default has the E_Account class glommed onto it.  Either use that class and script, or your own class if you wish.  In it, you'll find the function DoPosition().  You'll see towards the end, it calls GetPositionOnPath().  It finds the appropriate waypoint and returns the position, and it is only that position that is used for the player.  That is why changing waypoint rotation does nothing.

So, you could change that function to instead take two Vector3's by reference and return both the position and rotation of the waypoint in those arguments.  Then use both of those in the account._TeleportPlayer() call and the player will match the position and rotation set in edit mode.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

dagobah

  • General Accounts
  • *
  • Posts: 5
    • View Profile
Re: [Resolved] Arrival Path question
« Reply #2 on: Jan 02, 21, 05:56:06 PM »

Hi i know this was a post of ten years ago now lol, but may i ask waht the final code to set the rotation of the path is i tried mine but i got no luck  :(


code going to position and rotation:

Code: [Select]
pos as Vector3
  rot as Vector3
  where account
    is kindof _SessionStarting
      if GetAreaNumber() != $CLEANTESTAREA._getCleanTestArea()
        Debug( "LoginProcess", pc.name + " is logging into the game as an existing character.  Using last known position " + vc.character_position + ", and rotation " + vc.character_rotation + "." )
        account._TeleportPlayer( vc.character_position, vc.character_rotation )
      else
        account._TeleportPlayer( pos, rot )
      .
      return
    .
    default
      connection as NodeRef of Class _PlayerConnection = GetPlayerConnectionNode( account )
      where connection
        is kindof _TravelTarget
          targetAccount as NodeRef of Class _PlayerAccount = FindPlayerByName( connection._travelTargetCharacter )
          if targetAccount == None
            goto notarget
          .
          targetPC as NodeRef of Class _PlayerCharacter = targetAccount.GetMyChar()
          RemoveClassFromNode( "_TravelTarget", connection )
          if targetPC != None
            account._TeleportPlayer( targetPC.GetPosition(), targetPC.GetRotation() )
          else
            goto notarget
          .
        .
        default
          label notarget
          path as NodeRef of Class PathNode = PathUtils:GetPathByName( "Arrival" )
          if path != None
            pos = GetPositionOnPath( path )
            rot = GetRotationOnPath( path )
            Debug( "LoginProcess", name + " is moving between areas and I found an Arrival path (" + path + ").  Teleporting to " + pos + "." )
            account._TeleportPlayer( pos, rot )
          else
            Debug ( "LoginProcess", "No Arrival path found or target for " + name + " in area '" + GetAreaName( GetAreaNumber() ) + "', so positioning at origin." )
            account._TeleportPlayer( pos, rot )
          .
        .
      .
    .
  .
.


code to get rotation
Code: [Select]
function GetRotationOnPath( path as NodeRef of Class PathNode ) as Vector3
  if path == None
    return "(0,0,0)"
  .
 
  area as NodeRef of Class _Area = $AREA
  if not ( area is kindof ArrivalPointData )
    GlomClass( "ArrivalPointData", area )
  .
 
  where area is kindof ArrivalPointData
    waypoint as NodeRef of Class PathPointNode = PathUtils:GetNextWaypoint( path, area.lastWaypoint )
    if waypoint != None
      area.lastWaypoint = waypoint
      return waypoint.PathPointRotation
    else
      waypoint = PathUtils:GetFirstWaypoint( path )
      if waypoint != None
        area.lastWaypoint = waypoint
        return waypoint.PathPointRotation
      else
        return "(0,0,0)"
      .
    .
  .
.


help me please!


Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: [Resolved] Arrival Path question
« Reply #3 on: Jan 16, 21, 08:45:35 AM »

We have also set player rotation and position when player moves about, changes area and loaded into new area, as log in or area to area. We set them client side. You can run a check based on the area they enter (which might check for more than 1 player entering same area at same time) or have them load based on a change zone node, which is set up to determine rotation and position, on each node, with a list of values for each player.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Weiveismart

  • General Accounts
  • *
  • Posts: 3
    • View Profile
Re: [Resolved] Arrival Path question
« Reply #4 on: Mar 16, 21, 01:30:16 AM »

You can change the function to get two Vector3 by reference instead
Logged