[SOLVED] How do I make more than one teleporter?

With like a ton of teleporters

I have to close this topic if you don’t ask a clear question. Try to describe as well as possible what your goal is and what problems you encounter.

No, Don’t Close it.
i have 1 teleport and teleport Point, is it possible to make a second and third, and what code do i change, I’ve been trying but i couldn’t figure it out

Use the pencil icon to edit your first post of this topic to get a valid question. Also tell us what you have tried and what problem you encountered.

i have tried to change some of the Names, for the teleport, but then when i did it i didnt teleport

Did you change the names in the script and also in the scene? Be aware that you not overwrite the original script.

ok

so did i do this right?

var Teleport = pc.createScript('teleport2');

// initialize code called once per entity
Teleport.prototype.initialize = function () {
    this.entity.collision.on('collisionstart', this.onCollisionStart, this);

    this.teleportPoint = this.app.root.findByName('TeleportPoint2');
};

Teleport.prototype.onCollisionStart = function (result) {
    if (result.other.rigidbody) {
        result.other.rigidbody.teleport(this.teleportPoint.getPosition());
    }
};

Yes, almost. I would also change the “Teleport” variable at the beginning of each function to “Teleport2”.

This?

var Teleport = pc.createScript('teleport2');

// initialize code called once per entity
Teleport2.prototype.initialize = function () {
    this.entity.collision.on('collisionstart', this.onCollisionStart, this);

    this.teleportPoint = this.app.root.findByName('TeleportPoint2');
};

Teleport2.prototype.onCollisionStart = function (result) {
    if (result.other.rigidbody) {
        result.other.rigidbody.teleport(this.teleportPoint.getPosition());
    }
};

Yes and also the one in the first line. You probably also need to change the script name itself to prevent you go to use the wrong script. And I’m not sure, but I think you need to parse the script when you are done.

image

ok i did the one on the first line, and i changed it to Teleport2
and what is Parse Script

The button that is red on the image above. If you already have the script added to an entity I advice to remove it and add the script again.

For the next time it’s better to create a new script with the name “Teleport3” first and after that paste the code that you have in the script and replace every 2 for a 3.

if i have Teleport2 added to an entity, you advise to take it off and re-add it?
also it not working, is shows no errors
but i didnt do the parse thing

i press Parse, and it turned dark, then white again

Thats enough.

Now check everything again and compare it with your first teleporter to get it working.

the teleporter wasnt working but when i stood on it and shot, it was like a shockwave from fortnite

its not working, can the Teleport point be 80 long, 0.5 flat, and 10 wide?

Yes, but make sure that you also change the size of the collision component.

yes, 5,2.5,and40

1 Like