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

0 Members and 1 Guest are viewing this topic.

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #60 on: July 24, 2010, 08:53:12 am »
Happens to happen. Just add a !rebuild command that places the stationary gun on a new position and crouch. It'll spawn on the ground then ;)

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #61 on: July 24, 2010, 09:02:53 am »
i don't understand ...
i just want that the stationary gun i placed correctly the first time ...

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #62 on: July 24, 2010, 09:17:08 am »
It just happens. If you want it to be placed correctly the first time just crouch that moment..

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #63 on: July 24, 2010, 12:38:02 pm »
Im working to do a Fatal hit skills !
here it is !
Code: [Select]
const
FatalHitChance = 5;
color = $FFFFFF;


procedure FatalHit(ID :byte);
begin
DoDamage(ID,4000);
end;


Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
if (Random(1,101) <= FatalHitChance) then
FatalHit(Victim);
WriteConsole(Shooter,'Fatal Hit !',color)
end;
end;
Its okay ?  :-\

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #64 on: July 24, 2010, 12:56:55 pm »
Use DoDamageBy(ID1,ID2,Damage) instead of DoDamage. ID1 is the ID that gets the damage, ID2 the guy who will get the kill.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #65 on: July 24, 2010, 01:23:40 pm »
something like that ?
Code: [Select]
const
FatalHitChance = 5;
color = $FFFFFF;


procedure FatalHit(Victim,Shooter:Byte;);
begin
DoDamageBy(Victim,Shooter,1000)
end;


Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
if (Random(1,101) <= FatalHitChance) then
FatalHit(Victim);
WriteConsole(Shooter,'Fatal Hit !',color)
end;
end;

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #66 on: July 24, 2010, 01:35:19 pm »
Code: [Select]
const
  FatalHitChance = 5;
  color = $FFFFFF;

procedure FatalHit(Victim,Shooter:Byte;);
begin
  DoDamageBy(Victim,Shooter,1000);
end;


Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
  if (Random(1,101) <= FatalHitChance) then begin
    FatalHit(Victim);
    WriteConsole(Shooter,'Fatal Hit !',color)
  end;
end;

You forgot a ; and a begin + end

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #67 on: July 24, 2010, 03:24:55 pm »
Invalide number of parameter ...
Code: [Select]
Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
if soldier[shooter].level >= 50 then begin 
if (Random(1,101) <= LootAmmoChance) then begin
LootAmmo(Shooter);
end;
end;
if soldier[shooter].level >= 55 then begin
if (Random(1,101) <= FatalHitChance) then begin
FatalHit(Victim);
WriteConsole(Shooter,'Fatal Hit !',colorr);
end;
end;
end;

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #68 on: July 24, 2010, 03:28:13 pm »
Change FatalHit(Victim) to FatalHit(Victim,Shooter) ...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #69 on: July 24, 2010, 04:06:47 pm »
The script passs !
But there is alot of DAMN laggg ... :(
Like randomly sometime it say Fatal it and i got killed and that apear has i kill my self :P/

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #70 on: July 24, 2010, 04:16:14 pm »
I put this line at the beginning of the function (but after "Result := Damage"):
Code: [Select]
if (Victim = Shooter) then Exit;If the two IDs are the same the function gets cancelled so FatalHit cannot trigger.


Correct function:
Code: [Select]
Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
  if (Victim = Shooter) then Exit;
  if soldier[shooter].level >= 50 then 
    if (Random(1,101) <= LootAmmoChance) then
      LootAmmo(Shooter);
  if soldier[shooter].level >= 55 then
    if (Random(1,101) <= FatalHitChance) then begin
      FatalHit(Victim,Shooter);
      WriteConsole(Shooter,'Fatal Hit !',colorr);
    end;
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #71 on: July 24, 2010, 09:03:14 pm »
I want to give onflagscore 10% of mapXp i can ?  ??? 

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #72 on: July 25, 2010, 03:50:22 am »
Soldier[ID].EP := Soldier[ID].EP + (MapXP * 10 / 100);
CheckLevelUp(ID);


First line: Increase the EP
Second: Check whether the player has enough EP for the next level 

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Mich1103's scripting thread
« Reply #73 on: July 25, 2010, 04:06:09 am »
+ (MapXP * 10 / 100); lol

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #74 on: July 25, 2010, 04:39:26 am »
It's just to give him a basic idea of what percentage is all about >_>

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Mich1103's scripting thread
« Reply #75 on: July 25, 2010, 04:42:03 am »
also, you might have to use DIV instead of / if .ep is an integer

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #76 on: July 25, 2010, 12:41:42 pm »
So i decide to put my server in the sevrer 2.7.0 !
and now my shop script wont pass but it pass on 2.6.5 ....

Code: [Select]
shop -> [Error] (103:118): Invalid number of parameters

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Mich1103's scripting thread
« Reply #77 on: July 25, 2010, 01:36:00 pm »
yes, scripting for server version 2.7.0 has changed. i encourage you to look up the Changelog on enesce's website and read through ALL the changes. this is essential for a scripter!
as to your question, as you can read in the changelog, drawtext has been modified:

Quote from: Changelog
- Added BigTextID parameter to DrawText (after ID)
 This will allow you to have multiple drawtext events up and not overwrite standard messages.

essentially, there's a new parameter, BigTextID, that you need to specify.  And since you don't seem to know of all these changes, i also encourage you to read about the new functions that allow you to write/draw in new ways!

Quote from: ChangeLog
- Added InterfaceText function
- Added WorldText function
- Added InterfaceImage function
- Added WorldImage function

you might want to use InterfaceText, as they get their own writing slots on the screen (for instance: when you cap a flag, and get killed immediately after, the kill-message will replace the cap-message, which you might not like - you'd run into the same problem with DrawText.  Using InterfaceText, you can manipulate your own writing "slots" so that it doesn't get overwritten by immediately-following messages)
« Last Edit: July 25, 2010, 01:39:51 pm by zyxstand »
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 #78 on: July 25, 2010, 01:54:03 pm »
Thanks !
But soldat 1.5.1 will be realesed soon ?
or i can wait to transfer my server ?

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Mich1103's scripting thread
« Reply #79 on: July 25, 2010, 03:57:05 pm »
But soldat 1.5.1 will be realesed soon ?

HAHAHAHAH *wipes tear*
stick with 2.6.5 for now
Can't think of anything original to put here...