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

0 Members and 3 Guests are viewing this topic.

Offline amb2010

  • Camper
  • ***
  • Posts: 264
  • Fear the dot ...
Re: Mich1103's scripting thread
« Reply #40 on: July 22, 2010, 07:55:47 pm »
mich1103 are you even trying to figure out how to do these before you ask? They are fairly simple and anyone with basic knowledge of any kind of programming should be able to figure it out. Maybe use a translator on the descriptions for what each function/procedure does, although it probably wont work 100% it should help you get a basic understanding of what it does.
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #41 on: July 22, 2010, 08:02:05 pm »
I understand now !  :)
i can put more than 1 getplayerstat
like :
Code: [Select]
if GetPlayerStat(ID,'Human') = False
   then begin
if (GetPlayerStat(ID,'Active') = true)
   then begin
if (GetPlayerStat(ID,'name') = 'ZoMbIe')
   then begin

So whit that i can put that player need to be alive to be named : Major, then begin ^^ (exemple) :)

DarkCrusade

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

Anyone noticed how useless this is?

Offline amb2010

  • Camper
  • ***
  • Posts: 264
  • Fear the dot ...
Re: Mich1103's scripting thread
« Reply #43 on: July 22, 2010, 08:23:55 pm »
Eh he added it, just put in the wrong spot so at least he got half of your message ;). Maybe saying "Move the 'Active' check so its checked before the 'Human' check" would help more. Not everyone is always going to start out as an epic scripter and some people are more dense than others.
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #44 on: July 23, 2010, 01:34:55 am »
Telling him 5 times that he needs to check whether the ID is active before he can do anything with the ID should have been enough.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #45 on: July 23, 2010, 10:06:29 am »
Each time i lay a mine i got a error message in the console ...

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #46 on: July 23, 2010, 10:21:49 am »
You try to access a variable that doesn't exist.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #47 on: July 23, 2010, 10:26:02 am »
which variable ?  ???

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #48 on: July 23, 2010, 10:27:11 am »
How can I tell? Did I see the script or something? :P

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #49 on: July 23, 2010, 03:04:14 pm »
I think i will not put the mine skills in my script (too much trouble)
Or maybe you have another mine script (simple mine script)

The error can crash my server ?
« Last Edit: July 23, 2010, 03:07:03 pm by mich1103 »

Offline amb2010

  • Camper
  • ***
  • Posts: 264
  • Fear the dot ...
Re: Mich1103's scripting thread
« Reply #50 on: July 23, 2010, 03:33:31 pm »
Well the error says that its in the AppOnIdle procedure so if you could, post the code for that section unless you don't want to. Considering its when the user types /mine it has something to do with the code for the mine, probably the part where you spawn something to mark the location(if you do that) or the part where you check player locations.

Also DC you're working with someone with extremely horrible english comprehension so obviously there will be issues with communication, you told him 5 times but 5 times the exact same way(fairly rude as well) I was just suggesting trying to tell him in a different, kinder way what to do to see if it worked better.
« Last Edit: July 23, 2010, 03:36:30 pm by amb2010 »
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #51 on: July 23, 2010, 03:47:54 pm »
You want i post the AppOnIddle part ? (sorry im not native english speaker ...)

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #52 on: July 23, 2010, 04:03:46 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).

How is this rude? More information is appreciated!

I made a mine script and gave it to him. It works perfectly so he shouldn't have any issues with it. A few modifications and it's done.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #53 on: July 23, 2010, 04:20:36 pm »
Thanks  ;D  !
I includes it to my script and it work fine !
Now i need some idea for skills ...

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #54 on: July 23, 2010, 04:29:47 pm »
Look around RPG scripts, you might get some ideas for skills ;)

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #55 on: July 23, 2010, 04:58:35 pm »
LOOT AMMO !!!  ;D
:-\  how can i procede ?

Maybe something like that ?

Code: [Select]
function Chance(Perc: single): boolean;
begin
result := (strtofloat(inttostr(random(0,101)))/100.0 < perc);
end;

procedure LootAmmo(ID: byte);
begin
ForceWeapon(ID,GetPlayerStat(ID,'primary'),GetPlayerStat(ID,'secondary'),11);
end;

function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer;Weapon: Byte) : integer
begin
if soldier[ID].level >= 50 then begin
if chance(0.1) then begin
LootAmmo(Shooter);
end;
 end;
« Last Edit: July 23, 2010, 05:02:33 pm by mich1103 »

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #56 on: July 23, 2010, 05:09:56 pm »
Code: [Select]
LootAmmoChance = 10;

Procedure LootAmmo(ID:Byte);
var
  Amount,MaxAmmo:Byte;
begin
  case GetPlayerStat(ID,'Primary') of
    1: MaxAmmo := 7;
    2: MaxAmmo := 30;
    3: MaxAmmo := 40;
    4: MaxAmmo := 25;
    5: MaxAmmo := 8;
    6: MaxAmmo := 4;
    7: MaxAmmo := 1;
    8: MaxAmmo := 10;
    9: MaxAmmo := 50;
    10: MaxAmmo := 100;
    11: MaxAmmo := 200;
    12: MaxAmmo := 1;
    13: MaxAmmo := 1;
    14: MaxAmmo := 1;
    15: MaxAmmo := 150
    16: MaxAmmo := 1;
    0: MaxAmmo := 12;
    255:Exit;
  end;
  if (MaxAmmo <> 1) then
    Amount := MaxAmmo / 10 + Random(2,6)
  else
    Amount := 0;
  ForceWeapon(ID,GetPlayerStat(ID,'Primary'),GetPlayerStat(ID,'Secondary'),Amount);
  WriteConsole(ID,'Looted: ' + IntToStr(Amount) + ' ammunition.', $FFFFFF);
end;

Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
  if (Random(1,101) <= LootAmmoChance) then LootAmmo(Shooter);
end;

Try to figure what I did. I didn't test the code so maybe you must fix it ;)

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #57 on: July 23, 2010, 05:19:34 pm »
Work but if i loot with the minigun 15 ammo and that i have 100 ammo
i will have 15 ammo instead of 100 ...

DarkCrusade

  • Guest
Re: Mich1103's scripting thread
« Reply #58 on: July 23, 2010, 05:21:48 pm »
Code: [Select]
LootAmmoChance = 10;

Procedure LootAmmo(ID:Byte);
var
  Amount,MaxAmmo:Byte;
begin
  case GetPlayerStat(ID,'Primary') of
    1: MaxAmmo := 7;
    2: MaxAmmo := 30;
    3: MaxAmmo := 40;
    4: MaxAmmo := 25;
    5: MaxAmmo := 8;
    6: MaxAmmo := 4;
    7: MaxAmmo := 1;
    8: MaxAmmo := 10;
    9: MaxAmmo := 50;
    10: MaxAmmo := 100;
    11: MaxAmmo := 200;
    12: MaxAmmo := 1;
    13: MaxAmmo := 1;
    14: MaxAmmo := 1;
    15: MaxAmmo := 150
    16: MaxAmmo := 1;
    0: MaxAmmo := 12;
    255:Exit;
  end;
  if (MaxAmmo <> 1) then begin
    Amount := MaxAmmo / 10 + Random(2,6) + GetPlayerStat(ID,'Ammo')
    if (Amount > MaxAmmo) then
      Amount := 0;
  end else Amount := 0;
  ForceWeapon(ID,GetPlayerStat(ID,'Primary'),GetPlayerStat(ID,'Secondary'),Amount);
  WriteConsole(ID,'Looted: ' + IntToStr(Amount) + ' ammunition.', $FFFFFF);
end;

Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;
begin
  Result := Damage;
  if (Random(1,101) <= LootAmmoChance) then LootAmmo(Shooter);
end;
« Last Edit: July 23, 2010, 05:27:05 pm by DarkCrusade »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Mich1103's scripting thread
« Reply #59 on: July 24, 2010, 08:34:18 am »
Thanks  :)
Player are able to spawn a stationary gun !
but it stuck like that
                             |
                             |
                             v