GIVE_WEAPON after dead.

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
Greg
Ped
Ped
Posts: 4
Joined: Thu Jul 05, 2012 7:47 pm
Location: Poland

GIVE_WEAPON after dead.

Post by Greg » Sun Jul 22, 2012 8:52 am

Hi all.

I have a little problem with script. It don't work correctly.
PLAYER_PED p1 = ( 136.50, 137.50, 3.00 ) 10 180

COUNTER loop = 1

LEVELSTART

WHILE_EXEC ( loop = 1 )
IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ) )
GIVE_WEAPON ( p1 , ROCKET_LAUNCHER , 10 )
ENDIF
ENDWHILE

LEVELEND
Script description:
When the game started, player has 99 rockets (infinite). When he respawned, he has 10, 20, 30 ... 99 rockets (infinite again).

I want to player gets only 10 rockets.

I wait for help, thanks : )

User avatar
Sektor
Boss
Boss
Posts: 1366
Joined: Tue Mar 04, 2008 6:51 am
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GIVE_WEAPON after dead.

Post by Sektor » Sun Jul 22, 2012 9:14 am

I'm surprised I've never played a map where everyone respawns with limited ammo. Usually it's none or infinite ammo.

This should do it:

[mis]
PLAYER_PED p1 = ( 136.50, 137.50, 3.00 ) 10 180

COUNTER loop = 1
COUNTER p1died = 0

LEVELSTART

GIVE_WEAPON ( p1, ROCKET_LAUNCHER, 10 )

WHILE_EXEC ( loop = 1 )

IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))

IF ( HAS_CHARACTER_DIED ( p1 ))
SET p1died = 1
ELSE
IF ( p1died = 1 )
GIVE_WEAPON ( p1, ROCKET_LAUNCHER, 10 )
SET p1died = 0
ENDIF
ENDIF

ENDIF

ENDWHILE
LEVELEND
[/mis]

Greg
Ped
Ped
Posts: 4
Joined: Thu Jul 05, 2012 7:47 pm
Location: Poland

Re: GIVE_WEAPON after dead.

Post by Greg » Sun Jul 22, 2012 9:31 am

Thanks, Sektor. It's working very well!

I have a very interesting idea for my map : ).

User avatar
Pyro
Immortal
Posts: 414
Joined: Wed Mar 17, 2010 4:07 am
GH nick: Pyro
Location: Wales, UK

Re: GIVE_WEAPON after dead.

Post by Pyro » Sun Jul 22, 2012 5:02 pm

Like Sektor said, I'm surprised you don't just give 99 straight away. Inside that loop you'll get ammo so quickly you might as well make it 99 anyway! Still, Sektors' code will work for what you need for limited ammo after death.

User avatar
T.M.
Immortal
Posts: 957
Joined: Fri Jan 29, 2010 3:00 pm
Location: F21B3EED

Re: GIVE_WEAPON after dead.

Post by T.M. » Mon Jul 23, 2012 8:41 am

I would make it to give 1 rocket at a time instead. It would look better since you actually see the ammo going up then.

Post Reply