Author Topic: Mich1103's scripting thread  (Read 12529 times)

0 Members and 2 Guests are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #20 on: July 21, 2010, 12:42:01 pm »
@ DarkCrusade : i already did some skills (Easy one ^^)

thats how i did the regeneration skills !
Code: [Select]
Procedure Heal(ID: integer);
begin
if soldier[ID].level >=25
then begin 
DoDamage(ID,-3);
end;
end;

Procedure AppOnIdle(Ticks: Integer);
Begin
for i:= 1 to 32 do begin
Heal(i);
If you want you can see my script in action :P
IP:soldat.no-ip.ca PORT: 23098
« Last Edit: July 21, 2010, 12:51:08 pm by mich1103 »

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #21 on: July 21, 2010, 12:56:49 pm »
Whenever you access an ID in AppOnIdle (in general when you loop through the player list) you must check whether the ID is active (whether the ID is a player/bot on the server).

if (GetPlayerStat(ID,'Active') = true) then

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Mich1103's scripting thread
« Reply #22 on: July 21, 2010, 02:51:05 pm »
DC, he's probs not gonna understand that. i'll just give him the code. hopefully he can learn from it...

Code: [Select]
Procedure Heal(ID: integer);
begin
if soldier[ID].level >=25
then begin
DoDamage(ID,-3);
end;
end;

Procedure AppOnIdle(Ticks: Integer);
Begin
for i:= 1 to 32 do if GetPlayerStat(i,'Active') then begin
Heal(i);

Also, I'm not sure if you're aware of this, but a player's health is maximum 150.  check to make sure he has less than maximum health before actually healing. (I'm not sure if you can give more than 150 health anyway, in which case it might not matter too much).  Also, in realistic mode, max health is 65.  good to know.
Can't think of anything original to put here...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #23 on: July 21, 2010, 02:52:28 pm »
Ok now i understand !
Thanks  ;D

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #24 on: July 21, 2010, 02:54:21 pm »
Normal: 150  (200 by scripting)
Realistic: 65  (never tested)

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #25 on: July 21, 2010, 02:56:36 pm »
So with this script !
a player got 200 health ?

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #26 on: July 21, 2010, 02:58:32 pm »
Proximitly.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #27 on: July 22, 2010, 11:30:03 am »
I did a small small kamikaze script but the bullet are too high

The procedure
Code: [Select]
Procedure Kamikaze(ID: byte);
 begin
  if soldier[ID].level >= 40
   then begin
    CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 500, 0, 0,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 500, 1, 1,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 500, 2, 2,100, 4, 1);
   end;
  end;
I dont really know how X and Y work :)

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Mich1103's scripting thread
« Reply #28 on: July 22, 2010, 11:44:14 am »
Code: [Select]
Procedure Kamikaze(ID: byte);
var
  X, Y: single;
 begin
  if soldier[ID].level >= 40
   then begin
    GetPlayerXY(ID, X, Y)
    CreateBullet(X, Y - 10, 0, 0,100, 4, 1);
    CreateBullet(X, Y - 10, 1, 1,100, 4, 1);
    CreateBullet(X, Y - 10, 2, 2,100, 4, 1);
   end;
  end;

This should spawn all bullets in his ass

If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #29 on: July 22, 2010, 03:26:59 pm »
I did a small procedure for a Nuclear bomb !
Code: [Select]
procedure Nuke(ID: byte);
 begin
  if GetPlayerStat(ID,'Human') = False
   then begin
    DoDamage(ID,4000);
   end;
  end;
but the server crash when i do /nuke ...  :'(
Code: [Select]
if regExpMatch('^/(nuke)$', Text) then
  begin
For i := 1 to 32 do     
if soldier[ID].level >= 40 then
        begin
if soldier[ID].money >= 50 then
         begin
          Nuke(i);
 writeconsole(0, 'NUCLEAR BOMB !', Color);
  end else begin writeconsole(ID, 'You are not lvl 40 + or you dont have enough money.', Color);
   end;
    end;
                     end;
         

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #30 on: July 22, 2010, 04:15:55 pm »
Whenever you access an ID in AppOnIdle (in general when you loop through the player list) you must check whether the ID is active (whether the ID is a player/bot on the server).

if (GetPlayerStat(ID,'Active') = true) then
« Last Edit: July 22, 2010, 04:57:28 pm by DarkCrusade »

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Mich1103's scripting thread
« Reply #31 on: July 22, 2010, 04:18:34 pm »
Code: [Select]
if regExpMatch('^/(nuke)$', Text) then
  begin
if (soldier[ID].level >= 40) and (soldier[ID].money >= 50) then
        begin
For i := 1 to 32 do  begin   
          Nuke(i);
WriteConsole(i, 'NUCLEAR BOMB !', Color);
end;

  end else begin
writeconsole(ID, 'You are not lvl 40 + or you dont have enough money.', Color);
   end;
                     end;
that should work, remember... first check money/level, next begin your loop
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #32 on: July 22, 2010, 04:48:37 pm »
Work but i got some error !

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #33 on: July 22, 2010, 04:57:45 pm »
Whenever you access an ID in AppOnIdle (in general when you loop through the player list) you must check whether the ID is active (whether the ID is a player/bot on the server).

if (GetPlayerStat(ID,'Active') = true) then

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #34 on: July 22, 2010, 05:00:14 pm »
Already did  ;)  !
Code: [Select]
procedure Nuke(ID: byte);
 begin
  if GetPlayerStat(ID,'Human') = False
   then begin
  if (GetPlayerStat(ID,'Active') = true)
   then begin
    DoDamage(ID,4000);
   end;
  end;
 end;

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #35 on: July 22, 2010, 05:05:16 pm »
What's so hard to understand about "You must check whether the ID is active before you can access any other data"?

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #36 on: July 22, 2010, 05:08:09 pm »
I got it i got no error now  :D
but with the kamikaze part
Code: [Select]
Procedure Kamikaze(ID: byte);
var
  X, Y: single;
 begin
  if soldier[ID].level >= 40
   then begin
    GetPlayerXY(ID, X, Y)
    CreateBullet(X, Y - 10, 0, 0,120, 4, 1);
    CreateBullet(X, Y - 10, 1, 1,120, 2, 1);
    CreateBullet(X, Y - 10, 2, 2,120, 9, 1);
   end;
  end;
The bullet dont do any damage ... !

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #37 on: July 22, 2010, 05:21:43 pm »
function CreateBullet(X, Y, VelX, VelY, HitM: single; sStyle, Owner: byte): integer;

The owner of these bullets should be the ID. The bulletstyle 4 (M79 bullet).

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #38 on: July 22, 2010, 05:45:08 pm »
How can i put like that the nuke kill only bot named ZoMbIe ?

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Mich1103's scripting thread
« Reply #39 on: July 22, 2010, 06:06:30 pm »
omg x.X ..... IF GETPLAYERSTAT(ID,'NAME') = 'ZoMbIe'!!! thats hard? -.- // what is your IQ? ^^
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.