HughJanus 244 Posted January 18, 2020 Share Posted January 18, 2020 I would like to find out if NPCs are hit in certain spots, but dont know the int values of the bones. Are they already known? Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted January 27, 2020 Author Share Posted January 27, 2020 Maybe someone can help me if I explain what I'm trying to do: I am iterating through all the NPCs in the players surroundings and trying to check if they got hit in the leg. If they got hit in the leg, I flag the NPC. If an NPC got flagged, I compute a chance of stumbling for this NPC (so if he runs or sprints, there is a chance he stumbles and falls (I do that by setting the NPC to ragdoll and applying a light force to him, so he is pushed forward)). Unfortunately until now I have not figured out how to check if an NPC got hit in the leg. Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted January 28, 2020 Share Posted January 28, 2020 It might be easiest to run GET_PED_LAST_DAMAGE_BONE after you shoot a ped and take your own notes. For the bigger parts the results should hopefully be consistent enough. Would be great if you shared the list if you ever get around to creating one! Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted January 29, 2020 Author Share Posted January 29, 2020 I might need your help there, bud :) Because I have tried this already (and I wanted to get the int value shown on screen and not write it in a file), but I failed miserably^^ If you lend me a hand, I would be glad to create the list! Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted January 29, 2020 Share Posted January 29, 2020 Sure, if you show me what you have so far I will see what I can do. Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted January 29, 2020 Author Share Posted January 29, 2020 (edited) Its the DrawText method that kills me. I have something like that: std::string text = "Last Damaged Bone = "; int actBone; if (PED::GET_PED_LAST_DAMAGE_BONE(lastTarget, &actBone)) { text += std::to_string(actBone); DrawText(0.5, 0.5, text); } But the DrawText method (which wants two doubles and a string) is throwing an error - it says it wants a string^^ Edit: Wrong info - the DrawText wants two floats and a char* and I couldnt get the str to char*. Just remembered that. Edit 2: I have now googled a bit and have another solution, but I think the text will only get displayed for the split second the player is shooting: if (PED::IS_PED_SHOOTING(playerPed)) { Entity playerTarget; if (PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(player, &playerTarget)) { int actBone; std::string text = "Last Damaged Bone = "; if (PED::GET_PED_LAST_DAMAGE_BONE(playerTarget, &actBone)) { text += std::to_string(actBone); int n = text.length(); std::vector<int> temp(n + 1); char c[30]; strcpy(c, text.c_str()); DrawText(0.5, 0.5, c); } } } How would I be able to draw the text for longer? (if this works) Edited January 29, 2020 by HughJanus corrected the code snippet, added information Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted January 30, 2020 Share Posted January 30, 2020 Could you also include your DrawText function? I am not sure where you got it from. Before calling _DRAW_TEXT you probably also need to "convert" your string to something the game accepts via _CREATE_VAR_STRING which essentially copies your string data to a game-controlled buffer. That should then show the text. As you have said correctly it will only occur for one frame though, so it would be best to loop this function. 1 Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted January 31, 2020 Author Share Posted January 31, 2020 (edited) Yesterday evening I had half an hour time and did it (i used a fixed character array as a global variable which is shown permanently and I always fill that with the latest bone the playerPed hit). I will share the code of my solution on the weekend when I have more time. Edit: so heres the code (you can use it just like that if your project has all of alexander blades SDK stuff included): void DrawText(float x, float y, char* str) { UI::DRAW_TEXT(GAMEPLAY::CREATE_STRING(10, "LITERAL_STRING", str), x, y); } void main() { bool modScriptState{ false }; constexpr int toggleKey{ VK_F8 }; int msgTime{ 0 }; char c[40]; int act = 99999; std::string text = "Last Damaged Bone = "; while (true) { if (IsKeyJustUp(toggleKey)) { modScriptState = !modScriptState; msgTime = GetTickCount() + 3000; } if (modScriptState) { Player player = PLAYER::PLAYER_ID(); Ped playerPed = PLAYER::PLAYER_PED_ID(); if (WEAPON::IS_PED_WEAPON_READY_TO_SHOOT(playerPed)) { strcpy(c, text.c_str()); DrawText(0.4, 0.4, c); } else { if (PED::IS_PED_SHOOTING(playerPed)) { Entity playerTarget; if (PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(player, &playerTarget)) { int actBone; if (PED::GET_PED_LAST_DAMAGE_BONE(playerTarget, &actBone)) { act = actBone; text = "Last Damaged Bone = " + std::to_string(act); strcpy(c, text.c_str()); DrawText(0.4, 0.4, c); } } } } } WAIT(0); } } void ScriptMain() { srand(GetTickCount()); main(); } Edited January 31, 2020 by HughJanus code added Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted January 31, 2020 Share Posted January 31, 2020 Good to see it's working now! Looking forward to your findings 🙂 I think for most of the bigger bones it will be quite simple but for others, such as the fingers, it could be trickier so I'd recommend starting with the more obvious ones. Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted January 31, 2020 Author Share Posted January 31, 2020 (edited) At first I went to analyze the leg bones, but the results are weird. Here are the IDs I noted when shooting those zones: bottom: 6884, 56200 thighs: 65478 knees: 6884, 55120 lower legs: 43312 ankles: 55120 feet: 33646, 34606, 45454 I dont really know what to think of this, but it made the thing I wanted work. I check if the last hit bone is any of those and then mark the NPC and make them stumble. It works if I shoot their leg or foot anywhere. Edited January 31, 2020 by HughJanus typos Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted February 1, 2020 Share Posted February 1, 2020 Thanks for the research! That also confirms that they use different ids than on GTA V unfortunately. I had a closer look based on your findings and could map a few bones (mix of peds and horses it seems) and find more ids, although some names appear multiple times with different values. SKEL_ROOT: 0 SKEL_R_Thigh: 6884 reins: 7434 FACIAL_R_LipCorner: 10509 SKEL_R_Finger41: 11300 FACIAL_L_LipCorner: 31911 SKEL_Neck1: 14284 SKEL_Neck2: 14285 SKEL_Neck3: 14286 SKEL_Neck4: 14287 SKEL_Neck5: 14288 SKEL_Spine1: 14411 SKEL_Spine2: 14412 SKEL_Spine3: 14413 SKEL_Spine4: 14414 SKEL_Spine5: 14415 SKEL_R_Finger12: 16749 SKEL_L_Finger32: 16765 SKEL_R_Finger32: 16781 SKEL_L_Finger32: 16829 SKEL_Head: 21030 SKEL_SADDLE: 29245 SKEL_R_SATCHELROOT: 34484 SKEL_L_Finger41: 35876 SKEL_L_Finger12: 41325 SKEL_L_Finger12: 41326 SKEL_L_Finger12: 41405 SKEL_L_Finger32: 41341 SKEL_L_Finger32: 41357 SKEL_R_Calf: 43312 SKEL_L_Forearm: 53675 PH_bridle_attach_L: 53945 PH_L_LipAttach: 53945 PH_bridle_attach_R: 53951 PH_R_LipAttach: 53951 SKEL_R_Forearm: 54187 SKEL_L_CALF: 55120 PH_SaddleHorn: 62111 PH_bridle_wagon_L: 64311 PH_bridle_wagon_R: 64413 SKEL_L_Thigh: 65478 Confirmed Horse: SKEL_ROOT: 0 SKEL_Neck2: 14285 SCALE_Pelvis: 19060 SCALE_Spine1: 38711 SCALE_Spine3: 38713 SPR_L_Saddlebag: 47850 SPR_R_Saddlebag: 50064 SPR_C_BedRoll: 53074 1 Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted February 1, 2020 Author Share Posted February 1, 2020 How did you manage to pinpoint the IDs to certain bones when the IDs come up multiple times with different names? What I also noticed is that the ID you got for the head (21030) I get when I shoot a dead body (no matter where) - maybe it returns the last damaged bone before death for me? Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted February 1, 2020 Share Posted February 1, 2020 There are from some of the data files, but unfortunately are incomplete. I am not sure why there are multiple IDs for the same names, could be horse/ped again or something entirely unrelated. What happens when you shoot them in the leg until they die? Will it also return head afterwards? Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted February 1, 2020 Author Share Posted February 1, 2020 You're right, it shows the last damaged bone before death. Attached you find the .asi if you want to take a look for yourself (stripped away all the other stuff I am currently trying out - you can enable it with F9). ShowLastDamagedBone.asi Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted February 2, 2020 Share Posted February 2, 2020 Thanks! I fear we will not be able to find all bones using this way since there are so many, so hopefully we can find them in the data files. Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted March 18, 2020 Author Share Posted March 18, 2020 (edited) I need some help. I have been trying to apply force to certain bones, but they seem to vary for each NPC. For example I tried to apply a force push to the right forearm (= 54187), when an NPC is down. The sheriff in Valentine does work, but other NPC might be pushed in the left forearm, some even in the thigh,.. How can I make sure that I push every NPC in the right forearm - can I work with bone names somehow like this: GET_ENTITY_BONE_INDEX_BY_NAME(Ped, "SKEL_R_Forearm"); Or does it need another name? Edit: I just tried it with the bone names, but the result is the same. The Sheriff in Valentine keeps moving his arms, other NPCs mostly dont. Is that a known problem? How can it be solved? Edited March 18, 2020 by HughJanus Quote Link to comment Share on other sites More sharing options...
LMS 673 Posted March 18, 2020 Share Posted March 18, 2020 I wonder if some peds just do not have these bones (or use different names). It's hard to say without the models. Can you get valid positions for the forearm bone on the other peds? Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted March 19, 2020 Author Share Posted March 19, 2020 Havent tried. I was so frustrated after discovering that, that I moved on with something else^^ Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted May 15, 2020 Author Share Posted May 15, 2020 (edited) Has anyone figured out any other bones yet? I think I found two more: right upper arm 46065 left upper arm 37873 Edited May 16, 2020 by HughJanus Quote Link to comment Share on other sites More sharing options...
jctwizard 0 Posted October 16, 2020 Share Posted October 16, 2020 I came across this thread when searching about bones and I was wondering if either of you know is there a Native to change the scale/size of specific bones to say make the player head bigger? Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted February 3, 2021 Author Share Posted February 3, 2021 @jctwizard I dont know, unfortunately. I have the following bone IDs on NPCs I cant really tell which limb they belong to: 14283 22798 30226 34606 45454 54802 56200 Is there an easy way of finding out? Quote Link to comment Share on other sites More sharing options...
atMee 1 Posted February 3, 2021 Share Posted February 3, 2021 SKEL_Neck0 SKEL_R_Hand SKEL_L_Clavicle SKEL_L_Hand SKEL_L_Foot SKEL_R_Clavicle SKEL_Pelvis 1 Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted February 8, 2021 Author Share Posted February 8, 2021 On 2/3/2021 at 8:47 PM, atMee said: SKEL_Neck0 SKEL_R_Hand SKEL_L_Clavicle SKEL_L_Hand SKEL_L_Foot SKEL_R_Clavicle SKEL_Pelvis Do you by any chance know the ID of SKEL_R_Foot? Or maybe even better, have a list of all the bones? :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.