Author Topic: Friendly Fire with Accidental Forgiveness  (Read 5132 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Friendly Fire with Accidental Forgiveness
« on: May 11, 2007, 09:44:49 pm »
Script Name: Friendly Fire with Accidental Forgiveness
Script Description: If you attack a friendly, you will be punished by hurting yourself. But in case you accidentally fire a few shots on him, you don't have to worry. It won't hurt you. Once you attack your team members too much, then you start receiving damage. If you attack enemies, your TKBuild counter will lower, meaning you will need more TK damage to against receive the TK damage you give.
Original Author: Curt (DorkeyDear)
Core Version: 2.6.2
Code:
Code: [Select]
//Friendly Fire with Accidental Forgiveness
//Created by: Curt
//http://forums.soldat.pl/index.php?topic=14394

const
  KillonTK = true;  //If the shooter kills a friendly, then he will or will not be killed (it is possible for him to TK and not die, although it can still be on accident if a friendly is low on health and shoots them in spray or something); Ignore this if RecTimes is 0
  DmgNeed = 50;     //Total damage needed for friendly fire to start hurting the shooter
  FFTimes = 1.5;    //Number of times more or less damage the shooter receives damage when shooting a friendly
  RecTimes = 0;     //Number of times more or less damage the victim of a friendly fire receives; set to 0 if you want the victim to not be harmed
  DmgTimes = 3;     //Number of times damage needed a friendly firer needs to do to an enemy to make his friendly fire damage counter to lower back down

var
  TKBuild: array[1..32] of integer;

procedure OnJoinGame(ID, Team: byte);
begin
  if TKBuild[ID] <> 0 then TKBuild[ID] := 0;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  if (KillonTK) and (Killer <> Victim) and (GetPlayerStat(Killer,'Team') = GetPlayerStat(Victim,'Team')) then DoDamage(Killer,4000);
end;

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  Result := Damage;
  if (Shooter <> Victim) and (GetPlayerStat(Victim,'Alive') = true) then if GetPlayerStat(Shooter,'Team') = GetPlayerStat(Victim,'Team') then begin
    Result := Round(Damage * RecTimes);
    TKBuild[Shooter] := TKBuild[Shooter] + Damage;
    if TKBuild[Shooter] >= DmgNeed then DoDamage(Shooter,Round(Damage * FFTimes));
  end else begin
    if TKBuild[Shooter] > 0 then TKBuild[Shooter] := TKBuild[Shooter] - Round(Damage / DmgTimes);
    if TKBuild[Shooter] < 0 then TKBuild[Shooter] := 0;
  end;
end;
Note: FriendlyFire must be enabled on the server for this script to work. You can actually specify if you want friendly fire damage to actually occur by setting the RecTimes to a number other then 0, 1 being the normal amount of received damage.
« Last Edit: September 05, 2007, 06:24:44 pm by DorkeyDear »

Offline adadqgg

  • Soldier
  • **
  • Posts: 228
  • Yuri for the win ~desu
Re: TK Prevention with Accidental Forgiveness
« Reply #1 on: May 12, 2007, 02:01:41 pm »
it sounded like the insurance company

Shikabane Hime... Undead girls... Dual-wielding Mac 11s... Epic bayonets... WIN!

Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Re: TK Prevention with Accidental Forgiveness
« Reply #2 on: May 12, 2007, 02:55:28 pm »
You should put something in the OnJoin event to reset TKBuild[ID_of_joiner] to the default value.
If you don't do that, I can make a lot of TKs and quit the server, whoever joins and is assigned with the ID I was using will already start with a high TKBuild.

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: TK Prevention with Accidental Forgiveness
« Reply #3 on: May 12, 2007, 06:50:05 pm »
You should put something in the OnJoin event to reset TKBuild[ID_of_joiner] to the default value.
If you don't do that, I can make a lot of TKs and quit the server, whoever joins and is assigned with the ID I was using will already start with a high TKBuild.
whooops, i forgot to include that in my post.. ill do that now :) thx

Offline wedding

  • Camper
  • ***
  • Posts: 338
  • [AdkZ] BuTcH3r
Re: TK Prevention with Accidental Forgiveness
« Reply #4 on: May 12, 2007, 08:14:35 pm »
Sounds great :D
Sex is like Hacking.You get in, you get out,then you hope that you didn't leave something behind that can be traced back to you.

Offline Freedom

  • Major
  • *
  • Posts: 97
  • Veritas Vincit
Re: TK Prevention with Accidental Forgiveness
« Reply #5 on: August 16, 2007, 08:40:46 am »
It doesn't work ;(
But i still have Alternative TKscript by Avarax! :P
Cum pare contendere anceps est, cum superiore furiosum, cum inferiore sordidum.

Offline miketh2005

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 668
  • What's the URL for www.microsoft.com?
Re: TK Prevention with Accidental Forgiveness
« Reply #6 on: August 23, 2007, 05:44:22 pm »
does it work now?
Quote from: 'Ando.' pid='12999178' dateline='1309046898'
My new password is secure as shit :)
Mate, I am not sure Shit is even secured nowadays.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: TK Prevention with Accidental Forgiveness
« Reply #7 on: August 25, 2007, 10:29:06 am »
I haven't touched this script in a long time, I'll see if it still works, or if I had a bug in there I never fixed. :)

Date Posted: August 25, 2007, 10:48:36 AM
It seems to work. I'll add a constants to make it ezr to set specifications, and I'll also zip it.

Date Posted: August 25, 2007, 10:51:16 AM
Ok, I redid the script  to make it a little shorter, and also there are two constants for the server owner to set specifications on the script.
FriendlyFire = (boolean) (true or false) FF must be enabled on the server, this just says if there is actual damage taking place when you shoot a friendly.
DmgNeed = (integer) the total damage needed before a player receives damage for TKing. 150 is full health of a person in unrealistic, and in realistic, 65 for some guidance of what to set this to. I would prefere something like 35.

Date Posted: August 25, 2007, 11:27:43 AM
I just added another constant DmgTimes, which sets the number of times more damage you need to deal to an enemy to get your TK damage count back to 0. I prefer 3, but you can choose what you want.

Offline Geistlort

  • Major(1)
  • Posts: 6
Re: TK Prevention with Accidental Forgiveness
« Reply #8 on: August 28, 2007, 04:47:20 pm »
thanks but error script :(

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: TK Prevention with Accidental Forgiveness
« Reply #9 on: August 30, 2007, 03:14:28 pm »
Update:
  • Kill on team kill option
  • Friendly Fire self damage hit multiplier
  • Replaced Friendly Fire boolean with RecTimes
  • Renamed the script to Friendly Fire with Accidental Forgiveness
« Last Edit: August 30, 2007, 03:19:27 pm by DorkeyDear »

Offline King_Of_Pain

  • Major
  • *
  • Posts: 73
  • Buy tickets to a Police concert. Now.
Re: Friendly Fire with Accidental Forgiveness
« Reply #10 on: August 30, 2007, 08:32:35 pm »
Your post still says that the script is set up for Server Core 2.6.0.  ???

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Friendly Fire with Accidental Forgiveness
« Reply #11 on: August 31, 2007, 03:11:36 pm »
Your post still says that the script is set up for Server Core 2.6.0.  ???
Nice catch, it is meant for 2.6.2 but I forgot to change what it said.