Main Page > GTA2 > Modding Tutorial > THREAD_TRIGGERs
A THREAD_TRIGGER is, as the name implies, a command that triggers a subroutine when a character (usually the player) performs a certain action. They are ideal to start missions: you can let a mission wait until a player answers a mission phone, or enters a certain car. There are five different THREAD_TRIGGERS:
THREAD_TRIGGER name = THREAD_WAIT_FOR_CHAR_IN_CAR ( char_name , car_name , subroutine: ) THREAD_TRIGGER name = THREAD_WAIT_FOR_CHAR_IN_BLOCK (char_name , X.x , Y.y , Z.z , subroutine: ) THREAD_TRIGGER name = THREAD_WAIT_FOR_CHAR_IN_AREA (char_name , X.x , Y.y , Z.z , width , height , subroutine: ) THREAD_TRIGGER name = THREAD_WAIT_FOR_CHAR_IN_AREA_ANY_MEANS (char_name , X.x , Y.y , Z.z , width , height , subroutine: ) THREAD_TRIGGER name = THREAD_WAIT_FOR_ANSWER_PHONE ( char_name , phone_name , subroutine: )
name | An unique name for the trigger. |
---|---|
char_name | Name of the character. |
car_name | Name of the car the character is supposed to enter. |
X.x , Y.y , Z.z | Coordinates of the block or area the character is supposed to enter. |
width , height | The width and height of the area in blocks. |
phone_name | Name of a phone. |
subroutine: | The name of the subroutine that should be triggered when the conditions are met. Note the : at the end of the subroutine. |
The THREAD_WAIT_FOR_CHAR_IN_AREA_ANY_MEANS is very similar to the THREAD_WAIT_FOR_CHAR_IN_AREA, but it checks for characters entering the area on foot or by car, whereas the latter only checks for players on foot.
THREAD_TRIGGERs are always set and created before LEVELSTART at the same time, but they can be activated and deactived midgame. This is done with the following commands:
ENABLE_THREAD_TRIGGER ( trigger_name ) DISABLE_THREAD_TRIGGER ( trigger_name )
Mapping | Map Editor · Buildings · Roads · Water & animations · Slopes · Flat tiles · Collision info · Level edge · Zones · Putting a level ingame | |
---|---|---|
Scripting | Declarering: | Main script · Script Compiler · Code lists · Commands · Vehicles · Objects · Sounds · Characters |
Programming: | IF · WHILE · COUNTERs · Subroutines · THREAD TRIGGERs · Kill Frenzies | |
Both | Manual · Lighting · Car shops · Cranes & crushers · Gangs · Subway · Multiplayer levels | |
File types | .gci · .gmp · .gxt · .mis · .mmp · .scr · .seq · .tmp · .sty | |
Other | Texting · Physics · Creating vehicles · Terminology · Installing levels |