Quantcast

Jump to content

» «
Photo

Petrol Mod

309 replies to this topic
the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#1

Posted 12 February 2009 - 09:12 AM

I have always enjoyed the petrol mods that come out for gta games. Anything that can add an extra level of realism is good imo.

Anyway, what are the chances of one being created for GTA IV? Once you enter a car it is stored in memory so hopefully it should save the amount of petrol you put in it. This was always a problem with previous petrol mods.

a-k-t-w
  • a-k-t-w

    Wannabe GTA IV Dev

  • Members
  • Joined: 30 Sep 2008

#2

Posted 12 February 2009 - 09:32 AM

Yes, I think this is possible. Just make the car stop working after you run out of petrol?

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#3

Posted 12 February 2009 - 09:44 AM

Yeah i have no idea how to do it, but it would be a great realism mod. If it is made, hopefully the car you are driving will remember how much petrol you have put in it. Thats been the problem with previous petrol mods, as soon as you put the car in the garage, the amount of petrol put in was lost, and you could go from having a full tank to nothing at all.

Another nice addition would be petrol station icons added to the map.

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#4

Posted 12 February 2009 - 09:55 AM

Doing a petrol mod wouldn't be too hard. But it is not possible to store the amount of petrol in the savegame, as far as i know.

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#5

Posted 12 February 2009 - 10:17 AM

But if you get into a car, and then leave it, that car is stored in memory, ie it stays there unless you quit the game, or get into another car. So there must be some way of getting said car to remember the amount of said petrol.

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#6

Posted 12 February 2009 - 10:27 AM

QUOTE (the_gas @ Feb 12 2009, 11:17)
But if you get into a car, and then leave it, that car is stored in memory, ie it stays there unless you quit the game, or get into another car. So there must be some way of getting said car to remember the amount of said petrol.

Yes, this works as long as the current game runs. But as soon as you load a savegame all objects will get new unique IDs and thus the stored information is gone.

FakeJ66
  • FakeJ66

    Punk-ass Bitch

  • Members
  • Joined: 28 Dec 2008

#7

Posted 12 February 2009 - 10:52 AM

it should be possbile by lua-scripting as far as i know. because there is a mod for sa already. and it's a cleo script.

Intosia
  • Intosia

    I'm random! ^^

  • Members
  • Joined: 11 Dec 2008

#8

Posted 12 February 2009 - 12:17 PM

Cant be to hard. Give every car a 'gas amount' and a 'fuel ratio'. Then just read the velocity of the car and do some math. Or am i missing something?

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#9

Posted 12 February 2009 - 02:05 PM

Good Good, hopefully someone can make it. As long as it remembers my petrol count if i leave my car to say go online, or go to a strip club, then im happy.

Pandur
  • Pandur

    Player Hater

  • Members
  • Joined: 10 Jan 2009

#10

Posted 12 February 2009 - 05:58 PM

Of course there must also be a way to refill your car at the gas stations!!!
Surely a lot of work, but should be possible!

I hope for it, too!

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#11

Posted 12 February 2009 - 06:44 PM

Who will be our knight in shining armour? confused.gif

Andrew
  • Andrew

  • Inactive Staff
  • Joined: 21 Jul 2003
  • None

#12

Posted 12 February 2009 - 10:00 PM

Hmm could be interesting, I wouldnt even be sure on the maths involved. There isn't any way of drawing to the screen properly yet. So any display that we had last time doesn't work.


AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#13

Posted 13 February 2009 - 04:51 AM

QUOTE (Intosia @ Feb 12 2009, 12:17)
Cant be to hard. Give every car a 'gas amount' and a 'fuel ratio'. Then just read the velocity of the car and do some math. Or am i missing something?

^ The problem with this is that it would use up gas whenever you're moving, even if you're only coasting. So it'd be better to have it do the math when W is pressed/the controller trigger is squeezed.

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#14

Posted 13 February 2009 - 07:06 AM

QUOTE (AngryAmoeba @ Feb 13 2009, 04:51)
QUOTE (Intosia @ Feb 12 2009, 12:17)
Cant be to hard. Give every car a 'gas amount' and a 'fuel ratio'. Then just read the velocity of the car and do some math. Or am i missing something?

^ The problem with this is that it would use up gas whenever you're moving, even if you're only coasting. So it'd be better to have it do the math when W is pressed/the controller trigger is squeezed.

That's a good shout.

Andrew
  • Andrew

  • Inactive Staff
  • Joined: 21 Jul 2003
  • None

#15

Posted 13 February 2009 - 08:56 AM

QUOTE (the_gas @ Feb 13 2009, 08:06)
QUOTE (AngryAmoeba @ Feb 13 2009, 04:51)
QUOTE (Intosia @ Feb 12 2009, 12:17)
Cant be to hard. Give every car a 'gas amount' and a 'fuel ratio'. Then just read the velocity of the car and do some math. Or am i missing something?

^ The problem with this is that it would use up gas whenever you're moving, even if you're only coasting. So it'd be better to have it do the math when W is pressed/the controller trigger is squeezed.

That's a good shout.

Even if you're coasting in a car you're using up fuel. Since the engine is still running and still ticking over.

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#16

Posted 13 February 2009 - 09:30 AM

True, but but the petrol consumption in this situation must be lower than at top speed, if this can be factored in i doubt it.

Andrew
  • Andrew

  • Inactive Staff
  • Joined: 21 Jul 2003
  • None

#17

Posted 13 February 2009 - 01:28 PM Edited by Gangsta Killa, 13 February 2009 - 05:19 PM.

Very true, IV has a velocity varible. I think this holds the amount of acceleration being applied to the car.

I made a very basic mod, my scripting skills arent good, lol. No filling stations yet, or no way to refill the tank, not to mention that one tank is for every car in the game. And it currently drains fuel based on the speed.

AngryAmoeba
  • AngryAmoeba

    Symbiote

  • Members
  • Joined: 12 Jan 2009

#18

Posted 14 February 2009 - 03:03 AM

Well that's a good start! And yes, sorry, my logic was wrong because I don't know much about the mechanics of cars. I figured only pushing the gas pedal used gas.

Andrew
  • Andrew

  • Inactive Staff
  • Joined: 21 Jul 2003
  • None

#19

Posted 14 February 2009 - 07:09 AM

I had a check into the Velocity value, its empty. So that can't be used to drive. I'm going to see if its possible to get a controller press.

Currently the petrol works like so.

-One tank for all cars
-Petrol is drained depending on the speed of the car.
-Amout used goes up in 0.25f increments expect at top speed where its a 2.0f drain
-Fuel is drained every second.

At the present moment, a tank that has 60 fuel, will get you from The Algonquin safehouse to somewhere on the first island. I tried to find a way to turn off the cars engine once you'd ran out of fuel, or set a flag to say can't start car. At the moment I'm having to freeze the cars position and turn on its hazard lights.

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#20

Posted 14 February 2009 - 08:29 AM

Good work Gangsta, sorry i cant be of more help. Hopefully you can continue to improve the mods realism.

Andrew
  • Andrew

  • Inactive Staff
  • Joined: 21 Jul 2003
  • None

#21

Posted 14 February 2009 - 08:59 AM Edited by Gangsta Killa, 14 February 2009 - 09:02 AM.

I'm trying, not got time to work on it today, until later on tonight. I'm using the .net scripthook. Having some fun with the native calls now.

I've got a couple of ideas on how to store fuel for a few different cars.

Edit: Trying to work out how the "SET_ENGINE_ON" native works, each way I've tried causes an error in the script.

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#22

Posted 14 February 2009 - 09:05 AM

Did you try to set the EngineHealth of the car to 0? It would be a way to stop it from working.

Gen0cide_
  • Gen0cide_

    Rat

  • Members
  • Joined: 16 Jan 2009

#23

Posted 14 February 2009 - 05:43 PM

But then, say you coasted into the petrol station, you wouldn't be able to refuel as youre engine would be destroyed.

Oh, and couldn't you dump saved petrol info into a txt file in a folder that the script could create. If you label it according to what slot the game is saved in, and have the info apply itself to certain car names at each safehouse in a certain order, you would only get mismatched petrol values when there are two cars at the same safehouse at the same time. And that wouldn't really matter as the only real difference is probably the color of the cars

Pandur
  • Pandur

    Player Hater

  • Members
  • Joined: 10 Jan 2009

#24

Posted 14 February 2009 - 07:19 PM

QUOTE
Did you try to set the EngineHealth of the car to 0? It would be a way to stop it from working.


Hmm, also it will force the engine to smoke...

SET_ENGINE_ON only lets the char restart the engine, as far as I know. I tried to make a lua file that makes the char turning engines on and off without leaving the car. For me, it was only possible with a tricky function...

I havent found a native that forces the engines off till now.

the_gas
  • the_gas

    Rat

  • Members
  • Joined: 11 Jun 2005

#25

Posted 14 February 2009 - 08:08 PM

Guys, gonna level with you. I ain't got a clue what you are on about, but we have faith in you to make this mod possible. happy.gif

Leopard_
  • Leopard_

    Call me Leo.

  • Members
  • Joined: 21 Jun 2008

#26

Posted 14 February 2009 - 08:23 PM Edited by Leopard_, 14 February 2009 - 09:11 PM.

QUOTE (the_gas @ Feb 14 2009, 20:08)
Guys, gonna level with you. I ain't got a clue what you are on about, but we have faith in you to make this mod possible.  happy.gif

Good news for you. I've done an gas mod (with an working gas station!). Going to release soon i think.. just gonna have to upload it. I'll edit this post when i have uploaded it.

EDIT:
Fuel mod, right here.

Leopard

Pandur
  • Pandur

    Player Hater

  • Members
  • Joined: 10 Jan 2009

#27

Posted 14 February 2009 - 10:06 PM

QUOTE
Good news for you. I've done an gas mod (with an working gas station!). Going to release soon i think.. just gonna have to upload it. I'll edit this post when i have uploaded it.


wow.gif Awesome!!! I definitelly try this one out!!!

Andrew
  • Andrew

  • Inactive Staff
  • Joined: 21 Jul 2003
  • None

#28

Posted 14 February 2009 - 11:22 PM

QUOTE (HazardX @ Feb 14 2009, 10:05)
Did you try to set the EngineHealth of the car to 0? It would be a way to stop it from working.

I did indeed, set to 0, but it smokes and continues to run until you crash it then it stops.

@Leopard, how did you manage to stop the cars engine?

Leopard_
  • Leopard_

    Call me Leo.

  • Members
  • Joined: 21 Jun 2008

#29

Posted 14 February 2009 - 11:54 PM

QUOTE (Gangsta Killa @ Feb 14 2009, 23:22)
@Leopard, how did you manage to stop the cars engine?

I turned off the engine, then setted the engine health to 0. Combination works great. Niko never success starting the car tounge2.gif
But the smoke appears, which i don't want.
Might aswell share what i have...
CODE

void OnVehicleFuelStop(Ped ped)
{
Vehicle veh;
GetCarCharIsUsing(ped, &veh);
SetEngineHealth(veh, 0.0);
SetCarEngineOn(veh, 0, 1);
BottomText("Out of fuel", 4000);
}



sammclean23
  • sammclean23

    Playa

  • Members
  • Joined: 21 Jul 2007

#30

Posted 14 February 2009 - 11:54 PM

going to go in game tonight and find more stations

have you found any others since the one included in the mod (leopard)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users