Jump to content

Need some help with teleportations in oneat function


Recommended Posts

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!:) 

Edited by makar5000
  • Like 1
Link to comment
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)

 

  • Like 1
Link to comment
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.

Edited by RedHairedHero
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...