I love code snippets. It makes developing process easier. GTA2 scripting is not a hard task at all, the script is self-documented. But sometimes I see codes that are interesting, have something in them that I haven't seen before. It's a good idea to share these.

That will set maximum wanted level to zero and remove all cops and cop cars from the map (only setting max wanted to 0 will still let cops drive and walk around and you may still get a wanted level when a cop sees you doing something wrong, though it will disappear quicker than normal)

Useful little thing to add delays while inside a WHILE_EXEC or WHILE loop (by default they are skipped if they are inside these code bits), useful if you want timed explosions etc while still having proper IF functions...

Proper Delaying in WHILE/WHILE_EXEC Loops

Put this before LEVELSTART...

Code:

wait_short:DELAY_HERE ( 30 )RETURN

Extremely short bit of code. The "wait_short:" is the label name (you must include the colon at the end of the name!) and then put anything you like inbetween the label name and the "RETURN". Adjust your "DELAY_HERE" count to whatever you need (30 "game ticks" is 1 second real time).

When you are ready to use it in your script simply do this...

Code:

GOSUB wait_short:

Throw that in wherever you like, again, don't forget the colon at the end of the label name!

Put inside WHILE/WHILE_EXEC loop... this constantly updates whatever car the player is in and saves it for future use and then checks to see if player 2 is holding an electro baton while player 1 is pressing the car horn. If both are true then orders player 2 to the back door of player 1's current car. This will stop if player 2 switches weapons and/or player 1 stops pressing the horn. Set up multiple ones for different players and you you can have multiple players as passengers!

This code let's you have a custom instant gang that will also replace the missing members if they are dead. This example is done by using a phone but can be changed to whatever you like, and also you can add more members if needs be.

If you want them to drive cars then it becomes unstable with more than 16 bots but on foot you can have more than 70 bots after you. This script was quickly tested with bil.sty and bil.gmp. I haven't tested it multiplayer.

I think, like me, many of you have once tried this function:SET_CAR_NO_COLLIDE ()but did not see an effect.It is used for the the car at the Residential start point.This car cannot be pushed and can move shove even the heaviest vehicle away.

race respawn checkpoint-all respwan zones must be in the teleporter range-the respawn zones should be in the middle of the checkpoints to reduce camera time-the commented lines get rid of the camera flights but only once-Edit: added messages and teleport works almost instantly now

lock out a bot:doors are another candidate for "it's not a bug, it's a feature".Bots cannot walk or drive through doors, even when they are already open. Although this is stupid it can be an advantage because there is no other way to lock out non player characters.

Just create a door with invisible tiles that is always open and bots wont get through it (99% of them). bots can still be pushed through by explosions.

If you give the door a <code>close never</code> type, it will stay permanently open & will let anything go through. All other types will only let the 'type' that opened it through, e.g the player, a particular car.

In your code, ANY_PLAYER is the 'type' that opened it. So only they can get through, I guess. There is an ANY_CAR door opening type but there's no ANY_MEANS one.

Setting the door closing type to CLOSE_NEVER would be worth a try, given the quote above.

(EDIT) Welcome, your code be run by a THREAD_TRIGGER at each player's start location. It would contain a WHILE_EXEC which checked the player still existed, then checked if they were on fire, then shortened the flame duration.

Industrial has like 30 threads, for Kill Frenzy and phones and so on. 6 threads plus your main loop should be fine. (Maybe I should give an example, oops.)

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum