Kick BOT by LUA script


(vargatom) #1

How to remove a BOT automatically triggered by an event with LUA script?


(phisherman) #2

What kind of event? What are you trying to do?


(vargatom) #3

So Omnibot 0.80 and Nq 1.2.9.b6 can not solve that BOTs xp is not saved, so it must be solved differently.
In noquarter.cfg not works the folloving line:
omnibot_flags “1”
(I can not link this page because the forum censored this)
I thought when the game ends I would like to kick all BOTs with a lua script. This command (kickallbots) is defined in the shrubbot.cfg .

Like this:

if text == "Exit. Time Limit hit \ n" or text == "Exit. EndRound Wolf \ n" then
    et.EXEC_NOW

or

et_SetPlayerSkill( cno, skill )

When next map loading BOTs will automatically connect with 0 xp again.


(phisherman) #4

According to the wiki, et_SetPlayerSkill( cno, skill ) is a callback function, so you can’t use it to set players’ skill. What about this code? It resets all bots’ xp at the beginning of each round.

function et_InitGame( levelTime, randomSeed, restart )

	for local i=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do

		if et.gentity_get(i, "pers.localClient") == 1 then
			et.trap_SendConsoleCommand(et.EXEC_APPEND, "!resetxp " .. i .. ";")
		end
	end
end

(vargatom) #5

Well I tried it.
I think You can put this script into your collection.
It works very well!
Thank You!


(vargatom) #6

Hi Guys,

When I look et_console.log I found this message:


Setting MOTD…
Lua API: Loading resetxpforbots.lua
Lua API: syntax error during pre-compilation: [string “resetxpforbots.lua”]:4: ‘<name>’ expected near ‘local’


I would like to know it does not interfere with other modules?


(ryven) #7

you don’t need to specify local for i variable, since it is local by default


(vargatom) #8

Hi,

Something happened because the script does not work now. Something nq setting can disturb it and is important which lua version is running on the server?
In the xp folder of NQ folder have not files for BOTs but BOTs have xp and not loose it.
The bots xp will only be done after the server is restarted.