Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    2. News

    1. Red Dead Redemption 2

      1. News
      2. Red Dead Online
      3. The Armadillo Inn
    1. GTA Online

      1. After Hours
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

Alexander Blade

[V] Script/Native Documentation and Research

Recommended Posts

sjaak327

 

 

 

nicer does not mean better :lol:

I'm talking specifically about interacting with GTAIV engine using the c++ hook only or interacting through the .net scripthook.

 

The .Net hook DOES in fact make the scripters job easier and to me that is better. I'm not talking which language is better as we all know c++ has it's advantages and .Net has its advantages. Just talking about working with the 2 hooks available.

 

Not to mention the .Net hook allows me to reload scripts I'm working on in game. I love being able to Alt-Tab to VS, change code... compile with a post build event to install the dll and alt-Tab back into game within a few seconds. This is all a matter of how things were designed and the .Net hook is so much nicer.

 

Aru's hook also has the ability to reload on the fly. I prefer the c++ hook over a.net precisely because it allows for more freedom, including the ability to call natives by hash. And it doesn't add another dependency just because it is easier to use, easy doesn't mean it is better.

 

what freedom do u gain i wonder? how do u reload asi scripts then?

 

plus i like c#... it really depends on what u like to code in

 

The .net hook didn't call game natives directly (even though you could call them directly) and had many things preconfigured. Yes that is indeed easier to use but makes customization harder to achieve.

 

The scripthook came with a development loader in which any asi/dll that was loaded could be unloaded and reloaded. Including the .net scripthook by the way. Which is another downside I mentioned before, it is another layer.

Edited by sjaak327

Share this post


Link to post
Share on other sites
Noox

I like c++ because in c++ we can recreate original game scripts and ingame there were many amazing things and also connected animations like the man stealing bicycle from the women in bus assasination mission etc. i was looking at the scripts and i began to understand. THe big problem is there are thousands of useless lines in the file all are + - + 0xc bit and strange things

These are not useless lines... 0x means you're writing a hex code.

Share this post


Link to post
Share on other sites
byteMe420

 

 

 

 

nicer does not mean better :lol:

I'm talking specifically about interacting with GTAIV engine using the c++ hook only or interacting through the .net scripthook.

 

The .Net hook DOES in fact make the scripters job easier and to me that is better. I'm not talking which language is better as we all know c++ has it's advantages and .Net has its advantages. Just talking about working with the 2 hooks available.

 

Not to mention the .Net hook allows me to reload scripts I'm working on in game. I love being able to Alt-Tab to VS, change code... compile with a post build event to install the dll and alt-Tab back into game within a few seconds. This is all a matter of how things were designed and the .Net hook is so much nicer.

 

Aru's hook also has the ability to reload on the fly. I prefer the c++ hook over a.net precisely because it allows for more freedom, including the ability to call natives by hash. And it doesn't add another dependency just because it is easier to use, easy doesn't mean it is better.

 

what freedom do u gain i wonder? how do u reload asi scripts then?

 

plus i like c#... it really depends on what u like to code in

 

The .net hook didn't call game natives directly (even though you could call them directly) and had many things preconfigured. Yes that is indeed easier to use but makes customization harder to achieve.

 

The scripthook came with a development loader in which any asi/dll that was loaded could be unloaded and reloaded. Including the .net scripthook by the way. Which is another downside I mentioned before, it is another layer.

 

i see your point but i dont see the issue with another layer or an extra dependency with modding this game. Everything in the pc uses some api or dependency. I dont think we can notice the extra calls unless u run some tests but i believe it isnt significant so u go with what is easier to write instead of what may loop faster. I do get your point of customization but you can still do that in .net as u dont have to use the wrapped code. I actually check the source to see how the wrapped code works and i use or change when appropriate. I don't mean to get into a which hook is better debate because in the end it depends on which hook will allow u to accomplish your goal in a simple way. The .net hook wrapped code does have some nice helper code.

 

Also didnt realize u could unload.load asi scripts :O

 

edit: i also forgot to mention about yeah .net has to use JIT compiling but is this really a performance killer for gta? i have written asi scripts and then made the exact same script in .net and they behave the same

Edited by byteMe420

Share this post


Link to post
Share on other sites
GooD-NTS

I'd prefer to have native scripting through #sc editing than any of external hooks.

Share this post


Link to post
Share on other sites
NTAuthority

I'd prefer to have native scripting through #sc editing than any of external hooks.

Native scripts lack debugger support and any development assistance whatsoever without completely changing the interpreter.

Share this post


Link to post
Share on other sites
unknown modder

I'd prefer to have native scripting through #sc editing than any of external hooks.

 

Agreed, much simpler and dont have to worry about any issues from those external hooks. I know people trying to get RPC working for ps3 are having trouble calling certain natives due to the function they are hooking into.

Share this post


Link to post
Share on other sites
Deji

Well, I'd prefer to, this time, completely skip all the documenting, researching and pain of most of this "native" stuff and just dive straight into my current idea of doing everything in a more custom/new way which is actually made to be modded instead of hacking something which isn't until we can use it. To me, our weakness has always been how long and tiring the fight to understand Norths custom formats, instead of doing the harder (at first) job of diving straight into the executable and hooking our own formats into it instead, which we'll have full control over, and actually understand.

Edited by Deji

Share this post


Link to post
Share on other sites
unknown modder

Well, I'd prefer to, this time, completely skip all the documenting, researching and pain of most of this "native" stuff and just dive straight into my current idea of doing everything in a more custom/new way which is actually made to be modded instead of hacking something which isn't until we can use it. To me, our weakness has always been how long and tiring the fight to understand Norths custom formats, instead of doing the harder (at first) job of diving straight into the executable and hooking our own formats into it instead, which we'll have full control over, and actually understand.

the executable tells us pretty much everything we need to know about the games file formats, its just the case of finding it. the only unknowns about the script files are really all native documentation and global variable documentation.

Things like knowing Global_2097152 is the array(of only 1 item for some reason) that stores all info relating to things like your garage cars and mp property

Share this post


Link to post
Share on other sites
Deji

 

Well, I'd prefer to, this time, completely skip all the documenting, researching and pain of most of this "native" stuff and just dive straight into my current idea of doing everything in a more custom/new way which is actually made to be modded instead of hacking something which isn't until we can use it. To me, our weakness has always been how long and tiring the fight to understand Norths custom formats, instead of doing the harder (at first) job of diving straight into the executable and hooking our own formats into it instead, which we'll have full control over, and actually understand.

the executable tells us pretty much everything we need to know about the games file formats, its just the case of finding it. the only unknowns about the script files are really all native documentation and global variable documentation.

Things like knowing Global_2097152 is the array(of only 1 item for some reason) that stores all info relating to things like your garage cars and mp property

 

Meh, not looked into that side of things yet. I'm still fully focused on working on completely separate things, which CAN be implemented on V when the proper time comes, or any other game for that matter. With the games file formats, we can only do the things they're made for. With a good enough understanding of the executable, we can do anything. All we have to do is work on our own formats and tools, then find a way to implement them.

 

Cracking formats is the easier, and possibly quicker of the two options at first, but to have our own open-source tools and formats which can be adapted to all the GTA games is my current stance. I'm all for cracking North's formats, mostly just because I'm interested in their development processes, but I reckon infinite power can only be gained by doing something a lot more independent.

Share this post


Link to post
Share on other sites
NTAuthority

 

I'd prefer to have native scripting through #sc editing than any of external hooks.

 

Agreed, much simpler and dont have to worry about any issues from those external hooks. I know people trying to get RPC working for ps3 are having trouble calling certain natives due to the function they are hooking into.

 

... that's just a case of the 'current thread' variable being unset, at least assuming 'certain natives' include model requesting and whatnot.

Share this post


Link to post
Share on other sites
sjaak327

I'd prefer to have native scripting through #sc editing than any of external hooks.

The problem with that is that it requires users to edit the scripts.rpf. At the time the hooks for IV were released, there wasn't even an option to edit game scripts directly.

 

I personally use win32 API calls for some of my stuff (apart from the game natives, and using VS and compile is preferred over editing the scripts directly imho.

Share this post


Link to post
Share on other sites
Deji

By the way, does anyone have any plans for inevitable .exe patches? There's obviously gonna be loads of them and they will screw our progress up with each update.

Share this post


Link to post
Share on other sites
NTAuthority

By the way, does anyone have any plans for inevitable .exe patches? There's obviously gonna be loads of them and they will screw our progress up with each update.

pattern-based matching of code

Share this post


Link to post
Share on other sites
Alexander Blade

Quite a discussion you have here , I guess you guys forgot that script editing usually means

1. Decompiler -> Compiler (a lot of stuff to do in order to make code compilable) , not talking about tools which force user to deal with low level

2. Rpf editing each time you change the script - this is not user friendly at all

3. Possibility to break game saves (it's harder than it was for IV but still)

4. As was mentioned above - requires custom debugger writing

5. You will definitely need to write custom natives in order to extend functionality

6. ?????

7. PROFIT

 

It is 7 : 1 :D

 

unknown modder

Everything works fine when you are doing it the way game does

 

Deji

The simplest way is actually the one with editing resources as they are (like it is in openFormats) , resource is a game class memory dump , which is being directly mapped into the game's class instance , it's not possible to change internal stuff like this without rewriting rage from scratch :) Unification is definitely good but only when it's not being overcomed by per-resource unique features .

Edited by Alexander Blade

Share this post


Link to post
Share on other sites
unknown modder

Quite a discussion you have here , I guess you guys forgot that script editing usually means

1. Decompiler -> Compiler (a lot of stuff to do in order to make code compilable) , not talking about tools which force user to deal with low level

2. Rpf editing each time you change the script - this is not user friendly at all

3. Possibility to break game saves (it's harder than it was for IV but still)

4. As was mentioned above - requires custom debugger writing

5. You will definitely need to write custom natives in order to extend functionality

6. ?????

7. PROFIT

 

It is 7 : 1 :D

 

unknown modder

Everything works fine when you are doing it the way game does

If you know how to use the low level its still pretty easy to write fairly advanced scripts with it. You have seen the things me and toothpik(and a few others) have made just creating scripts in low level.

Share this post


Link to post
Share on other sites
Alexander Blade

Well low level is a low level , no more no less , thats why Write in C

 

 

Edited by Alexander Blade

Share this post


Link to post
Share on other sites
julionib

/\ lol

Share this post


Link to post
Share on other sites
TemporaryAccount7

Write in C not VB.

If Julio Writes in C he will make scripts better than the ones of rockstar.

Julio is the best gta coder. even better than Aaron Garbut, Adam Fowler, Adam Cochrane, The Benz and everyone

Edited by TemporaryAccount7

Share this post


Link to post
Share on other sites
Anas12

guys I new here, can you plz tell which software language should I use to code GTA V

Share this post


Link to post
Share on other sites
Alexander Blade

guys I new here, can you plz tell which software language should I use to code GTA V

You can't code for GTA V til PC release

Share this post


Link to post
Share on other sites
byteMe420

 

guys I new here, can you plz tell which software language should I use to code GTA V

You can't code for GTA V til PC release

 

Well when released, I imagine it will be setup for C++ like the previous scripthook. I know a V .net hook is planned as well.

Edited by byteMe420

Share this post


Link to post
Share on other sites
Alvarez

So, learn C++ to start understanding the code and later change to easier script languages is the key, huh?

 

Angel Script, Lua and C++ novice here.

Share this post


Link to post
Share on other sites
XeClutch

I knew you guys had something good in store for everyone, nice topic and research!

 

Fixes on your list:

 

 

Was: Any _0x499747B6(Any p0); // 0x499747B6Now: char *GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(Vehicle veh); // 0x499747B6
Was: Any NET_BUT(); // 0x6970BA94Now: bool NETWORK_IS_HOST_OF_THIS_SCRIPT(); // 0x6970BA94

 

 

 

 

My edits to the list (parameters, returns..ect..)

 

Namespace Vehicle:

 

void SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle veh, int r, int g, int b); // 0x8DF9F9BCvoid GET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle veh, int *r , int *g, int *b); // 0x1C2B9FEFvoid CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle veh); // 0x51E1E33D
Vehicle CREATE_VEHICLE(uint vehicleHash, float X, float Y, floayt Z, float heading, bool unk1, bool unk2); // 0xDD75460Avoid DELETE_VEHICLE(Vehicle *veh); // 0x9803AF60
void SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle veh, int r, int g, int b); // 0x9D77259Evoid GET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle veh, int *r, int *g, int *b); // 0x3FF247A2void CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle veh); // 0x7CE00B29
void SET_VEHICLE_NUMBER_PLATE_TEXT(Vehicle veh, char* plateText); // 0x400F9556char* GET_VEHICLE_NUMBER_PLATE_TEXT(Vehicle veh); // 0xE8522D58void SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(Vehicle veh, int plateindex); // 0xA1A1890E 
bool IS_VEHICLE_ATTACHED_TO_TRAILER(Vehicle veh); // 0xE142BBCCbool IS_VEHICLE_ON_ALL_WHEELS(Vehicle veh); // 0x10089F8Evoid SET_VEHICLE_SIREN(Vehicle veh, bool sirenOn); // 0x4AC1EFC7bool IS_VEHICLE_SIREN_ON(Vehicle veh); // 0x25EB5873bool IS_VEHICLE_SEAT_FREE(Vehicle veh, int seatIndex); // 0xDAF42B02

 

 

 

Namespace Player

 

 

char *GET_PLAYER_NAME(Player player);
bool IS_PLAYER_TARGETTING_ANYTHING(Player player); // 0x456DB50Dbool IS_PLAYER_FREE_AIMING(Player player); // 0x1DEC67B7bool IS_PLAYER_FREE_AIMING_AT_ENTITY(Player player, Entity e); // 0x7D80EEAAbool IS_PLAYER_DEAD(Player player); // 0x140CA5A8bool IS_PLAYER_PLAYING(Player p); // 0xE15D777F
int GET_MAX_WANTED_LEVEL(); // 0x457F1E44

 

 

 

Namespace Entity

 

 

uint GET_ENTITY_MODEL(Entity e); // 0xDAFCB3ECint GET_ENTITY_HEIGHT_ABOVE_GROUND(Entity e); // 0x57F56A4Dbool IS_ENTITY_A_PED(Entity e); // 0x55D33EABbool IS_ENTITY_A_MISSION_ENTITY(entity e); // 0x2632E124bool IS_ENTITY_A_VEHICLE(Entity e); // 0xBE800B01bool IS_ENTITY_AN_OBJECT(Entity e); // 0x3F52E561
void ATTACH_ENTITY_TO_ENTITY(Entity attachEntity, Entity targetentity, int unk1, float relativeXCoord, float relativeYCoord, float relativeZCoord, float relativeXRotation, float relativeYRotation, float relativeZRotation , int unk2, int unk3, int unk4, int unk5, int unk6, int unk7); // 0xEC024237
void DELETE_ENTITY(Entity *e); // 0xFAA3D236void DETACH_ENTITY(Entity e, int unk1, int unk2); // 0xC8EFCB41void FREEZE_ENTITY_POSITION(Entity e, bool freeze); // 0x65C16D57void SET_ENTITY_ROTATION(Entity e, float rX, float rY, float rZ, int unk1, int unk2); // 0x0A345EFEvoid SET_ENTITY_VISIBLE(Entity e, bool visible); // 0xD043E8E1bool IS_ENTITY_VISIBLE(Entity e); // 0x120B4ED5

 

 

 

Namespace Ped

 

 

bool IS_PED_A_PLAYER(Ped p); // 0x404794CA
Vehicle veh GET_VEHICLE_PED_IS_IN(Ped p, int unk); // 0xAFE92319bool IS_PED_IN_ANY_VEHICLE(Ped p, int unk1); // 0x3B0171EE

 

 

 

Namespace Gameplay

 

 

void SET_BIT(int* location, int bt); // 0x4EFE7E6Bvoid CLEAR_BIT(int* location, int bit); // 0x8BC9E618bool IS_BIT_SET(int location, int bit); // 0x902E26AC
void SET_TIME_SCALE(char* timeScaleName); // 0xA7F84694
bool IS_STRING_NULL(char* location); // 0x8E71E00Fbool IS_STRING_NULL_OR_EMPTY(char* location); // 0x42E9F2CA
uint GET_GAME_TIMER(); // 0xA4EA0691uint GET_FRAME_TIME(); // 0x96374262uint GET_FRAME_COUNT(); // 0xB477A015
int GET_RANDOM_FLOAT_IN_RANGE(int min, int max); // 0x0562C4D0float GET_RANDOM_INT_IN_RANGE(float min, float max); // 0x4051115B
void DISPLAY_ONSCREEN_KEYBOARD(int language, char *gxtName, char *unk1, char *defaultText, char *unk2, char* unk3, char* unk4, int maxMessageLen); // 0xAD99F2CEint UPDATE_ONSCREEN_KEYBOARD(); // 0x23D0A1CEchar *GET_ONSCREEN_KEYBOARD_RESULT(); // 0x44828FB3

 

 

I meant to reply earlier but SET_TIME_SCALE is wrong. If you look at the function it edits a float.

e230cdcdb381da653aea1cd88de3067e.png

 

Here you see it being called with a float.

1779ea1c7aef0641c0eef0bbcc681cf3.png

 

I use this and it works fine:

 

void SET_TIME_SCALE(float timeScale);

Share this post


Link to post
Share on other sites
Alexander Blade

When gtamodding wiki will work I'll add my current c++ header with native declarations , so before every change you post here you will make it in the wiki , currently login doesn't work there

Edited by Alexander Blade

Share this post


Link to post
Share on other sites
casscode

i firstly would like to thank all the devs that make scripting for gta possible. then a question. instead of creating a wrapper for the .net framework. why not use the more accessible languages(by accessible, i mean that one does not have to install a large framework for the runtime) like d or rust, or even use luajit this time around.

 

plus eventually the game will be playable on *nix through wine, and using the scripthook.net bindings on wine is not easy

Edited by casscode

Share this post


Link to post
Share on other sites
Alexander Blade

 

plus eventually the game will be playable on *nix through wine

SLvPl7a.png Yeeeees , wiiiiiiiine , GTA V probably won't support dx9 at all

Share this post


Link to post
Share on other sites
casscode

 

 

plus eventually the game will be playable on *nix through wine

SLvPl7a.png Yeeeees , wiiiiiiiine , GTA V probably won't support dx9 at all

 

yes, but wine may eventually support dx10/11

Share this post


Link to post
Share on other sites
Alexander Blade

gta iv under wine still runs on 5fps using good hardware , the only way to play it on wine was to use gallium-nine drivers with patched wine

 

the only reason ppl used .net scripthook is cuz it was easy to use classes with msvs ide integration

Share this post


Link to post
Share on other sites
WhiteHulk

My mind is basicle blown

Share this post


Link to post
Share on other sites
Aleph-Zero

i firstly would like to thank all the devs that make scripting for gta possible. then a question. instead of creating a wrapper for the .net framework. why not use the more accessible languages(by accessible, i mean that one does not have to install a large framework for the runtime) like d or rust, or even use luajit this time around.

 

plus eventually the game will be playable on *nix through wine, and using the scripthook.net bindings on wine is not easy

 

"why not use the more accessible languages(by accessible, i mean that one does not have to install a large framework for the runtime)"

 

Every windows machine capable of running GTA V comes with .net framework installed.

 

Also .Net just blows everything else out of the water imo (in ease of use and libraries).

So much stuff you don't have to worry about, you just need to worry about what your script will actually do.

 

"plus eventually the game will be playable on *nix through wine, and using the scripthook.net bindings on wine is not easy"

Even if they manage to run GTA V on linux, there's a big chance scripthook won't work. And if it does, there's mono which comes with the most popular distros.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 3 Users Currently Viewing
    0 Members, 0 Anonymous, 3 Guests

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.