Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: DorkeyDear 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://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.
-
it sounded like the insurance company
-
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.
-
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
-
Sounds great :D
-
It doesn't work ;(
But i still have Alternative TKscript by Avarax! :P
-
does it work now?
-
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.
-
thanks but error script :(
-
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
-
Your post still says that the script is set up for Server Core 2.6.0. ???
-
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.