Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: Bellamy on July 03, 2008, 01:48:28 am
-
Script Name: Cap Bonus
Script Description: For each cap in-game, you get a bonus. (see script for each bonus)
Original Author(s): Bellamy (buffer help from IQ-Unlimited)
Core Version: 2.6.3
var
t: integer;
procedure ActivateServer();
begin
t := 0;
end;
procedure OnFlagScore(ID, TeamFlag: byte);
begin
if t = 0 then begin
if GetPlayerStat(ID, 'kills') >= 20 then begin
GiveBonus(ID, 4);
t := 1;
end;
end;
if t = 1 then begin
if GetPlayerStat(ID, 'kills') >= 40 then begin
GiveBonus(ID, 3);
t := 2;
end;
end;
if t = 2 then begin
if GetPlayerStat(ID, 'kills') >= 60 then begin
GiveBonus(ID, 5);
t := 3;
end;
end;
if t = 3 then begin
if GetPlayerStat(ID, 'kills') >= 80 then begin
GiveBonus(ID, 2);
t := 4;
end;
end;
if t = 4 then begin
if GetPlayerStat(ID, 'kills') >= 100 then
GiveBonus(ID, 1)
t := 5;
end;
end;
end;
// GiveBonus(ID: byte; Bonus: integer) -- 1= Predator 2= Berserker 3= Vest 4= Grenades 5= Cluster Nades
Just a simple script I wrote when I was bored. I just wanted to add a little spice to my server.
-
Use your brain. That will not work if you killed anybody.
Tip: Use variables.
-
what is that?...
-
Well, you should use variables!
Its allmost impossible (if not compeletely) to try to do that without vars.
Do wah xm.Ripper said, DOOOOO IITTT!
(if you do one kill and cap, then you have 21 kills, and you wont get any bonuses...) ::)
-
Gah, your right. I didn't even think of it that way. '= #' didn't even click with me that it has to be that #.
I don't think straight most of the time. Some of you know that by now. lol
I'll go back and fix it. It'll be on here later.
P.S. - Or I could just make it '# to #'.
-
Nah. Did you check that script ?
You can not use *Flags* stat right now. That will available be in next version of dedicated server.
-
Change server version to 2.6.4, or modify the script to keep track OnFlagScore i believe the event is called for whenever any1 caps the flag
-
Why 2.6.4? There is no 2.6.4....
And I think OnFlagScore keeps each players caps and not as a team.
But I don't know, you may be right.
-
he means like... when a player gets a cap, give them the bonus then store that they got the cap, so that next time you can check and modify the bonus.
-
Well I'm not so sure if I'm able to do that, as I am an all-out newb to scripting. Meh. I might try it.
And yes, the script up top is now completely jack. I'm working on it folks.. I'm working on it...
EDIT**
I FIXED THE SCRIPT, SO IT SHOULD WORK PERFECT NOW
PLEASE DONT COMPLAIN MOAR :P
-
No, it shouldn't work now, use arrays
-
[pseudo-dummy-code]
var caps: array[1..32] of byte;
procedure onjoingame // resets caps on join
begin
caps[ID] := 0;
end;
procedure onflagscore // increasing counter and giving bonuses
begin
caps[ID] := caps[ID] + 1;
case caps[ID] of
1: give small bonus
2: etc
end;
end;
procedure onmapchange // resets caps - optional
var i: byte;
begin
for i := 1 to 32 do
caps := 0;
end;
[/pseudo-dummy-code]
couldnt be arsed to write it all up as it should be, do it yourself. I hope you get the general idea of how it should work >.<
-
Yeah, I do. I'm just not that good at scripting yet to know how to do that. :P
-
#1 rule for programming in any language: Make sure it actually works by testing it.
I don't want to be really harsh but this "I'm new to this and I don't know how to do that yet"
Really should stop...The stuff you are missing is the really basic stuff that is covered by most pascal help sections in the first 5-10 parts. You really need to read the basics before making any scripts. Yes practice makes perfect but you can't practice lets say football without knowing the whole game ;)
You need to prepare yourself for scripting and when something doesn't work google it...Ex: "How do I make arrays in pascal" , this will bring it up and give many examples which can probably be used in your soldat script. Although some of the code they give isn't defined in the scriptcore but the basic variable declaring and usage should be the same.
-
Ok, well, I'll "try harder".
Whiner.
-
Doesn't belong in the Scripting Releases forum in the first place, as it isn't a working script...
-
I tested it, it works fine.
-
Which one?
-
It will work as long as a single player is doing all the caps. But not if two or more people cap...
-
So, therefore, it works.
-
So, therefore, it works.
You aren't gonna make it far with that attitude.... It works yes, but properly no. So you should fix it. If you tested it you would have noticed it didn't work right. When people are telling you that you made a script that doesn't work properly and are attempting to help, it isn't whining, its feedback to help you become a better scripter which IMO isn't working out to well.
-
Ok sure. Maybe I was the wrong one. But I'm not sure if I'll be able to fix it. Like I said, I'm a beginner at scripting, therefore, I don't know much about complicated things. :P
PS - I could use some help on how to use complicated things that I don't know how to use already. Maybe a "lesson" on some important things that I am missing in my scripts...