Author Topic: L4D scripting: Boomer and smoker  (Read 859 times)

0 Members and 1 Guest are viewing this topic.

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
L4D scripting: Boomer and smoker
« on: July 23, 2009, 02:16:30 pm »
I am currently back on working for my L4D server.. I (nearly) finished my boomer script.. BUT I need something for it to entirely work!

Code: [Select]
//Boomer script by D4NG3R

function OnPlayerDamage(Shooter, Boomer: byte; Damage: integer): integer;
var Bx,By,Sx,Sy: single;
begin
if (IdToName(Boomer) = 'Boomer') and (IdToName(shooter) <> 'Major') then begin
Bx := GetPlayerStat(Boomer,'X');
By := GetPlayerStat(Boomer,'Y');
Sx := GetPlayerStat(Shooter,'X');
Sy := GetPlayerStat(Shooter,'Y');
If (Distance(Bx,By,Sx,Sy) < 250) and (GetPlayerStat(Boomer,'Alive') = False) and (GetPlayerStat(Shooter,'Alive') = True) then begin
WriteConsole(Shooter,'A boomer just Vommited on you!',RGB(150,200,150))

WriteConsole(Shooter,'A couple of zombies where attracted by the vommit!',RGB(200,150,150))

WriteConsole(Shooter,'A zombie hits you!',RGB(200,150,150))
CreateBullet(Sx+5,Sy,50,0,10,1,Boomer);

WriteConsole(Shooter,'A zombie hits you!',RGB(200,150,150))
CreateBullet(Sx-5,Sy,-50,0,10,1,Boomer);
end;
end;
Result := Damage;
end;

procedure OnPlayerKill(Shooter, Boomer: byte; Weapon: string);
var Bx,By,Sx,Sy: single;
begin
if (IdToName(Boomer) = 'Boomer') and (IdToName(Shooter) <> 'Major') then begin
Bx := GetPlayerStat(Boomer,'X');
By := GetPlayerStat(Boomer,'Y');
Sx := GetPlayerStat(Shooter,'X');
Sy := GetPlayerStat(Shooter,'Y');
CreateBullet(Bx,By,9,0,5,14,Boomer);
CreateBullet(Bx,By,-9,0,5,14,Boomer);
CreateBullet(Bx,By,8,-2,5,14,Boomer);
CreateBullet(Bx,By,-8,-2,5,14,Boomer);
CreateBullet(Bx,By,6,-4,5,14,Boomer);
CreateBullet(Bx,By,-6,-4,5,14,Boomer);
CreateBullet(Bx,By,4,-6,5,14,Boomer);
CreateBullet(Bx,By,-4,-6,5,14,Boomer);
CreateBullet(Bx,By,2,-7,5,14,Boomer);
CreateBullet(Bx,By,-2,-7,5,14,Boomer);
CreateBullet(Bx,By,0,-7,5,14,Boomer);
WriteConsole(Shooter,'You killed the Boomer',RGB(75,150,75))
end;
end;
^Works, I have been playing with this for the whole afternoon.

I need some help tho.. Between the "Boomer vommited on you" "couple of zombies where attracted by the vommit" and those two hits I need pauses of 3/4 seconds..

using
     sleep(5000);
Just freezes the server for 5 seconds...

+ is there an easier way to just give a player 20 damage instead of spawning a bullet next to them...?

---

Next up smoker

What basically needs to happen is this:

Everyone that is named SMOKER and is on BLUE team (bots) spawn a flame in the middle of them (create bullet) every 4 seconds, to give an effect like they are burning this flame should have a damage multiplier of 0 (no damage).


                  Forum Rules   -   Search

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: L4D scripting: Boomer and smoker
« Reply #1 on: July 23, 2009, 02:33:59 pm »
Quote
using
     sleep(5000);
Just freezes the server for 5 seconds...
Use AppOnIdle() with 5 seconds timer.

Quote
+ is there an easier way to just give a player 20 damage instead of spawning a bullet next to them...?
http://enesce.com/help/html/Functions/DoDamage.html

Quote
Everyone that is named SMOKER and is on BLUE team (bots) spawn a flame in the middle of them (create bullet) every 4 seconds, to give an effect like they are burning this flame should have a damage multiplier of 0 (no damage).

Create flame in AppOnIdle() every 4 seconds

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: L4D scripting: Boomer and smoker
« Reply #2 on: July 23, 2009, 02:34:23 pm »
I need some help tho.. Between the "Boomer vommited on you" "couple of zombies where attracted by the vommit" and those two hits I need pauses of 3/4 seconds..

using
     sleep(5000);
Just freezes the server for 5 seconds..

Use a global variable as counter and script something in the AppOnIdle event, which is called every second. This does mean that 3-4 seconds really means 3-4 seconds, since it could be anything in between. Example (although this one just loops, you need something a bit more complicated):

Code: [Select]
//not tested

Var
Counter : byte;

Procedure AppOnIdle(Ticks: Integer);
{
  inc(Counter, 1);
  if Counter = 3 then begin
    //magic here, will happen every 4 seconds
    Counter := 0;
  end;
}

+ is there an easier way to just give a player 20 damage instead of spawning a bullet next to them...?

http://enesce.com/help/index.html?Functions/DoDamage.html

Next up smoker

What basically needs to happen is this:

Everyone that is named SMOKER and is on BLUE team (bots) spawn a flame in the middle of them (create bullet) every 4 seconds, to give an effect like they are burning this flame should have a damage multiplier of 0 (no damage).

See example of timing to put in CreateBullet. Then make an if-statement in OnPlayerDamage. You know what weapon (flamer), who the Victim is (SMOKER), and who the shooter is (depends on what you fill in in CreateBullet). If all those match then make the result of OnPlayerDamage zero (instead of Result:=Damage).

Good luck and happy scripting... gast ;)
Come join: EliteCTF
Listen to: My Music

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: L4D scripting: Boomer and smoker
« Reply #3 on: July 23, 2009, 03:02:35 pm »
I cant seem to get the smoker script to work.. I keep getting (different) errors!
                  Forum Rules   -   Search