Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do I need to compile into *.asi file for editing the source codes? #91

Open
mymyongg opened this issue Feb 6, 2018 · 2 comments
Open

Comments

@mymyongg
Copy link

mymyongg commented Feb 6, 2018

Hi aitor!
It's really an awesome work to make this environment for self-driving car research.
I'm trying to edit the source codes you provided to add the lane points near the ego vehicle to the dataset.
It seems that I should look into the *.cpp files since I see you calculated the lane reward using 'getCurrentLanePoints' function in 'LaneRewarder.cpp'. By the way, if I manage to edit the code to return the lane points, do I need to compile the whole source codes into an *.asi file and just copy that into the GTA root directory? If yes, how can I do that?
If not bothering you much, could you also explain how the source codes actually work interactively?
Plus, I'll be grateful for any suggestions for getting the ground truth lane points.
Thanks again for making this wonderful tool.

@gyubeomim
Copy link

gyubeomim commented Feb 17, 2018

as far as I know, Yes. @mymyongg
you need to build (or compile) this source code to *.asi file and place it to GTAV home folder to apply your modification.

  • first of all, open DeepGTAV.vcxproj file to build *.asi file
  • change some codes
  • Press Ctrl + Shift + B to build this solution. (or build --> Build Solution)
  • in menu tab, project --> DeepGTAV properties --> Build Event --> Pose-Build Event, and remove Command Line if your got some error while building
  • move *.asi files which is in bin\ to your GTAV home folder
  • run GTAV
  • if there is no error, your modification is applied

@zakfrom5x
Copy link

#include "script.h"
#include "NativeUI.h"

using namespace NativeUI;

Menu* mainMenu;

// Function to give the player a specific weapon
void GiveWeapon(Hash weaponHash) {
WEAPON::GIVE_WEAPON_TO_PED(PLAYER::PLAYER_PED_ID(), weaponHash, 0, false, true);
}

// Function to activate God Mode
void ActivateGodMode(bool enable) {
PED::SET_PED_INVINCIBLE(PLAYER::PLAYER_PED_ID(), enable);
}

// Function to enable infinite ammo
void ActivateInfiniteAmmo(bool enable) {
WEAPON::SET_PED_INFINITE_AMMO_CLIP(PLAYER::PLAYER_PED_ID(), enable);
}

// Function to spawn a Vapid Dominator FX Muscle Car
void SpawnVapidDominatorFX() {
// Request the vehicle model
VEHICLE::REQUEST_MODEL(0x6B8D2B1A); // Vapid Dominator FX hash

// Wait until the model is loaded
while (!VEHICLE::HAS_MODEL_LOADED(0x6B8D2B1A)) {
    WAIT(0);
}

// Get player's position
Vector3 playerPos = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);

// Create the vehicle at player's position
Vehicle vehicle = VEHICLE::CREATE_VEHICLE(0x6B8D2B1A, playerPos.x, playerPos.y, playerPos.z, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()), true, true);
VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(vehicle);
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), vehicle, -1); // Put the player into the vehicle

}

// Initialize the menu
void InitializeMenu() {
mainMenu = new Menu("ZakHax", "Main Menu");

// Add menu items
mainMenu->AddMenuItem(new MenuItem("God Mode", "Toggle God Mode"));
mainMenu->AddMenuItem(new MenuItem("Give Weapons", "Give all weapons"));
mainMenu->AddMenuItem(new MenuItem("Infinite Ammo", "Toggle Infinite Ammo"));
mainMenu->AddMenuItem(new MenuItem("Spawn Vapid Dominator FX", "Spawn a Vapid Dominator FX"));

// Register menu events
mainMenu->OnItemSelect([](Menu* sender, MenuItem* item, int index) {
    if (item->Text == "God Mode") {
        static bool godModeEnabled = false;
        godModeEnabled = !godModeEnabled;
        ActivateGodMode(godModeEnabled);
        UI::Notify(godModeEnabled ? "God Mode Enabled" : "God Mode Disabled");
    } else if (item->Text == "Give Weapons") {
        GiveWeapon(0x1B06D571); // Example: Pistol
        GiveWeapon(0x5EF9F8B8); // Example: Assault Rifle
        GiveWeapon(0xA2719263); // Example: Sniper Rifle
        UI::Notify("Weapons Given");
    } else if (item->Text == "Infinite Ammo") {
        static bool infiniteAmmoEnabled = false;
        infiniteAmmoEnabled = !infiniteAmmoEnabled;
        ActivateInfiniteAmmo(infiniteAmmoEnabled);
        UI::Notify(infiniteAmmoEnabled ? "Infinite Ammo Enabled" : "Infinite Ammo Disabled");
    } else if (item->Text == "Spawn Vapid Dominator FX") {
        SpawnVapidDominatorFX();
        UI::Notify("Vapid Dominator FX Spawned");
    }
});

}

// Main script entry point
void ScriptMain() {
InitializeMenu();

while (true) {
    WAIT(0);

    // Toggle menu with F5 key
    if (IsKeyPressed(VK_F5)) {
        mainMenu->Visible = !mainMenu->Visible;
    }
    
    // Render the menu if it's visible
    if (mainMenu->Visible) {
        mainMenu->Draw();
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants