Script Help.

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: Script Help.

Post 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.
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: Script Help.

Post 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
Shazdeh
Psycho
Psycho
Posts: 60
Joined: 29 Jul 2009, 20:22
GH nick: Dont_have_yet

Re: Script Help.

Post 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?
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Script Help.

Post 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
You just lost the game.
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: Script Help.

Post by Razor »

you can set phone arrows by zone i think :) and if you correctly create phone + zone then arrows should show themselfs :P
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post 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?
.4LPINE
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Script Help.

Post by Sektor »

That style is normal.
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post 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.
.4LPINE
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Script Help.

Post 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.
You just lost the game.
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post 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?
.4LPINE
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Script Help.

Post 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.
Last edited by Gustavob on 03 Jan 2010, 19:51, edited 1 time in total.
You just lost the game.
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post 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.
.4LPINE
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: Script Help.

Post 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 )
You just lost the game.
Razor
Lunatic
Lunatic
Posts: 456
Joined: 19 Jul 2008, 14:14
GH nick: Razor, R
Location: Poland / Szczecin
Contact:

Re: Script Help.

Post 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 :)
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post by ALPINE »

ADD_GROUP_TO_CHARACTER ( player )
ADD_EXISTING_CHAR_TO_GROUP ( bastard )
I asked exactly about trick like this :) Thanks :)
.4LPINE
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post 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?
.4LPINE
Heri
Jaywalker
Jaywalker
Posts: 5
Joined: 28 Dec 2009, 22:03
GH nick: Heri

Re: Script Help.

Post 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
Last edited by Heri on 04 Jan 2010, 11:39, edited 1 time in total.
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post 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.
.4LPINE
Heri
Jaywalker
Jaywalker
Posts: 5
Joined: 28 Dec 2009, 22:03
GH nick: Heri

Re: Script Help.

Post by Heri »

I tested it, it works great =]
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Script Help.

Post by ALPINE »

OK It will be useful...

By the way - I sent the letter to Rockstargames about opening gta2 source :) Maybe they will respond :)
.4LPINE
Post Reply