Quote:
Originally Posted by DaJuBi
Vielen, vielen Dank dafür :D
MfG
€dit: Irgendwie funktioniert die Quest nicht:
PHP Code:
quest testbsp begin state start begin when kill begin local tab = { [1] = { {192, 1} }, [21] = { {192, 1} }, [41] = { {192, 1} }, [3] = { {591, 1} }, [23] = { {591, 1} }, [43] = { {591, 1} }, [64] = { {691, 1} }, [63] = { {2192, 1} }, [62] = { {2291, 2}, {2206, 1} }, [61] = { {1901, 1} }, [65] = { {1304, 1} }, [68] = { {230, 1} }, [104] = { {2091, 1} }, [71] = { {2093, 1} }, [72] = { {1192, 1} }, [73] = { {2491, 1}, {2492, 2}, {2493, 2} } } table.foreach(tab, function(i, p) if i == pc.get_map_index() then for e = 1, table.getn(p), 1 do if p[e][1] == npc.get_race() then local bsp = p[e][1] end end end ) chat(bsp) end end end
Code:
testbsp.quest:68:syntax error : [string "start"]:62: unexpected symbol near `)'
Error occured on compile testbsp.quest
Kann niemand helfen?
MfG
|
Hey, bei deiner Quest fehlt ein end.
Du musst die function auch wieder beenden, sollte dann compilen ohne Error.
- nun wird aber nichts im chat ausgegeben wahrscheinlich.
Dazu lesen wir noch .Remix. sein Beitrag:
Quote:
Originally Posted by .Remix.
Code:
for i = 1, table.getn(tab[pc.get_map_index()]) do
if npc.get_race() == tab[pc.get_map_index()][1] then
local bsp = tab[pc.get_map_index()][1]
local x = tab[pc.get_map_index()][2]
end
end
chat('Mobvnum: '..bsp)
chat('Name: '..mob_name(bsp))
chat('X = '..x)
Sicher, dass es da keine Probleme geben wird? :o
Immerhin sind es lokale Variablen und nur im dem Block definiert.
|
Wo er recht hat, hat er recht.
Was in dem Block ist bleibt im Block. Also definieren wir die vorher und zack wuerde deine Quest so aussehen:
PHP Code:
quest testbsp begin
state start begin
when kill begin
local tab = {
[1] = {
{192, 1}
},
[21] = {
{192, 1}
},
[41] = {
{192, 1}
},
[3] = {
{591, 1}
},
[23] = {
{591, 1}
},
[43] = {
{591, 1}
},
[64] = {
{691, 1}
},
[63] = {
{2192, 1}
},
[62] = {
{2291, 2},
{2206, 1}
},
[61] = {
{1901, 1}
},
[65] = {
{1304, 1}
},
[68] = {
{230, 1}
},
[104] = {
{2091, 1}
},
[71] = {
{2093, 1}
},
[72] = {
{1192, 1}
},
[73] = {
{2491, 1},
{2492, 2},
{2493, 2}
}
}
local bsp = nil
table.foreach(tab, function(i, p)
if i == pc.get_map_index() then
for e = 1, table.getn(p), 1 do
if p[e][1] == npc.get_race() then
bsp = p[e][1]
end
end
end
end)
chat(bsp)
end
end
end