Collection of gta scripting and map weirdness
-
- Immortal
- Posts: 889
- Joined: 16 May 2009, 06:14
- GH nick: BenMillard
- Location: London, UK
- Contact:
Re: Collection of gta scripting and map weirdness
My conversion of the official GTA2 scripting information (300kB) is now in my website in HTML. Just a draft for now but I've made all the big decisions and lot of the actual work is done.
One amazing thing I've learnt is there are nearly 300 unique scripting commands! I'm going to re-arrange and categorise all the commands, eventually.
Hopefully this HTML version will make finding out how thing are supposed to work a lot easier. There's a topic to discuss it further, to keep this one focussed.
(EDIT) It seems IS_CAR_IN_BLOCK ignores the Z coordinate. So if you have two areas which overlap, the "winning" area will simply depend on how your code is arranged.
Remember the coordinate must be the exact centre of the area, with the total width and the total height of the area. The area must be rectangular but you could use multiple commands in OR expressions to check any shape. Might get slow or desync if you have hundreds in a WHILE_EXEC, though.
(EDIT) Pyro's use of GOSUB in WHILE_EXEC to a DELAY_HERE doesn't work, in my tests. The the DELAY_HERE didn't cause a delay; the RETURN sent my code straight back to the next command in the WHILE_EXEC block. I guess there was some coincidence in his code or the scenario which made Pyro think it work...
One amazing thing I've learnt is there are nearly 300 unique scripting commands! I'm going to re-arrange and categorise all the commands, eventually.
Hopefully this HTML version will make finding out how thing are supposed to work a lot easier. There's a topic to discuss it further, to keep this one focussed.
(EDIT) It seems IS_CAR_IN_BLOCK ignores the Z coordinate. So if you have two areas which overlap, the "winning" area will simply depend on how your code is arranged.
Remember the coordinate must be the exact centre of the area, with the total width and the total height of the area. The area must be rectangular but you could use multiple commands in OR expressions to check any shape. Might get slow or desync if you have hundreds in a WHILE_EXEC, though.
(EDIT) Pyro's use of GOSUB in WHILE_EXEC to a DELAY_HERE doesn't work, in my tests. The the DELAY_HERE didn't cause a delay; the RETURN sent my code straight back to the next command in the WHILE_EXEC block. I guess there was some coincidence in his code or the scenario which made Pyro think it work...
Last edited by BenMillard on 20 Jan 2011, 19:40, edited 2 times in total.
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.)
Re: Collection of gta scripting and map weirdness
i added the posts about scripting oddities and made a code example
yur sa'nok ngeyä
- Gustavob
- Immortal
- Posts: 407
- Joined: 18 May 2009, 21:40
- GH nick: Gustavob
|Gustavob| - Location: Nowhere.
- Contact:
Re: Collection of gta scripting and map weirdness
BUSY_CAR_SHOP object doesn't work properly. It was supposed to simply fix the car ("the plates have been changed") instead repainting it to another colour but it glitches the car just like when you repaint it to remap 255, 256 or -2
You just lost the game.
Re: Collection of gta scripting and map weirdness
added and also some of my own discoveries added
yur sa'nok ngeyä
-
- Immortal
- Posts: 889
- Joined: 16 May 2009, 06:14
- GH nick: BenMillard
- Location: London, UK
- Contact:
Re: Collection of gta scripting and map weirdness
SET_CAR_NO_COLLIDE only has to be set once, same as SET_CAR_ROCKETPROOF and so on. No loop required.
These collisions do much more damage to your car, shortening its useful life. Pacifier can become useless within a minute of ramming and shoving small cars.
It also stops the car bouncing off walls. Very hard to drive in narrow areas and use alleyways.
These collisions do much more damage to your car, shortening its useful life. Pacifier can become useless within a minute of ramming and shoving small cars.
It also stops the car bouncing off walls. Very hard to drive in narrow areas and use alleyways.
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.)
Re: Collection of gta scripting and map weirdness
Yeah thats true, i noticed that too recently. I had a situation where it didn't work without that trick. I haven't probed when this has to be done yet.
I also didn't add yet the problem with the ELSE statement. sometimes it is linked with the wrong IF.
I also didn't add yet the problem with the ELSE statement. sometimes it is linked with the wrong IF.
yur sa'nok ngeyä
-
- Immortal
- Posts: 889
- Joined: 16 May 2009, 06:14
- GH nick: BenMillard
- Location: London, UK
- Contact:
Re: Collection of gta scripting and map weirdness
- HAS_CHARACTER_DIED remains true until the camera updates.
Workaround: Wait for at least 90 cycles. - HAS_CHAR_BEEN_ARRESTED works the same. However, you remain in the Cop Car for about 140 cycles.
Workaround: Wait for at least 150 cycles. - DELAY_HERE doesn't work inside WHILE_EXEC
Workaround below. (Actual running code.)
Code: Select all
COUNTER loopage = 1
COUNTER p1wait = -1 // DELAY_HERE doesn't work in WHILE_EXEC
LEVELSTART
// Main Loop
DISPLAY_BRIEF (8001) // debug
WHILE_EXEC (loopage = 1)
// Player 1 just died?
IF ( (p1wait = -1) AND (CHECK_CHARACTER_HEALTH(p1, 0)) ) // not waiting AND player exists
IF (HAS_CHARACTER_DIED(p2))
--p1score_target //
SET p1wait = 1 // start the death timer
ENDIF
ENDIF
// Wait for Player 1 to finish dying and camera to reset:
// Note: At the start of a mission, p1wait = -1
IF (p1wait > 0) // death timer is running
++p1wait // count from 1 to 90
ENDIF
IF (p1wait > 90)
SET p1wait = -1 // reset the eath timer
ENDIF
ENDWHILE
LEVELEND
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.)
Re: Collection of gta scripting and map weirdness
yeah HAS_CHARACTER_DIED is true for a while. thats why i use a delay in tiny tiny town army too, because if i would change the wanted level up to 4 too early it would be switched back to 0 again.
DELAY () in IF statements works can be used too sometimes in while_exec loops
DELAY () in IF statements works can be used too sometimes in while_exec loops
yur sa'nok ngeyä
- Gustavob
- Immortal
- Posts: 407
- Joined: 18 May 2009, 21:40
- GH nick: Gustavob
|Gustavob| - Location: Nowhere.
- Contact:
Re: Collection of gta scripting and map weirdness
It seems diagonal walls (aka 45° walls) create invisible walls for no apparent reason
You just lost the game.
Re: Collection of gta scripting and map weirdness
You can also stand on top of them if set to field/pavement/road and looks like you're floating, but that's been known for agesGustavob wrote:It seems diagonal walls (aka 45° walls) create invisible walls for no apparent reason
On a similar note, GTA2 won't properly show 45° walls that have the "flat" option ticked (for transparency) - it will show but you will lose the transparency and it'll show black where the transparency was.
- Old School GTA2 Mapper and Scripter.
- Creator of the original GTA2 Scripting tutorials hosted by Ben Millard.
Re: Collection of gta scripting and map weirdness
I added this too because it was missing. It's been known for ages yeah. Actually most of these things have been discovered by someone else before many times, i even discovered many things that after i found out to remember to have discovered it some years before already. So just in case anyone thinks ">I< know that for ages" don't take this "who discovered what" too seriously
yur sa'nok ngeyä
Re: Collection of gta scripting and map weirdness
found out something what drove me crazy until i found it:
SET SET_CAR_NUMBER_GRAPHIC ( p1_ffield2 , 8 ) doesn't produce an compiler error or game crash but does weird things in other parts of the script.
obviously it should be SET_CAR_NUMBER_GRAPHIC ( p1_ffield2 , 8 )
SET SET_CAR_NUMBER_GRAPHIC ( p1_ffield2 , 8 ) doesn't produce an compiler error or game crash but does weird things in other parts of the script.
obviously it should be SET_CAR_NUMBER_GRAPHIC ( p1_ffield2 , 8 )
yur sa'nok ngeyä
Re: Collection of gta scripting and map weirdness
Any characters following you (scripted or instant gang) will never get on a train with you, even if you try using clever functions like storing the "car" the player is in then forcing NPC's to enter it. Always been a bug.
- Old School GTA2 Mapper and Scripter.
- Creator of the original GTA2 Scripting tutorials hosted by Ben Millard.
Re: Collection of gta scripting and map weirdness
if you have at least ~16 static cars on a map and use store car command the car you where in disappears instantly after you get in another one <- not confirmed. found on tiny face off army lite.
it doesnt happen if you play singleplayer and if you are in field of sight of player1. it happend first at the place where firetruck is. could anybody please try to confirm that.
it doesnt happen if you play singleplayer and if you are in field of sight of player1. it happend first at the place where firetruck is. could anybody please try to confirm that.
yur sa'nok ngeyä
Re: Collection of gta scripting and map weirdness
added:
IS_CHAR_IN_AIR (charname) does not work
KILL_CHAR can make the char hang mid air if he is falling when it is executed in WHILE_EXEC
IS_CHAR_IN_AIR (charname) does not work
KILL_CHAR can make the char hang mid air if he is falling when it is executed in WHILE_EXEC
Last edited by elypter on 27 Sep 2011, 15:01, edited 1 time in total.
yur sa'nok ngeyä
Re: Collection of gta scripting and map weirdness
IS_CHAR_IN_AIR should be IS_CHAR_FALLING. Wrong/old name for the command in the documentation.
You don't see the standard falling animation if you do the grenade/molotov glitch to fall without taking damage but it still returns true.
You don't see the standard falling animation if you do the grenade/molotov glitch to fall without taking damage but it still returns true.
Re: Collection of gta scripting and map weirdness
i scripted it differently now already but good to know that it is possible.Sektor wrote:IS_CHAR_IN_AIR should be IS_CHAR_FALLING. Wrong/old name for the command in the documentation.
You don't see the standard falling animation if you do the grenade/molotov glitch to fall without taking damage but it still returns true.
yur sa'nok ngeyä
Re: Collection of gta scripting and map weirdness
A few things (mostly about trailers):
- Trailers are ignored if you use the PARKED_CAR_DATA and only shows the towing vehicle. Work around: Use CAR_DATA instead. (I know this is listed but I thought I'd expand on it a little)
- You can make any type of vehicle have any type of trailer (such as Dementias with Tanks as a trailer) but there are some (lots!) issues:
- Only trucks (TRUKCAB1 and TRUKCAB2) can tow most vehicles at full speed (3rd gear). Any other car is limited to 1st gear with poor acceleration and turning.
- Depending on the vehicle towing and what vehicle you have as a trailer, sometimes the towing vehicle cannot start moving unless you turn slightly. Rarely you cannot move or turn at all (usually applies to small vehicles trying to tow big vehicles).
- Using a big, powerful vehicle to tow a small car will make the towing vehicle extremely agile compared to normal and accelerate to top speed extremely quickly.
- Entering any vehicle attached as a trailer will crash the game. Detach it and then enter it to work correctly.
- If you have a towing vehicle that has a gun on it (vehicle guns, Armed Land Roamer Gun, tank gun etc) it will not detach until you switch to a non-vehicle weapon.
- Setting the trailer type to TRAIN (train passenger carriage) will make the trailer not appear until you get in the towing vehicle. However, this trailer is extremely buggy and will crash the game randomly. Will instantly explode if it touches another car and crash the game. (Thanks to TM for the basic information while I went and tested this and other train ones as well)
- Setting the trailer type to TRAINFB (train flat-bed) will also appear hidden until you get in the towing vehicle. Even more buggy than TRAIN as trailer.
- Setting the trailer type to BOXCAR (train box carriage) will appear hidden until you get in the towing vehicle. Still buggy as TRAIN.
- Setting the trailer type to TRAINCAB (the train itself) will appear hidden until you get in the towing vehicle. Will instantly crash the game when you enter though and doesn't appear anyway.
- Towing a tank and then detaching it will make the tank roll over the towing vehicle destroying it leaving a tank above the wreck you now can't enter.
- GIVE_WEAPON command on a vehicle ignores the amount you list and always gives +50. Work around: Either use GIVE_WEAPON command twice to get 99 ammo (sets car bomb to 1 ammo) on a vehicle or use OBJ_DATA to create specific weapon under the vehicle if you want to specify an exact amount such as 1 vehicle bomb but at the cost of hearing the voice over on picking up a weapon. (Thanks Sektor for pointing out the work around)
- Old School GTA2 Mapper and Scripter.
- Creator of the original GTA2 Scripting tutorials hosted by Ben Millard.
Re: Collection of gta scripting and map weirdness
"Towing a tank and then detaching it will make the tank roll over the towing vehicle destroying it leaving a tank above the wreck you now can't enter."
lol
lol
yur sa'nok ngeyä