Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

makar5000

help
Need some help with teleportations in oneat function

7 posts in this topic

Hey everyone! I'm trying to add new prefab. When you eat it, you'll be teleported to pig king, for example. But I realy dont know how to make it. Any ideas? I appreciate all of your replies! Thanks for trying to help!:) 

Share this post


Link to post
Share on other sites

Maybe you can see how the teleportation of the staff works, since it teleport you in a telelocator focus if one is activated.

Share this post


Link to post
Share on other sites

Well there's a console command " c_gonext("pigking") " maybe you can make it run that command oneat function somehow...maybe!

Share this post


Link to post
Share on other sites
7 hours ago, SuperDavid said:

Well there's a console command " c_gonext("pigking") " maybe you can make it run that command oneat function somehow...maybe!

Nope, not working. I've added this:

local dest = ("pigking")
if dest ~= nil then
        if eater ~= nil then
            if eater.Physics ~= nil then
                eater.Physics:Teleport(dest.Transform:GetWorldPosition())
            else
                eater.Transform:SetPosition(dest.Transform:GetWorldPosition())
            end
            SuUsed("c_goto", true)
            return dest
        end
    end

And it crashed with 

[00:00:47]: [string "../mods/foxy's mod 0.2/scripts/prefabs/hum_..."]:254: attempt to index field 'Transform' (a nil value)

 

Share this post


Link to post
Share on other sites
On 2/13/2017 at 2:04 AM, HabdomeRaider said:

local dest = c_find("pigking")

 

Only problem I can see with using a console command is if the character being played is not the host. This is just off the top of my head though, I haven't tested this theory.

Edit: You should just be able to use FindEntity to get the Pig King's coordinates.

Share this post


Link to post
Share on other sites