UGX-Mods

Call of Duty 5: World at War => Help Desk => Modding => Topic started by: CanadianTyler on August 04, 2015, 05:58:38 pm

Title: Make a xmodel move up and down
Post by: CanadianTyler on August 04, 2015, 05:58:38 pm
I need help making a xmodel move up and down. I've made a model in Maya but I'm not sure how to animate it and export it to World At War.

I know how to export a model that's not animated. I'm just not sure how it works in World At War. All I want is for a model to move up and down and repeat that motion. (I'm making a target range :D )

Would I just animated it with keyframes and then export it like that ? Or do I have to use joints and stuff. If anyone knows let me know.
Title: Re: Make a xmodel move up and down
Post by: Lukkie1998 on August 04, 2015, 06:17:20 pm
You could make an animation on the model, binding all the meshes to a joint and animate that joint, or you could just put it in as a script_model, and script it so it moves from left to right.

Code Snippet
Plaintext
while(1) {
    ent moveX(600,1);
    ent waittill("move_done");
    ent moveX(-600,1);
    ent waittill("move_done");
}

This way it will move 600 units on the X-axis and then move 600 units back, which I think is easier than animating it, exporting and scripting the anim, etc.

Lukkie1998
Title: Re: Make a xmodel move up and down
Post by: CanadianTyler on August 04, 2015, 08:38:29 pm
You could make an animation on the model, binding all the meshes to a joint and animate that joint, or you could just put it in as a script_model, and script it so it moves from left to right.

Code Snippet
Plaintext
while(1) {
    ent moveX(600,1);
    ent waittill("move_done");
    ent moveX(-600,1);
    ent waittill("move_done");
}

This way it will move 600 units on the X-axis and then move 600 units back, which I think is easier than animating it, exporting and scripting the anim, etc.

Lukkie1998

Thanks i'll try that out. I'm new to scripting how do I add this script to my model ?
Title: Re: Make a xmodel move up and down
Post by: Lukkie1998 on August 04, 2015, 09:04:33 pm
Thanks i'll try that out. I'm new to scripting how do I add this script to my model ?

Add it to radiant using 2D view > script > script_model, Press N and give it this KvP: targetname - shoot_target .

Then open up your MAPNAME.gsc (usually in root/mods/MODNAME/maps), and add below _zombiemode::main();

Code Snippet
Plaintext
level thread shoot_target_move();

So it looks like (Or something like that):

Code Snippet
Plaintext
////////////////////////////
//// Zombiemode /////////////
////////////////////////////
_zombiemode::main();
level thread shoot_target_move();

Then add this to the bottom of the same file:

Code Snippet
Plaintext
shoot_target_move()
{
model = getEnt("shoot_target","targetname");

while(1) {
model moveX(600,1);
model waittill("move_done");
model moveX(-600,1);
model waittill("move_done");
}
}

Change the 600 and -600 corresponding to the distance you want the models to move, and change the 1 to the time you want the models to move from one side to another.

BTW the script only works for one Target!!!

Lukkie1998
Title: Re: Make a xmodel move up and down
Post by: CanadianTyler on August 04, 2015, 09:10:53 pm
Add it to radiant using 2D view > script > script_model, Press N and give it this KvP: targetname - shoot_target .

Then open up your MAPNAME.gsc (usually in root/mods/MODNAME/maps), and add below _zombiemode::main();

Code Snippet
Plaintext
level thread shoot_target_move();

So it looks like (Or something like that):

Code Snippet
Plaintext
////////////////////////////
//// Zombiemode /////////////
////////////////////////////
_zombiemode::main();
level thread shoot_target_move();

Then add this to the bottom of the same file:

Code Snippet
Plaintext
shoot_target_move()
{
model = getEnt("shoot_target","targetname");

while(1) {
model moveX(600,1);
model waittill("move_done");
model moveX(-600,1);
model waittill("move_done");
}
}

Change the 600 and -600 corresponding to the distance you want the models to move, and change the 1 to the time you want the models to move from one side to another.

BTW the script only works for one Target!!!

Lukkie1998

Thank you very much. I'll try it :)