Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: Avarax on January 23, 2007, 07:09:45 am
-
I wrote the basic EP & Levelling structure, the character structure and a heal algorithm already... it all works, 2.6.0 commands are {}'ed
const
//Teams
ALPHA = 1;
BRAVO = 2;
CHARLIE = 3;
DELTA = 4;
SPECTATOR = 5;
HP_PER_LEVEL = 200;
MAX_LVL = 10;
EP_PER_LEVEL = 100;
//Game Modes
DEATHMATCH = 0;
POINTMATCH = 1;
TEAMMATCH = 2;
CTF = 3;
RAMBO = 4;
INF = 5;
HTF = 6;
SERVER = 255;
type tplayer = record
name: string;
ep,level,maxhp: integer;
end;
var soldier: array[1..32] of tplayer;
function GetEP(Killer,Victim:string): integer;
var KID,VID,multiplier,lvldif,EP: integer;
begin
KID:=NametoID(Killer);
VID:=NametoID(Victim);
lvldif:=soldier[VID].level-soldier[KID].level;
multiplier:=100 + 10 * lvldif;
If multiplier<40 then
multiplier:=40;
EP:=1000 + (soldier[VID].level * EP_PER_LEVEL * multiplier DIV 100);
Result:=EP;
end;
function MaxEP(ID: integer): integer;
begin
Result:=2200 + (soldier[ID].level * 2000) + (soldier[ID].level * soldier[ID].level * 200);
end;
{procedure Heal(ID,percent,absolute: intteger);
begin
DoDamage(ID,(-1) * soldier.[ID].maxhp * percentage DIV 100 - absolute);
end;}
procedure GainLvl(ID: integer);
begin
soldier[ID].level:=soldier[ID].level+1;
Command('say ' + IDtoName(ID) + ' reached Level ' + inttostr(soldier[ID].level));
soldier[ID].maxhp:=4000 + HP_PER_LEVEL * soldier[ID].level;
//Heal(ID,100,0);
end;
procedure ActivateServer();
begin
end;
procedure AppOnIdle(Ticks: integer);
begin
end;
procedure OnCommand(ID: integer;Text: string);
begin
end;
function OnRequestGame(IP: string;State: integer):integer;
begin
Result := State;
end;
procedure OnJoinGame(IP, Nickname: string;Team: byte);
begin
end;
procedure OnJoinTeam(IP, Nickname: string;Team: byte);
var JID: integer;
begin
JID:=IPtoID(IP);
soldier[JID].level:=0;
soldier[JID].ep:=0;
soldier[JID].maxhp:=4000;
soldier[JID].name:=Nickname;
end;
procedure OnLeaveGame(IP, Nickname: string;Team: byte);
begin
end;
procedure OnFlagGrab(ID: integer;TeamFlag: byte;GrabbedInBase: boolean);
begin
end;
procedure OnFlagReturn(ID: integer;TeamFlag: byte);
begin
end;
procedure OnFlagScore(ID: integer;TeamFlag: byte);
begin
end;
procedure OnPlayerKill(Killer,Victim,Weapon: string);
var EP,KID,VID: integer;
begin
KID:=NametoID(Killer);
VID:=NametoID(Victim);
If KID=VID then
begin
If soldier[KID].ep > 1000 + soldier[KID].level * EP_PER_LEVEL then
soldier[KID].ep:=soldier[KID].ep - (1000 + soldier[KID].level * EP_PER_LEVEL)
else
soldier[KID].ep:=0;
end
else
begin
EP:=GetEP(Killer,Victim);
soldier[KID].ep:=soldier[KID].ep + EP;
If soldier[KID].ep >= MaxEP(KID) then
begin
If soldier[KID].level >= MAX_LVL then
else
GainLvl(KID);
end;
end;
end;
procedure OnPlayerRespawn(ID: integer);
begin
end;
procedure OnPlayerSpeak(Name,Text: string);
begin
end;
procedure OnAdminConnect(IP: string);
begin
end;
procedure OnAdminDisconnect(IP: string);
begin
end;
procedure OnAdminMessage(IP, Msg: string);
begin
end;
-
Phew. That looks ... amazing.
What does it do ?
-
it will be a script that allows your soldier to level throughout a usual soldat CTF match. with each kill, the script calculates an Experience (EP) value. Once you reached a certain amount of experience, you will level up and gain things like 5% more health, life generation, life leech (vampirism), extra weapons, powerfull spells and the like. scripting spells in soldat seems kind of hard though, you can't do anything classic, like a fireball, but you can make summon spells for example that summon like a couple of boogie men that guard your base for let's say 10 seconds.
it'll be a new and unique expirience imo.
i also tried scripting "evolvable" weapons, but that requires to load different weapon.inis, and everytime you change the ini to load a weapon for a guy that reached a new level, everyone and not only that one person will get the gun. that's a so far unsolvable problem and improvable weapons will therefore not be implemented
-
can you script how much health someone has?? that seems pretty kickass
-
but you can make summon spells for example that summon like a couple of boogie men that guard your base for let's say 10 seconds.
Really? Even I didn't know that :S
Explain?
-
hm quite simple, a script that adds some bots via /addbot if someone says for example "/summon". it also sets a boolean type variable true which will trigger a countdown in AppOnIdle which will kick the bots after some time again. quite simple ;(
regarding the health stuff, enesce said it'd be quite possible that a negative value used in the new DoDamage() function will heal. so basicly what i'm going to do is to do a certain negative amount of damage (calculated in relation to the soldiers current level) on spawn of a player.
-
Man how can u read my thougths i wrote a tread on a request on this script at the same time u posted this tread. (two shouls same thougth...)
Anyway u got it all. Great script. Youst wondering is there anyway of using scripts in normal soldat game mode. like a non delicated server..
And 3 little questions
Are u goin to add teleport some how?
hope not i hate that..
-------------------------------
Are u going to have chooseable skills and characers?
Hope that it whould extend the felling.
-------------------------------
(Crazy suggestion) Are u going to get the same exp for all killz or are u going to get examper 1 m79 kill on 10m 1exp, 1 knife kill on 100m 50exp or something?
-
Someone who joins in the middle of a map, at a server running this script, will have no change. Did you think about it ? ;)
-
Someone who joins in the middle of a map, at a server running this script, will have no change. Did you think about it ? ;)
procedure OnJoinTeam(IP, Nickname: string;Team: byte);
var JID: integer;
begin
JID:=IPtoID(IP);
soldier[JID].level:=0;
soldier[JID].ep:=0;
soldier[JID].maxhp:=4000;
soldier[JID].name:=Nickname;
end;
ya well he will start start at lvl 0, and he'll suck for the duration of that round... i could implement some algorithm that makes him start with the lowest level among the other players, starting at that level with 0 Ep. that'd fix it a bit :)
thanks for reminding me of that.
@Mr.Snow:
1.Teleport isn't possible yet with any script functions as far as i know.
-----
2. hm, no, you will however be able to choose which skill you learn with levelup, like you learn healing at lvl 3. but there are 3 kinds of healing:
- regeneration (small amount but simultaneous)
- carrion feed (gain life on kill, big amount)
- healing spell (heals 100% on command ("/heal"), has some cooldown, like 1 minute)
the script would then ask you which skill to learn and you'd choose with "/1", "/2" or "/3".
-----
3. you'll get no bonus for "skillfull" kills, but you will get a bonus for killingsprees. you get X % bonus where X is the square of the number of kills in a row
-
ya well he will start start at lvl 0, and he'll suck for the duration of that round... i could implement some algorithm that makes him start with the lowest level among the other players, starting at that level with 0 Ep. that'd fix it a bit :)
thanks for reminding me of that.
You know what would be a lot more awesome? If the player's progress was saved in a text file or something.
-
nope, that'd be too RPGish and is not appropriate for soldats fast gameplay. also, it'd cause a huge unbalance, since people that invest much time will easily pwn newcomers.
EDIT:
Fixed the Join Algorithm:
procedure OnJoinTeam(IP, Nickname: string;Team: byte);
var i,JID,temp: integer;
begin
temp:=0;
JID:=IPtoID(IP);
soldier[JID].level:=1;
If NumPlayers > 1 then
begin
for i:=1 to 32 do
If soldier[i].level > temp then
temp:=soldier[i].level;
soldier[JID].level:=temp;
end;
soldier[JID].ep:=0;
soldier[JID].maxhp:=4000;
soldier[JID].name:=Nickname;
end;
the script is way complexer already than the one posted in my opening post
-
Wait wait now.. U men that the skills ain't saved until next time u join?
Like every time you disconnect u get lvl0?
That isn't so funny...
It ain't hard to kill people whit sniper for example even if they have vampirism. (higher levels cant be harder than haxers whit tele hax huh?)
Can u at least Make it possible for exp save. Why don't just use the normal old Cs way.
U must type "/savexp" to save em.
Sorry for pushing you if this is hard (i dunno). But my opinion is that it be loads more funny..
You can of course have a max lvl save, like u have lvl 7 and then wen you return you have lvl 5 again. The return level can be anyway set lower and i think IF you can do this you can easily set return level to max that means u have the same level as b4 you left. Quite stretchable script then. But that's only IF you add it. *hoping*plz plz plz do*hoping*
Btw. Is it only me and Tomaz who thinks that it whould be awsome? I think most soldat players whould.
-
uh... No :D
EDIT:
Hooray, first spell functionally implemented: Summon Ghouls, variable levels of Skill possible
-
you can't do anything classic, like a fireball, but you can make summon spells for example that summon like a couple of boogie men that guard your base for let's say 10 seconds.
it'll be a new and unique expirience imo.
i also tried scripting "evolvable" weapons, but that requires to load different weapon.inis, and everytime you change the ini to load a weapon for a guy that reached a new level, everyone and not only that one person will get the gun. that's a so far unsolvable problem and improvable weapons will therefore not be implemented
Why not lock away the secondary weapons and mod them to use for spells. Obviously I don't know if it's possible, but I'd imagine it'd be possible to script the flame thrower along with, say, a chainsaw modded for flight, a LAW which causes a string of cluster-like ground explosions, a knife that homes in on a target (and/or acts like a bomb killing everything on screen), etc.
Anyway, sounds like a great idea overall, though I think Soldat may be a bit too fast to really appreciate the additions. Players will really have to bind the unique commands as taunts to get the most out of it.
-
Sort of like a Soldat RPG? ;D
-
hm no i will not mod the secondaries since i'm trying to keep it just like the usual soldat... anything that changes gameplay too much won't be implemented.
@ghg:
kinda, but it's only about the levelling, the rest is usual CTF (or others) soldat
-
*cry´s quiet* no level save..
I would have loved it so..
Anyway i wonder how the level limits are set is it like 100 exp lvl and then up 100exp eatch level or is it like 100-300-600?
-
EP needed to reach next Level = 3050 + ((CurrentLevel-1) * EPNEEDED_PER_LEVEL) + ((CurrentLevel-1)² * 100)
This here is a constant, i chose this value for now.
EPNEEDED_PER_LEVEL = 1800
Here are the EP values you'd need with this calculation:
Level 2: 3050
Level 3: 4950
Level 4: 7050
Level 5: 9350
... and so on
-
I want to see this on zombie servers. ;DDD !
-
Thank you for the level list. I wonder how much Ep is gained for each kill
And is Ep gained only by killing or is it points so if you in point mush kill whit flag you get more Ep tan without?
-
Hmm, sounds and looks interesting. I wish there was a way to set a respawntime for every invidual player. You could shorten your respawn time as a skill, or ability. Could come handy in CTF, I think.
-
I think this would be cool for a singleplayer game. Could you like , deny the usage of an X weapon till you're X level. This would be really useful for spells and such.
SINGALPLEYAR HUZZAH!!!!!
-
I think this would be cool for a singleplayer game. Could you like , deny the usage of an X weapon till you're X level. This would be really useful for spells and such.
yes thats possible, with the finished script, you get the minigun as the ultimate gun if your reach the maximum level (maximum level can be customly defined). the minigun is disabled till then and then enabled at max level for that individual player as some ultimate gun.
@Clawbug:
yeah i thought of such skill, using the /setteam command to let the person immediatly respawn after death. but this terribly spawn the console with "X has joined alpha team" messages ;)
So far, i thought of making 3 spell classes, that improve and are learned every X levels. once you reach the required level, you are asked which of the spells of this class you want to learn:
Healing Spells - improves every 2 Levels - Choose between these spells:
-Instant Heal (on command, 1 minute cooldown): Heals you for 100%. With higher levels, you will heal even more than 100% of your max health and the cooldown decreases.
-Regeneration: Heals you for a small amount of health with every second. Heals faster if you are at very low health. Amount healed increases with higher level.
-Vampirism: Heals a big amount of health on kill and gives you some extra Expirience. Amount healed increases with higher level.
Summon Spells - improves every 5 levels - Choose between these spells:
-Summon Ghouls (on command, 3 minutes cooldown): Summons a couple of Ghouls with chainsaw on your team to protect your base for few seconds. Number of Ghouls, duration increases with higher level. Cooldown decreases with higher level.
-Summon Flame Spirit (on command, 5 minutes cooldown): Summons a mighty modded flamethrower wielding Flame Spirit on charlie team with LOTS of health that attacks everyone in the game. Duration increases with higher level, cooldown decreases.
Weapon Spells - improves every 3 levels - Choose one of these spells:
-Instant Reload (on command, 1 minute cooldown): instantly reloads your magazine with some extra ammo. Amount of Extra ammo increases with higher level, cooldown decreases
-Disarm (on command, 1,5 minutes cooldown): Disarms the nearest enemy for a couple of seconds. Duration increases with level, cooldown decreases.
-Carrion Ammo: Has a certain % chance to instantly reload your magazine on kill. % chance increases with higher level.
-
how does it 'ask' you? a server message? and do you just type the answer?
and will the minigun be like your hovergun? :p
-
yeah it will ask you via a private server message. then you have to choose by writing /1, /2 or /3 in the console
you can mod the minigun however you wish, the script is quite customizable... i modded it as a flak gun firing cluster fragments... not too overpowered, yet very nice to keep opponents at range
-
Nice.
ONLY for 2.6.0?
*whine*
-
lookey, i'm making some graphics for the manual of the script :D
---Warmth---
(http://home.arcor.de/avarax/warmth.png)
Category: Healing, Static
Heals you for 2% HP each second
If you are under one third of you maximum health, Warmth will regenerate 5% HP each second instead.
-
Nice addon to the script :)
(still want savexp)
-
---Conjure Clip---
(http://home.arcor.de/avarax/conjure.png)
Category: Offensive, Spell ('/ofs')
Cooldown: 90 seconds
Instantly renews your ammo and even gives you some extra bullets.
The number of extra bullets is X % of the default ammo of your gun, where X is (20 + 5 * skilllevel).
Cooldown decreases by 10 seconds per skilllevel.
-
cool :o
could there maybe be a /sniper cmd where a sniper with like %99 accuracy guards where you sit or like /kruger and then 2 krugers follow you around?
-
---Disarm---
(http://home.arcor.de/avarax/disarm.png)
Category: Defensive, Spell ('/def')
Cooldown: 120 seconds
Disarms your nearest opponent for X seconds, where X is (2 + (skilllevel / 2)).
Cooldown decreases by 10 seconds per skilllevel.
-
woow :o nice work
-
Well here is a definate list of spells and talents that will be in the script. you can learn and improve only one spell / talent out of each category:
Category: Healing
Warmth: static, regeneration
Holy Medikit: spell, 100% heal
Vampirism: static, life leech
Category: Defense
Disarm: spell, disarms nearest enemy for a short duration
Evasion: static, gives you a chance to avoid damage
Thorns: static, redirects an amount of damage to the damage dealer
Category: Offense
Conjure Clip: spell, reloads your magazine and gives some extra ammo
Carrion Ammo: static, gives you a chance to instantly reload with each kill
Critical Strike: static, gives you a chance to do double or even triple of the normal damage
Category: Summoning
Summon Ghoul: spell, summons some chainsaw bots on your team for some time
Summon Flame Spirit: spell, summons a mighty flame bot on charlie team for some time
Summon Spellshield: spell, summons a shield to block the next spell casted, also negates some static effects that would affect you in a negative way
the script is about 500 lines long already, including 3 out of the 12 spells and the levelling and spell-learning system
-
Sounds like a nice script and I like those graphics for the manual.
But how do you determine the closest player, just wondering how you figure that out with GetPlayerXY()
-
(http://upload.wikimedia.org/wikipedia/commons/0/07/Pythagoras.png)
Pythagoras says:
c²=a²+b²
Avarax says:
GetPlayerXY(caster,X1,Y1);
temp:=999999;
nearest:=0;
for i:=1 to 32 do
If i<>caster then
begin
GetPlayerXY(i,X2,Y2);
If (X2<>0) and (Y2<>0) {and GetPlayerStat(i,'Alive')} then
begin
temp2:=sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2));
If temp2 < temp then
begin
temp:=temp2;
nearest:=i;
end;
end;
end;
This part:
temp2:=sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2));
is equal to what Pythagoras says and calculates the range from Soldier A to Soldier B. The rest is for finding out which is the nearest.
-
Wow thats a good way of doing it. ;D
Code snippet saved.
Can't wait till its out.
-
Question!
You typed:
---Conjure Clip---
(http://home.arcor.de/avarax/conjure.png)
Category: Offensive, Spell ('/ofs')
Is "/ofs" the command in game?
-
yap
/ofs = shortcut for all offensive spells
here is another thread in General Discussion btw, if you havent noticed yet:
http://forums.soldat.pl/index.php?topic=10754.0
i introduced the EP system there and answered some other questions there
-
Looking very promising so far. I look forward to playing this.
-
sorry i have a stupid question but i am new here
where i have to include the script
soldat/scripts and then?
socketcore.pas
core.pas
includes.txt
networkcore
or admincore?
-
lock please.
-
what is false?
folder:
soldat/scripts
levels.pas :
const
//Teams
ALPHA = 1;
BRAVO = 2;
CHARLIE = 3;
DELTA = 4;
SPECTATOR = 5;
HP_PER_LEVEL = 200;
MAX_LVL = 10;
EP_PER_LEVEL = 100;
//Game Modes
DEATHMATCH = 0;
POINTMATCH = 1;
TEAMMATCH = 2;
CTF = 3;
RAMBO = 4;
INF = 5;
HTF = 6;
//Weapons
DEAGLES = 1;
HKMP5 = 2;
AK74 = 3;
STEYR = 4;
SPAS = 5;
RUGER = 6;
M79 = 7;
BARRET = 8;
MINIMI = 9;
MINIGUN = 10;
FLAMER = 11;
BOW = 12;
FLAMEBOW = 13;
SOCOM = 0;
KNIFE = 14;
CHAINSAW = 15;
LAW = 16;
SERVER =255 ;
type tplayer = record
name: string;
ep,level,maxhp: integer;
end;
var soldier: array[1..32] of tplayer;
function GetEP(Killer,Victim:string): integer;
var KID,VID,multiplier,lvldif,EP: integer;
begin
KID:=NametoID(Killer);
VID:=NametoID(Victim);
lvldif:=soldier[VID].level-soldier[KID].level;
multiplier:=100 + 10 * lvldif;
If multiplier<40 then
multiplier:=40;
EP:=1000 + (soldier[VID].level * EP_PER_LEVEL * multiplier DIV 100);
Result:=EP;
end;
function MaxEP(ID: integer): integer;
begin
Result:=2200 + (soldier[ID].level * 2000) + (soldier[ID].level * soldier[ID].level * 200);
end;
{procedure Heal(ID,percent,absolute: intteger);
begin
DoDamage(ID,(-1) * soldier.[ID].maxhp * percentage DIV 100 - absolute);
end;}
procedure GainLvl(ID: integer);
begin
soldier[ID].level:=soldier[ID].level+1;
Command('say ' + IDtoName(ID) + ' reached Level ' + inttostr(soldier[ID].level));
soldier[ID].maxhp:=4000 + HP_PER_LEVEL * soldier[ID].level;
//Heal(ID,100,0);
end;
procedure ActivateServer();
begin
end;
procedure AppOnIdle(Ticks: integer);
begin
end;
procedure OnCommand(ID: integer;Text: string);
begin
end;
function OnRequestGame(IP: string;State: integer):integer;
begin
Result := State;
end;
procedure OnJoinGame(IP, Nickname: string;Team: byte);
begin
end;
procedure OnJoinTeam(IP, Nickname: string;Team: byte);
var i,JID,temp: integer;
begin
temp:=0;
JID:=IPtoID(IP);
soldier[JID].level:=1;
If NumPlayers > 1 then
begin
for i:=1 to 32 do
If soldier[i].level > temp then
temp:=soldier[i].level;
soldier[JID].level:=temp;
end;
soldier[JID].ep:=1;
soldier[JID].maxhp:=4000;
soldier[JID].name:=nickname;
end;
procedure OnLeaveGame(IP, Nickname: string;Team: byte);
begin
end;
procedure OnFlagGrab(ID: integer;TeamFlag: byte;GrabbedInBase: boolean);
begin
end;
procedure OnFlagReturn(ID: integer;TeamFlag: byte);
begin
end;
procedure OnFlagScore(ID: integer;TeamFlag: byte);
begin
end;
procedure OnPlayerKill(Killer,Victim,Weapon: string);
var EP,KID,VID: integer;
begin
KID:=NametoID(Killer);
VID:=NametoID(Victim);
If KID=VID then
begin
If soldier[KID].ep > 1000 + soldier[KID].level * EP_PER_LEVEL then
soldier[KID].ep:=soldier[KID].ep - (1000 + soldier[KID].level * EP_PER_LEVEL)
else
soldier[KID].ep:=0;
end
else
begin
EP:=GetEP(Killer,Victim);
soldier[KID].ep:=soldier[KID].ep + EP;
If soldier[KID].ep >= MaxEP(KID) then
begin
If soldier[KID].level >= MAX_LVL then
else
GainLvl(KID);
end;
end;
end;
procedure OnPlayerRespawn(ID: integer);
begin
end;
procedure OnPlayerSpeak(Name,Text: string);
begin
end;
procedure OnAdminConnect(IP: string);
begin
end;
procedure OnAdminDisconnect(IP: string);
begin
end;
procedure OnAdminMessage(IP, Msg: string);
begin
end;
procedure OnException(ErrorMessage: string);
begin
// WriteFile('ErrorLog.txt', ErrorMessage);
end;
function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
//NOTE: This function will be called when [_ANY_] player types a / command.
Result := false; //Return true if you want disable the command typed.
end;
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
end;
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
// Victim = Player Damaged // Shooter = Player doing the damage
result := Damage;
end;
and yes i have done it into the includes.txt
need help
-
Do you have to change anything in this script, like i run a mod server and there is alot of kills, how would you lower the amount of EP you get for each kill?
-
something is wrong i didnt level up
Date Posted: August 02, 2007, 02:49:54 PM
or can anyone send it me
(email or icq or msn
msn : master-cool@hotmail.de
icq: 261721288
email : master-cool@hotmail.de
forum : dieteam.de.vu
-
anyone?
-
This thread is very outdated, lock please.