Post: teleporting models
10-02-2015, 06:30 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); quick question aye

if i have a model spawned in like this:

    modelspawn()
{
level.Ballista = spawn("script_model", (-2400,-7720,250));
level.Ballista.angles = (0,0,0);
level.Ballista setModel("t6_wpn_sniper_ballista_world");
}



how can i make a function so that later on i can change the cordinates of that model, so like
if i press square it teleports the model like under the map for example.

this is an example of how i kinda want it

    if(self UseButtonPressed())
{
level.Ballista setOrigin(0,0,1000);
}


of course i have already tried this above ^ but doesn't work.

it 1000% has to work like this in order for my thing to work

if i can get this to work, then i will be able to release my gamemode by tommorow or
the next day i been working on for weeks Smile
(adsbygoogle = window.adsbygoogle || []).push({});
10-02-2015, 01:00 PM #2
jwm614
NextGenUpdate Elite
Originally posted by OfficialCoolJay View Post
quick question aye

if i have a model spawned in like this:

    modelspawn()
{
level.Ballista = spawn("script_model", (-2400,-7720,250));
level.Ballista.angles = (0,0,0);
level.Ballista setModel("t6_wpn_sniper_ballista_world");
}



how can i make a function so that later on i can change the cordinates of that model, so like
if i press square it teleports the model like under the map for example.

this is an example of how i kinda want it

    if(self UseButtonPressed())
{
level.Ballista setOrigin(0,0,1000);
}


of course i have already tried this above ^ but doesn't work.

it 1000% has to work like this in order for my thing to work

if i can get this to work, then i will be able to release my gamemode by tommorow or
the next day i been working on for weeks Smile


Moveto(origin, time);

The following user thanked jwm614 for this useful post:

OfficialCoolJay
10-02-2015, 01:00 PM #3
-Numb
You talkin to me?
Originally posted by OfficialCoolJay View Post
quick question aye

if i have a model spawned in like this:

    modelspawn()
{
level.Ballista = spawn("script_model", (-2400,-7720,250));
level.Ballista.angles = (0,0,0);
level.Ballista setModel("t6_wpn_sniper_ballista_world");
}



how can i make a function so that later on i can change the cordinates of that model, so like
if i press square it teleports the model like under the map for example.

this is an example of how i kinda want it

    if(self UseButtonPressed())
{
level.Ballista setOrigin(0,0,1000);
}


of course i have already tried this above ^ but doesn't work.

it 1000% has to work like this in order for my thing to work

if i can get this to work, then i will be able to release my gamemode by tommorow or
the next day i been working on for weeks Smile


As far as I know level.Ballista setOrigin(coords); should work just fine.. You sure the calling of the function is right?

Try this to see if it works
    if(self UseButtonPressed())
{
level.Ballista setOrigin(0,0,1000);
self iprintlnbold("^1TEST");
}
10-02-2015, 02:01 PM #4
Originally posted by jwm614 View Post
Moveto(origin, time);


thankyou so much Smile
10-02-2015, 03:28 PM #5
I'm pretty sure the setOrigin function takes one vec3, not 3 different floating points. Try doing this:

    
// declaration, copy and paste anywhere outside of another functions declaration, note it must be declared before its called
newOrigin(x, y, z)
{
self setOrigin((x, y, z));
}
// if statement to be placed in a loop (thread the call)
if(self useButtonPressed())
{
level.Ballista newOrigin(0, 0, 1000);
}


But also, I assume you're spawning a pick-up? If so, make sure to delete the entity after it has moved, its a waste of memory and is spammed can cause the game to crash.

EDIT:
Another thing to note, I can only guess that the button check it preformed only if the client is within a certain distance? You may also want to add some sleep (the wait command) for the thread, because a constant loop running constantly without any delay to catch up could also cause a crash (100% will lag). Just putting things out there for you, PM me if you need anything else.
10-03-2015, 03:19 AM #6
I have spent weeks on end trying to make this function work and the only possible solution is to move the model rather then delete it because when the model deletes, players don't detect the model and more in their self thread which says if you are a certain distance from this model give the gun and delete model, but in doing so it stuffs up and i have spent about a week non stop trying to resolve this doing hundreds of combination and having lots of help from others, so now i just teleport it under the map and it works, not that big of a deal when it comes to memory, if you have seen peoples zombieland mapedits u can see people have over 100+ carepackages without framerate or lag, where as i won't even have that many.

Now i am very close to releasing my gamemode, and it will be source, so anybody can look at this function and try to get it to work with delete() cause i know you will have trouble doing so haha. But if you can i will bow down to you :p
10-03-2015, 03:47 AM #7
itsSorrow
In my man cave
Originally posted by OfficialCoolJay View Post
I have spent weeks on end trying to make this function work and the only possible solution is to move the model rather then delete it because when the model deletes, players don't detect the model and more in their self thread which says if you are a certain distance from this model give the gun and delete model, but in doing so it stuffs up and i have spent about a week non stop trying to resolve this doing hundreds of combination and having lots of help from others, so now i just teleport it under the map and it works, not that big of a deal when it comes to memory, if you have seen peoples zombieland mapedits u can see people have over 100+ carepackages without framerate or lag, where as i won't even have that many.

Now i am very close to releasing my gamemode, and it will be source, so anybody can look at this function and try to get it to work with delete() cause i know you will have trouble doing so haha. But if you can i will bow down to you :p


do the moveto(origin, time) one

The following user thanked itsSorrow for this useful post:

OfficialCoolJay
10-03-2015, 03:56 AM #8
yeah thats what i ended up doing and works Smile
10-03-2015, 03:59 AM #9
itsSorrow
In my man cave
Originally posted by OfficialCoolJay View Post
yeah thats what i ended up doing and works Smile


release ur gamemode! I am eager to see it!
10-03-2015, 06:11 AM #10
Originally posted by OfficialCoolJay View Post
I have spent weeks on end trying to make this function work and the only possible solution is to move the model rather then delete it because when the model deletes, players don't detect the model and more in their self thread which says if you are a certain distance from this model give the gun and delete model, but in doing so it stuffs up and i have spent about a week non stop trying to resolve this doing hundreds of combination and having lots of help from others, so now i just teleport it under the map and it works, not that big of a deal when it comes to memory, if you have seen peoples zombieland mapedits u can see people have over 100+ carepackages without framerate or lag, where as i won't even have that many.

Now i am very close to releasing my gamemode, and it will be source, so anybody can look at this function and try to get it to work with delete() cause i know you will have trouble doing so haha. But if you can i will bow down to you :p


I thought the whole reason you wanted to move it was so the player cannot pick it up a second time? So deleting it makes perfect sense, just spawn the weapon again if they want it again? Also I just thought I'd put it out there, you're spawning an entity with a set model, a model is nothing but a rendered texture.

Just as I was about to finish it came to me, are you writing a zombie land? Because then I see why you'd want the entity to stay, so you can buy ammo and/or other humans can buy the weapon...what I posted should have fixed your issue, but MoveTo is way more practical and more efficient in what you want to do.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo