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
cheers,
JohnTooray aka. 2Ray


