and I would be happy if the save system.
Forum
CS2D Scripts I need bot level systemI need bot level system
7 replies 1
and I would be happy if the save system.
Admin/mod comment
§2.2 - Only meaningful contributions with added value1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
exp = {} addhook("kill","_k") function _k(k,v) 	if player(k,"bot") then 		exp[k] = exp[k] + 1 		parse("setmaxhealth "..k.." "..player(k,"maxhealth)+math.floor(exp[k]/10)) 	end end addhook("spawn","_s") function _s(id) 	if player(id,"bot") then 		parse("sethealth "..id.." "..player(id,"maxhealth") 	end end
Every 10 kills the bot will gain max health.
You can make other things. Just check
if exp[id] >= 50 then
or any other number. That way you can make explicit stats. For example "if bot has more than 50 kills then set his armor to 150" or anything else you want.
Note that this is a pseudo code and not an actual Lua code. I only gave you a little and basic representation of how a save/load system for bots works. For this case, our main hooks are join and leave with the conjunction with I/O library functions of Lua. For these functions and their documentation you can find them at this website. This Lua pil (Click me!) also gives a great explanation of how you use them.
I would also recommend the minute hook to trigger occasionally the save system for the sake of the data not being lost during a map change (since the leave and map change events are obviously two different things).
This of course it doesn't apply to every user demanding for a Lua code but it's also not pleasant to see people asking every time for scripts without even understanding the basics.
1