Page 2 of 3

Re: Script Help.

Posted: 04 Jul 2009, 11:01
by BenMillard
Guide to GTA2 gang scripting, including special arrows. The arrow_id part is where the phone arrow colour is set.

In multiplayer games, these coloured arrows point to other players. So it's a bad idea to use this type of arrow in normal multiplayer games. But in a game with 2 colour-coded teams you will have 4 spare colours.

Re: Script Help.

Posted: 04 Jul 2009, 11:34
by Razor
im creating sp missions and i need arrows to red,green,yellow phones :) not just to zone of gang declared by Set_gang_info

Re: Script Help.

Posted: 02 Aug 2009, 19:18
by Shazdeh
SET_ARROW_COLOR
wont it help you?

/////////////////////////////////////////////////////////////

Should I ask my questions about scripting in here or open a new topic for them?

Re: Script Help.

Posted: 23 Sep 2009, 14:33
by Gustavob
I think they're made with General Trigger zones, named with the first letters of the words of the phone name or with the phone name itself. But I'm not sure

Re: Script Help.

Posted: 23 Sep 2009, 21:52
by Razor
you can set phone arrows by zone i think :) and if you correctly create phone + zone then arrows should show themselfs :P

Re: Script Help.

Posted: 03 Jan 2010, 15:03
by ALPINE
I'm going to write a mission. I wrote scripts before (and built a map), but it was a long time ago...

It's normal to use WHILE block like this?

Code: Select all

COUNTER mission_stage = 0
COUNTER TRUE = 1

WHILE (TRUE = 1) // infinite loop
  IF (mission_stage = 1)
     /* big code implements mission stage #1 
        contains a lot of checks like IF (LOCATE_CHARACTER_BY_FOOT(...) ...
        contains similar blocks IF (mission_substage = 1)... = 2.... =3...
        and set "mission_stage" to 2 when it's needed */
  ENDIF
  IF (mission_stage= 2) 
    /* big code implements mission stage #2 */
    /* etc */
  ENDIF
  /* some code here, that must be executed anyway 
     (checking death of important persons, 
     messaging "Mission Failed" and reset mission_stage to 1, etc)   */
ENDWHILE
It's correct? It's good style of coding for gta2 or there must be another concept of script?

Re: Script Help.

Posted: 03 Jan 2010, 15:11
by Sektor
That style is normal.

Re: Script Help.

Posted: 03 Jan 2010, 18:07
by ALPINE
Is here function to check distance between object A and B? Something like LOCATE_CHARACTER_ANY_MEANS(), but takes another object as second parameter, not (x,y,z) coordinate.

Re: Script Help.

Posted: 03 Jan 2010, 18:57
by Gustavob
There's no command for checking if an object is somewhere or to check if "this object is at X blocks of distance of that object", although theres a command that checks if an item (object, character, car etc) is onscreen.

Re: Script Help.

Posted: 03 Jan 2010, 19:17
by ALPINE
Great.
I want to bring bastard-character to attack player only if he is near the defined object. So I if this object is onscreen, that means player is near it. Check will be fine.

One more question:
I need AI Character that will be follow the player. I found objective GOTO_CHAR_ON_FOOT, but if player takes a car, character must enter this car as passenger. Must I manually write this behaivor? Or there is easy way to bring the character follow player?

Re: Script Help.

Posted: 03 Jan 2010, 19:22
by Gustavob
You can make the character follow the player in another car (create a car and set bastard-character's objective to enter the car, then check if he is in car before setting his objective to FOLLOW_CAR_IN_CAR) or you can make this:

Code: Select all

IF ( IS_CHARACTER_IN_ANY_CAR ( player ) )
 STORE_CAR_CHARACTER_IS_IN ( player , player_car )
 SET_CHAR_OBJECTIVE ( bastard , ENTER_CAR_AS_PASSENGER , player_car )
ENDIF
This will check if player is in any car and store it as if it was scripted with car_data and make the bastard character enter player's car as passenger.

I think it works. If it dont tell us.

Re: Script Help.

Posted: 03 Jan 2010, 19:41
by ALPINE
OK but he must leave car if player leaves (he just copy player actions). I'll write this behaivor myself. Thank you ;)

I'm writing COOPERATIVE mission for Industrial (bil). No map change (same GMP file), location of all stuff is taken from example bil.mis file. I hope mission will be good.

Re: Script Help.

Posted: 03 Jan 2010, 19:46
by Gustavob
Just check if player exit car with IF ( NOT ( IS_CHARACTER_IN_CAR ( player , player_car ) ) and set the bastard-character's objective to exit car and go to player. Might work


EDIT: Also, I forgot something:

Code: Select all

ADD_GROUP_TO_CHARACTER ( player )
ADD_EXISTING_CHAR_TO_GROUP ( bastard )

Re: Script Help.

Posted: 03 Jan 2010, 22:03
by Razor
Gustavob wrote:Just check if player exit car with IF ( NOT ( IS_CHARACTER_IN_CAR ( player , player_car ) ) and set the bastard-character's objective to exit car and go to player. Might work


EDIT: Also, I forgot something:

Code: Select all

ADD_GROUP_TO_CHARACTER ( player )
ADD_EXISTING_CHAR_TO_GROUP ( bastard )
use that command it is better and easier :)

Re: Script Help.

Posted: 04 Jan 2010, 00:03
by ALPINE
ADD_GROUP_TO_CHARACTER ( player )
ADD_EXISTING_CHAR_TO_GROUP ( bastard )
I asked exactly about trick like this :) Thanks :)

Re: Script Help.

Posted: 04 Jan 2010, 02:25
by ALPINE
Now I have some problems with FIRE_AT_OBJECT_FROM_VEHICLE.

If I try to fire a car or another character, game crashes. Firing object like FOOTY (ball) not crashes the game. Any suggestions?

If I try to steal firing tank, game crashes, because character with "FIRE_AT_OBJECT_FROM_VEHICLE" objective is now on foot (kicked from tank by me). So tank must be unstealable...

AI Characters can only shoot using TANK? That about GUNJEEP, FIRETRUK with water cannon or flame thrower?

Re: Script Help.

Posted: 04 Jan 2010, 10:46
by Heri
FIRE_AT_OBJECT_FROM_VEHICLE "Orders the character to fire from his current vehicle at a particular object. Really only useful when the character is inside a tank! Set ‘second item’ to be the name of the object to fire at. Only works with Tank at moment!!"

I just made script ( the characters inside tank, gunjeep, firetruck - can use the car weapons )

Code: Select all

// Players
PLAYER_PED p1 = ( 150.3 , 109.0 , 7.0 ) 25 270

PARKED_CAR_DATA  tank_car = ( 150.3 , 111.0 , 7.0 ) 34 0 TANK 
PARKED_CAR_DATA  jeep_car = ( 150.3 , 107.0 , 7.0 ) 34 0 GUNJEEP

CHAR_DATA tank_char
CHAR_DATA jeep_char

COUNTER loop = 0
COUNTER step = 0

LEVELSTART

WHILE_EXEC ( loop = 0 )

IF ( step = 0)
 tank_char = CREATE_CHAR_INSIDE_CAR ( tank_car ) 13 criminal END
 jeep_char = CREATE_CHAR_INSIDE_CAR ( jeep_car ) 13 criminal END 
 SET step = 1
ENDIF

IF (step = 1)
 //TANK
 SET_CHAR_MAX_DRIVESPEED ( tank_char , 0.0 ) // Tank doesn't move
 SET_CHAR_TO_STAY_IN_CAR ( tank_char , ON )  
 SET_CHAR_OBJECTIVE ( tank_char , KILL_CHAR_ANY_MEANS , p1 )
 SET_CHAR_TO_USE_CAR_WEAPON ( tank_char , ON )
 //JEEP 
 SET_CHAR_MAX_DRIVESPEED ( jeep_char , 0.1 )  
 SET_CHAR_TO_STAY_IN_CAR ( jeep_char , ON )  
 SET_CHAR_OBJECTIVE ( jeep_char , KILL_CHAR_ANY_MEANS , p1 )
 SET_CHAR_TO_USE_CAR_WEAPON ( jeep_char , ON )
ENDIF

ENDWHILE


LEVELEND

Re: Script Help.

Posted: 04 Jan 2010, 11:23
by ALPINE
Heri, I can read manual.
I ask about this strange bugs and maybe undocumened features of this behaivor. Check out Sektor's "Super tank" - is this function documented? ;)

UPD: Thanks. Does it work? By the way, I didn't use SET_CHAR_TO_USE_CAR_WEAPON... maybe this was a problem.

Re: Script Help.

Posted: 04 Jan 2010, 12:31
by Heri
I tested it, it works great =]

Re: Script Help.

Posted: 04 Jan 2010, 13:36
by ALPINE
OK It will be useful...

By the way - I sent the letter to Rockstargames about opening gta2 source :) Maybe they will respond :)