Jump to content

HughJanus

Recognized Creator
  • Posts

    830
  • Joined

  • Last visited

  • Days Won

    93

 Content Type 

Profiles

Forums

Gallery

Downloads

News Articles

Modding Wiki

RDR2 Native Database

RDR2 Native Parameters

RDR2 Player Clothes Database

RDR2 Ped Voices Database

RDR2 Ped Speech Lines

RDR2 Modding Tutorials

RDR2 Ped Model Database

RDR2 Animations Database

RDRFR Changelog

RDRFR Installation Guide

RDRFR Features

RDRFR Settings

LML User Contributions

Everything posted by HughJanus

  1. @Maro I have no idea how to add animations or make NPCs survive dismemberment with only a script. As for the decomposing, I would love to see that, but also have not found any natives yet that would support such a change.
  2. @lininop I only check for headshots, because I figured getting a small knife thrown into an adult body wouldnt make that much of an impact. Should I change that?
  3. Hey guys @lininop@AbleAtlas, I tried fixing the headshot knife no impact thing and added a value for the sneaking noise multiplier. Please test, if possible (as I dont have much time on my hands and the rest of the team is not available this weekend). @AnymYo I think those values can only be changed in the game files (at least I have not found natives for them yet). PedDamageOverhaul.asi PedDamageOverhaul.ini
  4. We havent looked into that at all. Dont know if we will add it, since its a little out of scope.
  5. What config are you using and what weapon exactly? Did you alter anything about the config? Do you use any other mods?
  6. I will try again with the other types, now that I have the cast into the pointer type (maybe that was the problem all along). Edit: Tried it like this, but to no avail, unfortunately. struct CSpeechStruct { char* f_0; char* f_1; uint f_2; uint f_3; uint f_4; bool f_5; uint f_6; }; I'm thrilled to see if you can get it working!
  7. Are you using ABs script hook or RPH? Edit: forget what I asked, just saw the forum you posted in. Why dont you try GET_CURRENT_PED_WEAPON and pass the player ped to it? In the parameters you have to pass the variable in which the weapon shall be stored. Something like this should do it: Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash weaponHash = 0; int ammo = 100; WEAPON::GET_CURRENT_PED_WEAPON(playerPed, &weaponHash, false, 0, false); if (weaponHash != 0) WEAPON::SET_PED_AMMO(playerPed, weaponHash, ammo);
  8. I tried what you proposed and the IDE now lets me do it. Unfortunately, script hook still throws the error on activation of the script. Here is what I currently have: struct CSpeechStruct { char* f_0; Any f_1, f_2, f_3, f_4, f_5, f_6; }; bool PedFearTestHelper(Ped ped, Any x) { return invoke<BOOL>(0x8E04FEDD28D42462, ped, (UINT_PTR)x); } bool PedFearTest(Ped ped) { CSpeechStruct Var0; Var0.f_0 = "PLEAD"; Var0.f_1 = 0; Var0.f_2 = 0; Var0.f_3 = -69597692; Var0.f_4 = 0; Var0.f_5 = 1; Var0.f_6 = 1; return PedFearTestHelper(ped, (UINT_PTR)&Var0); } I am now looking into including C code into the C++ project. Maybe this way I can use the exact code of the mission script. Or is it easier to use C# code in a C++ project? (havent started researching yet)
  9. OK, so now I tried again. I started from the ground up and searched the mission scripts. In the script named "feud1.c" I found the following methods (getting called by each other): var func_2348(var uParam0, var uParam1) { return AUDIO::_PLAY_AMBIENT_SPEECH1(uParam0, uParam1); } bool func_1859(var uParam0, char* sParam1, int iParam2, int iParam3, int iParam4, int iParam5, int iParam6, int iParam7) { struct<7> Var0; Var0.f_5 = 1; Var0.f_6 = 1; Var0 = sParam1; Var0.f_1 = iParam5; Var0.f_2 = iParam6; Var0.f_3 = iParam2; Var0.f_4 = iParam3; Var0.f_5 = iParam4; Var0.f_6 = iParam7; return func_2348(uParam0, &Var0); } func_1859(*iParam1, "PLEAD", -69597692, 0, 1, 0, 0, 1) I tried to mirror this exactly and had a few type mismatches. I think this is where the problem lies. I would have liked to do it that way: bool PedFearTestHelper(Ped ped, Any* x) { return invoke<BOOL>(0x8E04FEDD28D42462, ped, x); } bool PedFearTest(Ped ped) { struct CSpeechStruct { Any f_1, f_2, f_3, f_4, f_5, f_6; }; CSpeechStruct Var0; Var0.f_5 = 1; Var0.f_6 = 1; Var0 = "PLEAD"; Var0.f_1 = 0; Var0.f_2 = 0; Var0.f_3 = -69597692; Var0.f_4 = 0; Var0.f_5 = 1; Var0.f_6 = 1; return PedFearTestHelper(ped, &Var0); } But the errors are here (because I cannot assign a char* to CSpeechStruct): Var0 = "PLEAD"; and here (because CSpeechStruct* cannot be assigned to Any*): return PedFearTestHelper(ped, &Var0); Due to these errors I have adjusted the code as follows: struct CSpeechStruct { Any f_1, f_2, f_3, f_4, f_5, f_6; char* f_0; }; bool PedFearTestHelper(Ped ped, CSpeechStruct* x) { return invoke<BOOL>(0x8E04FEDD28D42462, ped, x); } bool PedFearTest(Ped ped) { CSpeechStruct Var0; Var0.f_5 = 1; Var0.f_6 = 1; Var0.f_0 = "PLEAD"; Var0.f_1 = 0; Var0.f_2 = 0; Var0.f_3 = -69597692; Var0.f_4 = 0; Var0.f_5 = 1; Var0.f_6 = 1; return PedFearTestHelper(ped, &Var0); } Now my IDE does not throw any errors, but script hook does as soon as it loads the asi. From all this, I assume that the main obstacle is the type mismatches. Since I dont know what the native wants as a second parameter exactly, I dont really know what to pass to it. @LMS You seem very savvy, could you make an educated guess on what C++ structure would be fitting to be passed to the native? I dont know anything in C++ that would match the var type of the mission script. var seems to be some kind of more forgiving Any type. Same with the struct<x>, I wouldnt know how to get an equivalent in C++.
  10. What would you like to be able to change? Animals being affected by damage changes? This mod does not ever need any update if script hook is updated, you can always use it with any script hook version.
  11. So, I have given it another try. The relationship stuff seems to work. I set the relationship between the player and the van der linde gang to respected (in both ways). Now if I aim at a gang member, they become aggressive and start shooting after a while. Yet I still cant pull the trigger when aiming at them. There seems to be something else blocking me from targetting them. I can hurt them with dynamite if I throw it close enough, but I can never aim at them and pull the trigger. More testing will be required to solve this. I will keep you updated. Edit: all the natives with "target" in them didnt work. I searched the GTA 5 natives for clues and found "SET_CAN_ATTACK_FRIENDLY" (https://runtime.fivem.net/doc/natives/?_0xB3B1CB349FF9C75D). Maybe this is the method to use? We havent found that one in RDR2 yet, unfortunately.
  12. I now tried going around the wrapper and directly invoking the native hash, but it also threw an error (with or without filling the rest of the contruct with default values). struct CSpeechStruct { public: char* SpeechName; public: char* VoiceName; public: uint UnknownUInt1; public: uint SpeechModifier; public: uint UnknownUInt2; public: bool UnknownBool1; public: int UnknownBool2; public: uint UnknownUInt3; }; CSpeechStruct s; s.SpeechName = "GENERIC_THANKS"; s.VoiceName = 0; s.UnknownUInt1 = 0; s.SpeechModifier = 0xE7176FB2; s.UnknownUInt2 = 0; s.UnknownBool1 = false; s.UnknownBool2 = 0; s.UnknownUInt3 = 0; invoke<BOOL>(0x8E04FEDD28D42462, ped, s); I give up for now. Maybe I will find the passion to further try this later some time. I suppose it will take less time porting the whole mod to RPH than trying to make this native work^^ Thanks for the help, though.
  13. Are you sure you filled the Hash into the right parameter? In your snippet its the fifth, in your post before you said the fourth. If I place the Hash into the fifth, scripthook throws an error. If I put it into the fourth, nothing happens (but at least there is no error).
  14. Would you be so kind to post a code snippet? I have tried this (8 parameters like the code snippet you posted): struct SpeechParams { char* speechName; char* voiceName; int v3; Hash speechParamHash; Entity entity; BOOL v6; int v7; int v8; }; struct SpeechParams params { "GENERIC_THANKS", 0, 0, 0xE7176FB2, 0, 0, 0, 0 }; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, params); And this (7 parameters like you said in one of your posts): struct SpeechParams { char* speech; char* voice; int i1; Hash h2; Entity targetPed; bool networkGameInProcess; bool b4; }; struct SpeechParams params { "GENERIC_THANKS", 0, 0, 0xE7176FB2, 0, 0, 0 }; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, params); When using the one with 7 parameters, I got an error. When using the one with 8, nothing happened. If you post a code snippet, I can use that and try to do something with the struct (if thats what youre doing different) or with the parameters (if we differ there). But at the moment I dont even know how many parameters I am supposed to have.
  15. I do it like this in PDO (you can only read in integers, though): float ini_npcmeleemodifier = (float)GetPrivateProfileInt("PedDamageConfiguration_Advanced", "NPCMeleeModifier", 100, ".\\PedDamageOverhaul.ini") / 100; int ini_storypedhealth = GetPrivateProfileInt("PedDamageConfiguration_Basic", "StoryNPCHealth", 0, ".\\PedDamageOverhaul.ini"); The first parameter is the section of the ini, the second one is the name of the ini value, the third one is the default value (if the value name is not found in the ini), the last one is the ini file path. This method I use for checking if the ini is present: bool does_file_exist(const char* fileName) { std::ifstream infile(fileName); return infile.good(); } //in the script bool iniexists = does_file_exist(".\\PedDamageOverhaul.ini"); And this one to draw the message on screen (if the enable/disable button is pressed): if (GetTickCount() < msgTime) { if (modScriptState) { DrawText(0.4, 0.4, "PedDamageOverhaul has been ENABLED."); if (iniexists) DrawText(0.6, 0.6, "ini file found."); else DrawText(0.6, 0.6, "ini file not found."); } else DrawText(0.4, 0.4, "PedDamageOverhaul has been DISABLED."); }
  16. Ah, I see. I guess you would need a container for checking player outfits and storing them with their respective wetness (which can decrease over time). But you would need a native to check the current player clothes and I havent tried anything remotely similar, so I dont know if its easy (natives which support just that) or complicated (having to work around with natives who dont do that exactly) 😕 Nevertheless, cool idea.
  17. So like this? ScriptedSpeechParams params{"GENERIC_THANKS", 0, 1, 0xE7176FB2, 0, true, 1, 1}; What is the hash for (0xE7176FB2)?
  18. Nice mod. How do you deal with the changing of clothes? If I wear outfit x and it gets wet, can I change to outfit y to reset the meter? If changing back from y to x, does it make y dry again?
  19. Thank you. If nothing helps, maybe I will look at porting the mod to RPH, if everything is so easy there - but I suppose, I will have to replace all the natives I used?
  20. I tried the following (adapted the construct to the parameters you posted further above): struct ScriptedSpeechParams { const char* speechName; const char* voiceName; alignas(8) int v3; alignas(8) Hash speechParamHash; alignas(8) Entity entity; alignas(8) BOOL v6; alignas(8) BOOL v7; }; static_assert(sizeof(ScriptedSpeechParams) == 0x38, "incorrect ScriptedSpeechParams size"); //declaring the line (taken out of a container) char* speechline = speechl_it->second; ScriptedSpeechParams params{speechline, 0, 0, 291934926, ped, NETWORK::NETWORK_IS_GAME_IN_PROGRESS(), 1}; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, &params); But unfortunately it didnt work. Then I tried it with the exact same construct, but different parameters: struct ScriptedSpeechParams { const char* speechName; const char* voiceName; alignas(8) int v3; alignas(8) Hash speechParamHash; alignas(8) Entity entity; alignas(8) BOOL v6; alignas(8) int v7; alignas(8) int v8; }; static_assert(sizeof(ScriptedSpeechParams) == 0x40, "incorrect ScriptedSpeechParams size"); //declaring the line (taken out of a container) char* speechline = speechl_it->second; ScriptedSpeechParams params{ speechline, 0, 1, 0x67F3AB43, 0, true, 1, 1 }; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, &params); Still threw an error. Then I used the exact same thing: struct ScriptedSpeechParams { const char* speechName; const char* voiceName; alignas(8) int v3; alignas(8) Hash speechParamHash; alignas(8) Entity entity; alignas(8) BOOL v6; alignas(8) int v7; alignas(8) int v8; }; static_assert(sizeof(ScriptedSpeechParams) == 0x40, "incorrect ScriptedSpeechParams size"); //declaring the line (taken out of a container) char* speechline = speechl_it->second; ScriptedSpeechParams params{ "RE_PH_RHD_V3_AGGRO", "0405_U_M_M_RhdSheriff_01", 1, 0x67F3AB43, 0, true, 1, 1 }; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, &params); Still didnt work. Then also tried this, but didnt work either: struct ScriptedSpeechParams { const char* speechName; const char* voiceName; alignas(8) Any a; alignas(8) Any b; alignas(8) Any c; alignas(8) Any d; alignas(8) Any e; }; static_assert(sizeof(ScriptedSpeechParams) == 0x38, "incorrect ScriptedSpeechParams size"); //declaring line (taken out of a container) char* speechline = speechl_it->second; ScriptedSpeechParams params{ speechline, 0, 0, 291934926, ped, NETWORK::NETWORK_IS_GAME_IN_PROGRESS(), 1 }; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, &params); I also tried it with the player Ped, but to no avail 😕 Edit: went through the decompiled scripts and found the following construct being filled this way (like you posted it): Param0 = uParam0 //ped ? struct<7> Var0; Var0.f_5 = 1; Var0.f_6 = 1; Var0 = sParam1; //speechline "RE_PH_RHD_V3_AGGRO" Var0.f_1 = sParam5; //voice "0405_U_M_M_RhdSheriff_01" Var0.f_2 = iParam6; //int 1 Var0.f_3 = iParam2; //int 1744022339 Var0.f_4 = uParam3; //ped ? Var0.f_5 = iParam4; //int 1 Var0.f_6 = iParam7; //int 1 PLAY_AMBIENT_SPEECH(Param0, &Var0); Havent used it successfully yet, though. Edit 2: using it like this and its not crashing anymore, but it doesnt happen anything either^^ (no speaking of peds): char* speechline = speechl_it->second; struct SpeechParams { char* speechline; char* voice; int i1; int i2; Ped p3; int i4; int i5; }; SpeechParams params{ "RE_PH_RHD_V3_AGGRO", "0405_U_M_M_RhdSheriff_01", 1, 291934926, ped, 1, 1 }; AUDIO::x_PLAY_AMBIENT_SPEECH1(ped, params);
  21. I wouldnt know how to do it. Someone here already said they tried to spawn different Arthur Peds after chapter 4, but he always has TB. Maybe we can find something when OpenIV releases a version with all files unhashed and modable.
  22. Thank you, I will try it and share the solution.
  23. Thanks, LMS! Gonna try it out soon. Edit: Just tried it and it didnt work the way I did it. Short summary: I use the script hook natives and the wrapper for the function looks as follows static BOOL _PLAY_AMBIENT_SPEECH1(Ped ped, char* speechName) { return invoke<BOOL>(0x8E04FEDD28D42462, ped, speechName); } I copied that and adjusted it static BOOL x_PLAY_AMBIENT_SPEECH1(Ped ped, boost::any p1) { return invoke<BOOL>(0x8E04FEDD28D42462, ped, p1); } I used the type "any" from the boost-library, so I didnt have to make my own^^ The code in my helper function looks as follows: void PedFear(Ped ped) { //container for speechlines std::map<int, char*> speech; speech[1] = "PANIC_HELP"; speech[2] = "GENERIC_FRIGHTENED_HIGH"; speech[3] = "GUN"; speech[4] = "GUN_RUN"; speech[5] = "INTIMIDATED_GEN"; speech[6] = "INTIMIDATED_AGAIN_GEN"; speech[7] = "PLEAD"; speech[8] = "SCARED_HELP"; //iterator for the container std::map<int, char*>::iterator speechl_it = speech.begin(); //numbers for randomizing the speech lines int linerand = 1 + (std::rand() % (speech.size() - 1 + 1)); int linecounter = 1; while (speechl_it != speech.end()) { if (linerand == linecounter) { char* speechline = speechl_it->second; boost::any var[7]; var[0] = speechline; // speechline var[1] = 0; // voice - Can be 0 var[2] = 0; // uparam5 var[3] = 291934926; // iparam11 var[4] = ped; // Ped target var[5] = NETWORK::NETWORK_IS_GAME_IN_PROGRESS(); // network is game in progress var[6] = 1; // bool at the end? AUDIO::_PLAY_AMBIENT_SPEECH1(ped, var); return; } linecounter++; speechl_it++; } } But in game the game throws a script hook error as soon as I activate the mod. Am I not allowed to use the "any" type from the boost library?
×
×
  • Create New...