Page 1 of 1
Help-AI truck riding tut?
Posted: Wed Dec 10, 2003 5:45 pm
by MadHatter
Does anyone have a link to a tutorial for making enemy AI ride a truck with a driver, then jump off at the end like in M1LC3 (the lighthouse)? I got an opel truck driving off a trigger, just need some bad guys to come out of the truck! Thanks, I'm a scripting noob...didn't see anything in the tuts or forum!
Posted: Thu Dec 11, 2003 1:04 pm
by bdbodger
Why don't you use the global/vehicles_thinkers.scr
enemy_truck_think local.hp local.passengers local.path local.trigger local.type local.guy_type local.special:
like this
$enemytruck thread global/vehicles_thinkers.scr::enemy_truck_think 1000 6 $truck1_path nil nil models/human/german_waffenss_shutze.tik
Posted: Thu Dec 11, 2003 4:50 pm
by MadHatter
Thanks, BD, I'll start there...would the line go in the prespawn, or in the actual thread I'm calling? This crap's a little confusing, lol! I usually can figure out what to do by playing around - but ya gotta know where to start! Off to check the vehicle_thinker script...
Posted: Fri Dec 12, 2003 5:03 pm
by bdbodger
It goes in your script at the point that you want the truck to start driveing .
For example put a trigger_multiple into your map then run this thread in your level script
my_thread:
$mytrigger waittill trigger
$mytrigger remove
$enemytruck thread global/vehicles_thinkers.scr::enemy_truck_think 1000 6 $truck1_path nil nil models/human/german_waffenss_shutze.tik
end
Posted: Fri Dec 12, 2003 6:16 pm
by MadHatter
Hey, BD - it worked great and makes sense!! The last prob I'm having is that the guys stay in the truck after it stops...tried putting path_nodes around it, but they're not responding (they WILL shoot at you, tho). I think I might need to assign the guys variables, and then tell them to move to a node or somethin'?? Or do I thread to the 'unload' line in thinkers? It's not clear how to do this in vehicles_thinkers, but it does say something about unloading...any thoughts? Sux bein' a noob! Thanks again!
Posted: Sat Dec 13, 2003 12:06 pm
by bdbodger
There is nothing in the script that causes that . Are you sure that the truck has room to finish driveing without getting stuck ?
Posted: Sat Dec 13, 2003 10:06 pm
by MadHatter
Argh! There's plenty of room for the truck, BD...I'm getting "LD ERROR: (entnum 11, radnum-1, targetname) - reducing mindist from 128 to 0 to match leash...Leash mush be greater than mindist or AI will want to both run away and stay put" in the console...so looks like I need to alter the leash on the AI that spawn, but have no idea how to!! They shoot at you, lie down, etc. but don't get out of the truck no matter what you do. Adding "$truck1_disconnect_paths" doesn't help.
All I'm doing is using a trigger to call an opeltruck model,$truck1, targeted to $point1. Each point is named, and calls the next point. There's a terrible delay when I 1st hit the trigger. If I restart it doesn't delay again. This is the script:
--------------------------------
//test_triggers script
main:
exec global/ai.scr
exec global/loadout.scr maps/test_triggers.scr
exec global/friendly.scr
level waittill prespawn
exec global/ambient.scr test_triggers
level waittill spawn
$player item weapons/colt45.tik
level.script = "maps/test_triggers.scr"
thread trigger1 //call truck thread
end
trigger1:
$trigger1 waittill trigger
$trigger1 remove
$truck1 thread global/vehicles_thinkers.scr::enemy_truck_think 1000 6 $truck1_path nil nil models/human/german_waffenss_shutze.tik
$truck1 drive $point1
end
----------------------------------------------------
Whaddaya think?? I gotta be close!!
Posted: Sun Dec 14, 2003 5:39 am
by bdbodger
You don't put
$truck1 drive $point1
The $truck1_path in the thread statement is the first info -> vehiclepoint node on a path of nodes where the first node targets the second node and the second targets the third node etc etc etc . You need to make a path of nodes where you want the truck to go . Even two nodes will work . The easiest way to do that is make how ever many nodes you think you will need . Select the first node and press N to bring up the entity window give the first node a targetname of truck1_path , close the window and with the first node still selected , select the second node . Now press the control key and k on the keyboard you will see a line go from the first node to the second and only the second node will be still selected now select the third node and press control and k again etc etc untill you have a path of nodes . That is it . The 1000 is health the 6 is ai's in truck and the $truck1_path is the path . You don't need to pick what kind of ai will be in the truck but you can .
This will work too :
$truck1 thread global/vehicles_thinkers.scr::enemy_truck_think 1000 6 $truck1_path
Here is the syntax
$truck1 thread global/vehicles_thinkers.scr::enemy_truck_think < health > < number of ai's > < path to follow > < trigger targetname if you want to use one but not needed > < if set to "green" destroyed model will be models/vehicles/opeltruckgreen_d.tik instead of the opeltruck_d.tik > < ai's in truck .tik name goes here > < if set to "panzer" guy in slot one will have a panzerschrek >
any values you don't use , use nil instead unless they are on the end of statement then value will automaticaly be nil
Posted: Sun Dec 14, 2003 11:26 am
by MadHatter
Works great, BD - thanks!! I guess I was confusing the engine with my BS, lol...hopefully other people will use the info, too...this forum rock!
