Author Topic: Leveling & EP script in developmnet for 2.6.0  (Read 6502 times)

0 Members and 1 Guest are viewing this topic.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Leveling & EP script in developmnet for 2.6.0
« 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


Code: [Select]
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;
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Raithah

  • Camper
  • ***
  • Posts: 424
  • Life™
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #1 on: January 24, 2007, 10:14:08 pm »
Phew. That looks ... amazing.

What does it do ?

The preferred outcome of war is peace. Ironic, huh ?
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam auctor lectus pulvinar neque. Vestibulum commodo nisl convallis nisi. Aliquam in magna. Quisque orci. Duis sed nunc eu quam egestas feugiat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla auctor turpis non urna. Sed porttitor. Donec et dui non odio.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #2 on: January 26, 2007, 07:01:02 am »
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
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Krillious

  • Camper
  • ***
  • Posts: 324
  • If you were a hindu I could aim for the dot
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #3 on: January 26, 2007, 07:07:39 am »
can you script how much health someone has?? that seems pretty kickass

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #4 on: January 26, 2007, 07:25:21 am »
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?

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #5 on: January 26, 2007, 08:56:39 am »
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.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline M.rSnow

  • Camper
  • ***
  • Posts: 482
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #6 on: January 26, 2007, 07:37:10 pm »
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?
« Last Edit: January 26, 2007, 07:39:51 pm by M.rSnow »
Lapis: You need a vacation or a bullet though the head both works just fine by me.

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #7 on: January 27, 2007, 01:55:44 am »
Someone who joins in the middle of a map, at a server running this script, will have no change. Did you think about it ? ;)

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #8 on: January 27, 2007, 07:05:00 am »
Someone who joins in the middle of a map, at a server running this script, will have no change. Did you think about it ? ;)

Code: [Select]
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
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #9 on: January 27, 2007, 07:18:03 am »
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.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #10 on: January 27, 2007, 07:25:57 am »
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:

Code: [Select]
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
« Last Edit: January 27, 2007, 07:27:37 am by Avarax »
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline M.rSnow

  • Camper
  • ***
  • Posts: 482
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #11 on: January 27, 2007, 08:18:35 am »
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.
« Last Edit: January 27, 2007, 08:31:35 am by M.rSnow »
Lapis: You need a vacation or a bullet though the head both works just fine by me.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #12 on: January 27, 2007, 08:35:57 am »
uh... No :D

EDIT:
Hooray, first spell functionally implemented: Summon Ghouls, variable levels of Skill possible
« Last Edit: January 27, 2007, 11:13:26 am by Avarax »
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Mr. Domino

  • Flagrunner
  • ****
  • Posts: 969
  • Don't just sit there and waste your precious time.
    • XBLIG.co
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #13 on: January 27, 2007, 01:20:33 pm »
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.

Offline ghg

  • Camper
  • ***
  • Posts: 411
  • Village Idiot
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #14 on: January 27, 2007, 01:55:43 pm »
Sort of like a Soldat RPG?  ;D
-=Gradius wuz you=-

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #15 on: January 27, 2007, 04:59:04 pm »
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
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline M.rSnow

  • Camper
  • ***
  • Posts: 482
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #16 on: January 28, 2007, 07:28:08 am »
*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?
Lapis: You need a vacation or a bullet though the head both works just fine by me.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #17 on: January 28, 2007, 02:14:29 pm »
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 like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline j4n0

  • Major(1)
  • Posts: 35
  • lolwut
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #18 on: January 28, 2007, 03:29:31 pm »
I want to see this on zombie servers. ;DDD !

Offline M.rSnow

  • Camper
  • ***
  • Posts: 482
Re: Leveling & EP script in developmnet for 2.6.0
« Reply #19 on: January 29, 2007, 04:49:56 pm »
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?
Lapis: You need a vacation or a bullet though the head both works just fine by me.