Dynamic Skill Script

Misc Releases such as Textures, Choreo, Tools, and even Sound.
Post Reply
User avatar
Shana
Lead Developer
Lead Developer
Posts: 2971
Joined: Tue Aug 29, 2006 8:12 pm
Location: Germany
Contact:

Dynamic Skill Script

Post by Shana »

Heres a small script which i made for my server some days ago, it changes the skill level depending on the amount of players on the server.
The script is written in the eventscript scripting language, so you need mattie´s eventscript plugin for it to work, you can download it here.
After you downloaded and installed the plugin on your server, go into the addons\eventscripts folder and create a new folder called dynamic_skill.
Create a new text file in the dynamic_skill folder and name it es_dynamic_skill.txt.
Then open the es_dynamic_skill.txt file and copy&paste this code into it:

Code: Select all

event load
{
es_setinfo skill 1
es_setinfo players 0
es_setinfo dynamic_skill on
es_makepublic dynamic_skill
es_msg Dynamic skill script by [YaS] W0rf0x enabled
es_log Dynamic skill script by [YaS] W0rf0x enabled
}

event unload
{
es_setinfo dynamic_skill off
es_msg Dynamic skill script by [YaS] W0rf0x disabled
es_log Dynamic skill script by [YaS] W0rf0x disabled
}

event player_activate
{
es_getplayercount players
if (server_var(players) equalto "3") do
{
es_msg Playercount raised, skill has been set to 2.
es_setinfo skill 2
}
if (server_var(players) equalto "5") do
{
es_msg Playercount raised, skill has been set to 3.
es_setinfo skill 3
}
}

event player_disconnect
{
es_getplayercount players
if (server_var(players) equalto "4") do
{
es_msg Playercount lowered, skill has been set to 2.
es_setinfo skill 2
}
if (server_var(players) equalto "2") do
{
es_msg Playercount lowered, skill has been set to 1.
es_setinfo skill 1
}
}
After you did this, just add

Code: Select all

es_load dynamic_skill
to your server.cfg.
The scripts default setting are made for 6 player servers, but you can easily edit it.
skidz
Obsidian Gold
Obsidian Gold
Posts: 3228
Joined: Mon May 29, 2006 6:36 am
Location: Maple Ridge, BC
Contact:

Post by skidz »

hmm, only the skill convar. You could make a complex script eh, would be somewhat time consuming.
electrocret
Pixel
Posts: 1
Joined: Wed Jan 02, 2008 5:50 am

Thought

Post by electrocret »

Hey Worfox. I noticed that you put es_setinfo dynamic_skill on and off. hypothetically if you were going to reference to this script in another script you could use es_exists www(dot)eventscripts(dot)com/pages/Es_exists (replace the (dot) with a .). The way you have it works too, but it somewhat makes a variable that you're not necessarily going to use.

es_exists <var> script dynamic_skill

other than that little suggest, Nice and simple script, LoL that's how I like them, although they don't always end up that way . :shock: 1178 lines, and still adding more to the Pseudo Admin script on Smeg.

[EDIT] didn't notice the es_makepublic, heh I don't ever check the public variables on Game-monitor or HLSW, but whatever creams your twinkies.
Last edited by electrocret on Wed Jan 02, 2008 6:46 am, edited 2 times in total.
User avatar
Shana
Lead Developer
Lead Developer
Posts: 2971
Joined: Tue Aug 29, 2006 8:12 pm
Location: Germany
Contact:

Re: Thought

Post by Shana »

electrocret wrote:Hey Worfox. I noticed that you put es_setinfo dynamic_skill on and off. hypothetically if you were going to reference to this script in another script you could use es_exists www(dot)eventscripts(dot)com/pages/Es_exists (replace the (dot) with a .). lol the way you have it works too, but it somewhat makes a variable that you're not necessarily going to use.

es_exists <var> script dynamic_skill

other than that little suggest, Nice script.
Thanks for the info, i will do it like that when i update the script, i want to add a function to have a list of maps that have dynamic skill disabled, but i first have to get a bit more familiar with eventscripts, that script was the first time i used eventscripts, thats why the script is so simple yet.
Misfire
Polygon
Polygon
Posts: 31
Joined: Wed Aug 13, 2008 7:15 pm

Re: Dynamic Skill Script

Post by Misfire »

W0rf0x wrote:Heres a small script which i made for my server some days ago, it changes the skill level depending on the amount of players on the server.
The script is written in the eventscript scripting language, so you need mattie´s eventscript plugin for it to work, you can download it here.
After you downloaded and installed the plugin on your server, go into the addons\eventscripts folder and create a new folder called dynamic_skill.
Create a new text file in the dynamic_skill folder and name it es_dynamic_skill.txt.
Then open the es_dynamic_skill.txt file and copy&paste this code into it:

Code: Select all

event load
{
es_setinfo skill 1
es_setinfo players 0
es_setinfo dynamic_skill on
es_makepublic dynamic_skill
es_msg Dynamic skill script by [YaS] W0rf0x enabled
es_log Dynamic skill script by [YaS] W0rf0x enabled
}

event unload
{
es_setinfo dynamic_skill off
es_msg Dynamic skill script by [YaS] W0rf0x disabled
es_log Dynamic skill script by [YaS] W0rf0x disabled
}

event player_activate
{
es_getplayercount players
if (server_var(players) equalto "3") do
{
es_msg Playercount raised, skill has been set to 2.
es_setinfo skill 2
}
if (server_var(players) equalto "5") do
{
es_msg Playercount raised, skill has been set to 3.
es_setinfo skill 3
}
}

event player_disconnect
{
es_getplayercount players
if (server_var(players) equalto "4") do
{
es_msg Playercount lowered, skill has been set to 2.
es_setinfo skill 2
}
if (server_var(players) equalto "2") do
{
es_msg Playercount lowered, skill has been set to 1.
es_setinfo skill 1
}
}
After you did this, just add

Code: Select all

es_load dynamic_skill
to your server.cfg.
The scripts default setting are made for 6 player servers, but you can easily edit it.
hey, how did u install eventscript plugin, did u simply copy the addon's folder to ur server, was there any editing involved with the vdf file? Doesn't seem to want to load it up on my server, im using the latest 2.0 beta

EDIT: Nevermind, found the orange box beta in teh forums
Post Reply