Problems with script - get weapons when entering gang cars

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
User avatar
JohnTooray
Mugger
Mugger
Posts: 19
Joined: 06 May 2011, 11:43
Location: Munster, Germany

Problems with script - get weapons when entering gang cars

Post by JohnTooray »

Hey folks!

Here is a script written by me. When entering a car of a specific gang you maybe find a machine gun or grenades inside. But there are some things I'm unhappy with. The following parts are kinda sloppy:
The script checks if the player is in a Black Shark. Is there a better way to handle this? The script shouldn't work with EVERY black Shark but only with real gangcars.
Also you can exit the car and reenter it and you get another weapon depending on the random value. I work around with "gangcounter" which counts up for a quite long time. So in fact most cars are wrecked or given up by the player in this time. But that means also that you won't get any weapons in any other gangcar you enter untill "gangcounter" hits 20000. Is there maybe a possibility to check if you are in ANOTHER car? Or does anyone know a better way to handle this problem?

And here's the script:

Code: Select all

COUNTER loop = 1
COUNTER random = 0
COUNTER gangcar = 0
COUNTER in_gangcar = 0
COUNTER gangcounter = 0

CAR_DATA current_car


LEVELSTART


WHILE_EXEC ( loop = 1 )
  ++ random
  IF ( IS_CHARACTER_IN_ANY_CAR (player) )
    STORE_CAR_CHARACTER_IS_IN (player, current_car)
    IF ( ( CHECK_CAR_MODEL_AND_REMAP (current_car, GRAHAM , 2) ) AND ( HAS_CAR_GOT_DRIVER (current_car) ) )
      IF ( gangcar = 0 )
        IF ( ( ( random = 2 ) OR ( random = 11 ) ) OR  ( random = 18 ) )
  	  GIVE_WEAPON (player, GRENADE, 10)
  	  SET gangcar = 1
  	  SET in_car = 1
	ENDIF
	IF ( ( ( random = 6 ) OR ( random = 17 ) ) OR  ( random = 20 ) )
          GIVE_WEAPON (player, MACHINE_GUN, 15)
          SET gangcar = 1
          SET in_car = 1
        ENDIF
      ENDIF
    ENDIF
  ELSE
    IF ( in_car = 1 )
      SET in_car = 0
    ENDIF
  ENDIF
  IF ( gangcar = 1)
    ++ gangcounter
  ENDIF
  IF ( ( gangcounter = 20000) AND ( in_car = 0 ) )
    SET gangcar = 0
    SET gangcounter = 0
  ENDIF
  IF (random = 20)
    SET random = 0
  ENDIF
ENDWHILE
I'm thankful for every hint or help I can get :)

cheers,
JohnTooray aka. 2Ray
Last edited by JohnTooray on 26 May 2011, 21:49, edited 1 time in total.

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

Re: Problems with scipt - get weapons when enering gang cars

Post by elypter »

i have done something similar in tiny tiny town army already.
i don't check for a gang car, only for the car type. I don't know a way to check for gang cars but you can check for type and remap and disable cars in traffic with that color in the sty file.

because it looks like you are interested in more complex scripting i suggest to take a look at the following maps (the first ones are probably the most interesting):

bc awkward cargo
tiny face off army lite (its a completely different scripting that in tiny tiny town army)
tiny tiny town army
destruction derby reloaded
dafes death valley
golden lap
rocket chamber ep +hd + pe
bff wipeout
911
bernaar race
ra2 zooka no respect
decon king
prison break
flame zooka arena(not released)
lorn theatre (the shield is also in tiny face off army lite already)
multislayer cops & robbers
the original bil.mis
pyros testing scripts
various singleplayer maps maybe

you can find them here: http://gta2dare.omnitude.net/maplist/li ... mode=exist
or in my packs
yur sa'nok ngeyä

User avatar
JohnTooray
Mugger
Mugger
Posts: 19
Joined: 06 May 2011, 11:43
Location: Munster, Germany

Re: Problems with script - get weapons when entering gang ca

Post by JohnTooray »

Hey thanks for the tip with the sty file. Haven't looked very much in that stuff. I don't even know there's a way to change which remaps appears ingame. Thought that's hardcoded or so...

For the maps:
Playtested some of them randomly in gh play alone mode. But not that much. Always to busy working on my map and script called "GTaGazze".


cheers
2Ray

Post Reply