lolleroz Posted May 4, 2011 Share Posted May 4, 2011 Here is a simple script idea I had on my mind, if someone has scripting abilities and doesn't have idea he can always use this ^^. Okay so we can notice, AIs (peds, cops etc) always die by headshot. However, player doesn't. So why not make a script where your HP drops to 0 if you get a headshot? Naturally, there would be chance of dying, like 40% (customizable in ini). Why is that? Because you could get shot in the face, not in the brain (which makes a difference) if you would get shot in the cheek with 9mm you wouldn't instantly die (although it wouldn't be totally non-lethal as well) so basicly here's what you can do As you know whenever Niko gets shot, you can see bloodstains on his clothes depending on where he got shot you can often see blood stain on his head indicating he got shot in the head, but he doesnt die so the point is, make a script which detects if niko has blood decal on his head (im sure this is possible to do) and then execute a script line, where script would determine if his HP drops to 0 or not (based on the chance user sets in the ini, if you set it to 100% you die right away, if to 50% theres a chance of surviving) Link to comment Share on other sites More sharing options...
ikt Posted May 4, 2011 Share Posted May 4, 2011 Here is a simple script idea I had on my mind, if someone has scripting abilities and doesn't have idea he can always use this ^^.Okay so we can notice, AIs (peds, cops etc) always die by headshot. However, player doesn't. So why not make a script where your HP drops to 0 if you get a headshot? Naturally, there would be chance of dying, like 40% (customizable in ini). Why is that? Because you could get shot in the face, not in the brain (which makes a difference) if you would get shot in the cheek with 9mm you wouldn't instantly die (although it wouldn't be totally non-lethal as well) so basicly here's what you can do As you know whenever Niko gets shot, you can see bloodstains on his clothes depending on where he got shot you can often see blood stain on his head indicating he got shot in the head, but he doesnt die so the point is, make a script which detects if niko has blood decal on his head (im sure this is possible to do) and then execute a script line, where script would determine if his HP drops to 0 or not (based on the chance user sets in the ini, if you set it to 100% you die right away, if to 50% theres a chance of surviving) The game doesn't actually apply decals on where the player is shot, it only has various levels of blood. Even if the game does that, there isn't a function to detect the place of decals. But what you described is totally possible: Here's some pseudo-code using things in scripting.h from Scripthook. Should work, but for name of limbs, I have no idea. GetCharLastDamageBone(PlayerChar, &placeshot);if (placeshot == head){DamageChar(PlayerChar, hitPoints, true);} If you want, give it a shot. Coding isn't very hard to Link to comment Share on other sites More sharing options...
lolleroz Posted May 4, 2011 Author Share Posted May 4, 2011 Thanks, I'll try to work something out even if I haz no experience. Link to comment Share on other sites More sharing options...
L0uNGeR Posted May 4, 2011 Share Posted May 4, 2011 I'm working on this right now (in C#)... I can already capture the spot where I was hit last (mostly 1224 / 0x4C8: upper arm) Just give me a moment to make it capture headshots and do something with it. Useful: http://www.gtamodding.com/index.php?title=Ped_Bones Link to comment Share on other sites More sharing options...
L0uNGeR Posted May 4, 2011 Share Posted May 4, 2011 Done This should anyone give a small start. I'm not very good with C# but this is what I got so far (it works). using System;using GTA;public class HeadshotTest : Script{ public HeadshotTest() { Interval = 250; this.Tick += new EventHandler(this.HeadshotTest_Tick); } private void HeadshotTest_Tick(object sender, EventArgs e) { GTA.Native.Pointer BonePointer = typeof(Int32); GTA.Native.Function.Call("GET_CHAR_LAST_DAMAGE_BONE", Player.Character, BonePointer); string sBone = BonePointer.ToString(); // GTA.Bone.Neck = 1204 (BONE_NECK: 0x4B4) // GTA.Bone.Head = 1205 (BONE_HEAD: 0x4B5) switch (sBone) { case "1205": Game.DisplayText("HEADSHOT!!"); break; //case "": // ........ // break; //case "": // ........ // break; } }} Link to comment Share on other sites More sharing options...
lolleroz Posted May 4, 2011 Author Share Posted May 4, 2011 Done This should anyone give a small start. I'm not very good with C# but this is what I got so far (it works). using System;using GTA;public class HeadshotTest : Script{ public HeadshotTest() { Interval = 250; this.Tick += new EventHandler(this.HeadshotTest_Tick); } private void HeadshotTest_Tick(object sender, EventArgs e) { GTA.Native.Pointer BonePointer = typeof(Int32); GTA.Native.Function.Call("GET_CHAR_LAST_DAMAGE_BONE", Player.Character, BonePointer); string sBone = BonePointer.ToString(); // GTA.Bone.Neck = 1204 (BONE_NECK: 0x4B4) // GTA.Bone.Head = 1205 (BONE_HEAD: 0x4B5) switch (sBone) { case "1205": Game.DisplayText("HEADSHOT!!"); break; //case "": // ........ // break; //case "": // ........ // break; } }} So if I understand properly, with your script whenever Niko gets a headshot he dies and a text 'HEADSHOT!' appears? Sounds really cool, testing it at the time. Thanks alot for your effort guys, to be honest I expected no answer. Link to comment Share on other sites More sharing options...
L0uNGeR Posted May 4, 2011 Share Posted May 4, 2011 For now it only displays the text, but you can do whatever you want when he gets a headshot. :-) Link to comment Share on other sites More sharing options...
lolleroz Posted May 4, 2011 Author Share Posted May 4, 2011 Oh, cool, thank you ^^ Link to comment Share on other sites More sharing options...
ikt Posted May 4, 2011 Share Posted May 4, 2011 (edited) In C++ for Scripthook: void CustomThread::RunTick(){Player PlayerIndex = ConvertIntToPlayerIndex(GetPlayerId()); Ped PlayerChar; GetPlayerChar(PlayerIndex, &PlayerChar);ePedBone placeshot;GetCharLastDamageBone(PlayerChar, &placeshot);u32 randInt;GenerateRandomIntInRange(0, 1000, &randInt); //generates random int between 0 and 1000if (((placeshot == 0x4B4) || (placeshot == 0x4B5)) && (randInt > 800)) //neckshot or headshot, 80% chance of lethality{ DamageChar(PlayerChar, 1000, true); //1000 to make sure player will be dead with armor}if (((placeshot == 0x4B4) || (placeshot == 0x4B5)) && (randInt <= 200)) //neckshot or headshot, 20% survivable{ DamageChar(PlayerChar, 150, true); //150 is enough to kill you when the health bar blinks red, otherwise it will make it blink. (150 should be 75% health)}} Paste and it should work. If you want to be even more accurate, open the url mentioned above with bone info and modify stuff. You can even choose eyes, mouth and forehead, so it should be entirely possible to make something realistic. It's even possible to detect if Niko is hit in his spine and make him ragdoll, but that's too realistic to be fun. Breaking (disabling) limbs should be very possible. Or make Niko lay o the ground when hit in the nuts. ENDLESS POSSIBILITIES! Edited May 4, 2011 by ikt Link to comment Share on other sites More sharing options...
L0uNGeR Posted May 4, 2011 Share Posted May 4, 2011 Not really, they don't hit many spots... On my tests they didn't even hit the neck or forehead. Link to comment Share on other sites More sharing options...
ikt Posted May 4, 2011 Share Posted May 4, 2011 Not really, they don't hit many spots...On my tests they didn't even hit the neck or forehead. Oh well, limping is an option. Link to comment Share on other sites More sharing options...
L0uNGeR Posted May 4, 2011 Share Posted May 4, 2011 (edited) I think there's one problem though, I think the game never removes the value from GET_CHAR_LAST_DAMAGE_BONE... Because I just died twice after getting a headshot.... Also, I don't think you need to give damage when you don't kill Niko, headshots do a lot of damage already. So with this script, it's either a lot of damage or death (70% chance). Here's my new version btw, was kind of figuring out how to get the proper type from the pointer, since it only gave me the ToString() function... http://pastebin.com/Ni1S3GCq using System;using GTA;// CAPTURING HEADSHOTS// ©2011 LouNGeR// For http://www.gtaforums.com/index.php?act=ST&t=475837public class HeadshotTest : Script{ public HeadshotTest() { Interval = 250; this.Tick += new EventHandler(this.HeadshotTest_Tick); } private void HeadshotTest_Tick(object sender, EventArgs e) { GTA.Native.Pointer BonePointer = typeof(Int32); GTA.Native.Function.Call("GET_CHAR_LAST_DAMAGE_BONE", Player.Character, BonePointer); Int32 iBone = Convert.ToInt32(BonePointer.Value); // http://www.gtamodding.com/index.php?title=Ped_Bones // BONE_NECK: 0x4B4 // BONE_HEAD: 0x4B5 switch (iBone) { case 0x4B5: //Game.DisplayText("HEADSHOT!!"); // Received a headshot Random RNG = new Random((int)DateTime.Now.Ticks); Double RandomNumber = RNG.NextDouble(); if (RandomNumber < .7) // Let's say Niko has a 70% chance of dying Player.Character.Die(); break; } }} Edited May 6, 2011 by L0uNGeR Link to comment Share on other sites More sharing options...
lolleroz Posted May 4, 2011 Author Share Posted May 4, 2011 Marry me and let's have a threesome Wait...wat. Thanks alot for your help guys, I'm editing Lounger's (great job mate!) script at the time, trying to add more possibilities of damages...I just wish we could do the same to peds (it would prolly slow down the game as hell) Can't wait to be unable to move after getting shot 3 times in my back with AK...lol. It's pretty good along with my realistic weapon statistics, I made the weapons more powerfull but made AI less accurate (although, they are still very lethal!) as well to balance things out (I didn't like how they could shoot you 5 times when running in slalom anyway) Link to comment Share on other sites More sharing options...
L0uNGeR Posted May 4, 2011 Share Posted May 4, 2011 I just wish we could do the same to peds (it would prolly slow down the game as hell) If you would apply this endless loop to every ped in the game, yes... But there are ways, like doing checks on all peds withing a reasonable radius. Link to comment Share on other sites More sharing options...
lolleroz Posted May 5, 2011 Author Share Posted May 5, 2011 Didn't know about that, cool, cool ^^ Link to comment Share on other sites More sharing options...
utymmn Posted January 18, 2012 Share Posted January 18, 2012 this sounds like a promising conversation. so if i am to understand correctly, i could adapt these scripts to "checks on all peds withing a reasonable radius" then 'ragdoll' specific limbs, or make their model disappear (like first person mod)? oh my god. Link to comment Share on other sites More sharing options...
jitsuin Posted January 18, 2012 Share Posted January 18, 2012 (edited) ytxsc Edited February 3, 2012 by jitsuin Link to comment Share on other sites More sharing options...
lindsayslorach Posted January 18, 2012 Share Posted January 18, 2012 How about you cast the integer from last damage bone to type GTA.Bone? It would make it so much easier! Then in your switch statement you could do "case Bone.Head:" or whatever. @jitsuin: In your code you have a comment saying that you can remove the Exists() check if including Niko, but that check has nothing to do with checking if "p" is Niko, it's checking if "p" exists. You also don't even use the Ped variable "p" you defined at the top of the script. Link to comment Share on other sites More sharing options...
jitsuin Posted January 18, 2012 Share Posted January 18, 2012 (edited) I figure niko will exist so if u do something with p it will always have ped p, crashed when i shot someone in the head, i missed something Edited January 18, 2012 by jitsuin 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