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

0 Members and 2 Guests are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #80 on: July 25, 2010, 04:09:59 pm »
So i can wait ?

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #81 on: July 25, 2010, 04:11:17 pm »
You can and you must.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #82 on: July 25, 2010, 04:16:29 pm »
How many time before it will be released ?

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #83 on: July 25, 2010, 04:23:23 pm »
Who knows..

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #84 on: July 25, 2010, 04:28:11 pm »
EnEsCe  ;D

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Mich1103's scripting thread
« Reply #85 on: July 25, 2010, 04:46:16 pm »
i doubt it.
Can't think of anything original to put here...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #86 on: July 25, 2010, 05:25:29 pm »
How can i do a shield skills !
like your invincible for 20 second !

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Mich1103's scripting thread
« Reply #87 on: July 25, 2010, 07:13:40 pm »
here's the basic pseudo code
function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer;Weapon: Byte) : integer;
  if (Victim is invincible) Result := 0 else Result := Damage

someone confirm this: i'm not sure if this works with m79/law/nade instant kill - i guess u can check it out!
Can't think of anything original to put here...

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #88 on: July 26, 2010, 03:24:49 am »
If you want real invincibility you must set the result to -9999. I'm not sure whether you use some other stuff in OnPlayerDamage, if that's so you must exit after you've set the result to the new value.

Example:

Code: (pascal) [Select]
Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
  if (Soldier[Victim].Godmode) then begin
    Result := -99999;
    Exit;
  end;
  // Other stuff here
end:

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #89 on: July 26, 2010, 08:43:12 am »
But for the timer of 20 second ?

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #90 on: July 26, 2010, 09:05:04 am »
Code: (pascal) [Select]
type
  Stats=Record
  GodTime:Integer;
  end;

var
  Soldier: Array[1..32] of Stats;

Procedure OnJoinGame(ID,Team:Byte);
begin
  Soldier[ID].GodTime := -1;
end;

Function OnPlayerCommand(ID:Byte; Text:String):Boolean;
begin
  if (LowerCase(Copy(Text,1,4)) = '/god') then begin
    Soldier[ID].GodTime := 20;
    WriteConsole(ID,'You are invincible for 20 seconds!',$FFFFFF);
  end;
  Result := false;
end;

Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer; 
begin 
 Result := Damage; 
 if (Soldier[Victim].GodTime <> -1) then begin 
   Result := -99999; 
   Exit; 
 end; 
 // Other stuff here 
end; 

Procedure AppOnIdle(Ticks:Integer);
var
  i:Byte;
begin
  for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) then
    if (Solder[i].GodTime <> -1) then begin
      Solder[i].GodTime := Soldier[i].GodTime - 1;
      if (Soldier[i].GodTime = 0) then begin
        Soldier[i].GodTime := -1;
        WriteConsole(i,'You are mortal again..',$CC0000);
      end;
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #91 on: July 26, 2010, 09:51:47 am »
And for the command i do it like that ?
Code: [Select]
if regExpMatch('^/(god|shield)$', Text) then
  begin
if (soldier[ID].level >= 60) then begin
soldier[ID].GodTime :=20;
WriteConsole(ID,'You are invincible for 20 seconds!',$FFFFFF);
end else begin
writeconsole(ID, 'You are not lvl 60 +', Color);
end;
Result := false;
end;
end;


DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #92 on: July 26, 2010, 09:59:56 am »
Yes.

Also you'll love to use this:

Function LowerCase(Input:String):String;

Returns the input string in lowercase. Example:

Input = 'fOoBAR'
Result = 'foobar'
« Last Edit: July 26, 2010, 10:08:56 am by DarkCrusade »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #93 on: July 26, 2010, 11:08:21 am »
What it is supposed to do ?

From: July 26, 2010, 11:13:21 am
  • shop -> [Error] (736:1): 'BEGIN' expected

« Last Edit: July 26, 2010, 11:13:23 am by mich1103 »

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #94 on: July 26, 2010, 11:20:43 am »
If the error is 'BEGIN' expected then you have an 'END' too much and viceversa.

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Mich1103's scripting thread
« Reply #95 on: July 26, 2010, 11:24:28 am »
i think you want to take out the "end" on line 726
also, perhaps you should nest all your "If Text = 'lol' then begin" with else lines so that it doesn't have to check it against every possible command and will stop as soon as the first one has been reached.  Also, your code is very crowded. Any chance you can break it up into multiple parts??
Can't think of anything original to put here...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #96 on: July 26, 2010, 12:26:33 pm »
i need a cooldown of 2 min ... for the god script !

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #97 on: July 26, 2010, 12:58:36 pm »
Just add another timer for the cooldown.. you should be able to do that, and if you need help you can still ask ;)

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #98 on: July 26, 2010, 01:25:54 pm »
I've tried but 'I FAILED'  :'(

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #99 on: July 26, 2010, 01:38:12 pm »
So show me what you tried? And please not the whole script