Jump to content

Pasta Mike

Member
  • Content Count

    1
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About Pasta Mike

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello fellow scripters and modders! I am trying to make a script that allows the player to perform an action that will teleport them. I only made this far. It seems that SCR_PlayerController.SetPosition is not correct here, but I am not sure how to do it otherwise. Any suggestion? class SCR_Teleport : ScriptedUserAction { // References protected SCR_PlayerController m_PlayerController; protected ref array<vector> m_TargetPositions; //------------------------------------------------------------------------------------ void SCR_Teleport() { m_TargetPositions = new array<vector>; m_TargetPositions.Insert("5145 14.34 4015"); //m_TargetPositions.Insert("X2_Y2_Z2"); // More target positions here } //------------------------------------------------------------------------------------- override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity) { m_PlayerController = SCR_PlayerController.Cast(pUserEntity); if (!m_PlayerController) return; if (m_TargetPositions.Count() == 0) return; int randomIndex = Math.RandomInt(0, m_TargetPositions.Count()); vector targetPosition = m_TargetPositions.Get(randomIndex); m_PlayerController.SetPosition(targetPosition); } //-------------------------------------------------------------------------------------- override bool GetActionNameScript(out string outName) { outName = "Teleport"; return true; } };
×