TuffyTown
Recognized Creator-
Posts
31 -
Joined
-
Last visited
-
Days Won
8
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
RDR Modding Tutorials
RDR2 Ped Model Database
RDR2 Animations Database
RDRFR Changelog
RDRFR Installation Guide
RDRFR Features
RDRFR Settings
LML User Contributions
Everything posted by TuffyTown
-
c++ Adding/Removing Items To Inventory Using Natives
TuffyTown posted a topic in RDR2 Mods Discussion
Adding items to the player inventory is kinda hard, so I decided to tell everyone how to do it since I know a lot of people don't know how. These are the basics. The functions are basically taken right from the game scripts, but I have modified them to be more simplified. First you need to add these structures. Note that script struct and array variables are aligned to 8 bytes. struct sGuid { alignas(8) int data1; alignas(8) int data2; alignas(8) int data3; alignas(8) int data4; }; struct sSlotInfo { alignas(8) sGuid guid; alignas(8) int f_1; alignas(8) int f_2; alignas(8) int f_3; alignas(8) int slotId; }; struct sItemInfo { alignas(8) int f_0; alignas(8) int f_1; alignas(8) int f_2; alignas(8) int f_3; alignas(8) int f_4; alignas(8) int f_5; alignas(8) int f_6; }; Then you will need to add these functions: // Creates an empty GUID instance sGuid CreateNewGUID() { sGuid guid{}; return guid; } // Gets an item's GUID from the inventory sGuid GetPlayerInventoryItemGUID(u32 item, sGuid guid, u32 slotId) { sGuid outGuid{}; INVENTORY::INVENTORY_GET_GUID_FROM_ITEMID(1, (Any*)&guid, item, slotId, (Any*)&outGuid); return outGuid; } // Gets the players inventory GUID sGuid GetPlayerInventoryGUID() { return GetPlayerInventoryItemGUID(MISC::GET_HASH_KEY("CHARACTER"), CreateNewGUID(), MISC::GET_HASH_KEY("SLOTID_NONE")); } // Gets an item's group hash (eInvItemGroup) u32 GetItemGroup(u32 item) { sItemInfo info{}; if (!ITEMDATABASE::_ITEMDATABASE_IS_KEY_VALID(item, 0)) { return 0; } if (!ITEMDATABASE::ITEMDATABASE_FILLOUT_ITEM_INFO(item, (Any*)&info)) { return 0; } return info.f_2; } // Gets an item's slot info data sSlotInfo GetItemSlotInfo(u32 item) { sSlotInfo slotInfo{}; slotInfo.guid = GetPlayerInventoryGUID(); slotInfo.slotId = MISC::GET_HASH_KEY("SLOTID_SATCHEL"); u32 group = GetItemGroup(item); switch (group) { case 0xC2286F01: // CLOTHING if (!INVENTORY::_INVENTORY_FITS_SLOT_ID(item, MISC::GET_HASH_KEY("SLOTID_WARDROBE"))) { slotInfo.guid = GetPlayerInventoryItemGUID(MISC::GET_HASH_KEY("WARDROBE"), slotInfo.guid, MISC::GET_HASH_KEY("SLOTID_WARDROBE")); slotInfo.slotId = INVENTORY::_GET_DEFAULT_ITEM_SLOT_INFO(item, MISC::GET_HASH_KEY("WARDROBE")); } else { slotInfo.slotId = MISC::GET_HASH_KEY("SLOTID_WARDROBE"); } break; case 0x95A6F147: // HORSE slotInfo.slotId = MISC::GET_HASH_KEY("SLOTID_ACTIVE_HORSE"); break; case 0x80FB92CD: // UPGRADE if (INVENTORY::_INVENTORY_FITS_SLOT_ID(item, MISC::GET_HASH_KEY("SLOTID_UPGRADE"))) { slotInfo.slotId = MISC::GET_HASH_KEY("SLOTID_UPGRADE"); } break; default: if (INVENTORY::_INVENTORY_FITS_SLOT_ID(item, MISC::GET_HASH_KEY("SLOTID_SATCHEL"))) { slotInfo.slotId = MISC::GET_HASH_KEY("SLOTID_SATCHEL"); } else if (INVENTORY::_INVENTORY_FITS_SLOT_ID(item, MISC::GET_HASH_KEY("SLOTID_WARDROBE"))) { slotInfo.slotId = MISC::GET_HASH_KEY("SLOTID_WARDROBE"); } else { slotInfo.slotId = INVENTORY::_GET_DEFAULT_ITEM_SLOT_INFO(item, MISC::GET_HASH_KEY("CHARACTER")); } break; } return slotInfo; } // Adds an item to the player inventory via GUID bool AddItemWithGUID(u32 item, sGuid &guid, sSlotInfo &slotInfo, u32 quantity, u32 addReason) { if (!INVENTORY::_INVENTORY_IS_GUID_VALID((Any*)&slotInfo.guid)) { return false; } if (!INVENTORY::_INVENTORY_ADD_ITEM_WITH_GUID(1, (Any*)&guid, (Any*)&slotInfo.guid, item, slotInfo.slotId, quantity, addReason)) { return false; } return true; } // Adds an item to the player inventory via hash // This is the main function you will be calling to add items to your inventory bool AddItemToInventory(u32 item, u32 quantity) { sSlotInfo slotInfo = GetItemSlotInfo(item); sGuid guid = GetPlayerInventoryItemGUID(item, slotInfo.guid, slotInfo.slotId); return AddItemWithGUID(item, guid, slotInfo, quantity, MISC::GET_HASH_KEY("ADD_REASON_DEFAULT")); } Now to actually add an item to the player inventory, all you need to call is AddItemToInventory() Like so: AddItemToInventory(MISC::GET_HASH_KEY("CONSUMABLE_CORNEDBEEF_CAN"), 1); AddItemToInventory(MISC::GET_HASH_KEY("PROVISION_TALISMAN_BUFFALO_HORN"), 1); // etc To remove an item from the player inventory is way easier and can be done with a single native call: INVENTORY::_INVENTORY_REMOVE_INVENTORY_ITEM_WITH_ITEMID(1, MISC::GET_HASH_KEY("CONSUMABLE_CORNEDBEEF_CAN"), 1, MISC::GET_HASH_KEY("REMOVE_REASON_DEFAULT")); And that's how you add/remove items from the player inventory. Any questions, ask me and I'll try to answer them. -
csharp ScriptHookRDR2DotNet (C#) is being updated again
TuffyTown replied to TuffyTown's topic in Community ScripthookRDR2.NET
@HughJanus The Euphoria stuff is a complete mystery to me. Not sure why it's even there. I haven't touched any of it except changing native calls. I've looked at the code serveral times and it all seems pointless to me. I'm honestly not sure how it even works, but I kept it because some people probably use it. If you need to do things with ragdolls, there are certain natives that can mess with that. If you need to change specific behaviors, then you'll probably need to do file editing with LML.- 5 replies
-
- modding resource
- scripting
-
(and 2 more)
Tagged with:
-
csharp ScriptHookRDR2DotNet (C#) is being updated again
TuffyTown replied to TuffyTown's topic in Community ScripthookRDR2.NET
I personally have not experienced this, but I am almost certain that this is still an issue as the DllMain.cpp files are basically the exact same. I will look into this, but there is no guarantees that I can fix it, but I will try.- 5 replies
-
- modding resource
- scripting
-
(and 2 more)
Tagged with:
-
Since the original C# script hook hasn't been updated in almost 3 years, I decided to make my own fork of the project and start updating it again. I've already made many great improvements and additions to the new version, including a new native calling system that removes the need to use Function.Call(). Credits go to Satlyq for the original ScriptHookRDR2DotNet implementation You can find the project here: https://github.com/Halen84/ScriptHookRDR2DotNet-V2 You can download the latest version here: https://github.com/Halen84/ScriptHookRDR2DotNet-V2/releases/latest You can find all releases here: https://github.com/Halen84/ScriptHookRDR2DotNet-V2/releases/ If you would like to create mods with this version of ScriptHookRDR2DotNet (ScriptHookRDR2DotNet V2), please follow this guide posted by Mooshe. Notes: - Old mods that use ScriptHookRDR2DotNet will NOT be compatible with this version - The following tutorial is a little outdated, but the steps are almost all the same. The code that he uses is outdated.
- 5 replies
-
- 1
-
- modding resource
- scripting
-
(and 2 more)
Tagged with:
-
Which Scripthook Vers for build "1436.28"
TuffyTown replied to veryrareflicks's topic in RDR2 Mods Discussion
just update the game and version.dll -
How can I determine the movement set of a ped?
TuffyTown replied to HughJanus's topic in RDR2 Mods Discussion
You can check if a ped is bleeding out via IS_PED_IN_WRITHE(Ped ped) -
There is already a mod for this https://www.nexusmods.com/reddeadredemption2/mods/1209 A quick google search is all it takes...
-
-
-
What NativeUI are you talking about? ScriptHookDotNet hasnt been updated in years so you probably shouldnt use it anymore. If you want to make mods, you should probably learn C++
-
question How to Decompile Native Functions?
TuffyTown replied to WesternGamer's topic in RDR2 Mods Discussion
-
Here is a simple list of keycodes 8 backspace 9 tab 13 enter 16 shift 17 ctrl 18 alt 19 pause/break 20 caps lock 27 escape 32 (space) 33 page up 34 page down 35 end 36 home 37 left arrow 38 up arrow 39 right arrow 40 down arrow 45 insert 46 delete 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 65 a 66 b 67 c 68 d 69 e 70 f 71 g 72 h 73 i 74 j 75 k 76 l 77 m 78 n 79 o 80 p 81 q 82 r 83 s 84 t 85 u 86 v 87 w 88 x 89 y 90 z 91 left window key 92 right window key 93 select key 96 numpad 0 97 numpad 1 98 numpad 2 99 numpad 3 100 numpad 4 101 numpad 5 102 numpad 6 103 numpad 7 104 numpad 8 105 numpad 9 106 multiply 107 add 109 subtract 110 decimal point 111 divide 112 f1 113 f2 114 f3 115 f4 116 f5 117 f6 118 f7 119 f8 120 f9 121 f10 122 f11 123 f12 144 num lock 145 scroll lock 186 semi-colon 187 equal sign 188 comma 189 dash 190 period 191 forward slash 192 grave accent 219 open bracket 220 back slash 221 close braket 222 single quote
-
-
All of these are already documented on femga's repo
-
-
Try this: if (!OBJECT::IS_DOOR_REGISTERED_WITH_SYSTEM(doorHash)) { OBJECT::_ADD_DOOR_TO_SYSTEM_NEW(doorHash, 1, 0, 0, SCRIPTS::GET_ID_OF_THIS_THREAD(), 0, 0); } OBJECT::DOOR_SYSTEM_SET_DOOR_STATE(doorHash, 0); // 0 = DOORSTATE_UNLOCKED
-
-
Found some new MotionState names, so I decided to share my findings here. Some of them are still unknown. Feel free to add on to this post if you find any names. MotionState_None = 4000413475, MotionState_Idle = 2423432979, MotionState_WalkStart = 2892990199, MotionState_Walk = 3626484699, MotionState_WalkStop = 1039980451, MotionState_JogStart = 1762715185, MotionState_Jog = 2879691058, MotionState_JogStop = 1921962887, MotionState_Run = 4294436772, MotionState_RunStart = 3389713994, MotionState_RunStop = 3971165696, MotionState_SprintStart = 1619979220, MotionState_Sprint = 3179812827, MotionState_SprintStop = 3736771182, MotionState_Crouch_Idle = 1140525470, MotionState_Crouch_WalkStart = 2053115016, MotionState_Crouch_Walk = 147004056, MotionState_Crouch_WalkStop = 429657324, MotionState_Crouch_JogStart = 788591807, MotionState_Crouch_Jog = 1823606944, MotionState_Crouch_JogStop = 514412321, MotionState_Crouch_RunStart = 2021882972, MotionState_Crouch_Run = 898879241, MotionState_Crouch_RunStop = 2009014104, MotionState_DoNothing = 247561816, _0xE18CF8D9 = 1427811395, MotionState_InVehicle = 2497303949, _0x78643517 = 3883834778, MotionState_Aiming = 1063765679, MotionState_Diving_Idle = 1212730861, MotionState_Diving_Swim = 2439938700, // Something to do with swimming MotionState_Swimming_TreadWater = 3518960071, MotionState_Dead = 230360860, MotionState_Stealth_Idle = 1110276645, MotionState_Stealth_WalkStart = 1378577627, MotionState_Stealth_Walk = 69908130, MotionState_Stealth_WalkStop = 208063303, MotionState_Stealth_JogStart = 2599815243, MotionState_Stealth_Jog = 1313835858, MotionState_Stealth_JogStop = 2820186403, MotionState_Stealth_RunStart = 3746167742, MotionState_Stealth_Run = 4211833313, MotionState_Stealth_RunStop = 2453556011, MotionState_Parachuting = 3133206795, MotionState_ActionMode_Idle = 3661668572, MotionState_ActionMode_WalkStart = 405893284, MotionState_ActionMode_Walk = 3532676775, MotionState_ActionMode_WalkStop = 3658701735, MotionState_ActionMode_JogStart = 121273477, MotionState_ActionMode_Jog = 502040856, MotionState_ActionMode_JogStop = 722171322, MotionState_ActionMode_RunStart = 522680683, MotionState_ActionMode_Run = 834330132, MotionState_ActionMode_RunStop = 3214436417, /* Most of these below are probably animal related */ _0xD4245C6C = 1772316371, _0x8D9C2FE9 = 3065742770, // Something to do with crouching _0x6F9FD71F = 3704249663, _0x5FF0AE81 = 4261625842, _0x2CAC0EC9 = 4056519739, _0xED751F5A = 1396281153, _0x32744F0A = 2864204450, _0x3B95D344 = 145311488, _0x67CEC1F7 = 1687431867, _0xDD6D7C82 = 1524945618, // Crouch quick stop? _0xD25AE144 = 4161186757, // Something to do with crouching _0x838FE5DF = 1533326580, _0x03C1EEED = 3092246840, _0x39E6DBA8 = 2979206612, _0x27BF5075 = 2603427240, _0x3DFC9AB6 = 2238165385, _0x86DEF684 = 1785465342, _0xF44902C9 = 3182136551, _0x28085F0D = 802868116, _0x3E25BCAE = 1863875406, // Crouch quick stop? _0xF1B6A8AD = 202215844, _0x13C3816B = 1398696542, _0x42499F4E = 2994988260, _0xBE5B7E0F = 3744976664, _0x930FDD2D = 2882129524, _0xE5AC0F31 = 3914821169, _0x9C29C70B = 1786078862, _0x3FC0B3BE = 25465920, // Something to do with stealth _0xDAB33BE2 = 1926482157,
-
-
Update November 10, 2021: I have rewritten the core functionality of basically the entire thing, so if you are using this, please please please use the new version. The old version was terrible to work with and I am sorry, but hopefully with this rewrite it should be a lot easier. I tested a lot of things so hopefully there should be less bugs.
-
-
-
Released an update that adds more toggle button support.
-
I made an open source RDR2 Native Menu Base that uses in-game sprites to make menus just like how they are in-game You can find the GitHub repository here: https://github.com/Halen84/RDR2-Native-Menu-Base Hopefully you guys wont make fun of my bad programming too much, as I'm fairly new to C++ lol. If you have any questions, ask me and I'll answer them to the best of my ability. Note: These pictures are slightly outdated, but they still hold up. Update November 10, 2021: I have rewritten the core functionality of basically the entire thing, so if you are using this, please please please use the new version. The old version was terrible to work with and I am sorry, but hopefully with this rewrite it should be a lot easier. Update Feburary 12, 2022: Another overhaul and rewrite. Enjoy!
-
Returns true if player is in first person