Truck script


(shagileo) #1

hello guys,

i found some tutorials for making a tank move and all that kinda shioot, so i was thinking of making a truck. i thought it would be the same thing (the script that is), but when i test my map, the only thing that moves are my trucks front wheels and the rest stays at the same spot. i searched all over the internet, including all possible mapping forums, but never I find a solution. Can anyone please give mean example of a simple moving truck script, without redirecting me to ‘take a look at the goldrush script’? bcause that scrip is way to complicated.

i’ll give you guys the script i have so far (maybe for real pro mappers this things could mean the apocalypse for them right now because … i’m not that kinda pro type :D) . If my script is sooooo horrible, then please help me out 8)

good luck and thanks in advance.

! WARNING: HEART ATTACK COULD BE A RESULT AFTER READING THIS SCRIPT ! :

game_manager //this is triggered by the script multiplayer in your map
{
 spawn
 {
  wait 200
 }
}
truck //scriptname of script_mover
 {
 spawn
 {
  wait 300
  
  followspline 0 spl_01 50000 length 32 wait //spawn the tank to here

  trigger self truck_path //goto tank_path
 }

 trigger truck_path
 {
  //here is the commands the mover will follow

  stopsound
  playsound sound/vehicles/truck/truck_move.wav looping volume 512
  //play a tank sound
  followspline 0 spl_01 100 wait length 304
  //this says goto spl_01 at a speed of 100 and don't look at
  //the next command until after waiting 304
  followspline 0 spl_02 100 wait length 304
  followspline 0 spl_03 100 wait length 304
  followspline 0 spl_04 100 wait length 304
  followspline 0 spl_05 100 wait length 304
  followspline 0 spl_06 100 wait length 304
  followspline 0 spl_07 100 wait length 304
  followspline 0 spl_08 100 wait length 304
  followspline 0 spl_09 100 wait length 304
  followspline 0 spl_10 100 wait length 304	
  followspline 0 spl_11 100 wait length 304
  followspline 0 spl_12 100 wait length 304
  followspline 0 spl_13 100 wait length 304
  followspline 0 spl_14 100 wait length 304
  followspline 0 spl_15 100 wait length 304
  followspline 0 spl_16 100 wait length 304
  followspline 0 spl_17 100 wait length 304
  followspline 0 spl_18 100 wait length 304
  followspline 0 spl_19 100 wait length 304
  followspline 0 spl_20 100 wait length 304
  followspline 0 spl_21 100 wait length 304
  followspline 0 spl_22 100 wait length 304
  followspline 0 spl_23 100 wait length 304
  //add more lines for how many more splines u have
  //notice that you don't include scripting for spline controls

  trigger self truck_path
  //repeat tank_path part of the script, remove this line
  //if u don't won't it to loop
 }
}
truck_shell
{
 spawn
 {
  wait 400
  attachtotag truck tag_truck
  //this attaches the tank_shell to the scriptmover tank
 }
}

i took the script from a tutorial for tanks, so maybe that’s why you’re looking like this: :o

grtz


(Flippy) #2

If you think the truck script in goldrush is too complicated, you are probably going to find that the script for your own truck is too complicated aswell… Since they won’t differ so much I guess… The only difference I could think of is the truckbarriers, and imo they are not hard to ‘see’ in the script.

Anyway, I never did a truck before, but you might have to attach the body and all that to the script_mover. I believe a tank is just the one model and the turret, and I remember to have to attach the turret aswell… so it might be similar on the truck.


(shagileo) #3

well about the models you have to attach to the tank you’re totally right, but since i’ve never worked with trucks before either i tried to do that as well, but it didn’t really work.

about the script in grush; i can figure out most of the parts, but i get stuck at the barriers. i don’t need barriers and gold in my truck, i just want it to patrol the area on the looping spline route. My script doesn’t have to contain all that shiot, just the moving part. I just don’t want to delete too much out of the grush script.

Also, big difference between the tank and truck scripts seem to be that the tank only has one track, while with the truck, there are two sets of wheels. How do I insert that correctly into my script and what do I have to type in the module for “scriptname, targetname, model2” …?? I’v already tried using the tank, but that’s just following the tutorials and hence not so difficult. But what about a truck?? :s

thanks btw for a quick reply hehe

:clap:


(S14Y3R) #4

lol@60 line script :smiley: Worry when you get over 10k lines :stuck_out_tongue: Anyway, I assume from your lack of stopcheck that you just want the truck to automatically follow its path at map start, right?

Your “truck” script_mover should have the model2 /path/to/blitz.md3 so a secondary “shell” misc_gamemodel isn’t necessary for the truck.

What is “truck_shell”? Is that your wheels?

for the wheels, all you need are 2x misc_gamemodel’s


truck_whl_b //targetname/scriptname of misc_gamemodel
{
	spawn
	{
		wait 500
		attachtotag truck tag_wback
	}
}

truck_whl_f //targetname/scriptname of misc_gamemodel
{
	spawn
	{
		wait 500
		attachtotag truck tag_wfront
	}
}

If your wheels are the only thing that move, you probably have your model2 set up for the wheels :stuck_out_tongue:

gl.


(DerSaidin) #5

Ok, don’t take a look at goldrush - go and export all the entities, and copy the mapscript, then bring it all into your map.


(shagileo) #6

ok thanks all of you, and special thanks to S14Y3R 8)

i’ll go and try it out asap, and when it works, i’m gonna send you some big ass present for next christmas (when i have enough money to buy it of course :nod: )

allright radiant, here i come … somehow i don’t think it cares :asleep:

grtz and i’ll let you guys know when it works (and if it won’t hehe)


(shagileo) #7

ok thanks all!! it works perfectly !!

so here is my script so others can use it too. it’s a script for a patroling truck. :slight_smile:

game_manager //this is triggered by the script multiplayer in your map 
{ 
 spawn 
 { 
  wait 200 
 } 
} 
truck //scriptname of script_mover 
 { 
 spawn 
 { 
  wait 300 
  
  followspline 0 spl_01 50000 length 32 wait //spawn the tank to here 

  trigger self truck_path //goto tank_path 
 } 

 trigger truck_path 
 { 
  //here is the commands the mover will follow 

  stopsound 
  playsound sound/vehicles/truck/truck_move.wav looping volume 512 
  //play a tank sound 
  followspline 0 spl_01 100 wait length 304 
  //this says goto spl_01 at a speed of 100 and don't look at 
  //the next command until after waiting 304 
  followspline 0 spl_02 100 wait length 304 
  followspline 0 spl_03 100 wait length 304 
  followspline 0 spl_04 100 wait length 304 
  followspline 0 spl_05 100 wait length 304 
  followspline 0 spl_06 100 wait length 304 
  followspline 0 spl_07 100 wait length 304 
  followspline 0 spl_08 100 wait length 304 
  followspline 0 spl_09 100 wait length 304 
  followspline 0 spl_10 100 wait length 304    
  followspline 0 spl_11 100 wait length 304 
  followspline 0 spl_12 100 wait length 304 
  followspline 0 spl_13 100 wait length 304 
  followspline 0 spl_14 100 wait length 304 
  followspline 0 spl_15 100 wait length 304 
  followspline 0 spl_16 100 wait length 304 
  followspline 0 spl_17 100 wait length 304 
  followspline 0 spl_18 100 wait length 304 
  followspline 0 spl_19 100 wait length 304 
  followspline 0 spl_20 100 wait length 304 
  followspline 0 spl_21 100 wait length 304 
  followspline 0 spl_22 100 wait length 304 
  followspline 0 spl_23 100 wait length 304 
  //add more lines for how many more splines u have 
  //notice that you don't include scripting for spline controls 

  trigger self truck_path 
  //repeat tank_path part of the script, remove this line 
  //if u don't won't it to loop 
 } 
} 

truck_whl_b //targetname/scriptname of misc_gamemodel 
{ 
   spawn 
   { 
      wait 500 
      attachtotag truck tag_wback 
   } 
} 
truck_whl_f //targetname/scriptname of misc_gamemodel 
{ 
   spawn 
   { 
      wait 500 
      attachtotag truck tag_wfront 
   } 
}

copy this in your script file of your map :wink:

grtz


(S14Y3R) #8

Good to hear its working. :slight_smile: But I noticed I forgot something…:o

You’ll probably want the wheels to turn, eh?


truck_whl_b
{
	spawn
	{
		wait 500
		attachtotag truck tag_wback
		wait 250
		setrotation 100 0 0 //match speed of truck
	}
}

truck_whl_f
{
	spawn
	{
		wait 500
		attachtotag truck tag_wfront
		wait 250
		setrotation 100 0 0 //match speed of truck
	}
}

:oops:


(shagileo) #9

S14Y3R you’re toooo good

well i was so happy about my truck moving i didn’t care about those wheels. i was actually planning to take a look at the script of supply to make those little basterds go spinning, but hey, help is one S14Y3R away :wink: .

so thanks again for the help, i really hope other people with the same problem can now go to bed again and sleep normal 8)

grtz