UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

teleport script help

broken avatar :(
Created 7 years ago
by Foelex
0 Members and 1 Guest are viewing this topic.
2,445 views
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 22 March 2016
Last active: 6 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Foelex's Groups
Foelex's Contact & Social Links
I want to make a script where you have to shoot something and then eleport to the next room.
Any help? :) :D

This is what i have so far...


Code Snippet
Plaintext
 function init()
{
    level.buttonNeeded = 1;
    level.buttonFound = 0;
 
    level thread button();
}
 
function button()
{
    model_teleport_1 = GetEnt("teleport_model_1", "targetname");
    trig_1 = GetEnt("button_1", "targetname");
    model_1 = GetEnt("button_model_1", "targetname");
 
    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_1 waittill("trigger", player);
 
        level.buttonFound++;
 
        IPrintLn("Button found!"); // Not Needed
 
        thread button_found(player);
 
        break;
    }
 
    //trig_1 Delete();
    //model_1 Delete();
}
 
function button_found(player)
{
    while(1)
    {
        self waittill(level.buttonFound >= level.buttonNeeded);
 
        if(level.buttonFound == level.buttonNeeded)
        {
            self MoveTo("teleport_model_1", .5, .05, .05);
            IPrintLn("round2");
            player_fudge_moveto( teleport_model_1 );
        }
 
        break;
    }
}
Last Edit: December 04, 2016, 01:30:30 am by Dust
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
From now on please use the code tags when adding code to a post. That way the post won't look messy, and it is easier to read.
Marked as best answer by Foelex 7 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 1 year ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
Signature
Completed maps:
Kingdom Hearts - World at War Link
Minecraft - Black ops 3 Link

WIP:
~

×
shinged's Groups
shinged's Contact & Social LinksShingedvinny545TheShingedMatarra_
I want to make a script where you have to shoot something and then eleport to the next room.
Any help? :) :D

This is what i have so far...


Code Snippet
Plaintext
 function init()
{
    level.buttonNeeded = 1;
    level.buttonFound = 0;
 
    level thread button();
}
 
function button()
{
    model_teleport_1 = GetEnt("teleport_model_1", "targetname");
    trig_1 = GetEnt("button_1", "targetname");
    model_1 = GetEnt("button_model_1", "targetname");
 
    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_1 waittill("trigger", player);
 
        level.buttonFound++;
 
        IPrintLn("Button found!"); // Not Needed
 
        thread button_found(player);
 
        break;
    }
 
    //trig_1 Delete();
    //model_1 Delete();
}
 
function button_found(player)
{
    while(1)
    {
        self waittill(level.buttonFound >= level.buttonNeeded);
 
        if(level.buttonFound == level.buttonNeeded)
        {
            self MoveTo("teleport_model_1", .5, .05, .05);
            IPrintLn("round2");
            player_fudge_moveto( teleport_model_1 );
        }
 
        break;
    }
}

Okay so quite a few problems here.
1. you dont need a while loop if your using waittill
2. self MoveTo("teleport_model_1", .5, .05, .05); your trying to move the player to something thats not defined in that function. Also you would just move the player to model_1 as thats what you defined it as.

Code Snippet
Plaintext
function button()
{
    model_teleport_1 = GetEnt("teleport_model_1", "targetname");
    trig_1 = GetEnt("button_1", "targetname");
    model_1 = GetEnt("button_model_1", "targetname");
    trig_1 SetHintString("");
    trig_1 SetCursorHint("HINT_NOICON");
    trig_1 waittill("trigger", player);
    IPrintLn("Button found!"); // Not Needed

    //level.buttonFound++; ?

    player SetOrigin( model_teleport_1.origin );
    PrintLn("round2");
    //player_fudge_moveto( teleport_model_1 );
}
That should maybe do what you want it to do

 
Loading ...