Visar inlägg med etikett GTAV. Visa alla inlägg
Visar inlägg med etikett GTAV. Visa alla inlägg

måndag 4 januari 2016

GTA V: Change vehicle sounds on any vehicle to any sound

It's really easy to change the sounds on any vehicle to any other vehicle sound in GTA V.

Before we start, make sure to use OpenIV with the mods folder for safety: http://openiv.com/?p=1132

This is how you do it:
1. Go to update\update.rpf\common\data\levels\gta5 with OpenIV
2. Right click on vehicles.meta and press "Save content/ Export".
3. Open the file that you exported with notepad.
4. Find the vehicle model you want to change (CTRL+F and then search for modelName). If you are unsure which model it is you can use Native Trainer to spawn them and find out.
5. Look for "<audioNameHash />" under your model name. Replace it with "<audioNameHash>PutYourModelNameHere</audioNameHash>" and instead of "PutYourModelNameHere" you write the name of the model you want to use the sound from. Here are all model names: http://pastebin.com/i4AX8kBY (taken from Alexander Blades Native Trainer source).
6. Save the file, go back to OpenIV and replace the vehicles.meta with your version of it.
7. Start GTA V try it out :)

Tip: A sound that I like a lot is the engine sound of Stirling GT with model name FELTZER3. That would be <audioNameHash>FELTZER3</audioNameHash>

Play GTA V without violence

Family Friendly Free Roaming has been out for a while now. FFFR is a modification for Grand Theft Auto 5 that disables violence in the game. The latest versions has made it even less violent. This means that even children can play it.

Except making the game less violent, the purpose of the mod is to make it more fun exploring the amazing world without interrupting elements.

There are also features like entering vehicles as passenger and busing pedestrians around.

You can read more and get the latest version of FFFR here: https://www.gta5-mods.com/scripts/family-friendly-free-roaming


onsdag 22 juli 2015

GTA V Scripting PC Part 3: Keyboard and Controller support

Keyboard support example

For keyboard support you need these functions:

bool get_key_pressed(int nVirtKey)
{
    return (GetAsyncKeyState(nVirtKey) & 0x8000) != 0;
}

We need to check if the key is valid with isprint(): http://www.cplusplus.com/reference/cctype/isprint/
We also want a delay between possible keystrokes. We use GetTickCount() for this:

DWORD trainerResetTim;

void reset_mod_switch()
{
    trainerResetTime = GetTickCount();
}

We want to get the key pressed every 400 milliseconds. Insert is used as key if activateKeyChar is not a valid key:

bool on_off_switch_pressed(){
    if (isprint(activateKeyChar)){ // activateKeyChar is your key
        return ((GetTickCount() > trainerResetTime + 400) &&   get_key_pressed(activateKeyChar));
    }
    else{
        return ((GetTickCount() > trainerResetTime + 400) && get_key_pressed(0x2D));
    }
}

Read the previous post about how to read from the .ini file. You can in this way let the user choose a key code from here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx and write it in the .ini file so that your mod can get it and use it.

Now you can in your script loop check if your button is pressed:

if (on_off_switch_pressed()){
// do something
}

Controller support example

Controller support is similar:

bool on_off_mod_with_controller_switch_pressed(){
    return ((GetTickCount() > trainerResetTime + 400) && isControllButtonPressed(activateControllerButtonChar)
        && canActivateWithController);
}

canActivateWithController is a bool used to make it so that the controller only is usable when wanted.

Controller button keys:http://pastebin.com/X6X2hUB7

int xInputIndex = 2; // always 2
bool isControllButtonPressed(int controllerButton){
    if (canActivateWithController){
        if (CONTROLS::IS_CONTROL_PRESSED(xInputIndex, controllerButton)){
            return true;
        }
    }
    return false;
}



fredag 10 juli 2015

How to make scripts for GTA V PC

Scripting mods for GTA V is actually quite easy. I will show you how to create some neat stuff. First, let's watch this GTA V scripting tutorial made by Johnny Manson, about how to get started and making your first script.


Johnny is directly using C++ to code with. You can also add scripts that let you write in .NET and LUA. In this tutorial we will only write in C++

So, Jonny gave us a template to start with. I made it even smaller and you can check it out here: code.
Mods are of course usually larger. You can remove the line "PED::SET_PED_CAN_BE_DRAGGED_OUT(playerPed, false);" and replace with something else.
Download the latest Script Hook SDK and replace everything in the file "script.cpp" with the contents of code.

Before you TAB down from the game to make changes in your code in visual studio, hold CTRL and press R. A small beep will sound which means that all mods are inactivated. You can now create a new version of your mod and replace the old one with it. When you're done press CTRL+R again to reload all your mods. You should hear three beeps. Note that for this to work you need an empty file named "ScripthookV.dev" in your game folder.

When you start scripting you need some sources and information about how to do different things. The above all most important source is Alexander Blades http://www.dev-c.com with the native database /nativedb/. Not everything is known about how functions work or which parameters are used. Sometimes you need to guess or try and error.

When your mod is ready for it's first release you can publish it on sites like gta5-mods.com and gtainside.com.

In the next post we will look into how to read and write to configuration files (.ini).