Author Topic: Health Regeneration Around Medic  (Read 10121 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Health Regeneration Around Medic
« 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:
Code: [Select]
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
« Last Edit: August 13, 2007, 08:19:58 pm by DorkeyDear »

Offline XfalconX

  • Major(1)
  • Posts: 21
Re: Health Regeneration Around Medic
« Reply #1 on: August 13, 2007, 07:26:06 pm »
« Last Edit: August 13, 2007, 07:29:10 pm by XfalconX »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Health Regeneration Around Medic
« Reply #2 on: August 13, 2007, 07:47:47 pm »
Didn't seem to give me errors back in 2.6.1b that I can remember of.
Does it at least still work?

Offline XfalconX

  • Major(1)
  • Posts: 21
Re: Health Regeneration Around Medic
« Reply #3 on: August 13, 2007, 07:57:36 pm »
found out that it does run but will it be a problem infinitaly repeating the error on the cmd screen?

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Health Regeneration Around Medic
« Reply #4 on: August 13, 2007, 08:18:37 pm »
I fixed it, with a little help from EagleEye.
« Last Edit: August 13, 2007, 08:21:38 pm by DorkeyDear »

Offline XfalconX

  • Major(1)
  • Posts: 21
Re: Health Regeneration Around Medic
« Reply #5 on: August 13, 2007, 08:23:06 pm »
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

Offline miketh2005

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 668
  • What's the URL for www.microsoft.com?
Re: Health Regeneration Around Medic
« Reply #6 on: August 15, 2007, 12:18:27 pm »
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
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: Health Regeneration Around Medic
« Reply #7 on: August 15, 2007, 01:45:16 pm »
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.

Offline -Aaron-

  • Major
  • *
  • Posts: 57
Re: Health Regeneration Around Medic
« Reply #8 on: November 01, 2007, 04:06:16 pm »
How close does the player have to be to the medic? I think I might use this.
Quote from: LeetFidle
WTF are you talking bout?! ww2 is fiction feckergot.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Health Regeneration Around Medic
« Reply #9 on: July 29, 2008, 02:16:27 pm »
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:
Code: [Select]
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
« Last Edit: July 29, 2008, 05:18:23 pm by DorkeyDear »

Offline blackdevil0742

  • Veteran
  • *****
  • Posts: 1061
  • Don't Panic
Re: Health Regeneration Around Medic
« Reply #10 on: July 29, 2008, 03:31:06 pm »
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.
« Last Edit: July 29, 2008, 03:59:50 pm by blackdevil0742 »

OBEY!!!

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Health Regeneration Around Medic
« Reply #11 on: July 29, 2008, 05:18:51 pm »
Try now

Offline blackdevil0742

  • Veteran
  • *****
  • Posts: 1061
  • Don't Panic
Re: Health Regeneration Around Medic
« Reply #12 on: July 30, 2008, 03:40:50 am »
It works now :=)

OBEY!!!

Offline zop

  • Major
  • *
  • Posts: 81
Re: Health Regeneration Around Medic
« Reply #13 on: July 31, 2008, 12:06:54 am »
thx Curt I can use it too.

http://122.116.167.31:23238:23238/galavela/?inc=player&name=%5BTomato+Bird%5D+Cibo[/size=1]

Offline preli

  • Major(1)
  • Posts: 4
Re: Health Regeneration Around Medic
« Reply #14 on: January 04, 2009, 08:07:50 am »
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.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Health Regeneration Around Medic
« Reply #15 on: January 04, 2009, 08:40:24 am »
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.

Offline preli

  • Major(1)
  • Posts: 4
Re: Health Regeneration Around Medic
« Reply #16 on: January 09, 2009, 12:17:03 pm »
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.

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Health Regeneration Around Medic
« Reply #17 on: January 09, 2009, 01:41:19 pm »
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)

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Health Regeneration Around Medic
« Reply #18 on: January 09, 2009, 03:47:50 pm »
I assume Dorkey allows other users to modify this script
sure
just as long as you don't say its urs :P

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: Health Regeneration Around Medic
« Reply #19 on: January 09, 2009, 07:20:51 pm »
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.