Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: croat1gamer on August 19, 2009, 02:42:55 pm

Title: Clips (beta)
Post by: croat1gamer on August 19, 2009, 02:42:55 pm
Script Name: Clips (beta)
Script Description Limited clips (ammo) for players, currently beta
Author: croat1gamer_v1.0 (http://soldatcentral.com/index.php?page=profile&u=226)
Compile Test: (http://soldatcentral.com/images/pass.gif) Passed
Core Version: 2.6.5
Hosted by: Soldat Central - http://soldatcentral.com/ (http://soldatcentral.com/)

Full Description:
As the name says, you have limited clips with each weapon.
You can edit the amount off the clips in the .pas file.

It is still a beta, because of 3 bugs:
1. Spas ammo- I might have an idea, but its for now too hard.
2. M79 shoots after reloading inside of 1 second- Blame the
AppOnIdle calling it just each second.
3. Changing weapons while reloading- 80% fixed, could need
something more reliable than the current fix

It is still a beta, the Bugged weapons (Spas and M79) are disabled
via SetWeaponActive.

For those who dont know what i mean by clips:
When you reload you loose one clip, no matter how many bullets
you had in it, so the ammo in it is lost.
When you get to 0 clips and fire all shots from it the weapon gets
removed (trying to find a way to spawn a gun with 0 bullets in it,
unsuccessful still).

Also, its my first script. :P

*NOTE:
Do not use weapon mods which have reload shorter than 1
second, as the script is based on AppOnIdle.

Also, it seems that the SetWeaponActive has some problems if
there are other scripts that use the same procedure.

RC version might come soon.


(http://soldatcentral.com/images/download.gif) (http://soldatcentral.com/dl.php?id=132&act=1)
(Size 1.35 KB)
- http://soldatcentral.com/index.php?page=script&f=132 -


** Script hosted by Soldat Central (http://soldatcentral.com/index.php?page=script&f=132)! Please visit the author's script page (http://soldatcentral.com/index.php?page=script&f=132) and Rate this script **
Title: Re: Clips (beta)
Post by: Leo on August 20, 2009, 03:21:01 am
I am very interesting in your script. Fix the bugs and I'll give it a try.
Title: Re: Clips (beta)
Post by: croat1gamer on August 20, 2009, 04:26:32 am
The weapon changing should be repaired soon, while Spas ammo will take some longer time.

The reload inside one secon is currently hard to make due to AppOnIdle being called just each second.

When i finish the weapon changing one it will be a rc version, as for Spas, i might need to nag EnEsCe for that.
Title: Re: Clips (beta)
Post by: Croatian on August 20, 2009, 04:35:28 am
Try to share it with Curt, he might help
Title: Re: Clips (beta)
Post by: croat1gamer on August 20, 2009, 05:24:36 am
Notice the first comment in the script (credits).

Also, it seems that the SetWeaponActive has some problems if there are other scripts that use the same procedure.
Title: Re: Clips (beta)
Post by: danmer on August 20, 2009, 10:14:12 pm
thanks for the moustache {:
Title: Re: Clips (beta)
Post by: DarkCrusade on August 21, 2009, 09:52:42 am
This could be interesting for -Niko-. He tried to do exactly what you did but thought it wouldn´t work because of the ScriptCore. It´s a great idea, I hope that I´ll see a server with that script soon somewhere since it adds more realism to game [pigtail]
Title: Re: Clips (beta)
Post by: croat1gamer on August 21, 2009, 10:42:38 am
But some things would need a bit upgraded scriptcore, as the current one has some flaws for the script.

Also, this is currently how im trying to fix the weapon changing bug, but as im at my workplace i dont have access to make a server and try it.

Code: [Select]
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);

begin
for i := 1 to 32 do
if c[i] = false then begin
if r[i] = true then dec(clip[SecondaryNum][i], -1);
c[i] := true;
end;
end;

It still needs a double check, as i dont think that this will suffice to solve it.
Also, excessive weapon changing has 2 things that will happen if im right:
1) Lag
2) You will loose/get clips (not sure which one will happen)

Note:
This is experimental, and not yet tested.
If someone wants to try it, here is the whole script (dev one)
http://pastebin.com/m34198e6a

Also, the current script was made on the July 10, 2009 (http://forums.soldat.pl/index.php?topic=35271), while the original version (which called 64 GetPlayerStats per second and created +50 additional ping, lol) was made a week before it.
Title: Re: Clips (beta)
Post by: Serial K!ller on August 21, 2009, 12:50:20 pm
You should check if slot is active, no point in checking player stats on unused slots :p
Code: [Select]
for i := 1 to 32 do begin
   if (GetPlayerStat(ID, 'Active') = true) then begin


   end;
end;
Title: Re: Clips (beta)
Post by: croat1gamer on August 21, 2009, 01:36:20 pm
Something like this?
http://pastebin.com/m36d45301

Not sure if it works though.
Working for another 25 minutes, then going home to test the dev version.
Title: Re: Clips (beta)
Post by: croat1gamer on August 21, 2009, 02:50:57 pm
The OnWeaponChange quickfix released.
It isnt too reliable in some cases, but should work fine for now.

For Spas users- Wait, still no ideas how to fix it. I might nag EnEsCe for that one.
Title: Re: Clips (beta)
Post by: Shard on August 24, 2009, 04:03:41 am
Just wondering, what did you do for the law? Did you give a player just one? Or did you give them a few, like 3 shots?
Title: Re: Clips (beta)
Post by: croat1gamer on August 24, 2009, 04:25:14 am
Read the .pas (http://soldatcentral.com/index.php?page=viewfile&f=132&file=ammo.pas) file.
Good that you mentioned that one, i see that i missed some amounts (accidentally, but also might intentionally), will fix it later (~4 hours, when i return from work).

There are 2 settings that i will use:
Realistic (default) (http://forums.soldat.pl/index.php?topic=35271.msg424442#msg424442)
Normal (http://forums.soldat.pl/index.php?topic=35271.msg424200#msg424200)
I might do something with ReadINI so it changes, depending which gamemode is being used.

And no, law wont have 1 shot by default, no matter what.
Title: Re: Clips (beta)
Post by: Shard on August 24, 2009, 11:00:00 am
7 law shots is too much, if I read that right.
Title: Re: Clips (beta)
Post by: croat1gamer on August 24, 2009, 12:23:19 pm
Fixing now.
Yeh, i was too lazy to update it then.
^._.^

Current one:
4 // Desert Eagles
3 // MP-5
2 // AK-74
3 // Steyr AUG
21 // Spas-12 /IGNORE THIS
2 // Ruger
7 // M79 /You can ignore it, but dont need to
2 // Barret M82A1
2 // FN Minimi
4 // Minigun
6 // M72 Law /Its balanced imo
7 // USSocom
21 // Chainsaw

*NOTE: It is an realistic/tw balance, as the amount of clips is partially for spraying.
And as i said, if you have any problems with it, mention them here:
http://forums.soldat.pl/index.php?topic=35271

I would need a few people who would like to test it in some sooner time.
Title: Re: Clips (beta)
Post by: F4||3N on August 25, 2009, 05:04:20 am
For knife, you could have 5 or so. (automatically respawn in your hand, or reload to respawn)

but once you throw it, the knife disappears.

this will be mad if it works!
Title: Re: Clips (beta)
Post by: Mittsu on August 25, 2009, 06:09:27 am
i think Barrett should have only 1 clip and law 3 bullets

and nice cript, cant wait for the bugs to be fixed
Title: Re: Clips (beta)
Post by: croat1gamer on August 25, 2009, 07:46:49 am
A forum member mentioned to me for the SNI Pro Climb server, and that it gets times by milliseconds, so any ways to speak to the script maker of its script, as it might be a solution to the Spas and M79 bugs.


NOTICE:
Also, i will host tomorrow an server with the script, realistic, probably tw (except stated otherwise), which will have the script, to test it, also i will include a script to comment any bugs you find out, with an possible uptime of 23/7.

My ip is dynamic, so i wont be able to provide it (unless changing the ip stated here every 24 hours) except the name.
Hosted in Europe, Croatia, 6+ mbps speed (home hosted, aye), but the ping kick will be +1k so anyone can test it.
Title: Re: Clips (beta)
Post by: VinceBros on September 02, 2009, 03:45:09 pm
Hi Croat, i've found what you've been searching for :P
Code: [Select]
const
TIMER = 100; //It means: 100 times per second

Procedure AppOnIdle(Ticks: integer);
var
  i: integer;
begin
  for i:=0 to TIMER do begin
     WriteConsole(0,'works',$E4C3C3C) // Change that line for whatever you want.
    Sleep(1000/TIMER);
  end;
end;
It is currently like Milliseconds, you can change it to a higher number to get more precise.
CHEERS!
Title: Re: Clips (beta)
Post by: Serial K!ller on September 02, 2009, 04:01:57 pm
Can't use sleep() it stops all activity on the server creating massive lag :/

I read somewhere to use a bot and createbullet above the bot and the time the bullet takes to fall will create a loop with delay on onplayerdamage().
Title: Re: Clips (beta)
Post by: VinceBros on September 02, 2009, 04:07:48 pm
Oh, Ya.. True.. I didn't see it was causing  EXTREME lag.

I'll try to find a way with the bot.
Title: Re: Clips (beta)
Post by: chutem on October 20, 2009, 01:14:43 am
Bloo made the SNI Pro Climb scripts.

But I believe it uses FormatDate (http://www.enesce.com/help/index.html?Functions/FormatDate.html) to get the time when each player spawns, and if they cap, it compares it to the time at that point, meaning it will be useless to you to call a function every xxx milliseconds.
Title: Re: Clips (beta)
Post by: croat1gamer on October 20, 2009, 09:25:12 am
Heh, hope the new scriptcore will make this possible.

Also,the repeat function was a horrible, horrible thing to try.
Really horrible.
The threaded loop option could have a solution.