Grand Theft Loco

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Grand Theft Loco

Post by Sektor »


User avatar
elypter
Immortal
Posts: 1121
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Grand Theft Loco

Post by elypter »

wow
how is that done scriptwise?
can that be done by store car command and remote control?
yur sa'nok ngeyä

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

Here's the map: http://gtamp.com/maps/loco.7z

It should support 1-6 players but I only tested 1 and 2. Start it in network mode since it uses a custom gxt.

store and remote control commands are used but the important command is SET since that allows adding of 188 to the last carriage and that is the pointer for the engine! It doesn't have any doors, so ordering peds into there does nothing but at least remote works.

You tap arrows a few times to set speed and direction instead of holding down like you do with cars.

SET is powerful since with the help of other commands, it can be used to manipulate GTA2 memory that isn't normally accessible. Thanks to Jones for his findings on that command.

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

Weirdly, IS_CHAR_PRESSING_HORN is triggered when driving the train backwards, so I used it to detect reverse. The horn button does nothing.

User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: Grand Theft Loco

Post by Cuban-Pete »

Is it the naked gun 2 and half?

Nice hacking by the way.
"Mmmm, your eyes are so beautiful."

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

That's a good name. I thought of calling it The Nudinator and I was going to have a weapon that killed every ped around called The Terminator but it crashed after a short time in multiplayer. Some commands Vike can fix so they don't crash when given invalid addresses, several are already patched in 11.43.

I thought of replacing the N weapon sprite with x-ray glasses, it doesn't have to be a gun :)

Thanks to SET, you can use any command on random/onscreen peds but exploding them or giving them orders crashes after a while, most likely when it gets to a bad address. There are some commands that might be able to check if an address is valid before writing to it.

User avatar
elypter
Immortal
Posts: 1121
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Grand Theft Loco

Post by elypter »

have you tried to add a door with stytool yet? then it could work to order a player into the engine
yur sa'nok ngeyä

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

It already has 2 doors according to stytool but they don't work and adding more doesn't help. I tried the unlock door command but it didn't help or it crashed.

ORDER_CHAR_TO_DRIVE_CAR makes the player or ped chase the train but once he catches it, he just stops and never tries to get in.

CarThief
Hitman
Hitman
Posts: 108
Joined: 19 May 2012, 18:12
GH nick: CarThief
Location: Holland, AKA The Netherlands

Re: Grand Theft Loco

Post by CarThief »

That's probaly the craziest thing i've seen all day, any chance you could at some point create a guide on how to (ab)use the SET commands for these kinds of purposes reliabily? Would make for some crazy new missions if these can be used, hehe...
Or atleast makes it quite handy to do stuff with the trains. Perhaps to make em invincible or put 'turrets' on top of them(mini tanks)! Or for the sake of detail simply put a car on the trailer-area of the trains, if they have any (hm, perhaps it could even be taken off, too).

Edit: And with guide i suppose any reliable way to get ahold of a certain otherwise unreachable thing in the game memory, aka if a specific number where to always refer to this or that part of a train. Though i take its far from that easy to do so?

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

I will try to write a guide or at least put comments in my code. I did make a Super Train script before I found out about the SET command by putting tanks on the carriages (that I could get in and STORE) and messing with the GCI strengh settings. I got bored of Super Train since it wasn't nearly as cool as Super Tank.

The gta2manager debug setting, show car/ped IDs helps, since when I got in the last carriage, it said the ID for the engine was 1 higher than the last carriage (it was like 17 and 18). From previous tests (displaying vehicle memory location with ADD_SCORE), I had figured out that each car uses 188 bytes, so I needed to add 188 to the last carriage to get the ID for the engine.

IF you STORE a car or CREATE a car then you can add to it to get the next car.

CAR_DATA car01 (pretend I had some data here)
SET nextcar = ( car01 + 188 )
EXPLODE ( nextcar )

That would explode car02, if you created car02 but if you didn't create car02 then a dummy/AI car would explode.

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Grand Theft Loco

Post by BenMillard »

Want to turn this into a re-usable code which could be copy-pasted into any level via THREAD_TRIGGER and publish it on my site. (With credit to all who help, naturally.)

Does the offset change if the train has more/less carriages?

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

The number of carriages doesn't matter.

Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: Grand Theft Loco

Post by Jones »

[mis]IF (wait=0)
SET wait=1
STORE_CAR_CHARACTER_IS_IN ( p , carriage )

WHILE_EXEC(NOT(CHECK_CAR_MODEL( carriage,TRAINCAB)))
SET carriage = ( carriage + 188 ) // 188 is the size of vehicle struct
ENDWHILE
SET toot = ( carriage +0 )
TAKE_REMOTE_CONTROL_OF_CAR ( p, toot )
ENDIF[/mis]
Seems to work well, you can enter any carriage and it will loop till the last one and gives you control over it.

edit: changed WHILE_EXEC(CHECK_CAR_MODEL( carriage, TRAIN )) to WHILE_EXEC(NOT(CHECK_CAR_MODEL( carriage,TRAINCAB)))
Last edited by Jones on 06 Apr 2013, 12:27, edited 1 time in total.

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

Nice. Works great.

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

I updated Loco so that you can get in any carriage to control the train instead of just the last one. I removed the subroutines and improved the display_message/brief timing. I changed the name of the bonus you get for driving the train backwards. I made it so all peds that you punch die from electrocution and all drivers are aggressive.

Galactic Boy
Immortal
Posts: 333
Joined: 15 Apr 2012, 08:26

Re: Grand Theft Loco

Post by Galactic Boy »

Game crashes when started. :(

User avatar
elypter
Immortal
Posts: 1121
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Grand Theft Loco

Post by elypter »

this would make a map idea of mine even more fun.
i thought about one team having to protect a train until it reaches its target and another team that tries to blow it up.
yur sa'nok ngeyä

User avatar
Sektor
Boss
Boss
Posts: 1387
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Grand Theft Loco

Post by Sektor »

Galactic Boy wrote:Game crashes when started. :(
You have to start it in network mode since it uses a custom GXT or you can copy loco.gxt over e.gxt. It's also possible you downloaded a test version. I updated it about 4 times today just trying different functions on dummy peds. In the current version, all peds get in player 1's car and get out when he does but for reasons I currently don't understand, it seems to stop doing that if you get in a tank or change car.

BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Grand Theft Loco

Post by BenMillard »

The sample from Jones doesn't declare all its variables and wait is never used?

Is a control structure around this missing?

Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: Grand Theft Loco

Post by Jones »

It only works in conjunciton with Sektor's code and wait is indeed used to prevent multpile execution of the code.

Post Reply