Collection of gta scripting and map weirdness

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Collection of gta scripting and map weirdness

Post by elypter »

Because gta2 scripting has so many bugs, oh excuse me, features ;) i thought it would be helpful to collect all these strange behaviors and limitations.
scripting_weirdness_thread_s.jpg
scripting_weirdness_thread_s.jpg (55.68 KiB) Viewed 81518 times
SCRIPT
Elypter:
  • (LIMITATION)EXPLODE_LARGE only explodes chars large. Cars explode normal with this command.
    Workaround: Put a char in a car and explode the char instead.
  • (BUG)FOR does not work at all.
    Workaround: Use WHILE
  • (COMPILER ERROR) empty loops cause do not compile
    Workaround: use DO_NOWT inside it or (obviously) delete the loop
  • (LIMITATION) IS_CHAR_FIRING_ONSCREEN ( p1 ) doesn't work with own player at least
  • (LIMITATION) you cannot set patrol points for chars in cars
  • (NO LIMITATION)HAS_CAR_GOT_WEAPON( rc_car, tank_gun ) works with tankgun(and probably others) too although the doc says only MINES, VMG and OIL works
  • (UNEXPECTED BEHAVIOUR) DELETE_ITEM( car ) doesn't work with vehicles that are on a trailer
    workaround: use PUT_CAR_ON_TRAILER to move it to a hidden place. the trailer is empty now but if it drowns the game crashes
  • (NOT WORKING)SET_CHAR_MAX_DRIVESPEED ( char_name , speed ) has no effect on players or bots
    workaround for bots and only useful when static and without cops: set the max speed in gci file.
  • (UNEXPECTED BEHAVIOUR) cars created with CREATE_CAR and probably all other car creation commands float in the air when they have a Z level above ground
    workaround: create a driver in the car. for example with: GIVE_DRIVER_AND_BRAKE(car01)
  • (UNEXPECTED BEHAVIOUR) when you teleport while entering a car the player gets teleported to where he is now and only the camera position changes and then flies back to the player.
  • (UNEXPECTED BEHAVIOUR) bots can't walk or drive through doors(even open ones) if the open rule is ANY_PLAYER
    workaround: delete the block or use other open rule. btw you can use this to lock out bots: http://gtamp.com/forum/viewtopic.php?p=3198#p3198
  • (LIMITATION) Maximum of code lines in a script is 3014 workaround
  • (UNEXPECTED BEHAVIOUR) SET_CAR_NO_COLLIDE ( carname ) makes your car uncrashable when standing. using this command in WHILE_EXEC gives it super crashing powers
  • (BUG) CLEAR_CAR_NO_COLLIDE ( carname ) has no effect
  • (UNEXPECTED BEHAVIOUR) A car that is put on a trailer is rotated by 180° relative to the trailer.
    workaround: put a ISETTA minicar on the trailer and the put your car on the minicar. this compensates the rotation by adding another 180°
  • (CRASH) When you remote control the vehicle you are sitting in and it gets destroyed the game crashes
  • (LIMITATION) while GIVE_WEAPON ( charname , weapon_type ) works on chars AND cars REMOVE_WEAPONS ( charname ) works only on chars
  • (UNEXPECTED BEHAVIOUR) ORDER_CHAR_TO_BACKDOOR(p1,p1_v) with you being the driver first and then with no driver added: when you exit the horn stays on all the time until you enter again. You cannot destroy the car with some weapons. bullets and rocket wont hit the car and stop before it like in matrix. if you throw a molotov on it it will bounce off. If the cars gets destroyed by other means you will die even if your character is not hit. this remains possible even if you died once the usual way. your existence is bound to the the one of the car ;) you can do that "out of car experience" even with 2 cars. When you enter as driver again you pull a clone of yourself out. then you become the clone and enter again. and the original stays on map as an indestructible bug graphic. They are rendered over everything on same level. Didn't test what happens on conveyors yet. http:///dump/clones.jpg
  • (UNEXPECTED BEHAVIOUR) ORDER_CHAR_TO_BACKDOOR(p1,p1_v) with you being the driver first and then the car the car has a driver which is alive: when the car gets destroyed you survive in the wreck and you can exit it alive. if it drowns you survive too but will be trapped for ever.
  • (UNEXPECTED BEHAVIOUR) ORDER_CHAR_TO_BACKDOOR(p1,p1_v) with you being the driver first and then the car had another driver which has been killed: when you exit the car you will always be "pushed" to the backseat when entering again. when it gets destroyed the same as above hapens.
  • (UNEXPECTED BEHAVIOUR) SUBS or loaded script files which are executed in a while exec loop are being executed like in a usual WHILE loop. this can cause serious bugs when the code is executed too slowly. there is no workaround with WHILE_EXEC loops in that subs or files.
  • (BUG) CHECK_WEAPON_TYPE_HIT_CHAR is never true. (at least i tested it with player1)
  • (UNEXPECTED BEHAVIOUR) Not all sounds work the same. Some can be made out of random choosing between multiple sound files, play instant as expected but play multiple times when choosing play forever. some play forever as expected but only play instant as long as it is constantly created new.
  • (DOC ERROR)it is IS_CHAR_FALLING not IS_CHAR_IN_AIR
  • (UNEXPECTED BEHAVIOUR) IS_CHAR_FALLING does not detect explosion falling, jumping and probably also not explosion push
  • (UNEXPECTED BEHAVIOUR) CHECK_WEAPON_TYPE_HIT_CAR stays true until the end of all times even if the car is wrecked and disappeared already. workaround: create a new car with that label
  • (UNEXPECTED BEHAVIOUR) when a car is handled by a script a regularly created gang won't get in it except it is a BUS.
  • (BUG) IS_CHAR_IN_AIR (charname) does not work
  • (UNEXPECTED BEHAVIOUR) KILL_CHAR can make the char hang mid air if he is falling when it is executed in WHILE_EXEC
Collection out of TMs Editor thread (various authors):
  • (COMPILER CRASH) Maximum allowed objects is 1000 or crash.
  • (COMPILER CRASH) CREATE_OBJ using 2d coords with ammo or remap value (spray shop), will crash compiler. workaround: use 3d coords with 255.0 as z-position.
  • (RULE) Coordinates must have at least 1 decimal precision.
  • (RULE) Declarations should always be before LEVELSTART command to avoid possible crashes.
  • (RULE) CREATE_* commands before LEVELSTART will not be visible in GTA2.
  • (RULE) You cannot use CREATE_CAR with PARKED_CAR_DATA datatype.
  • (RULE) MINI_CAR must be used with CREATE_CAR command or it creates a car with trailermodel instead.
  • (CRASH) Overlapping cars will crash GTA2 if too many overlap. Always avoid overlapping cars as much as possible.
  • (CRASH) If viewing too many objects at same time (around 600-2000 objects (depends on object type)) the GTA2 will crash.
  • (GTA2 CRASH) Cars that will insta crash GTA2: TRAINCAB, TRAIN, TRAINFB, BOXCAR, CAR9, CAR15, CAR20, CAR43.
  • (CRASH) Having a car type set to train (or any of its carriages).
  • (CRASH) Blowing up WRECK0-9 cars will crash GTA2.
  • (CRASH) Setting PLAYER_PED location on top of a car, char or any object, will crash GTA2.
  • (CRASH) Different objects have different maximum object limits.
  • (CRASH) Linking to zones (from script file) that doesnt exist in GMP file will crash GTA2.
  • (ERROR) Missing a restart zone will give error in GTA2 and quit without crashing.
  • (CRASH) SET_GANG_INFO "arrow id" value 0-7 or crash.
  • (CRASH OR ERROR) SET_GANG_INFO function must be used before LEVELSTART or it will either crash or have unexpected behavior.
  • (CRASH) GIVE_WEAPON command will crash if you try to give a weapon to a character that doesn't exist.
    Workaround: IF ( CHECK_CHARACTER_HEALTH ( playername, 0 ) )
  • (ERROR) Using gang phones (red, yellow, green) will give error on gta2.exe if they are not on a proper gang zone.
  • (CRASH) Using instantbomb on trucks with trailer attached in them will insta crash.
TM:
  • (COMPILER CRASH) Car shop (except spray shop) that was created with OBJ_DATA will crash compiler if using 2d coordinates and it is the first OBJ_DATA declaration in the script. workaround: use 3d coords with 255.0 as z-position, or move it to not be the first declaration."
  • (CRASH) Using PLAYER_PED with 2d coordinates crashes the game, however 255.0 makes 2d coords possible.
  • (CRASH)destructors don't delete cars which have player inside and crashes if you get out of car in middle of destructor
  • CAR_STOP and MOVING_CONE when used with GENERATOR shoots the object at the direction you set it rotation at. And those objects bounce from ground. It shoots them only if you put the z-coordinate really high
  • (CRASH) Using CREATE_GENERATOR will crash the game.
  • (NO ERROR) cars with trailers must be created with CREATE_CAR command or it creates a trailer with the same model as the car
  • (CRASH) CREATE_CRUSHER
  • (NO ERROR) If two objects (not cars and sometimes not chars?) overlap each other, one of them will get destroyed.
  • (CRASH) if z-position is greater or equal to 8.0 will cause crash. Safe to use is 7.999999 max. 7.99 preferred.
  • (CRASH) gang cars must be on their own gang zones or GTA2 crash
  • (CRASH) SET_GANG_INFO crash if pointing at a zone that doesnt exist in GMP file.
  • (UNEXPECTED BEHAVIOUR) SET_GANG_INFO can read only the first 4 letters from the zone name!
  • (UNEXPECTED BEHAVIOUR) dropping grenades on a conveyor which X and Y speed is set to zero will make the grenades unable to explode until you move them off the conveyor.
  • (CRASH) getting out of a car on a DESTRUCTOR object will crash the game.
  • (CRASH) if the car explodes for any reason on a DESTRUCTOR object, the game will crash.
  • (LIMITATION) SET_SHADING_LEVEL only works at noon and only affects walls
[*](HIDDEN FEATURE) CHECK_CAR_SPEED can take negative values as well, using -1 will trigger it instantly when you get inside the car.
BenMillard:
  • (COMPILER CRASH) A wide variety of filenames for .mis files will freeze the compiler.
    Short names with 1 or fewer punctuation characters are stable. workaround
  • (UNEXPECTED BEHAVIOUR)HAS_CHARACTER_DIED remains true until the camera updates.
    Workaround: Wait for at least 90 cycles.
  • (UNEXPECTED BEHAVIOUR)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.
Gustavob:
  • (CRASH)(UNCONFIRMED) if you add a train zone to a place which has blocks in two or more Z-Levels. Ben: I think it's only a problem if direction arrows are stacked up?
  • (UNEXPECTED BEHAVIOR) PERFORM_SAVE_GAME ( trigger name , X , Y , Z , width , height ) lets the player start after loading at X , Y+2.0 , Z
  • (BUG)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
  • (CRASH)when you are being chased and get in a taxi(in tytyarmy) and get on the backseat to become passenger and then the cops want to pull you out they won't pull anyone out but ener the vehicle and make the game crash
Sektor:
  • (UNEXPECTED BEHAVIOR)When you teleport a player after he died in a car the camera will not change position instantly but it will "fly" to the new position.
    workaround: encapsulate it with IF (NOT(HAS_CHARACTER_DIED(p1)))
Lantyz:
  • (UNEXPECTED BEHAVIOR) min_delay and max_delay do not work as expected. There is no random range but it will spawn after the smallest of both numbers
Pyro:
  • (UNEXPECTED BEHAVIOR)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.
  • (UNEXPECTED BEHAVIOR)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.

Just weired or uncommon things:
  • all operators take only 2 operands at maximum. http://gtamp.com/forum/viewtopic.php?p=3174#p3174
  • all statements have to be encapsulated with brackets.
  • you can use only one mathematical operation per line
  • you have to use "SET variable = value" instead of just "variable = value" which works like == in other languages http://gtamp.com/forum/viewtopic.php?p=3177#p3177
  • you have to use + 0 when you want to copy the value of a counter
  • you cannot use AND and OR in the same IF statement
  • There cannot be more than 1 OR in an IF statement
wrong:

Code: Select all

IF (( a==1 OR b==1 OR c==1) AND d==1)
    x = e = f + g + h
ENDIF
correct:

Code: Select all

IF(((a=1)OR(b=1))OR(c=1))
   IF(d=1)
      SET e = (f + g)
      SET e = (e + h)
      SET x = (e + 0)
   ENDIF
ENDIF
difference and similarities between WHILE() and WHILE_EXEC():
  • WHILE and WHILE_EXEC are executed as long as its conditions are true.
  • running through the whole code in a WHILE_EXEC loop always takes only 1 game cycle. the amount of cycles that is needed for a while loop depends on the amount of code.
  • DELAY_HERE can be executed in WHILE loops but not in WHILE_EXEC loops. use counters or IF(NOT(DELAY(xx))) instead
  • WHILE need less computing power but this doesnt really have an effect, especially not on todays PCs
MAP
TM(1.point discovered by Gustavob and refined by TM):
  • (GTA2) slopes 41-44 doesnt support rotation for side tiles
  • (DMAE) slope type 45 etc are rendered incorrectly in DMA editor if you set all sides have some tile texture, but in GTA2 just fine
  • (DMAE) those 44 slopes etc doesnt render one side correctly at all
  • (GTA2) all sloped blocks will still have collision even if they are set to air
  • (GTA2) you can walk on air blocks, but if you stop, you will fall down.
Gustavob:
  • (GTA2) When you add a light and use a random timing and dont choose an On or Off timing option, lights wont flash at all
BenMillard:
  • (GTA2)flashing lights cause desync
  • (GTA2)transparency doesn't work on 45° walls
    Pyro:
  • (GTA2)You can stand on top of diagonal slopes if set to field/pavement/road and looks like you're floating
Elypter:
  • (GTA2)when a train drives on any block that is not of type field the game crashes
  • (GTA2)when there is no pavement at a rain station where the wagon you are in is you cannot exit. entering is possible though.
  • (GTA2)If one of the trainzones is missing or named incorrectly the game crashes when the train reaches that point
  • (GTA2)If one of the trainzones is doubled the game crashes instantly
  • (GTA2)If one of the trainzones(entry,exit,stop) is not on the track the train will never stop at any station. if the entry point is missing it will drive fast, otherwise slow.
STY
Gustavob:
  • (CRASH/BUG)when a tile uses a palette with index over 255 it is displayed incorrectly in DMA Editor or it crashes. There is no problem with GTA2 and sty tool.
Elypter:
  • (CRASH)GTA2 crashes when you add a page to the tiles list. it works with sprites though.
  • (UNEXPECTED BEHAVIOR)textures that go over the boundaries of a page are continued on the other side
  • (NO FEATURE) the car flag "bullet proof" has no effect
  • (CRASH) emergency lights on any non emergency car crashes the game when activating.
  • (NO FEATURE) the car flag "roof decal" has no effect, not even on tv van
  • (BUG) the car flag "has popup head lights" has not the expected effect. the only car that has them doesnt use this flag. if you activate it, it is half on car before getting in and activating siren.
  • (ELSE)the other flags seem to work
Last edited by elypter on 24 Nov 2011, 12:24, edited 75 times in total.
yur sa'nok ngeyä
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Collection of gta scripting weirdness

Post by BenMillard »

Put a [list] tag before you bullet points and a [/list] tag after them. Keep the [*] tags.

That's how BBcode works in phpBB.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Collection of gta scripting weirdness

Post by Sektor »

I added the list tags.

SET_ commands don't have to be before levelstart and some would need to be used after levelstart.
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Collection of gta scripting weirdness

Post by Gustavob »

elypter wrote: # (CRASH) GIVE_WEAPON command will crash if you try to give a weapon to a player that doesn't exist.
Workaround: IF ( CHECK_CHARACTER_HEALTH ( playername, 0 ) )
You just lost the game.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting weirdness

Post by elypter »

added
yur sa'nok ngeyä
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting weirdness

Post by elypter »

added some more
yur sa'nok ngeyä
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Collection of gta scripting weirdness

Post by BenMillard »

There are some duplicates and I think some crashes are more specific than the given reason.
  • (RULE) Coordinates must always be written with 1 decimal precision.
    I always do PLAYER_PED and sometimes TOWER and powerups with 2-digit precision.
  • (CRASH) if you add a train zone to a place which has blocks in two or more Z-Levels
    I do this in MultiSlayer City. I think it's only a problem if direction arrows are stacked up?
(EDIT) Probably worth mentioning this:
  • (COMPILER CRASH) A wide variety of filenames for .mis files will freeze the compiler.
    Short names with 1 or fewer punctuation characters are stable.
I wrote this batch file to rename a working .mis filename to my desired .scr filename.

Code: Select all

REM Renames the "tiny-hs.SCR" made by Mis Pad to "tiny-hs-arena.scr",
REM This is because compiler freezes if I give it a "tiny-hs-arena.mis" as input.
MOVE tiny-hs.SCR tiny-hs-arena.scr
  1. Copy and Paste that into a new text file.
  2. Adapt the for your own file names.
  3. Save the new text file tiny-hs-arena.bat - the .bat part is important.
  4. Make sure you save as ASCII or ANSI. (Not Unicode or UTF-8!)
  5. Make sure it's in the same folder as your working .mis file. (Or add the file paths to the MOVE part inside the batch file.)
  6. Double-click the batch file after Mis Pad has compiled.
  7. It will replace any existing .scr which has the name you want.
  8. So you can use this again and again during development.
To edit the batch file with Notepad, right-click it and selecting Edit. Or use File > Open in any plain text editor. Or drag and drop.
Last edited by BenMillard on 17 Oct 2010, 00:36, edited 1 time in total.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting weirdness

Post by elypter »

i added some new ones and committed some changes
yur sa'nok ngeyä
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Collection of gta scripting weirdness

Post by Gustavob »

elypter wrote:# (COMPILER ERROR) empty loops cause do not compile
Workaround: use DO_NOWT inside it or (obviously) delete the loop
You just lost the game.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting weirdness

Post by elypter »

Gustavob wrote:
elypter wrote:# (COMPILER ERROR) empty loops cause do not compile
Workaround: use DO_NOWT inside it or (obviously) delete the loop
added
yur sa'nok ngeyä
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Collection of gta scripting weirdness

Post by BenMillard »

DELAY_HERE would usually work if you're just trying to use up game cycles? Can't think of another reason for an empty loop...
User avatar
Vike the Hube
Hitman
Hitman
Posts: 145
Joined: 28 Feb 2010, 22:34
GH nick: vike

Re: Collection of gta scripting weirdness

Post by Vike the Hube »

BenMillard wrote:Can't think of another reason for an empty loop...
I would guess as a placeholder for code you mean to put in later but I'm definitely intrigued :P
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting weirdness

Post by elypter »

Vike the Hube wrote:
BenMillard wrote:Can't think of another reason for an empty loop...
I would guess as a placeholder for code you mean to put in later but I'm definitely intrigued :P
Yeah. Main reasons for empty loops are placeholders or out-commented code.
yur sa'nok ngeyä
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Collection of gta scripting weirdness

Post by Gustavob »

I had to use empty loops to trigger some stuff when player enters some place when in a mission, it didnt work with the code inside the loop or inside an IF statement

Code: Select all

    WHILE_EXEC ( NOT ( LOCATE_CHARACTER_ON_FOOT ( player1, 26.0 , 4.5 , 2.0 , 0.5 , 0.5 ) ) )
        DO_NOWT
    ENDWHILE
    IF( (player_got_briefcase2 = 1 ) AND ( briefcase_exists = 0 ) )
        test_mission_briefcase = CREATE_OBJ ( 26.0 , 4.5 , 2.0 ) 0 BRIEFCASE END
        REMOVE_ARROW (arrow)
        DISPLAY_BRIEF ( 1043 )
        DISPLAY_TIMER ( explosiontimer, 5 )
[etc]
notice I had to use WHILE_EXEC ( NOT ( LOCATE... ) ) ), it didnt work without the "NOT"
You just lost the game.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting and map weirdness

Post by elypter »

the command CREATE_CONVEYOR exists(although not mentioned in the docs) but doesn't create any conveyor. Has anybody an idea if it is possible to create a conveyor midgame?
i tried to create it midgame but this somehow blows up the loop. creating multiple conveyors crash the compiler. probably the command wasn't finished but it would be cool to have it working. it would enable a lot of things.
yur sa'nok ngeyä
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Collection of gta scripting and map weirdness

Post by BenMillard »

You can't string a sequence of OR expressions together? This doesn't compile:

Code: Select all

IF ( (IS_CHARACTER_IN_MODEL(p1, BANKVAN)) OR (IS_CHARACTER_IN_MODEL(p1, COPCAR)) OR (IS_CHARACTER_IN_MODEL(p1, SWATVAN)) OR (IS_CHARACTER_IN_MODEL(p1, EDSELFBI)) OR (IS_CHARACTER_IN_MODEL(p1, GUNJEEP)) OR (IS_CHARACTER_IN_MODEL(p1, TANK)) )
This does compile:

Code: Select all

IF ( (IS_CHARACTER_IN_MODEL(p1, BANKVAN)) OR (IS_CHARACTER_IN_MODEL(p1, COPCAR)) )
(EDIT) In Pyro's script for San An Scramble, he does this (indenting adjusted):

Code: Select all

   IF ( ( ( ( ( p1tokens > p2tokens )
        AND ( p1tokens > p3tokens ) )
      AND ( p1tokens > p4tokens ) )
    AND ( winner = 0 ) )
  AND ( tokensleft = 0 ) )
So you give brackets to every AND, nesting them inside each other. This syntax is like having lots of function checks, not like the logical operators in other programming languages.
Last edited by BenMillard on 25 Dec 2010, 04:09, edited 2 times in total.
User avatar
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

Post by Gustavob »

it seems you can put only two conditions together in AND and OR, more than that doesnt compile
You just lost the game.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting and map weirdness

Post by elypter »

its the same with arithmetic operations.
yur sa'nok ngeyä
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Collection of gta scripting and map weirdness

Post by BenMillard »

You must use the SET command to store a value in a COUNTER. If you do it like other programming languages, the script will compile but the value won't be stored:

Code: Select all

COUNTER stage = 0 // initial value
LEVELSTART
stage = 1 // compiles but stage = 0
Here's the way GTA2 requires:

Code: Select all

COUNTER stage = 0 // initial value
LEVELSTART
SET stage = 1 // compiles and stage = 1
This catches me out and wastes hours every time I write a new script!

(EDIT) This topic is about the weirdness of GTA2 modding and explaining how to make it work. So these things should be included.
Last edited by BenMillard on 25 Dec 2010, 23:29, edited 1 time in total.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Collection of gta scripting and map weirdness

Post by elypter »

I think it's weired when comparing it with other languages but consistent with gta2 coding. it works like for example a CREATE_CAR command. Im pretty used to this now but is still a major source for bugs. It should definitely mentioned in a tutorial but i dont know it really belongs to this list. The last 2 posts too. Its weired in design but at least consistent.
yur sa'nok ngeyä
Post Reply