What's new

doSearchCreatureInRoom nie dzia?a w TFs 0.3.6pl1???

Status
Not open for further replies.

gicu0770

Active User
Joined
Aug 12, 2008
Messages
116
Reaction score
15
Dlaczego nie dzia?a mi ta funkcja doSearchCreatureInRoom stworzona przez Gelio??? Gdy zastosuje j? w swoim OTS wyskakuje mi taki b??d.


[
10/12/2010 20:13:20] [Error - Action Interface]
[10/12/2010 20:13:20] data/actions/scripts/posag.lua:eek:nUse
[10/12/2010 20:13:20] Description:
[10/12/2010 20:13:20] data/lib/050-function.lua:740: attempt to compare number with table
[10/12/2010 20:13:20] stack traceback:
[10/12/2010 20:13:20] data/lib/050-function.lua:740: in function 'doSearchCreatureInRoom'
[10/12/2010 20:13:20] data/actions/scripts/posag.lua:3: in function <data/actions/scripts/posag.lua:2>


A o to skrypt:

function onUse(cid, item, fromPosition, itemEx, toPosition)
local search = doSearchCreatureInRoom(2417,2366,2430,2382,9)
if (search == 0) then
doPlayerSendTextMessage(cid,22,"Na tych pozycjach nie ma zadnego stwora. Dostajesz item o id 1111.")
else
doPlayerSendTextMessage(cid,22,"Na tej pozycji jest jeszcze ".. search .." potworow.")
end
end

Doda?em do lib to

function doSearchCreatureInRoom(posx1, posy1, posx2, posy2, posz)
local position1 = {x=posx1, y=posy1, z=posz}
local position2 = {x=posx2, y=posy2, z=posz}
ile_monsterow = 0
for x=position1.x, position2.x do
for y=position1.y, position2.y do
local monsterpos = {x=x, y=y, z=posz, stackpos=253}
local monster = getThingfromPos(monsterpos)
if (monster > 0) then
if (isPlayer(monster) == 0) then
ile_monsterow = ile_monsterow+1
end
end
end
end
return ile_monsterow
end

Prosz? o pomoc.
Pozdro Gicu
 

Aragornkk

Senior User
Joined
Oct 11, 2008
Messages
705
Reaction score
44
Odp: doSearchCreatureInRoom nie dzia?a w TFs 0.3.6pl1???

monster > 0
na monster.uid > 0
 

gicu0770

Active User
Joined
Aug 12, 2008
Messages
116
Reaction score
15
Odp: doSearchCreatureInRoom nie dzia?a w TFs 0.3.6pl1???

A jak zastosowa? to w tym skrypcie bo jak po naci?ni?ciu na pos?g tworzy moba i potem kolejnego itd A po stworzeniu jednego powinna zadzia?a? blokada.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local search = doSearchCreatureInRoom(2417,2366,2430,2382,9)
dpos = {x=2422, y=2374, z=9}
if (search == 0) then
doCreateMonster("Dragon", dpos)
doPlayerSendTextMessage(cid,22,"Dragon: Graaa!")
else
doPlayerSendTextMessage(cid,22,"Nie zabiles wszystkich.")
end
end

Zmieni?em:
function doSearchCreatureInRoom(posx1, posy1, posx2, posy2, posz)
local position1 = {x=posx1, y=posy1, z=posz}
local position2 = {x=posx2, y=posy2, z=posz}
ile_monsterow = 0
for x=position1.x, position2.x do
for y=position1.y, position2.y do
local monsterpos = {x=x, y=y, z=posz, stackpos=253}
local monster = getThingfromPos(monsterpos)
if (monster.uid > 0) then
if (isPlayer(monster) == 0) then
ile_monsterow = ile_monsterow+1
end
end
end
end
return ile_monsterow
end

Skrypt odczytuje ci?gle 0 potwor?w na tym terenie a s?. :(
 
Last edited:
Status
Not open for further replies.
Top