SA-MP Forums [Tutorial] Simple Realistic Damage Values
 New Account Members List Search Today's Posts Mark Forums Read

 02/04/2012, 03:04 AM #21 [ABK]Antonio High-roller     Join Date: Sep 2011 Location: ID, USA Posts: 1,248 Reputation: 183 Re: Simple Realistic Damage Values I would do something along the lines of this. Code: ```public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid) { new Float:stat[2]; GetPlayerHealth(playerid, stat[0]); GetPlayerArmour(playerid, stat[1]); new Damage; switch(weaponid) { case 31: Damage = 25; //set the damage here for when this switch is over } if(stat[1] > Damage) SetPlayerArmour(playerid, stat[1]-Damage); else if(stat[1] == Damage) SetPlayerArmour(playerid, 0); else if(stat[1] < Damage && stat[1] > 0) { new subval = floatround(stat[1])-Damage; //takes their armor, subtracts 25 from it. Then it adds that negative number to their health //For instance, 15 armor -25 = -10. So we subract 10 basically. SetPlayerArmour(playerid, 0); SetPlayerHealth(playerid, stat[0]+subval); } else SetPlayerHealth(playerid, stat[0]-Damage); return 1; }``` __________________ ABKClan.com Last edited by [ABK]Antonio; 25/03/2013 at 06:21 AM.
02/04/2012, 11:42 AM   #22
rati555
Huge Clucker

Join Date: May 2010
Location: Georgia/Tbilisi
Posts: 200
Reputation: 20
Re: Simple Realistic Damage Values

Quote:
 Originally Posted by [ABK]Antonio I would do something along the lines of this. Code: ```public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid) { new Float:stat[2]; GetPlayerHealth(playerid, stat[0]); GetPlayerArmour(playerid, stat[1]); new Damage; switch(weaponid) { case 31: Damage = 25; //set the damage here for when this switch is over } if(stat[1] > Damage) SetPlayerArmour(playerid, stat[1]-Damage); else if(stat[1] == Damage) SetPlayerArmour(playerid, 0); else if(stat[1] < Damage && stat[1] > 0) { new subval = stat[1]-Damage; //takes their armor, subtracts 25 from it. Then it adds that negative number to their health //For instance, 15 armor -25 = -10. So we subract 10 basically. SetPlayerArmour(playerid, 0); SetPlayerHealth(playerid, stat[0]+subval); } else SetPlayerHealth(playerid, stat[0]-Damage); return 1; }```
I've got tag mismatch warning at this line
Code:
` new subval = stat[1]-Damage;`

 02/04/2012, 05:36 PM #23 [ABK]Antonio High-roller     Join Date: Sep 2011 Location: ID, USA Posts: 1,248 Reputation: 183 Re: Simple Realistic Damage Values new subval = floatround(stat[1])-Damage; __________________ ABKClan.com
 06/06/2012, 09:11 PM #24 DaRealShazz Big Clucker     Join Date: Jan 2012 Posts: 188 Reputation: 55 Re: Simple Realistic Damage Values Wouldn't returning 0 work?
 18/07/2012, 03:08 PM #25 Keelo Little Clucker     Join Date: Jul 2012 Posts: 9 Reputation: 0 Re: Simple Realistic Damage Values Hey I suck, I'm new on scripting please help me, in what .pwn should I copy this script? Plzz answer.
 19/07/2012, 10:16 AM #26 Coder_ Big Clucker   Join Date: Jul 2012 Posts: 69 Reputation: 1 Re: Simple Realistic Damage Values Awww Awesome tutorial 11/10 Thank You!
 31/07/2012, 07:36 PM #27 Coder_ Big Clucker   Join Date: Jul 2012 Posts: 69 Reputation: 1 Re: Simple Realistic Damage Values What the fuck! i use this on 3e and kill hud show i killed myself PLEASE HELP ME!
 05/08/2012, 08:45 PM #28 Pottus Godfather     Join Date: Jun 2012 Posts: 5,016 Reputation: 1066 Respuesta: Simple Realistic Damage Values This tutorial does not address the implications of using such a system, if you guys think such a system can be implemented effectively this way think again there is a lot of elements not even shown here that are vital! One issue for instance is such a system will not work correctly if you don't kill the player when they reach less than 50hp. Why is that? Well what happens if there HP is 40 and they get shot by deagle which is 46 damage, they die but the system is configured that they take 30 HP! This kind of system really takes tons and tons of testing to get working nicely it's not as simple as the tutorial would have you believe.
 30/09/2012, 04:13 PM #29 zDevon Huge Clucker   Join Date: Jan 2012 Location: Charlotte, NC (USA) Posts: 316 Reputation: 31 Re: Simple Realistic Damage Values I will update this tutorial in the coming days to address the above problem and any other loopholes mentioned, possibly including armor support. Testing will be slow however because I'm a bit injured. Stay tuned!
03/10/2012, 03:39 AM   #30
CaptainMactavish
Huge Clucker

Join Date: Jun 2012
Location: Argentina
Posts: 362
Reputation: 18
Respuesta: Simple Realistic Damage Values

A realistic damage should be calculated respect to the caliber of the weapon, velocity of the bullet, body part affected and distance between shooter and target.
Every one of this factors named before can be done (the caliber and velocity can be investigated and the distance can be got by GetPlayerPos and GetPlayerDistanceToPoint) except body part detection that is very inaccurate via scripting.
__________________

Quote:
 Originally Posted by dugi in Slice's Visitor Messages LOL Donde, está, la biblioteca. Me llamo T-Bone La araña discoteca. Discoteca, muñeca, La biblioteca Está en bigotes grandes, el perro, manteca. Manteca, bigotes, gigante, pequeño, la cabeza es nieve, cerveza es bueno. Buenos dias, me gusta papas frías, los bigotes de la cabra Es Cameron Diaz.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post [FilterScript] [0.3d R2] Realistic weapon bullet damage [WSF]ThA_Devil Filterscripts 30 19/06/2012 07:30 PM Celson General 7 09/12/2011 12:28 PM

All times are GMT. The time now is 09:44 PM.

 -- (EN) English -- (ES) Español -- (RU) Русски Contact Us - SA-MP - Archive - Top