Page 1 of 1

Problems with script - get weapons when entering gang cars

Posted: 26 May 2011, 16:25
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


WHILE_EXEC ( loop = 1 )
  ++ random
    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
	IF ( ( ( random = 6 ) OR ( random = 17 ) ) OR  ( random = 20 ) )
          GIVE_WEAPON (player, MACHINE_GUN, 15)
          SET gangcar = 1
          SET in_car = 1
    IF ( in_car = 1 )
      SET in_car = 0
  IF ( gangcar = 1)
    ++ gangcounter
  IF ( ( gangcounter = 20000) AND ( in_car = 0 ) )
    SET gangcar = 0
    SET gangcounter = 0
  IF (random = 20)
    SET random = 0
I'm thankful for every hint or help I can get :)

JohnTooray aka. 2Ray

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

Posted: 26 May 2011, 17:06
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
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: ... mode=exist
or in my packs

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

Posted: 27 May 2011, 21:09
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".