Forum

> > CS2D > Scripts > Script [Balance]
Forums overviewCS2D overview Scripts overviewLog in to reply

English Script [Balance]

7 replies
To the start Previous 1 Next To the start

old Script [Balance]

baRD
User Off Offline

Quote
Hi everyone, im in need of help balancing my script.
Spoiler >

So if someone would likely do that, I would appreciate that..
Thanks!

old Re: Script [Balance]

Rainoth
Moderator Off Offline

Quote
Do you mean changing the code to be more readable and more optimized or changing the code so there's no one OP class in your script?

old Re: Script [Balance]

Dousea
User Off Offline

Quote
You could use temporary table to save time though. I'm currently not in PC so it's impossible to point it out.

old Re: Script [Balance]

Talented Doge
User Off Offline

Quote
Most likely he is asking for rebalancing the classes.

1
2
3
4
5
if(class[id]=="engineer")then
   parse("equip "..id.." m3")
   parse("equip "..id.." mine")
   parse("equip "..id.." lightarmor")
end

Though the engineer doesn't get his wrenches.

old Re: Script [Balance]

Dousea
User Off Offline

Quote
I'm quite tired today but I gave you a little of my time. Don't expect it to be suddenly working though.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--===================--
 -- EXTREME CTF V.1 --
  ----+ by baRD +----
--===================--

version=1.1 -- Script version...
class={}

--| HOOKS |--
addhook("join","joinMsg")
addhook("menu","classMenu")
addhook("spawn","spawnEquip")
addhook("say","changeClass")
addhook("spawn","selectClass")
addhook("buy","antiBuy")
addhook("walkover","antiPickup")
addhook("drop","antiDrop")

--| Functions |--
function joinMsg(id) -- Don't edit this function...
	class[id]=0
	msg2(id,"\169255255000Welcome to "..game("sv_name").."!!!")
	msg("\169255255000"..player(id,"name").." has joined the game...")
end

function selectClass(id)
	if(class[id]==0)then
		menu(id,"Classes,Soldier,Spy,Engineer,Sniper")
	end
end

function changeClass(id,txt)
	if(txt=="!cchange")then
		menu(id,"Classes,Soldier,Spy,Engineer,Sniper")
		
		return 1
	end
end

function classMenu(id,title,sel)
	if(title=="Classes")then
		local name = {"soldier", "spy", "engineer", "sniper"}
		
		if(name[sel])then
			class[id]=name[sel]
			msg2(id,"\169255255000Type '!cchange' to change class...")
			if(player(id,"health")>0)then
				parse("killplayer "..id)
				parse("setdeaths "..id.." "..player(id,"deaths")-1)
			end
		end
	end
end

function spawnEquip(id)
	if(class[id]~=nil)then
		local items = {
			["soldier"] = {"m4a1", "lightarmor", "he"},
			["spy"] = {"machete", "stealthsuit", "flashbang", "flashbang", "satchelcharge"},
			["engineer"] = {"m3", "mine", "lightarmor"},
			["sniper"] = {"awp", "lightarmor", "fiveseven", "flashbang"}
		}
		
		for _,item in ipairs(items[class[id]]) do
			parse("equip "..id.." "..item)
		end
		
		if(class[id]=="spy")then
			parse("strip "..id.." knife")
			if(player(id,"team")==1)then
				parse("strip "..id.." glock")
				parse("equip "..id.." usp")
			end
		elseif(class[id]=="sniper")then
			parse("strip "..id.." glock")
			parse("strip "..id.." usp")
		end
	end
end

function antiBuy(id)
	msg2(id,"\169100255000Buying is not allowed...")
	
	return 1
end

function antiPickup(type)
	return 1
end

function antiDrop(id)
	msg2(id,"\169100255000Dropping weapons are not allowed...")

	return 1
end

old Re: Script [Balance]

Rainoth
Moderator Off Offline

Quote
Here's how I'd do it. Untested.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--===================--
 -- EXTREME CTF V.1 --
  ----+ by baRD +----
--===================--

extremectf = {
	version = 1.1,
	class = {},
	hooks = {"join","menu","spawn","say","buy","walkover","drop"},
	classes = {
		["all"] = {"soldier","spy","engineer","sniper"},
		["soldier"] = {32,79,51},
		["spy"] = {69,84,52,89},
		["engineer"] = {10,77,79},
		["sniper"] = {35,79,6,52,1,2}
	}
}

for k,v in pairs (extremectf.hooks) do
	addhook(v, "extremectf_"..v)
end

function extremectf_join(id)
	extremectf.class[id] = 0
	msg2(id,"\169255255000Welcome to "..game("sv_name").."!!!")
	msg("\169255255000"..player(id,"name").." has joined the game...")
end

function extremectf_menu(id,t,b)
	if t == "Classes" then
		extremectf.class[id] = extremectf.classes["all"][b]
		msg2(id,"\169255255000Type '!cchange' to change class...")
		extremectf_spawn(id)
	end
end
         
function extremectf_spawn(id)
	if extremectf.class[id] == 0
		menu(id,"Classes,Soldier,Spy,Engineer,Sniper")
	else
		return tostring(extremectf.classes[extremectf.class[id]])
	end
end

function extremectf_say(id)
	if(txt=="!cchange")then
		menu(id,"Classes,Soldier,Spy,Engineer,Sniper")
		return 1
	end
end

function extremectf_buy(id)
	msg2(id,"\169100255000Buying is not allowed...")  
	return 1
end

function extremectf_walkover(id)
	return 1
end

function extremectf_drop(id)
	msg2(id,"\169100255000Dropping weapons are not allowed...")
	return 1
end

As for balancing, I'd go for
1
2
3
4
["soldier"] = {32,4,79,51},
["spy"] = {69,84,52,89,1,21},
["engineer"] = {10,77,80,3},
["sniper"] = {35,79,6,52,4}

Your version of spy class is too weak and you have to take into account that engineer has big disadvantage using shotgun due to its low range. Of course it depends on the maps this is run on but most ctf maps have relatively open areas where long range weapons have the advantage.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview