Cleaning up mines and oil slicks

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
petr0
Mugger
Mugger
Posts: 11
Joined: 12 Jan 2011, 14:28
GH nick: petr0

Cleaning up mines and oil slicks

Post by petr0 »

Mines and oil are OK when used dynamicly, during the pursuit. But with oil you can for example permanently block access to electrogun on tiny town and mines can turn GTA2 into mine sweaper game. So I wonder if it's posible on the script level to:
a) make mines and oil disappear X seconds after planting
b) make the limit of simulaniously existing mines on the map really small, like 3 for example; same for oil
c) clean up whole map from mines and oil every X seconds

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

Re: Cleaning up mines and oil slicks

Post by Sektor »

If you place many of them then the old ones vanish. You could try creating many oil slicks using script to see if that clears old ones.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: Cleaning up mines and oil slicks

Post by elypter »

afaik destructors delete oil and mines. you can switch them on or off(create/delete) when you need them. Unfortunately they do not work inside a while_exec loop
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: Cleaning up mines and oil slicks

Post by Sektor »

DELETE_ITEM doesn't remove DESTRUCTORs. SWITCH_GENERATOR can turn them off but it can't turn them back on.

Does CREATE_DESTRUCTOR even work? There was nothing created when I used it. I can create them with DESTRUCTOR name but that means each one has to have a unique name.
petr0
Mugger
Mugger
Posts: 11
Joined: 12 Jan 2011, 14:28
GH nick: petr0

Re: Cleaning up mines and oil slicks

Post by petr0 »

Sektor wrote:If you place many of them then the old ones vanish. You could try creating many oil slicks using script to see if that clears old ones.
Can I create 100 mines with a nice little loop or do I have to write CREATE_OBJ 100 times?
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Cleaning up mines and oil slicks

Post by Sektor »

You can use a loop to create objects. I tested it and the oil that I started on vanished.

Code: Select all

PLAYER_PED player = (50.5, 46.5, 2.0) 25 0

OBJ_DATA slick
COUNTER loop = 1

LEVELSTART 

slick = CREATE_OBJ ( 50.5 , 46.5 ) 0 OIL  END

WHILE_EXEC ( loop < 100 )
  slick = CREATE_OBJ ( 50.5 , 45.5 ) 0 OIL  END
  ++loop
ENDWHILE

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

Re: Cleaning up mines and oil slicks

Post by elypter »

i experimented with destructors on tiny tiny town army. i have in mind that i got something work at least a bit but i have to check. chances exist but it is not a very good method anyway.
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: Cleaning up mines and oil slicks

Post by Sektor »

This constantly creates oil in one spot. Oil will vanish and mines will explode.

Code: Select all

//script meant for ste.gmp and ste.sty
PLAYER_PED p1 = (50.5, 50.0, 2.0) 25 0
PARKED_CAR_DATA car = (51.5, 50.0, 2.0) 0 0 GT24640

OBJ_DATA slick
COUNTER loop = 1

LEVELSTART

GIVE_WEAPON ( car, CAR_OIL )
GIVE_WEAPON ( car, CAR_MINE )

slick = CREATE_OBJ ( 50.5 , 50.0 ) 0 OIL  END

WHILE_EXEC ( loop = 1 )
  slick = CREATE_OBJ ( 50.5 , 51.0 ) 0 OIL  END
ENDWHILE

LEVELEND
You can make objects explode/vanish even faster by duplicating the slick = CREATE_OBJ line.
petr0
Mugger
Mugger
Posts: 11
Joined: 12 Jan 2011, 14:28
GH nick: petr0

Re: Cleaning up mines and oil slicks

Post by petr0 »

Works great, Sektor! But it should bo slower, not faster, so this is what I ended with:

Code: Select all

WHILE_EXEC (loop = 1) //the main loop

SET cleaner = (cleaner + 1)
IF (cleaner = 10)  // here you can balance objects time to live, 10 works for me - its about half a minute
  SET cleaner = 1 
  theoil = CREATE_OBJ ( 0.5 , 0.5 ) 0 OIL  END
ENDIF

// other stuff ...
But here comes the questions:
1. Oil and mines have common limit. Does this limit affect some other objects too?
2. Is it possible to make oil's time to live longer than mine's?
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Cleaning up mines and oil slicks

Post by Sektor »

1. I believe all objects share the same limit. So if there were footballs on the map then they would be removed if you dropped 88 mines.
2. No.
Post Reply