GTA2 UFO

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

GTA2 UFO

Post by Sektor »



Flying vehicles are possible in GTA2 v11.44 with custom scripts. Being able to save coordinates into counters and write them back to the objects/peds/vehicles opens up a lot of possibilities.

The UFO sprite was created by Jeff Mathews for GTA1 (he also made the program for editing GTA1 sprites): http://gtamp.com/GTA1/gta1-saucer.7z , I haven't properly converted it to GTA2, I cheated and used the saucer as a gangcar icon. It would be good if someone could convert it properly.

I used Elypter's tyty_army.sty file for that video, you'll notice the blue shockwave explosion rings but I mostly picked it since it had a plane sprite that's not actually in the video.

Here's the map: http://gtamp.com/maps/ufo.7z , it won't work on v11.43 or older.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 UFO

Post by Cuban-Pete »

Killed by your own UFO, priceless, especially when it's your 1000th post, conspiracy firewood.

It's late, I'm just rambling.
"Mmmm, your eyes are so beautiful."
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 UFO

Post by BenMillard »

Awesome!

Jailbreak: Army Base was going to get a faked surface-to-air (SAM) missile objective. The missiles would be Schmidts with custom handling and SET_JAMMED_ACCELERATOR, spawning high up on an invisible Field surface. They would be very weak to ensure they explode on impact but might also have INSTANT_BOMB fitted, if needed for balance.

This coordinates hacking could make the system quite a lot nicer, though. Maybe you would be shooting missiles at another ship or at reinforcements being brought in by road. You could also use them as anti-missile missiles, like the Patriot system, to combat surface-to-surface missile trucks.

The thing I'd most like to do is make players drop their weapons on death. That's a serious missing feature from GTA2 which is present in the newer GTA games, as well as other titles of this era such as Unreal Tournament.

So many possibilities we are only just starting to unlock. Dual machine pistol looked like fun, too!
Jones
Psycho
Psycho
Posts: 51
Joined: 08 Aug 2012, 21:25

Re: GTA2 UFO

Post by Jones »

Nice, can't wait to try it out :)
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 UFO

Post by T.M. »

Awesome.

By saving coordinates, you mean you only modify the Z-coordinate to prevent the UFO from falling down?
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

:ugeek: I have to modify x, y and z since the wheel physics don't work in the air. You are right that I need to constantly update Z or the UFO will fall.

When I first tried this, I wanted to mimic GTA2 physics, so I put a player in a car underground and had another car copy the angle/x/y and just have a higher z. Then we figured out how to read the movement keys, so I was able to add directional movement. GTA2 normally uses rotational movement. Rotational movement requires more calculations that weren't practical with GTA2 script maths functions but Vike addded sin/cos so it will be possible when he sends me that exe.

Another way of flying would be to just change the memory address that checks if the car is in the air but I haven't found that address. You can of course fake it by putting transparent land tiles in the air but that's going to leave tire marks in the sky and it would require a lot of map editing and give the player less control of their height.
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 UFO

Post by T.M. »

How do you read the keyboard?

When are you gonna release the source!?
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

Source for reading input:
[mis]
COUNTER in
COUNTER out
SET in = (p+348) // player+384 contains a pointer to GTA2 controls
CHANGE_GANG_CHAR_RESPECT (in,out,104) // save that pointer to the out counter (104 means read 4 bytes)
SET in = (out+129) // add 129 to those 4 bytes because I know that 129 = the horn/furp key
CHANGE_GANG_CHAR_RESPECT (in,out,101) // read the horn/furp key into the in counter (101 means read 1 byte)
IF (out=1) // explode the player when they fart
EXPLODE (p)
ENDIF
[/mis]
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 UFO

Post by T.M. »

Epic.

Now we really need some cleaner way writing that kind of code :)
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

All the UFO map files and MIS are here: http://gtamp.com/maps/ufo.7z , I'll release the new exe very soon, just finishing final tests.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: GTA2 UFO

Post by elypter »

very very nice. i think the new exe will motivate me enough to update tiny face off army and make the plane i put in there actually flyable
yur sa'nok ngeyä
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 UFO

Post by T.M. »

Interesting code.

Now, how should we make this easier to write?

It would be nice to have some sort of functions which would generate the below code automatically. Could add such feature to mispad perhaps?

[mis]
//write alien y
SET in = (currentalien+88)
CHANGE_GANG_CHAR_RESPECT (in,out,104)
IF (out>0)
SET in = (out+52) //y

IF (currentalieny<y)
SET currentalieny=(currentalieny+alienyspeed)
ELSE
SET currentalieny=(currentalieny-alienyspeed)
ENDIF
CHANGE_GANG_CHAR_RESPECT (in,currentalieny,114)
ENDIF

...


IF (player=6)
SET p=(p6+0)
SET p6fly=(fly+0)
SET p6freezeheight=(freezeheight+0)
SET p6z=(currentpz+0)
SET p6carz=(z+0)
SET p6bombdelay=(bombdelay+0)
ENDIF

...


//detect left
IF (left=1)
SET in = (currentpcar+88)
CHANGE_GANG_CHAR_RESPECT (in,out,104)
IF (out>0)
SET in = (out+48)
SET x = (x-pedxspeed)
CHANGE_GANG_CHAR_RESPECT (in,x,114)
//angle car west
IF (currentpspin=0)
SET in = (currentpcar+88)
CHANGE_GANG_CHAR_RESPECT (in,out,104)
IF (out>0)
SET in = (out+88)
SET currentpcarangle = 1080
CHANGE_GANG_CHAR_RESPECT (in,currentpcarangle,112)
ENDIF
ENDIF
ENDIF
ENDIF

[/mis]

I dont really understand anything from that.... care to add comments? We should document everything, have you got any list of the pointer hacks?

What good does "variable+0" exactly do?
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

From vike's changelog with some minor edits by me:
Peek (reading bytes from memory):
CHANGE_GANG_CHAR_RESPECT ( address counter, value counter, 101 or 102 or 104 )
i.e.
101: value counter <- byte ptr [address counter]
102: value counter <- word ptr [address counter]
104: value counter <- dword ptr [address counter]

Poke (writing bytes to memory):
CHANGE_GANG_CHAR_RESPECT ( address counter, value counter, 111 or 112 or 114 )
i.e.
111: byte ptr [address counter] <- value counter
112: word ptr [address counter] <- value counter
114: dword ptr [address counter] <- value counter

Some trig functions. They make fun stuff with peek and poke easier. The angles these take are the same that GTA2 works with internally, so you can directly use angles grabbed with peek.
In case you don't know what they are: 4xdegrees, anticlockwise from south. I.e. 0 = south, 360 = east, 720 = north, 1080 = west.
Cos:
CHANGE_GANG_CHAR_RESPECT ( gta2 angle counter, result counter, 120 )
Sin:
CHANGE_GANG_CHAR_RESPECT ( gta2 angle counter, result counter, 121 )
I'll document everything I've tested so far and release a list.
T.M. wrote:What good does "variable+0" exactly do?
GTA2Script is a bit weird:

[mis]
COUNTER a = 1
COUNTER b = 2
SET a=(b+0) // this makes a=2
SET a=b // for some reason this makes a=0
[/mis]
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 UFO

Post by T.M. »

Thats weird.

Code: Select all

SET_COUNTER_VAR: "SET %s = %s"
The command does exist. I must check, if it is compiled incorrectly...

Code: Select all

S_IS_S_PLUS_I: "SET %s = (%s + %d)"
If it is compiled correctly, but GTA2 only reads it incorrectly, then we should add a fix into the compiler, and use the above code for the "SET %s = %s" version, so it would expand it to: "SET %s = (%s + 0)" internally. That could reduce some confusing code. :)
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: GTA2 UFO

Post by Razor »

nice, but im still waiting for DEDICATED SERVERS! :)
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

LOL, just reminded me that I put "build a flying car" on my flashback todo list years ago as a joke. I should have had it on GTA2 list instead.
Cuban-Pete wrote:Killed by your own UFO, priceless, especially when it's your 1000th post, conspiracy firewood.

It's late, I'm just rambling.
Not only was this topic my 1000th post, the UFO video was my 42nd video and 42 is the answer to life the universe and everything.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: GTA2 UFO

Post by elypter »

...all the funny stuff that seems possible now like jetpacks
or a parachutes
or a skycrane
or a car float kit that allows you to get off the ground long enough to jump over other vehicles
or a turbo powerup
or a gravity gun
or guided missiles
or a loic
or dropping objects like molotovs, grenades or benches from a car
or a vehicle that is unsinkable turning it into a hovercraft
or a teleporting street
or virtual conveyors that can be turned on and off
or a more powerful shotgun
... ok i stop now:)
yur sa'nok ngeyä
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: GTA2 UFO

Post by Gustavob »

I'm willing to see silenced rocket launchers

Also boats. Maybe planes. And teleporting objects! Also detect if the player is near a certain object! And all sorts of different exciting stuff you can do with this.I fucking love you vike

But why does it appear that every car you pass above explode, even though you don't appear to touch them? Also is there any possibility we'll be able to detect certain keys being pressed?
You just lost the game.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 UFO

Post by Sektor »

I added the explosions myself since I wanted a way to attack things that were below. In my script, you can just switch to vehicle machinegun to turn off the level Z 2 explosions.
BenMillard wrote:Dual machine pistol looked like fun, too!
Yes but it's very over powered. I was hoping someone would notice it.
Post Reply