UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Mapping => Topic started by: Koan on July 14, 2016, 12:12:54 am

Title: Adding projectiles to a map, using vehicles
Post by: Koan on July 14, 2016, 12:12:54 am
Apologies for the poor quality gif, couldn't get ShadowPlay to work:
(http://i.gyazo.com/b3aa91df5d7b83b9a68c437967c9cd74.gif)



Credit to codmoddd1234 who sent me the bulk of this stuff, I adapted it into a tutorial with his permission.


Step 1

Right click in Radiant, go to script > vehicle. Give it the following key-value pairs:
Code Snippet
Plaintext
 targetname | veh_projectile
vehicletype | rubber_raft
      model | <any_xmodel>
You can use any xmodel. The rubber_raft vehicletype allegedly makes better curves, according to codmoddd.



Step 2

Right click in Radiant, go to info > vehicle > node_rotate. The node_rotate means the vehicle will follow a curve; if you want straight lines, select node instead of node_rotate, you can also use combinations of both.
Deselect everything. Select the vehicle, then the node_rotate, then press W to connect them.

(http://image.prntscr.com/image/fd8501786d044bbcb6228a3ddf0ebcf7.png)

Give it the following key-value pairs:
Code Snippet
Plaintext
spawnflags | 1
     speed | 80
 lookahead | .5
Play around with the speed and lookahead settings later as you wish.



Step 3

Place another node_rotate or node (or copy previous one, but if you copy it remember to remove spawnflags KVP from new nodes). Deselect everything, select the first node, then the new node, press W to connect.

Repeat this step until you have the path you want. As you place new nodes, you will see a red curve appear between the first and last nodes (select any node to see it). This is the path the vehicle will follow.

(http://image.prntscr.com/image/ea72318a05a247009f2866adc237a4f4.png)



Step 4

Make a new script, call it setupvehicles.gsc, with this code:
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_vehicle;
#include maps\_anim;
#using_animtree("generic_human");

setupvehicles_preload()
{
build_acustom_vehicle( "rubber_raft" );
}

build_acustom_vehicle( type )
{
model = undefined;
death_model = undefined;
death_fx = "explosions/large_vehicle_explosion";
death_sound = "explo_metal_rand";
health = 1234;
min_health = 1233;
max_health = 1235;
team = "axis";
turretType = undefined;
turretModel = undefined;
func = ::blankpointerfunction;  //vehicle.gsc needs this for nothing

if( type == "rubber_raft" )
{
model = "makin_raft_rubber";  //boat steers different than jeep
death_fx = undefined;
death_model = "makin_raft_rubber";
health = 1234;
min_health = 1233;
max_health = 1235;
team = "allies";
func = ::blankpointerfunction; //vehicle.gsc needs this for nothing
}

maps\_vehicle::build_template( type, model );
maps\_vehicle::build_life( health, min_health, max_health );
maps\_vehicle::build_treadfx();
maps\_vehicle::build_team( team );
maps\_vehicle::build_localinit( func ); 
}

blankpointerfunction()
{
}

With regards to the above script...
I don't actually know how much of this is needed, but just to be on the safe side I've included everything codmoddd included.

In your mapname.gsc, BEFORE the line maps\_zombiemode::main();, add:
Code Snippet
Plaintext
maps\setupvehicles::setupvehicles_preload();



Step 5

Add this function at the bottom of your mapname.gsc:
Code Snippet
Plaintext
launch_boat()
{
veh = getent("veh_projectile", "targetname");

if(!isDefined(veh))
return;

start_vehnode = getvehiclenode( veh.target, "targetname" );  //first nodes in path

while(1)
{
veh attachPath( start_vehnode );
veh StartPath();
veh waittill("reached_end_node");
}
}

IMPORTANT:
While testing this I had launch_boat() set to start whenever I press P, by using BluntStuffy's tutorial here (http://ugx-mods.com/forum/index.php/topic,8125.0.html). When including it in a map properly, you will need to either: add a line such as thread launch_boat(); after zombiemode::main() is called, or add a function that wait for a trigger then remove the while loop, or waits for some other event... you get the idea - this is a basic function for you to modify, not a drag-and-drop feature.



Step 6

Add this to your mapname_patch.csv:
Code Snippet
Plaintext
rawfile,vehicles/rubber_raft



Step 7

Compile, build mod after ticking new things (e.g. script), run game.



Please reply/let me know of any issues.
Title: Re: Adding projectiles to a map, using vehicles
Post by: NateTheGreat987 on July 15, 2016, 08:13:57 pm
Sweeeet!!!
Title: Re: Adding projectiles to a map, using vehicles
Post by: IamTIMMEHHH on October 10, 2016, 06:44:52 pm
nice!