jimmyoneshot Posted December 28, 2020 Share Posted December 28, 2020 (edited) 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 December 28, 2020 by jimmyoneshot Link to comment Share on other sites More sharing options...
LeeC22 Posted December 29, 2020 Share Posted December 29, 2020 (edited) 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 December 29, 2020 by LeeC22 jimmyoneshot 1 Link to comment Share on other sites More sharing options...
jimmyoneshot Posted December 29, 2020 Author Share Posted December 29, 2020 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(); } } } } } } } } LeeC22 1 Link to comment Share on other sites More sharing options...
LeeC22 Posted December 29, 2020 Share Posted December 29, 2020 I haven't done a mission in this game since September 2015. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now