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

models moving

broken avatar :(
Created 12 years ago
by pashan
0 Members and 1 Guest are viewing this topic.
4,445 views
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
Signature
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
how do i make a model move to a certain location when i go to a certain point?

Is that even possible to do?

- pashan
Marked as best answer by pashan 12 years ago
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
If you want to be exact with how far the model should go then don't use the movez, x or the y functions.
Use the function called "moveto"

Here is a simple small script for you. Note this is untested
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

move_script()
{
time = 5;//           Change this to how fast the model should move in seconds.
moving_model = getentarray ("moving_model", "targetname");
move_trigger = getent ("move_trigger", "targetname");
destination_point = getent ("destination_point", "targetname");

for( i = 0; i < moving_model.size; i++ )
{
                 move_trigger waittill ("trigger");
                 move_trigger delete();
                 moving_model[i] moveto (destination_point.origin, time);
                 }
}
In radiant, right click in the 2d view and go to "script" then "origin" and then a small red box should pop up. Press N to get to the entity window and give it this KVP.

targetname
destination_point

And place the red box to wherever you want the model to move to.

2. With go to a certain point, I assume that you mean that you will touch something that makes the model to start moving. So right click in the 2d view again and go to "trigger" then click "multiple" and bring up the entity wondow again and give it this KVP,

targetname
move_trigger

and place that trigger to wherever you want the player to touch that makes the model to start moving.

3. Now for the model that you want to move, right click in the 2d view and go to "script" then click "model" and choose your model that you want to move. After you have found your model, give it this KVP,

targetname
moving_model

Done!

Also, if you want, you can also look at the script so you can see and learn how it works ;).

Tell me if anything goes wrong and I will try to help.
Last Edit: April 06, 2014, 06:31:55 pm by Ege115
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
where do i place the script to?
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
If you want to be exact with how far the model should go then don't use the movez, x or the y functions.
Use the function called "moveto"

Here is a simple small script for you. Note this is untested
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

move_script()
{
time = 5;//           Change this to how fast the model should move in seconds.
moving_model = getent ("moving_model", "targetname");
move_trigger = getent ("move_trigger", "targetname");
destination_point = getent ("destination_point", "targetname");

Player = Get_Players();
for( i = 0; i < player.size; i++ )
{
                 move_trigger waittill ("trigger", player);
                 move_trigger delete();
                 moving_model moveto (destination_point.origin, time);
}
}
In radiant, right click in the 2d view and go to "script" then "struct" and then a small red box should pop up. Press N to get to the entity window and give it this KVP.

targetname
destination_point

And place the red box to wherever you want the model to move to.

2. With go to a certain point, I assume that you mean that you will touch something that makes the model to start moving. So right click in the 2d view again and go to "trigger" then click "multiple" and bring up the entity wondow again and give it this KVP,

targetname
move_trigger

and place that trigger to wherever you want the player to touch that makes the model to start moving.

3. Now for the model that you want to move, right click in the 2d view and go to "script" then click "model" and choose your model that you want to move. After you have found your model, give it this KVP,

targetname
moving_model

Done!

Also, if you want, you can also look at the script so you can see and learn how it works ;).

Tell me if anything goes wrong and I will try to help.
edge im not sure but i think you need getStruct("ent","targetname"); to aquiare an struct
also the for loop you're running on the players should be running over the moving model only if you get it like this
Code Snippet
Plaintext
moving_models = getentarray("moving_model", "targetname");
:P
Last Edit: March 17, 2014, 04:40:47 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
edge im not sure but i think you need getStruct("ent","targetname"); to aquiare an struct
also the for loop you're running on the players should be running over the moving model only if you get it like this
Code Snippet
Plaintext
moving_models = getentarray("moving_model", "targetname");
:P

I have used getent in that kind of script many times and it works perfect with the struct, and it works perfect for me.

Oh thank you JJbradman, the loop for the players was a very stupid mistake, I don't know what I was thinking about, but thanks for paying attention for that!  :)

Script updated.

Also, to implimet the script follow these steps.

Go to root/raw/maps/ and copy any .gsc file and paste it to your desktop.

Then open that file and delete the script inside it. And then paste the script I gave you and paste it in that file.

Save and close and rename the .gsc file to let's say
Code Snippet
Plaintext
moving_object

Then copy and paste that file into root/raw/mods/MAPNAME/maps/

After you have done that, open your MAPNAME.gsc and search hold CTRL and press F and search for,
Code Snippet
Plaintext
maps\_zombiemode::main();
After you have found that line, then paste this line,
Code Snippet
Plaintext
thread maps\moving_object::move_script();
right under the maps\_zombiemode line.

Done!
Last Edit: March 17, 2014, 04:47:58 pm by Ege115
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
I have used getent in that kind of script many times and it works perfect with the struct, and it works perfect for me.

Oh thank you JJbradman, the loop for the players was a very stupid mistake, I don't know what I was thinking about, but thanks for paying attention for that!  :)

Script updated.

Also, to implimet the script follow these steps.

Go to root/raw/maps/ and copy any .gsc file and paste it to your desktop.

Then open that file and delete the script inside it. And then paste the script I gave you and paste it in that file.

Save and close and rename the .gsc file to let's say
Code Snippet
Plaintext
moving_object

Then copy and paste that file into root/raw/mods/MAPNAME/maps/

After you have done that, open your MAPNAME.gsc and search hold CTRL and press F and search for,
Code Snippet
Plaintext
maps\_zombiemode::main();
After you have found that line, then paste this line,
Code Snippet
Plaintext
thread maps\moving_object::move_script();
right under the maps\_zombiemode line.

Done!
no problem :) btw you missed the
Code Snippet
Plaintext
[i]
in the last line
Code Snippet
Plaintext
moving_model[i] moveto (destination_point.origin, time);
everything else seems to be fine
Last Edit: March 17, 2014, 06:00:48 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
no problem :) btw you missed the in the last line
moving_model moveto (destination_point.origin, time);
everything else seems to be fine

God, how many mistakes do I make, I should test the script before I give them to people  XD.

Anyway, the script is now re-updated, and if JJbradman is saying that it looks fine, then the script should work just fine  :).
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
sorry forgot to add code boxes xD stahp it you (/u\)
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Don't worry, when I was going to reply to you, it said in the quate that you typed those letters  ;).
Last Edit: March 17, 2014, 06:06:46 pm by Ege115
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
cool  8) hey man you wanna play titan? :D if so go to the chat to talk
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Sorry for asking this but i am kind of confused (because i am a noob at mapping/scripting how is the final updated script suppose to look like?

Thank  you
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
I updated the script in the first first post so use the script I posted  ;).

 
Loading ...