Forum

> > CS2D > Scripts > [Tibia]-NPC moving for be infront of me +cmd ERROR
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Tibia]-NPC moving for be infront of me +cmd ERROR

2 replies
To the start Previous 1 Next To the start

old [Tibia]-NPC moving for be infront of me +cmd ERROR

Ryden
User Off Offline

Quote
Hello us !

Today i want someone to help me for make a code for:
An NPC , when i am back to him and i say "hi" we will TURN OUT
for be infront of me.
I know it's difficult but i need it please ,

Like this:
I am back to him and i say "hi"
After this he turn to be infront of me for talk to me.
And do this for every players

i hope you understand me
sorry for my bad english

And After this i maked some codes and i got some problems in my server...

it's saying , no it's spamming in console
LUA ERROR: sys/lua/cs2dtibia/monsters.lua:516: attempt to index field '?' (a nil value)


and this ,
LUA ERROR: sys/lua/cs2dtibia/hooks.lua:31: ')' expected near 'Don'


So here is my codes, for monster.lua 516 i got this,

1
not gettile(PLAYERS[p].x, PLAYERS[p].y).SAFE and

The full code is,

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
addhook("ms100", "MONSTERms100")
function MONSTERms100()
	t = t + 1
	if t % 100 == 0 then
		while #MONSTERS < CONFIG.MAXMONSTERS do
			local rand, spawnNo, mapName
			while true do 
				rand = math.random(#CONFIG.MONSTERS)
				mapName = CONFIG.MONSTERS[rand].spawn[map'name'] and map'name' or CONFIG.DEFAULTMAP
				spawnNo = math.random(#CONFIG.MONSTERS[rand].spawn[mapName])
				if math.random(0, 100) < CONFIG.MONSTERS[rand].spawnchance[mapName][spawnNo] then
					break
				end
			end 
			local m = deepcopy(CONFIG.MONSTERS[rand])
			local x, y, tilex, tiley
			local spawn = m.spawn[mapName][spawnNo]
			repeat
				tilex, tiley = math.random(spawn[1][1], spawn[2][1]), math.random(spawn[1][2], spawn[2][2])
			until not gettile(tilex, tiley).SAFE and 
				  not gettile(tilex, tiley).NOMONSTERS and 
				  tile(tilex, tiley, "walkable") and 
				  tile(tilex, tiley, "frame") ~= 34
			m.x, m.y = math.floor(tilex*32+16), math.floor(tiley*32+16)
			Monster:new(m)
		end
	end
	for _, m in ipairs(MONSTERS) do
		if t % m.atkspd == 0 then
			m.target = nil
			local closest
			for _, p in ipairs(table.shuffle(player(0, 'table'))) do
				if player(p, 'health') > 0 and 
					not gettile(PLAYERS[p].x, PLAYERS[p].y).SAFE and 
					not gettile(PLAYERS[p].x, PLAYERS[p].y).NOMONSTERS then
					local dist = math.sqrt((player(p, 'x')-m.x)^2 + (player(p, 'y')-m.y)^2)
					if dist < 400 then
						if not closest or dist < closest[2] then
							closest = {p, dist}
						end
					end
				end
			end

And in HOOK.LUA line 31 i got this,

1
parse("kick '..id..' "Don't Beg Please!")

And the all code is,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
beg={
"fuck",
"gay",
"admin noob"}

addhook("say","bed",9)
function bed(id,t)
     for _,word in pairs(begl) do
          if t:lower():match(word) then
               parse("kick '..id..' "Don't Beg Please!")
               msg("©255000000 "..player(id,"name").." got Kicked for Begging !!!")
               return 1
          end
     end
end

I hope you can fix me them please,
And for the monster problem it's spamming on my console :S
Thanks for your help
edited 1×, last 30.10.14 05:50:22 am

old Re: [Tibia]-NPC moving for be infront of me +cmd ERROR

Yates
Reviewer Off Offline

Quote
It will never work without a great deal of editing the code. I suggest no one try to help unless they know how to fully edit Tibia and are willing to re-write monster functions, movement and values.

Good luck though, you'll have a lot of bugs.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview