Author Topic: Map bullet speed  (Read 1659 times)

0 Members and 1 Guest are viewing this topic.

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Map bullet speed
« on: January 02, 2016, 05:38:56 pm »
Try this - it sometimes does not work, calculated dmg is sometimes higher or lower :(
ShootSpeed:double;
Code: [Select]
if (Shooter.ID<>Victim.ID) and (Shooter.Team<>Victim.Team) and (Shooter.Team<>5) and (Victim.Health-Damage<=0) then begin
ShootSpeed:=(sqrt((Map.Bullets[Bullet].VelX*Map.Bullets[Bullet].VelX)+(Map.Bullets[Bullet].VelY*Map.Bullets[Bullet].VelY))/100);

if (Round((GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*ShootSpeed*1.15))=Damage)then begin
DrawTextEx(Shooter.ID,108,'HEADSHOOT!',400,$F15D70,0.055,12,385);
DrawTextEx(Shooter.ID,109,'Damage: '+inttostr(damage)+', DamageCalculate: '+inttostr(Round((GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*ShootSpeed*1.15))),400,$F15D70,0.055,12,365);
end;
if (Round((GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*ShootSpeed))=Damage) then begin
DrawTextEx(Shooter.ID,108,'BODY!',400,$F15D70,0.055,12,385);
DrawTextEx(Shooter.ID,109,'Damage: '+inttostr(damage)+', DamageCalculate: '+inttostr(Round((GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*ShootSpeed))),400,$F15D70,0.055,12,365);
end;
if (Round((GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*ShootSpeed*0.9))=Damage) then begin
DrawTextEx(Shooter.ID,108,'LEGS!',400,$F15D70,0.055,12,385);
DrawTextEx(Shooter.ID,109,'Damage: '+inttostr(damage)+', DamageCalculate: '+inttostr(Round((GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId)*ShootSpeed*0.9))),400,$F15D70,0.055,12,365);
end;
end;
« Last Edit: January 02, 2016, 05:40:44 pm by soldat-game »

Offline Savage

  • Soldier
  • **
  • Posts: 155
Re: Map bullet speed
« Reply #1 on: January 03, 2016, 06:57:01 am »
Hi Dominik, I'm glad you are using bullet speed calculations I taught you but you did serious mistakes:

ShootSpeed:double; - ALMOST every floating point number value in Soldat is Single type (http://wiki.soldat.pl/index.php/TActiveMapBullet - property VelX: Single) so why the f*** you are wasting 4Bytes of memory?

Shooter.Team<>Victim.Team - That won't work on DM and isn't even needed for other game styles.

Victim.Health-Damage<=0 - Why you want to calculate speed only on death?

Try this - WHAT THE F*** Dominik? No one is gonna try this because it's one BIG mess - Map.Bullets[Bullet].VelX that should be BulletId, maybe it's your variable to avoid 0 and 255 id but I don't see any calculations for it.

GetDmg(Map.Bullets[Bullet].GetOwnerWeaponId) - Same as above, give us the function to try it.

DrawTextEx - Seriously? Why you are connecting SC2 with SC3 when you can use BigText from SC3? I thought you know that SC2 is slower than SC3.

calculated dmg is sometimes higher or lower - If you are using Round it will be sometimes only higher because calculated damage is truncated so you have to use Trunc function, here's my code from my Zombie server:

Damage Calculations:
* Final damage dealt by a bullet is the truncated result of [Damage from weapons.ini] * [CurrentSpeed] * [HitboxModifier] / 100
* The [HitboxModifier] used depends on where the bullet hits. Head: 1.15, torso: 1.0, legs: 0.9

Code: [Select]
//Barret Headshot
if (Map.Bullets[BulletId].GetOwnerWeaponId=8) and (Damage=Trunc(sqrt(Map.Bullets[BulletId].VelX*Map.Bullets[BulletId].VelX+Map.Bullets[BulletId].VelY*Map.Bullets[BulletId].VelY)*5.1175)) then
Shooter.WriteConsole('Headshot!',$00FF00);
//5.1175 because: default Barret dmg=445 | 445/100=4.45 | 4.45*1.15=5.1175

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Map bullet speed
« Reply #2 on: January 03, 2016, 09:44:14 am »
I know how this work, I forgot to considered vest, I wrote a script for a hangover  :-X
how vest reduce the damage? 25% orginal dmg?
Why you want to calculate speed only on death? is in ondamage.
resolved!
« Last Edit: January 03, 2016, 04:59:39 pm by soldat-game »