Car and driver AI script
Car and driver AI script
I have one idea in my head. But i need to know some things first.
Is it possible to script such thing.
I haven't scripted much but you guys should know the answer.
Just very basic script, no missions or anything.
Let's say startpos is (X,Y,Z): 55,55,2
Endpos is: 15,15,2
I create car at the startpos and give him driver.
I know that we can create cars and put driver in it.
Now, is it possible to make this car / driver to drive to the endpos from the startpos, as soon as he enters the car?
Let's say he will just run to the car, enters it and drives the car to the endpos and quits the car.
And then starts walking or whatever.
I guess roads are must have also or not?
I don't ask you guys to code it.
Don't! I just ask if its possible with commands the miss2 offers?
TIA.
Is it possible to script such thing.
I haven't scripted much but you guys should know the answer.
Just very basic script, no missions or anything.
Let's say startpos is (X,Y,Z): 55,55,2
Endpos is: 15,15,2
I create car at the startpos and give him driver.
I know that we can create cars and put driver in it.
Now, is it possible to make this car / driver to drive to the endpos from the startpos, as soon as he enters the car?
Let's say he will just run to the car, enters it and drives the car to the endpos and quits the car.
And then starts walking or whatever.
I guess roads are must have also or not?
I don't ask you guys to code it.
Don't! I just ask if its possible with commands the miss2 offers?
TIA.
Last edited by B-$hep on 30 Apr 2011, 18:38, edited 1 time in total.
Always wear safety glasses while programming.
- Gustavob
- Immortal
- Posts: 407
- Joined: 18 May 2009, 21:40
- GH nick: Gustavob
|Gustavob| - Location: Nowhere.
- Contact:
Re: Car and driver AI script
from what I know, it is possible but it needs road blocks+paths on the gmp file or just road blocks so the driver knows which directions to take and where to drive
ps: needs confirmation
ps: needs confirmation
Last edited by Gustavob on 30 Apr 2011, 18:40, edited 1 time in total.
You just lost the game.
Re: Car and driver AI script
So without any arrows and things it will not drive anywhere?
What happens if you give him a command to drive but there are no roads or directions?
Crash?
What happens if you give him a command to drive but there are no roads or directions?
Crash?
Always wear safety glasses while programming.
- Gustavob
- Immortal
- Posts: 407
- Joined: 18 May 2009, 21:40
- GH nick: Gustavob
|Gustavob| - Location: Nowhere.
- Contact:
Re: Car and driver AI script
i once tried something similar accidentally and the driver was just driving forward untill he hit a wall, then backwards untill he hit another wall, etc, trying to find arrow paths, no crash no nothing
You just lost the game.
Re: Car and driver AI script
It sucks that you have to edit the GMP file just to make the AI drive from A to B in a straight line. If you don't, they will keep on driving past the point you told them to and they go a little crazy. DMA Design never planned for GMP files that don't have roads.
Re: Car and driver AI script
Gustavob:
Lol, that's funny.
Ok, i guess, without roads it's impossible and i have to use MAKE_CAR_A_DUMMY and then point the arrows to the endpos. Hopefully he will drive to there where i want
And check somehow if its there and blow his head off. Lol.
Gonna read the scripting doc.
I will show you what i had in mind when i get this working.
Yep, Sektor. I agree.
EDIT:
is it possible to make some AI to main character or camera?
So camera would follow the dummy car when it arrives or starts moving?
Or i have to run or drive after the dummy car to see it and see how it drives the car reaches the destination?
I know that remote car has such behavior that camera follows the remote car instead player.
Lol, that's funny.
Ok, i guess, without roads it's impossible and i have to use MAKE_CAR_A_DUMMY and then point the arrows to the endpos. Hopefully he will drive to there where i want
And check somehow if its there and blow his head off. Lol.
Gonna read the scripting doc.
I will show you what i had in mind when i get this working.
Yep, Sektor. I agree.
EDIT:
is it possible to make some AI to main character or camera?
So camera would follow the dummy car when it arrives or starts moving?
Or i have to run or drive after the dummy car to see it and see how it drives the car reaches the destination?
I know that remote car has such behavior that camera follows the remote car instead player.
Always wear safety glasses while programming.
Re: Car and driver AI script
You could give the player remote control of the car, disable their controls and make the AI drive the car or have the player as a passenger and teleport them out before the destination.
Re: Car and driver AI script
Hmm, thanks.
I will try. It will be fun...
I will try. It will be fun...
Always wear safety glasses while programming.
Re: Car and driver AI script
Have you tried using the red arrows in map editor?
Also, perhaps you could do checks to see if the car has reached XYZ then give it new orders?
Also, perhaps you could do checks to see if the car has reached XYZ then give it new orders?
- Old School GTA2 Mapper and Scripter.
- Creator of the original GTA2 Scripting tutorials hosted by Ben Millard.
Re: Car and driver AI script
Yep Pyro, i already figured that arrow thing out.
I saw that many cars were created on my tiny road, but i wanted only 1, so i used red arrows and it works. Dummy just drives on that road alone with his copcar, back and forward.
I will try now make it stop and quit the car, then the camera thing.
I saw that many cars were created on my tiny road, but i wanted only 1, so i used red arrows and it works. Dummy just drives on that road alone with his copcar, back and forward.
I will try now make it stop and quit the car, then the camera thing.
Always wear safety glasses while programming.
-
- Immortal
- Posts: 889
- Joined: 16 May 2009, 06:14
- GH nick: BenMillard
- Location: London, UK
- Contact:
Re: Car and driver AI script
Online version of the DMA scripting guide for GTA2 might be helpful. It's not 100% complete or error-free, so please report bugs!
We can link to the commands we're suggesting and ones you have tried out. Just add a # and then the command name in full, with uppercase and underscores. Commands I've seen mentioned and various commands for drivers:
We can link to the commands we're suggesting and ones you have tried out. Just add a # and then the command name in full, with uppercase and underscores. Commands I've seen mentioned and various commands for drivers:
- CAR_DATA-set - creates the vehicle as soon as game starts.
- CAR_DATA with CREATE_CAR lets you create the car when you want.
- GIVE_DRIVER_AND_BRAKE makes the car start to drive, aimlessly.
- SET_CHAR_TO_STAY_IN_CAR might be the default behaviour.
- LOCATE_CHARACTER_BY_CAR counter-intuitive name but this makes the driver go to a particular coordinate.
- LOCATE_ANOTHER_CHARACTER_BY_CAR like the previous command but can drive to a player or AI character, instead of a specific location.
- CHAR_DATA reserves the name for the character.
- CREATE_CHAR_INSIDE_CAR is a bit like MAKE_CAR_A_DUMMY but lets you use the full character AI system. Yeah, a lot more things become possible this way!
- SET_CHAR_MAX_DRIVESPEED slow cars might be driven at 'warp speed' without this.
- SET_CHAR_DRIVE_AGGRESSION turning this ON makes the driver bash through traffic, if necessary.
- FOLLOW_CAR_IN_CAR using the character objectives system, you can make the driver follow another vehicle. To follow a character, even when they change vehicle, you'll need a complex loop with various other commands.
GTA5 Race, DM & Capture | GTA2 Levels & Coding | GTA2 YouTube Videos
Gran Turismo 6 custom track club(Sign in with PSN details, then follow link again.)
Gran Turismo 6 custom track club(Sign in with PSN details, then follow link again.)