• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC - wtf?!

vimoco

ۤ
Joined
Jan 11, 2009
Messages
1,011
Reaction score
9
Cześć,

Mam dziwny błąd z NPC, na sprostowanie powiem że to są npc z tfs i lib też z tfs

Lua:
[19/04/2010 14:45:29] [Error - Npc interface] 
[19/04/2010 14:45:29] data/npc/scripts/loot.lua
[19/04/2010 14:45:29] Description: 
[19/04/2010 14:45:29] data/lib/050-function.lua:222: attempt to index a boolean value
[19/04/2010 14:45:29] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/loot.lua

loot.lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) 			end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) 			end
function onCreatureSay(cid, type, msg) 			npcHandler:onCreatureSay(cid, type, msg) 		end
function onThink() 					npcHandler:onThink() 					end

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'helmets'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy royal (40k), warrior (6k), crusader (9k), crown (5k), devil (4k), chain (35gp) and iron helmets (30gp), also mystic turbans (500gp).'})
keywordHandler:addKeyword({'boots'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy golden boots (100k), steel boots (40k) and boots of haste (40k).'})
keywordHandler:addKeyword({'armors'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy golden (30k), crown (20k), knight (5k), lady (7,5k), plate (400gp), brass (200gp) and chain armors (100gp), also mpa (100k), dsm (60k) and blue robes (15k).'})
keywordHandler:addKeyword({'legs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy golden (80k), crown (15k), knight (6k), plate (500gp) and brass legs (100gp).'})
keywordHandler:addKeyword({'shields'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy blessed (150k), great (100k), demon (40k), vampire (25k), medusa (8k), amazon (4k), crown (5k), tower (4k), dragon (3k), guardian (2k), beholder (1k), and dwarven shields (100gp), also mms (80k).'})
keywordHandler:addKeyword({'swords'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy giant (10k), bright (6k), fire (3k) serpent (1.5k), spike (800gp) and two handed swords (400gp), also ice rapiers (4k), magic longswords (150k), magic swords (90k), warlord swords (100k) broad swords (70gp), short swords (30gp), sabres (25gp) and swords (25gp).'})
keywordHandler:addKeyword({'axes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy fire (10k), guardian halberds (7,5k) knight (2k), double (200gp) and battle axes (100gp), also dragon lances (10k), stonecutters axes (90k), halberds (200gp) and hatchets (20gp).'})
keywordHandler:addKeyword({'clubs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy thunder hammers (90k), war (6k), dragon (2k) and battle hammers (60gp), also skull staffs (10k) and clerical maces (200gp).'})

npcHandler:addModule(FocusModule:new())

linijka 221-223
PHP:
function getItemNameById(itemid)
	return getItemDescriptionsById(itemid).name
end

Co na to zaradzić?
 
O ile dobrze zrozumialem to linijka ta zwrocic ma wartosc true/false(bool), a zwraca co innego.
 
no ale co mi to dało? to moge z błedu wyczytać, a daj na to fixa..
 
Code:
return getItemDescriptionsById(itemid).name
Bool? lol?

To raczej nie powinno zwracać booleana. Powinien wyjść string (nazwa itema, tak?).

Moje pytania brzmią:
* Co ty wpisujesz, że ten NPC wywala Ci błąd?
* Jakiego itema nazwę on pobiera?
On nic nie sprzedaje to tak dla jasności ;) (kod który podałeś).
 
- Nic nie wpisuje, npc sie nie chce załadować
- Nie wiem własnie jakiego itema

A to skrypt na tego npca
Lua:
<npc name="Loot" script="data/npc/scripts/loot.lua" walkinterval="25" floorchange="0" access="3" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="147" head="114" body="94" legs="19" feet="0" addons="3" corpse="2212"/>

<parameters>

<parameter key="module_shop" value="1" />
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I buy swords, axes, clubs, armors, helmets, legs, boots, shields, wands and rods" />
		<parameter key="shop_sellable" value="dragon hammer,2434,6000;mastermind shield,2514,100000;magic plate armor,2472,130000;golden legs,2470,100000;demon helmet,2493,100000;giant sword,2393,25000;knight axe,2430,5000;poison dagger,2411,50;scimitar,2419,150;serpent sword,2409,900;skull staff,2436,10000;dragon lance,2414,25000;fire axe,2432,8000;fire sword,2392,8000;war hammer,2391,1200;spike sword,2383,1000;ice rapier,2396,1000;broad sword,2413,500;obsidian lance,2425,500;dragon slayer,7402,15000;war axe,2454,9000;amber staff,7426,8000;sapphire hammer,7437,2000;lunar staff,7424,5000;diamond sceptre,7387,3000;dragonbone staff,7430,6000;beastslayer axe,3962,1500;brutetamer's staff,7379,1500;wyvern fang,7408,1500;daramanian waraxe,2440,1000;furry club,27432,1000;crystal sword,7449,600;taurus mace,7425,500;silver dagger,2402,500;mammoth whopper,7381,300;daramanian mace,2439,110;heavy machete,2442,90;crown armor,2487,20000;blue robe,2656,17000;noble armor,2486,900;dark armor,2489,400;knight armor,2476,10000;dragon scale mail,2492,70000;golden armor,2466,20000;mammoth fur cape,7463,6000;leopard armor,3968,1000;pirate shirt,605,500;royal helmet,2498,30000;crusader helmet,2497,6000;crown helmet,2491,5000;dark helmet,2490,250;mystic turban,2663,150;strange helmet,2479,500;warrior helmet,2475,5000;skull helmet,5741,40000;beholder helmet,3972,7500;devil helmet,2462,1000;pirate hat,6096,1000;ragnir helmet,7462,400;krimhorn helmet,7461,200;crown legs,2488,18008;boots of haste,2195,30000;knight legs,2477,1000;steel boots,2645,10000;pirate boots,5462,2000;fur boots,7457,2000;crocodile boots,3982,1000;pirate knee breeches,5918,200;phoenix shield,2539,16000;crown shield,2519,10000;dragon shield,2516,7000;guardian shield,2515,2000;beholder shield,2518,1200;ancient shield,2532,900;black shield,2529,800;tower shield,2528,8000;vampire shield,2534,15000;demon shield,2520,30000;medusa shield,2536,9000;castle shield,2535,5000;scarab shield,2540,2000;dark shield,2521,400;tortoise shield,6131,150;bone shield,2541,80;magic lightwand,2162,30;wand of vortex,2190,100;wand of dragonbreath,2191,200;wand of plague,2188,1000;wand of cosmic energy,2189,2000;wand of inferno,2187,3000;tempest rod,2183,3000;moonlight rod,2186,200;snakebite rod,2182,100;volcanic rod,2185,1000;quarmire rod,2181,2000;war hammer,2391,10000;spike sword,2383,8000;noble armor,2486,8000;beholder shield,2518,7000;ice rapier,2396,5000;serpent sword,2409,6000;dark armor,2489,1500;dark helmet,2490,1000;ancient shield,2532,5000;" />"
</parameters>

</npc>
 
A wiecej wyjebaj skrypt poprzedni i zrob to co ma robic npc w tym pliku ;)
(przez keyword)
 
Lua:
<npc name="Loot" script="data/npc/scripts/loot.lua"  walkinterval="25" floorchange="0" access="3" level="1"  maglevel="1">
<health now="150" max="150"/>
<look type="147" head="114" body="94" legs="19" feet="0" addons="3" corpse="2212"/>

<parameters>

<parameter key="module_shop" value="1" />
                <parameter key="message_greet" value="Hello |PLAYERNAME|. I buy swords, axes, clubs, armors, helmets, legs, boots, shields, wands and rods" />
                <parameter key="shop_sellable" value="dragon hammer,2434,6000;mastermind shield,2514,100000;magic plate armor,2472,130000;golden legs,2470,100000;demon helmet,2493,100000;giant sword,2393,25000;knight axe,2430,5000;poison dagger,2411,50;scimitar,2419,150;serpent sword,2409,900;skull staff,2436,10000;dragon lance,2414,25000;fire axe,2432,8000;fire sword,2392,8000;war hammer,2391,1200;spike sword,2383,1000;ice rapier,2396,1000;broad sword,2413,500;obsidian lance,2425,500;dragon slayer,7402,15000;war axe,2454,9000;amber staff,7426,8000;sapphire hammer,7437,2000;lunar staff,7424,5000;diamond sceptre,7387,3000;dragonbone staff,7430,6000;beastslayer axe,3962,1500;brutetamer's staff,7379,1500;wyvern fang,7408,1500;daramanian waraxe,2440,1000;furry club,27432,1000;crystal sword,7449,600;taurus mace,7425,500;silver dagger,2402,500;mammoth whopper,7381,300;daramanian mace,2439,110;heavy machete,2442,90;crown armor,2487,20000;blue robe,2656,17000;noble armor,2486,900;dark armor,2489,400;knight armor,2476,10000;dragon scale mail,2492,70000;golden armor,2466,20000;mammoth fur cape,7463,6000;leopard armor,3968,1000;pirate shirt,605,500;royal helmet,2498,30000;crusader helmet,2497,6000;crown helmet,2491,5000;dark helmet,2490,250;mystic turban,2663,150;strange helmet,2479,500;warrior helmet,2475,5000;skull helmet,5741,40000;beholder helmet,3972,7500;devil helmet,2462,1000;pirate hat,6096,1000;ragnir helmet,7462,400;krimhorn helmet,7461,200;crown legs,2488,18008;boots of haste,2195,30000;knight legs,2477,1000;steel boots,2645,10000;pirate boots,5462,2000;fur boots,7457,2000;crocodile boots,3982,1000;pirate knee breeches,5918,200;phoenix shield,2539,16000;crown shield,2519,10000;dragon shield,2516,7000;guardian shield,2515,2000;beholder shield,2518,1200;ancient shield,2532,900;black shield,2529,800;tower shield,2528,8000;vampire shield,2534,15000;demon shield,2520,30000;medusa shield,2536,9000;castle shield,2535,5000;scarab shield,2540,2000;dark shield,2521,400;tortoise shield,6131,150;bone shield,2541,80;magic lightwand,2162,30;wand of vortex,2190,100;wand of dragonbreath,2191,200;wand of plague,2188,1000;wand of cosmic energy,2189,2000;wand of inferno,2187,3000;tempest rod,2183,3000;moonlight rod,2186,200;snakebite rod,2182,100;volcanic rod,2185,1000;quarmire rod,2181,2000;war hammer,2391,10000;spike sword,2383,8000;noble armor,2486,8000;beholder shield,2518,7000;ice rapier,2396,5000;serpent sword,2409,6000;dark armor,2489,1500;dark helmet,2490,1000;ancient shield,2532,5000;" />
</parameters>

</npc>

/d;
 
Ojj, wina lezała w pliku XML ;'<
Skopiowałem z 8.21 i sie krzaczyło :p

Dzięki za wszystko działa już po podmiance NPC z 8.54 ;0
 
Back
Top