Topic: Possible to have a teleport move?

Hey guys,
Is it possible to have a move that the character teleports and appears in some other place of the arena?

Share

Thumbs up Thumbs down

Re: Possible to have a teleport move?

@miladzarrin1: Yes.

Here's mine:

https://youtu.be/-qSNrrtfOPU?t=1644


Here's how I did it.

1)  Animator, I deleted some frames to create the teleport effect

2) I created a move file for teleportation.

3) I that move, I added particle effect in place of the frames that were invible

4) I changed the x-axis in the move's Self Applied Forces section so that I can set the distance of the teleporation disappearence and reappearance. I also had a sound effect to the teleporation as well.

5) In the move's Invincible Frames section, I enabled Completely Invincible and I enabled Ignore Body Colliders.

Share

Thumbs up +2 Thumbs down

Re: Possible to have a teleport move?

@apollo thanks for the detailed explanation.

Is there a way that we can set the teleport to always appear close to the opponent? I want my character to always go right behind the opponent and be able to hit them.

Thank you

Share

Thumbs up Thumbs down

Re: Possible to have a teleport move?

Plus when I add self applied forces my character pushes the other character forward. How did you fix this?

Share

Thumbs up Thumbs down

Re: Possible to have a teleport move?

Use ignore body colliders to ignore collision between characters
https://i.imgur.com/0cQ4u2P.png

This script might help with teleporting, it can be improved.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UFE3D;
using FPLibrary;

public class NewBehaviourScript : MonoBehaviour
{
    [SerializeField]
    private string teleportMoveName = "Teleport";

    [SerializeField]
    private Vector3 teleportPosition;

    private void OnEnable()
    {
        UFE.OnMove += this.OnMove;
    }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {

    }

    private void OnDisable()
    {
        UFE.OnMove -= this.OnMove;
    }

    private void SetPlayerPosition(ControlsScript player, FPVector position, FPVector offset)
    {
        offset.x *= player.mirror;

        player.worldTransform.position = position + offset;
    }

    private void OnMove(MoveInfo move, ControlsScript player)
    {
        if (move == null) return;

        if (move.moveName == teleportMoveName)
        {
            SetPlayerPosition(player, player.opControlsScript.worldTransform.position, FPVector.ToFPVector(teleportPosition));
        }
    }
}

Share

Thumbs up +1 Thumbs down

Re: Possible to have a teleport move?

Thank you for the help guys.
I used those methods, but finally, I added a teleport section to the move window like this:

https://i.ibb.co/88JS8mX/teleport.jpg

it's actually not that hard to implement and works fine. If anyone needed it (and has the source version), just give me a message. I'll be more than happy to help you out.

Share

Thumbs up Thumbs down