Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      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

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

Any known solution for disable/enable mission trigger


Maffine
 Share

Recommended Posts

Hi guys,

I am working on disabling the missions like what the game does when player is in a mission -- to prevent player triggering another mission. The

GAMEPLAY::TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME("mission_triggerer_d");

Function can disable some missions, but I cant restart the triggers using START_NEW_SCRIPT method. The native scripts use SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH but it doesn't in addon script.

Does anyone have experience with scripts? Any help will be appreciated.

SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH

Link to comment
Share on other sites

There seems to be 4 "mission_triggerer_?" scripts, a, b, c & d. The decompiled scripts show this as how the game gets rid of them. This is from when you go to bed.

SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(joaat("mission_triggerer_a"));

Setting new scripts running seems to be done like this as well as the way you posted:

SCRIPT::REQUEST_SCRIPT_WITH_NAME_HASH(-462902287);
while (!SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(-462902287))
{
	SYSTEM::WAIT(0);
}
SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH_AND_ARGS(-462902287, &ScriptParam_103, 23, 1424);

Which is a common process for many things in the game. Animations, scaleforms etc.. all request something, then wait until it is loaded. I can't find anything in the scripts though that start up the mission_triggerer scripts like that, either as a string or as a hash of that string.

 

Maybe the game will enable them as a matter of process after a period of time, if they're not being disabled. Have you tried disabling them, then doing a side mission or sleeping and then seeing if they are back active again?

 

Edit: I wrote a small mod to monitor the mission_triggerer scripts. When Michael had a mission available, trigger C was set to 1, when Franklin had a mission, B was set to 1. I only had a save where Trevor had a ? mission marker and that set D to 1. So it looks like the trigger is based on the person that owns the mission.

 

So maybe you can only enable the valid trigger script that was last active.

 

 

Edited by Guest
Link to comment
Share on other sites

17 hours ago, LeeC2202 said:

There seems to be 4 "mission_triggerer_?" scripts, a, b, c & d. The decompiled scripts show this as how the game gets rid of them. This is from when you go to bed.

SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(joaat("mission_triggerer_a"));

Setting new scripts running seems to be done like this as well as the way you posted:

SCRIPT::REQUEST_SCRIPT_WITH_NAME_HASH(-462902287);
while (!SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(-462902287))
{
	SYSTEM::WAIT(0);
}
SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH_AND_ARGS(-462902287, &ScriptParam_103, 23, 1424);

Which is a common process for many things in the game. Animations, scaleforms etc.. all request something, then wait until it is loaded. I can't find anything in the scripts though that start up the mission_triggerer scripts like that, either as a string or as a hash of that string.

 

Maybe the game will enable them as a matter of process after a period of time, if they're not being disabled. Have you tried disabling them, then doing a side mission or sleeping and then seeing if they are back active again?

 

Edit: I wrote a small mod to monitor the mission_triggerer scripts. When Michael had a mission available, trigger C was set to 1, when Franklin had a mission, B was set to 1. I only had a save where Trevor had a ? mission marker and that set D to 1. So it looks like the trigger is based on the person that owns the mission.

 

So maybe you can only enable the valid trigger script that was last active.

 

 

Hi LeeC, thanks again for your help.

I tried to go through a side mission with no luck. It seems that the triggerer script is constantly created and shut down by the game.

Anyway, do you know if there is a known solution to remove the trigger of the native missions?

PS: Would it be convenient for you to explain the mission_triggerer monitor a little bit? I got a hunch it might be helpful

Link to comment
Share on other sites

7 hours ago, Maffine said:

Anyway, do you know if there is a known solution to remove the trigger of the native missions?

Until last night, it's not something I had ever even thought about to be honest. I finished the game a couple of years back so haven't see a mission in all that time. Sorry, I get wrapped up in trying to find a solution to help and I frequently avoid (bad choice of words that) miss answering the question completely. :( If I don't know about something, I'll just throw ideas into the pot that might help, maybe write a mod or two. I find it hard to resist investigating new things.

 

The trigger watching script is just this:

using System;
using System.Collections.Generic;

using GTA;
using GTA.Native;

namespace ScriptWatcher
{
    public class cScriptWatcher : Script
    {
        private List<string> MissionStrings = new List<string>() { "mission_triggerer_a", "mission_triggerer_b", "mission_triggerer_c", "mission_triggerer_d" };

        public cScriptWatcher()
        {
            Tick += onTick;
            Interval = 1000;
        }

        private void onTick(object sender, EventArgs e)
        {
            // Exits from the loop if the game is loading
            if (Game.IsLoading) return;

			string missionString = "";
			
            for (int i = 0; i < MissionStrings.Count; i++)
            {
                int numScripts = Function.Call<int>((Hash)0x2C83A9DA6BFFC4F9, Function.Call<int>(Hash.GET_HASH_KEY, MissionStrings[i]));
				missionString += string.Format("~s~{0}: ~y~{1}, ", i, numScripts);
            }
			UI.ShowSubtitle(missionString);
        }
    }
}

Any active triggers will be shown in the subtitle string at the bottom. 0 = a,1 = b etc... I had to use the hash (0x2C83A9DA6BFFC4F9) because the native wasn't showing up in Visual Studio. I use an old version of SHVDN, so I sometimes have to use the hash instead of the named native on NativeDB.

Edited by Guest
Link to comment
Share on other sites

On 9/29/2018 at 7:45 PM, LeeC2202 said:

Until last night, it's not something I had ever even thought about to be honest. I finished the game a couple of years back so haven't see a mission in all that time. Sorry, I get wrapped up in trying to find a solution to help and I frequently avoid (bad choice of words that) miss answering the question completely. :( If I don't know about something, I'll just throw ideas into the pot that might help, maybe write a mod or two. I find it hard to resist investigating new things.

 

The trigger watching script is just this:

using System;
using System.Collections.Generic;

using GTA;
using GTA.Native;

namespace ScriptWatcher
{
    public class cScriptWatcher : Script
    {
        private List<string> MissionStrings = new List<string>() { "mission_triggerer_a", "mission_triggerer_b", "mission_triggerer_c", "mission_triggerer_d" };

        public cScriptWatcher()
        {
            Tick += onTick;
            Interval = 1000;
        }

        private void onTick(object sender, EventArgs e)
        {
            // Exits from the loop if the game is loading
            if (Game.IsLoading) return;

			string missionString = "";
			
            for (int i = 0; i < MissionStrings.Count; i++)
            {
                int numScripts = Function.Call<int>((Hash)0x2C83A9DA6BFFC4F9, Function.Call<int>(Hash.GET_HASH_KEY, MissionStrings[i]));
				missionString += string.Format("~s~{0}: ~y~{1}, ", i, numScripts);
            }
			UI.ShowSubtitle(missionString);
        }
    }
}

Any active triggers will be shown in the subtitle string at the bottom. 0 = a,1 = b etc... I had to use the hash (0x2C83A9DA6BFFC4F9) because the native wasn't showing up in Visual Studio. I use an old version of SHVDN, so I sometimes have to use the hash instead of the named native on NativeDB.

Hi LeeC, sorry for the late reply. Been working it out for a few days but had to admit my failure. However, here came a crazy thought. I plan to make a mimic of the game player ——that is, a ped that you can control with keys and a camera that you can control the way you control gameplay camera, and you just through your real player character away and control the scripted ped. I reckon that with no player ped reaching the vicinity of the mission trigger marker the mission will not be triggered. Do you know if there is any example of this kind? I know it sounds crazy but it is just such a tricky solution that I would definitely struggle to accomplish it if there is any possibility. Do you think this plan is even possible? I've been testing for few days but the algorithm of the gameplay camera is rather complicated.

Link to comment
Share on other sites

If you do a model swap on the main character, then you will control another ped with the normal gameplay camera and no missions will ever activate. You can't swap to a copy of the main characters though, because it's the model hash that the game uses to determine who you are playing as... unless you rebuild addon peds of the main characters that is.

 

You lose access to things like the fairground rides and cable cars, because they just won't work with anything but the main characters... unless you use the Character Swap mod but then you bring all the mission stuff back into play again.

 

So yes, swapping a player to another ped is very doable and that will get rid of any and all mission related activities. If you choose to do that, you have to be very careful when you die, because dying as anything other than a main character will cause an infinite loading screen crash. So either have a trainer installed that will take care of that for you, or you have to monitor for death and then switch back to the original character when you die. Getting arrested might have the same problem, not too sure on that one.

 

This is exactly what my latest mod does, it is replicating the normal gameplay features for addon peds, plus adding a lot more... so I know it's possible to do this.

Link to comment
Share on other sites

9 hours ago, LeeC2202 said:

If you do a model swap on the main character, then you will control another ped with the normal gameplay camera and no missions will ever activate. You can't swap to a copy of the main characters though, because it's the model hash that the game uses to determine who you are playing as... unless you rebuild addon peds of the main characters that is.

 

You lose access to things like the fairground rides and cable cars, because they just won't work with anything but the main characters... unless you use the Character Swap mod but then you bring all the mission stuff back into play again.

 

So yes, swapping a player to another ped is very doable and that will get rid of any and all mission related activities. If you choose to do that, you have to be very careful when you die, because dying as anything other than a main character will cause an infinite loading screen crash. So either have a trainer installed that will take care of that for you, or you have to monitor for death and then switch back to the original character when you die. Getting arrested might have the same problem, not too sure on that one.

 

This is exactly what my latest mod does, it is replicating the normal gameplay features for addon peds, plus adding a lot more... so I know it's possible to do this.

You are an angel LeeC. You just saved me from tons of works and bugs. Thank you so much!

Link to comment
Share on other sites

On 10/2/2018 at 2:19 AM, LeeC2202 said:

If you do a model swap on the main character, then you will control another ped with the normal gameplay camera and no missions will ever activate. You can't swap to a copy of the main characters though, because it's the model hash that the game uses to determine who you are playing as... unless you rebuild addon peds of the main characters that is.

 

You lose access to things like the fairground rides and cable cars, because they just won't work with anything but the main characters... unless you use the Character Swap mod but then you bring all the mission stuff back into play again.

 

So yes, swapping a player to another ped is very doable and that will get rid of any and all mission related activities. If you choose to do that, you have to be very careful when you die, because dying as anything other than a main character will cause an infinite loading screen crash. So either have a trainer installed that will take care of that for you, or you have to monitor for death and then switch back to the original character when you die. Getting arrested might have the same problem, not too sure on that one.

 

This is exactly what my latest mod does, it is replicating the normal gameplay features for addon peds, plus adding a lot more... so I know it's possible to do this.

Hi LeeC. Me again. Sorry for the disruption. I accidentally bumped into this thread. I tried to manipulate pointers but the game simply crashes(not surprise since I'm just a beginner coder...lol)

Do you happen to have any idea on how it is done? Like it is ever possible for a noob to achieve this with any possible tools? Or the exported function mentioned https://www.gta5-mods.com/scripts/character-swap#description_tab

I think it is impossible to reference an asi file?

 

Link to comment
Share on other sites

Hmmm... just took the code that was posted in that thread. I can get it to find an address for the pattern but no matter what model I use, the value I get back is the same, so something is wrong... which is actually quite sad as there's only 3 lines of code. :( My pattern attempts are usually like trying to get an egg out of a china cup with a sledgehammer, it never goes well.

 

I am afraid you're going to have to seek assistance from one of the more experienced coders with this one... whether one will reply is another matter altogether.. For one of them, it's literally a 2 minute task to convert that code to C#, for me, it's a recipe for bad things to happen.

 

Sorry I can't be more helpful than that.

Link to comment
Share on other sites

InfamousSabre

I'm not sure about this specific issue, but I had a very similar issue a while back. Constantly trying to disable scripts to avoid a specific action from happening and just ending up with my script fighting the game trying to kill a script every single tick. In the end I found I could use a GlobalPtr to disable the action. Maybe it will work here too. You'll just have to find which one it is. (IIRC setting ptr 3 to value 1 starts the Online Terms Agreement form. Don't freak out if you get it, just close the game and restart)

This is C++, but theres probably a C# equivalent.
 

// Returns pointer to global variable
// make sure that you check game version before accessing globals because
// ids may differ between patches
IMPORT UINT64 *getGlobalPtr(int globalId);

 

Edited by InfamousSabre
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.