Dateien

> > CS2D > Lua Scripts > ¥Weeds¥ Advanced Bot Team Balance v1.4
DateiübersichtCS2D-ÜbersichtLua Scripts-Übersicht

Englisch ¥Weeds¥ Advanced Bot Team Balance v1.4 >

24 Kommentare4 kb, 508 Downloads

alt ¥Weeds¥ Advanced Bot Team Balance v1.4

RichNagel
User Off Offline

Advanced Bot Team Balance v1.4

This Lua script for Counter-Strike 2D will automatically add or remove bots to a server in order to maintain a specified number of total players (bots plus humans) within the game.

Settings can be changed (and the script can be enabled or disabled) by issuing simple console commands on a "listen" server (when starting a new game), as well as on a dedicated server via RCon.

Spoiler >
(Click Spoiler for complete readme and usage instructions, also included in the ZIP)
7× editiert, zuletzt 04.01.13 09:58:21
Zugelassen von GeoB99

Download Download

4 kb, 508 Downloads

Kommentare

24 Kommentare
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

Logge dich ein!

Du musst dich einloggen, um selber Kommentare verfassen zu können!Einloggen

alt

RichNagel
User Off Offline

Disreguard my comment below... I'm well on my way to adding config file support


(EDIT) Configuration file support added!

(EDIT 2) v1.4: A few changes here and there (see "Spoiler").
4× editiert, zuletzt 02.01.13 14:33:25

alt

varik
User Off Offline

nice lua script
Ich mag es!

alt

RichNagel
User Off Offline

Folks,

One thing that I've recently discovered is that CS2D flushes all of the variables in a Lua script when the map cycles on a listen or dedicated server. This resets the main team balancing variable to 5 (the default "bot_balance = 5" line included in the Lua script).

Now, being that the 'bot team balance' can be configured via commands (listen server, as well as RCon for a dedicated server) in the console ("bot_balance 6" etc...), it would be SUPER if there was some way to save it to a config file, and then read the variable from the config file after the map cycles (and the Lua script is re-executed).

Anyhow, could anyone give any pointers on how to:

1 - Open a config file: e.g.

Open the filename "AdvancedBotTeamBalance.cfg" (which would be located in the same directory as the "AdvancedBotTeamBalance.lua" script).

2 - Read a line from the config file (in this case, there would be only one line to store the team balance number... BUT, POSSIBLY two lines; a second for if the team balancing routine is enabled or disabled): e.g.

bot_balance = 4
bot_balance_enabled = 1

3 - Read the "4" from the top line, and then pass it on to the Lua script's variable (as well as the "1" and also pass it on as another Lua script variable).

...and ALSO, WRITE to the config file if/when any of the settings have been changed in-game (listen server, or via RCon).

I've read a LOT from this site -> http://www.lua.org/manual/5.1/manual.html , and I THINK it probably would have something to do with using the "io.open", "io.read", "io.write" commands, etc... but it's WAY over my understanding of Lua coding (unless I could see a simple and an easy-to-understand code example).
3× editiert, zuletzt 23.12.12 05:30:57

alt

Blunt
User Off Offline

cool script :d
Ich mag es!

alt

Infinite Rain
Reviewer Off Offline

Nice!
Keep it up!
Ich mag es!

alt

Crazy Game
BANNED Off Offline

Mafia KAK
Ich mag es!

alt

IPC CS2D
User Off Offline

usefull, i need this!
Ich mag es!

alt

RichNagel
User Off Offline

Just updated the script (currently version 1.1) with the extremely minor changes that I refered to below.

alt

sheeL
User Off Offline

@user Jynxxx: works, if you think your code so special, why not upload it?, I will not discuss

@user RichNagel: good script man... 5/5
Ich mag es!

alt

Jynxxx
User Off Offline

@user sheeL: And yes you copied my method. While changing 3-5 things without my permission. Also your code will not work, deal with it.

alt

Yates
Reviewer Off Offline

@user sheeL: Are you BR or something? - That is basically stealing.

alt

RichNagel
User Off Offline

Man, this is all 'greek' to me LOL!

alt

sheeL
User Off Offline

@user Jynxxx: stop being stupid
i edited to console command
Ich mag es!

alt edit x2

sheeL
User Off Offline

1
2
3
4
5
6
7
8
9
10
11
addhook("parse","OnCommand")
addhook("rcon","OnCommand")

function OnCommand(param)
local avg = param:sub(13,14)
	if param == "bot_balance "..avg then
		msg(string.format("©255255255Bot balance has been changed to "..avg))
		botbalance=avg
		return 1
	end
end
Ich mag es!
2× editiert, zuletzt 21.12.12 18:23:53

alt

RichNagel
User Off Offline

@Jynxxx,

But that is using the "say" command, correct? The first experimental version of the script that I created I was using the "say" command.

But, later decided to use console commands to control the script.

alt

Jynxxx
User Off Offline

Shortened down that hideous parse function.

1
2
3
4
5
6
7
8
9
10
11
_balance = 0

addhook("say","_say")
function _say(id,text)
	local botbalance = text:sub(13,14)
	if text == "bot_balance "..botbalance then
		msg("©255255255Bot balance has been change to "..botbalance.."!@C")
		_balance = botbalance
		return 1
	end
end

alt

RichNagel
User Off Offline

Glad ya'll liked it

As a newbie to CS2D, this was a little feature that I wished that the game had. So... after a little 'crash course' in Lua scripting (and a LOT of cussing LOL!), this is what I came up with

P.S. Look for a slightly updated version later today (will still have the same version number though, 1.0):

I discovered later that it probably would be better to make the 'server join message' ONLY be displayed to the current player that is actually joining the game (verses having that message printed on the screen to ALL of the players on the server when another player joins the game).

Also, I'm gonna add a little clarification about human spectators in the game when the script is running:

Spectators are NOT counted in the 'total players' count... which is by design (and how I prefered it), but I need to clarify that.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang