Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

Is there any way to get the current mission name/id?


jimmyoneshot
 Share

Recommended Posts

There are certain bits of code that I only want to be applied in certain missions.

 

So far I've done this only with the prologue in which case I just got the location like this:-

 

if (World.GetZoneLocalizedName(Game.Player.Character.Position) == "North Yankton")

 

But obviously that will get a bit more awkward in other missions so I'm wondering is there a way to get what the current active mission is?

Edited by jimmyoneshot
Link to comment
Share on other sites

On 12/28/2020 at 1:37 AM, jimmyoneshot said:

But obviously that will get a bit more awkward in other missions so I'm wondering is there a way to get what the current active mission is?

 

I can't see any natives that do it. There are ones that set the mission name but I am not sure if that only applies to missions created in one of the creator modes in online.

 

It is possible that it is stored in Global memory somewhere but I wouldn't imagine finding it would be straightforward.  It could be stored as a string but it is more likely to be stored as a hash. But that hash might be generated from a text label, rather than the actual mission name.

 

Looking for a specific mission name "Did Somebody Say Yoga?" in the files finds it in a global.gxt2 files as this:

 

0x0FE15D9D = Did Somebody Say Yoga?

0x0FE15D9D = Quelqu'un a parlé de yoga ?

 

So they are localised, meaning it is probably stored as the hash, which will make it hard to find I would think.

 

Edit: I had another thought about this when I got into bed last night but had to wait until today to check something. It displays the mission name in the Mission Passed message at the end of the mission. If you could work out which scaleform that is, then you could check in the decompiled scripts how that parameter is passed to the scaleform. That would tell you where it is stored. There is a mission complete scaleform but I don't know if that's the same one.

 

Further Edit: Ok, so it looks like mission_complete is the right scaleform, however... I can only find a single instance of that scaleform being used in the scripts when searching for the name "mission_complete". The function call "SET_MISSION_TITLE", which I am presuming to be the one required, only gets called once and it's like this:

 

GRAPHICS::CALL_SCALEFORM_MOVIE_METHOD_WITH_STRING(iLocal_46, "SET_MISSION_TITLE", ScriptParam_0, ScriptParam_0.f_1, 0, 0, 0);

 

So it seems to be set from some parameters passed to the script. If there was a way to find the memory address of an active script, it may be possible to find the mission name hash at an offset from that but I don't know if that's even possible.

Edited by LeeC22
  • Like 1
Link to comment
Share on other sites

10 hours ago, LeeC22 said:

 

I can't see any natives that do it. There are ones that set the mission name but I am not sure if that only applies to missions created in one of the creator modes in online.

 

It is possible that it is stored in Global memory somewhere but I wouldn't imagine finding it would be straightforward.  It could be stored as a string but it is more likely to be stored as a hash. But that hash might be generated from a text label, rather than the actual mission name.

 

Looking for a specific mission name "Did Somebody Say Yoga?" in the files finds it in a global.gxt2 files as this:

 

0x0FE15D9D = Did Somebody Say Yoga?

0x0FE15D9D = Quelqu'un a parlé de yoga ?

 

So they are localised, meaning it is probably stored as the hash, which will make it hard to find I would think.

 

Edit: I had another thought about this when I got into bed last night but had to wait until today to check something. It displays the mission name in the Mission Passed message at the end of the mission. If you could work out which scaleform that is, then you could check in the decompiled scripts how that parameter is passed to the scaleform. That would tell you where it is stored. There is a mission complete scaleform but I don't know if that's the same one.

 

Further Edit: Ok, so it looks like mission_complete is the right scaleform, however... I can only find a single instance of that scaleform being used in the scripts when searching for the name "mission_complete". The function call "SET_MISSION_TITLE", which I am presuming to be the one required, only gets called once and it's like this:

 

GRAPHICS::CALL_SCALEFORM_MOVIE_METHOD_WITH_STRING(iLocal_46, "SET_MISSION_TITLE", ScriptParam_0, ScriptParam_0.f_1, 0, 0, 0);

 

So it seems to be set from some parameters passed to the script. If there was a way to find the memory address of an active script, it may be possible to find the mission name hash at an offset from that but I don't know if that's even possible.

Thanks very much Lee. I'll take a look into that. My idea was I wanted to mod the game to make certain things more realistic with the following:-

 

- To remove all visible blood damage from the playable characters and npcs that are fighting alongside them during the mission

- To exclude instances of the above where the player/s and such npcs are meant to be damaged such as during the car crash in the Prologue

- To repair vehicle damage to vehicles of friendly npcs that are involved in missions with the player

 

I have achieved the first 2 and partly achieved the third. The idea with the third was because during the mission 'Fraklin and Lamar' Lamar usually damages whichever car he takes so I wanted to remove this damage. Here is the code I currently use for that part:-

 

foreach (Ped p in World.GetNearbyPeds(Game.Player.Character, 20f)){

    if (
        p.GetRelationshipWithPed(Game.Player.Character).ToString() == "Respect"
    ){
        p.ClearBloodDamage();
        p.ClearLastWeaponDamage();
        p.ClearVisibleDamage();
        Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, p);

        if (p.IsInVehicle() && p.CurrentVehicle.IsDamaged){
            p.CurrentVehicle.Repair();
        }

    }

}

But as you can imagine it doesn't really need apply to every mission ha.

 

Here is the full code if you are interested:-

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using GTA;
using GTA.Native;
using GTA.Math;
using GTA.UI;

namespace No_Damage_Script
{
    public class Class1 : Script
    {

        private static bool yanktonDrivingSceneHasPlayed = false;

        public Class1()
        {
            Tick += clearPedDamage;
        }


        private void clearPedDamage(object sender, EventArgs e)
        {

            if (Game.IsMissionActive)
            {


                if (World.GetZoneLocalizedName(Game.Player.Character.Position) == "North Yankton")
                {

                    if (!yanktonDrivingSceneHasPlayed && Game.Player.Character.IsInVehicle())
                    {
                        yanktonDrivingSceneHasPlayed = true;
                    }

                    if (!Game.Player.Character.IsInVehicle())
                    {

                        if (!Game.IsCutsceneActive || yanktonDrivingSceneHasPlayed && Game.Player.Character.Handle == 1538)
                        {
                            Game.Player.Character.ClearBloodDamage();
                            Game.Player.Character.ClearLastWeaponDamage();
                            Game.Player.Character.ClearVisibleDamage();
                            Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, Game.Player.Character);
                        }

                        if (!Game.IsCutsceneActive && !yanktonDrivingSceneHasPlayed)
                        {

                            foreach (Ped p in World.GetNearbyPeds(Game.Player.Character, 20f))
                            {

                                if (
                                    p.GetRelationshipWithPed(Game.Player.Character).ToString() == "Respect"
                                )
                                {

                                    p.ClearBloodDamage();
                                    p.ClearLastWeaponDamage();
                                    p.ClearVisibleDamage();
                                    Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, p);
                                }

                            }
                        }
                    }

                }
                else
                {

                    Game.Player.Character.ClearBloodDamage();
                    Game.Player.Character.ClearLastWeaponDamage();
                    Game.Player.Character.ClearVisibleDamage();
                    Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, Game.Player.Character);

                    foreach (Ped p in World.GetNearbyPeds(Game.Player.Character, 20f))
                    {

                        if (
                            p.GetRelationshipWithPed(Game.Player.Character).ToString() == "Respect"
                        )
                        {
                            p.ClearBloodDamage();
                            p.ClearLastWeaponDamage();
                            p.ClearVisibleDamage();
                            Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, p);


                            if (p.IsInVehicle() && p.CurrentVehicle.IsDamaged)
                            {
                                p.CurrentVehicle.Repair();
                            }

                        }

                    }

                }
            }
        }



    }


}

 

Link to comment
Share on other sites

I haven't done a mission in this game since September 2015. :D

 

I bought it in July - August 2015, did the story with god mode on because I didn't care about the story, switched to Trevor, turned off autosave and that's when I started modding it. Haven't played as Michael or Franklin since and usually switch to mp_f_deadhooker as soon as I start playing. She's been my research assistant for 5 years. :)

Link to comment
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
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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