Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: DorkeyDear on August 13, 2007, 06:55:03 pm
-
Script Name: Health Regeneration Around Medic
Script Description: First player to do !medic becomes the medic. Anybody around the medic will be healed at a specified rate. When the map changes, medic is replaced, and may be reclaimed by anybody. There is a limitation of 1 medic per team. The script is designed for CTF mode, although may be easily modified for team match.
Original Author: Curt (DorkeyDear)
Core Version: 2.6.1b
Code:const
Color = $FFFFFFFF;
MaxDist = 65;
MaxHealth = 65;
HealRate = 8;
var
Medic: array[1..2] of byte;
procedure AppOnIdle(Ticks: integer);
var
i,j: byte;
X,Y: single;
begin
for i := 1 to 2 do begin
GetPlayerXY(Medic[i],X,Y);
if Medic[i] <> 0 then if GetPlayerStat(Medic[i],'Alive') = true then for j := 1 to 32 do if (GetPlayerStat(j,'Active') = true) and (GetPlayerStat(j,'Alive') = true) and (GetPlayerStat(Medic[i],'Team') = GetPlayerStat(j,'Team')) and (Distance(X,Y,GetPlayerStat(j,'X'),GetPlayerStat(j,'Y')) <= MaxDist) and (GetPlayerStat(j,'Health') < MaxHealth) then begin
if GetPlayerStat(j,'Health') + HealRate > MaxHealth then DoDamage(j,GetPlayerStat(j,'Health') - MaxHealth) else DoDamage(j,-HealRate);
end;
end;
end;
procedure OnJoinGame(ID, Team: byte);
begin
if Medic[Team] = 0 then WriteConsole(ID,'Medic is up for grabs on your team. Type !medic to claim it.',Color);
end;
procedure OnJoinTeam(ID, Team: byte);
var
OTeam: byte;
begin
if Team = 1 then OTeam := 2 else OTeam := 1;
if Medic[OTeam] = ID then begin
Medic[OTeam] := 0;
WriteConsole(0,'Medic for team #' + InttoStr(OTeam) + ' is up for grabs. Type !medic to claim it.',Color);
end;
end;
procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
if Medic[Team] = ID then begin
Medic[Team] := 0;
WriteConsole(0,'Medic for team #' + InttoStr(Team) + ' is up for grabs. Type !medic to claim it.',Color);
end;
end;
procedure OnMapChange(NewMap: string);
var
i: byte;
begin
for i := 1 to 2 do Medic[i] := 0;
WriteConsole(0,'Medic is now up for grabs for both teams. Type !medic to claim it.',Color);
end;
procedure OnPlayerSpeak(ID: byte; Text: string);
var
Team: byte;
begin
if (Text = '!medic') then begin
Team := GetPlayerStat(ID,'Team');
if Medic[Team] = 0 then begin
Medic[Team] := ID;
WriteConsole(ID,GetPlayerStat(ID,'Name') + ' has claimed medic for team #' + InttoStr(Team) + '.',Color);
end else WriteConsole(ID,'Medic has already been claimed by ' + GetPlayerStat(Medic[Team],'Name') + '.',Color);
end;
end;
- Full health in realistic mode is 65, and in unrealistic mode is 150.
In request from Amida
-
Didn't work ???
http://img532.imageshack.us/my.php?image=clip0002if2.flv
-
Didn't seem to give me errors back in 2.6.1b that I can remember of.
Does it at least still work?
-
found out that it does run but will it be a problem infinitaly repeating the error on the cmd screen?
-
I fixed it, with a little help from EagleEye.
-
Thank you very much, and if it is too much to ask for, any chance you can make a script that u can login like leo's servers or give me a link to an existing one, or try to answer more of my questions in http://forums.soldat.pl/index.php?topic=18758.0
-
I fixed it, with a little help from EagleEye.
Same thing happens with Admin invinibility, it's annoying and it causes....... sh@@ It happened just now.....FIXED ARSSE always messes up saying out of memory and I have to Force CLose
-
I fixed it, with a little help from EagleEye.
Same thing happens with Admin invinibility, it's annoying and it causes....... sh@@ It happened just now.....FIXED ARSSE always messes up saying out of memory and I have to Force CLose
I just checked to see if it works with this version, and I see no errors in the Command Prompt console.
-
How close does the player have to be to the medic? I think I might use this.
-
How close does the player have to be to the medic? I think I might use this.
You have to do a little experiementing to figure that out...
Change "Â MaxDist = 65;", the 65 in it to a larger number for a larger range, smaller for smaller.
Date Posted: November 01, 2007, 06:19:27 pm
Sombody requested that it doesn't heal the medic:
const
Color = $FFFFFFFF;
MaxDist = 65;
MaxHealth = 65;
HealRate = 8;
var
Medic: array[1..2] of byte;
procedure AppOnIdle(Ticks: integer);
var
i,j: byte;
X,Y: single;
begin
for i := 1 to 2 do begin
GetPlayerXY(Medic[i],X,Y);
if Medic[i] <> 0 then if GetPlayerStat(Medic[i],'Alive') = true then for j := 1 to 32 do if (GetPlayerStat(j,'Active') = true) and (GetPlayerStat(j,'Alive') = true) and (GetPlayerStat(Medic[i],'Team') = GetPlayerStat(j,'Team')) and (Medic[i] <> j) and (Distance(X,Y,GetPlayerStat(j,'X'),GetPlayerStat(j,'Y')) <= MaxDist) and (GetPlayerStat(j,'Health') < MaxHealth) then begin
if GetPlayerStat(j,'Health') + HealRate > MaxHealth then DoDamage(j,GetPlayerStat(j,'Health') - MaxHealth) else DoDamage(j,-HealRate);
end;
end;
end;
procedure OnJoinGame(ID, Team: byte);
begin
if Medic[Team] = 0 then WriteConsole(ID,'Medic is up for grabs on your team. Type !medic to claim it.',Color);
end;
procedure OnJoinTeam(ID, Team: byte);
var
OTeam: byte;
begin
if Team = 1 then OTeam := 2 else OTeam := 1;
if Medic[OTeam] = ID then begin
Medic[OTeam] := 0;
WriteConsole(0,'Medic for team #' + InttoStr(OTeam) + ' is up for grabs. Type !medic to claim it.',Color);
end;
end;
procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
if Medic[Team] = ID then begin
Medic[Team] := 0;
WriteConsole(0,'Medic for team #' + InttoStr(Team) + ' is up for grabs. Type !medic to claim it.',Color);
end;
end;
procedure OnMapChange(NewMap: string);
var
i: byte;
begin
for i := 1 to 2 do Medic[i] := 0;
WriteConsole(0,'Medic is now up for grabs for both teams. Type !medic to claim it.',Color);
end;
procedure OnPlayerSpeak(ID: byte; Text: string);
var
Team: byte;
begin
if (Text = '!medic') then begin
Team := GetPlayerStat(ID,'Team');
if Medic[Team] = 0 then begin
Medic[Team] := ID;
WriteConsole(ID,GetPlayerStat(ID,'Name') + ' has claimed medic for team #' + InttoStr(Team) + '.',Color);
end else WriteConsole(ID,'Medic has already been claimed by ' + GetPlayerStat(Medic[Team],'Name') + '.',Color);
end;
end;
was just a quick change
-
I believe it was me who wanted that ;)
Thank you so much for this DorkeyDear <3
Edit: I'm getting an error when I use the changed script.
-
Try now
-
It works now :=)
-
thx Curt I can use it too.
-
hi.
i'm new here and i don't know rly, very much about scripts. i have arsse, and i converted this file to .pas, and recompiled it, but it still don't work ;/.
If you know what i am doing wrong, please tell me.
-
hi.
i'm new here and i don't know rly, very much about scripts. i have arsse, and i converted this file to .pas, and recompiled it, but it still don't work ;/.
If you know what i am doing wrong, please tell me.
This is a script for the soldat dedicated server. For instructions on installing it, go here. (http://forums.soldat.pl/index.php?topic=21468.0)
-
thank you for your help. now i can recompile it, but it still doesn't work ;/. everything looks as if it rly works, but it doesn't.
i can write: !medic, and i can see replay: xXx have been claimed medic..., but when i got injured, it doesn't regenerate my HP :/. Does anybody knows why it doesn't works? Pls help me.
-
If you are a medic then you can heal other players, not yourself. Someone else would have to be a medic to heal you. But you could easily modify this script so it'd also heal the medic. If you don't know how then I can do it (I assume Dorkey allows other users to modify this script)
-
I assume Dorkey allows other users to modify this script
sure
just as long as you don't say its urs :P
-
Did you Dorkey uploaded a new version? Cause the script I've just downloaded heals medics too. preli I don't know why it doesnt work for you. Maybe you played nonrealistic and forgot to set MaxHealth=150? But even then you should be able to heal almost 1/2 of your HP.
-
He must have used the source I posted here (http://forums.soldat.pl/index.php?topic=18764#msg343611) where as you got it from the main topic.
-
I didn't forgot about it. I change it for 150, and eventhough it wasn't working. JotEmI if you could change this srcipt, just like u said, i would be very thankful to you for it.
-
Just download this version -> link (http://forums.soldat.pl/index.php?action=dlattach;topic=18764.0;attach=9325) It works fine for me.
-
Thank you very much. It works now :)