vp_teleport_avatar

From Virtual Paradise Wiki
Jump to navigation Jump to search
Method call snippet vp_teleport_avatar(instance, target_session, world, x, y, z, yaw, pitch);

Request that another avatar teleports to a new location.

Parameters

These are the parameters that this method requires:

Parameter Usage
VPInstance
instance
Pointer to the instance this method call is intended for
int
avatar_session
Session ID of the avatar to teleport
string
world
Destination world, empty string to teleport avatar in current world
float
x
X position
float
y
Y position
float
z
Z position
float
yaw
yaw angle
float
pitch
pitch angle

Returns

This method returns a return code integer, which indicates whether the call was successful or errored for any reason:

Return code Cause
VP_RC_SUCCESS Successful call (for methods that have a registered callback, it only means the request has been sent)
VP_RC_NOT_IN_WORLD Bot is not currently in a world

Behavior

Examples

void handle_chat(VPInstance sdk)
{
  const char *str;

  str = vp_string(sdk, VP_CHAT_MESSAGE);

  if (stricmp(str, "/home") == 0) // Request for teleport to center of world
    vp_teleport_avatar(sdk, vp_int(sdk, VP_AVATAR_SESSION), "", 0, 0, 0, 0, 0);
}

int main(int argc, const char* argv[])
{
  //...

  vp_event_set(sdk, VP_EVENT_CHAT, handle_chat);

  //...
}

See also