Forum

> > CS2D > Scripts > Script giving error in my bots
Forums overviewCS2D overview Scripts overviewLog in to reply

English Script giving error in my bots

3 replies
To the start Previous 1 Next To the start

old Script giving error in my bots

Alexsandro
User Off Offline

Quote
Hello

I have a problem to some part of my script, my bots are giving error

Quote
LUA ERROR (ai_onspawn): attempt to call a nil value
Freezing bots to stop Lua error msg flood! Use 'bot_freeze 0' to unfreeze bots!


And the error is in this function:

1
2
3
4
5
6
7
8
9
10
function SetBot()
if (BotID == 0) then
parse("bot_add")
	for _,i in pairs(player(0,"table")) do
		if player(i, "exists") and player(i, "bot") then
			BotID = i
			parse("setname "..i.." "..BotName)
end;end;end;end

SetBot()


Quick help

old Re: Script giving error in my bots

VADemon
User Off Offline

Quote
It's definitely the BotID variable that needs to be set first before checking it inside a onSpawn event.
From your code as it is now, I don't see any sense in using that variable; an explanation of what you want to do can be helpful.
edited 1×, last 21.08.13 03:18:03 pm

old Re: Script giving error in my bots

Alexsandro
User Off Offline

Quote
oh :0 I had forgotten this topic

well, I discovered the error, it was because I used script more intelligent bots and my server script was run faster than the bots, causing the error in the same

I would like to thank all who responded, but was already solved
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview