1
[Pedido] Npc cambio de item al azar el Jue 4 Dic 2014 - 3:53
Invitado

Invitado
Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lucky" script="data/npc/scripts/Lucky.lua" speed="0" floorchange="0">
<health now="1000" max="1000"/>
<look type="270" head="91" body="79" legs="85" feet="83" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hahahaha!! |PLAYERNAME|, me has encontrado toma este {obsequio}, es uno de los cinco mil que tengo para regalar."/>
</parameters>
</npc>
random_items = {
{10,2139,1}, --
{10,2461,1}, --
{10,6099,1}, --
{10,2663,1}, --
{10,2662,1}, --
{10,2665,1}, --
{10,3970,1}, --
{10,2458,1}, --
{10,2482,1}, --
{10,3971,1}, --
{10,3967,1}, --
{10,2460,1}, --
{10,6096,1}, --
{10,2473,1}, --
{10,2480,1}, --
{10,2481,1}, --
{10,2459,1}, --
{10,2457,1}, --
{10,2479,1}, --
{10,2490,1}, --
{10,2502,1}, --
{10,3969,1}, --
{10,2491,1}, --
{10,2462,1}, --
{10,2499,1}, --
{10,3972,1}, --
{10,2506,1}, --
{10,2475,1}, --
{10,2497,1}, --
{10,2501,1}, --
{10,2342,1}, --
{10,2498,1}, --
{10,5741,1}, --
{10,2493,1}, --
{10,2474,1}, --
{10,2496,1}, --
{10,2343,1}, --
{10,2471,1}, --
{10,5461,1}, --
{10,2660,1}, --
{10,2664,1}, --
{10,2659,1}, --
{10,2658,1}, --
{10,2654,1}, --
{10,2655,1}, --
{10,2650,1}, --
{10,2652,1}, --
{10,2651,1}, --
{10,2657,1}, --
{10,2485,1}, --
{10,2653,1}, --
{10,2467,1}, --
{10,2484,1}, --
{10,2464,1}, --
{10,2465,1}, --
{10,2483,1}, --
{10,3968,1}, --
{10,2463,1}, --
{10,2489,1}, --
{10,2503,1}, --
{10,2486,1}, --
{10,2656,1}, --
{10,2476,1}, --
{10,2487,1}, --
{10,2500,1}, --
{10,2466,1}, --
{10,2492,1}, --
{10,2505,1}, --
{10,2494,1}, --
{10,2508,1}, --
{10,2472,1}, --
{10,3983,1}, --
{10,2649,1}, --
{10,2468,1}, --
{10,2648,1}, --
{10,2478,1}, --
{10,2647,1}, --
{10,2477,1}, --
{10,2504,1}, --
{10,2488,1}, --
{10,2495,1}, --
{10,2470,1}, --
{10,2469,1}, --
{10,2507,1}, --
{10,2642,1}, --
{10,2195,1}, --
{10,2358,1}, --
{10,2643,1}, --
{10,3982,1}, --
{10,2645,1}, --
{10,2646,1}, --
{10,2644,1}, --
{10,2641,1}, --
{10,5462,1}, --
{10,6132,1}, --
{10,2405,1}, --
{10,2380,1}, --
{10,2386,1}, --
{10,2418,1}, --
{10,2388,1}, --
{10,2441,1}, --
{10,3965,1}, --
{10,2428,1}, --
{10,2378,1}, --
{10,3962,1}, --
{10,2429,1}, --
{10,3964,1}, --
{10,2435,1}, --
{10,2430,1}, --
{10,2425,1}, --
{10,2387,1}, --
{10,2381,1}, --
{10,2432,1}, --
{10,2426,1}, --
{10,2440,1}, --
{10,2427,1}, --
{10,2414,1}, --
{10,2431,1}, --
{10,2415,1}, --
{10,2447,1}, --
{10,2443,1}, --
{10,6553,1}, --
{10,2416,1}, --
{10,2382,1}, --
{10,2448,1}, --
{10,2401,1}, --
{10,2449,1}, --
{10,2398,1}, --
{10,3966,1}, --
{10,2422,1}, --
{10,2439,1}, --
{10,2417,1}, --
{10,2321,1}, --
{10,2394,1}, --
{10,2423,1}, --
{10,2434,1}, --
{10,2436,1}, --
{10,2445,1}, --
{10,2433,1}, --
{10,2424,1}, --
{10,2391,1}, --
{10,2437,1}, --
{10,2444,1}, --
{10,2421,1}, --
{10,3961,1}, --
{10,2453,1}, --
{10,2452,1}, --
{10,2403,1}, --
{10,2402,1}, --
{10,2404,1}, --
{10,2379,1}, --
{10,2550,1}, --
{10,2384,1}, --
{10,2396,1}, --
{10,2406,1}, --
{10,2420,1}, --
{10,2385,1}, --
{10,2376,1}, --
{10,2450,1}, --
{10,2395,1}, --
{10,2412,1}, --
{10,2442,1}, --
{10,2397,1}, --
{10,2411,1}, --
{10,2419,1}, --
{10,3963,1}, --
{10,2383,1}, --
{10,2413,1}, --
{10,2409,1}, --
{10,2377,1}, --
{10,2438,1}, --
{10,2392,1}, --
{10,2407,1}, --
{10,2451,1}, --
{10,2446,1}, --
{10,2393,1}, --
{10,2400,1}, --
{10,6528,1}, --
{10,2390,1}, --
{10,6528,1}, --
{10,2456,1}, --
{10,2455,1}, --
{10,5803,1}, --
{10,1294,1}, --
{10,2111,1}, --
{10,2389,1}, --
{10,2410,1}, --
{10,2399,1}, --
{10,2544,1}, --
{10,2545,1}, --
{10,2546,1}, --
{10,2543,1}, --
{10,2547,1}, --
{10,6529,1}, --
{10,2512,1}, --
{10,2526,1}, --
{10,2511,1}, --
{10,2510,1}, --
{10,2529,1}, --
{10,2530,1}, --
{10,2541,1}, --
{10,2509,1}, --
{10,2524,1}, --
{10,2531,1}, --
{10,3974,1}, --
{10,2513,1}, --
{10,2521,1}, --
{10,2540,1}, --
{10,2525,1}, --
{10,3975,1}, --
{10,2527,1}, --
{10,2532,1}, --
{10,3973,1}, --
{10,2518,1}, --
{10,6131,1}, --
{10,2538,1}, --
{10,2535,1}, --
{10,2533,1}, --
{10,2515,1}, --
{10,2516,1}, --
{10,2519,1}, --
{10,2528,1}, --
{10,2537,1}, --
{10,2517,1}, --
{10,2536,1}, --
{10,2542,1}, --
{10,2534,1}, --
{10,2539,1}, --
{10,2520,1}, --
{10,6391,1}, --
{10,6433,1}, --
{10,2514,1}, --
{10,2522,1}, --
{10,2523,1}, --
{10,2454,1}, --
{10,6553,1}, --
{10,6132,1}, --
{10,2208,1}, --
{10,2209,1}, --
{10,2124,1}, --
{10,2213,1}, --
{10,2127,1}, --
{10,2167,1}, --
{10,2179,1}, --
{10,2168,1}, --
{10,2164,1}, --
{10,2166,1}, --
{10,2214,1}, --
{10,2357,1}, --
{10,2123,1}, --
{10,2165,1}, --
{10,2207,1}, --
{10,2169,1}, --
{10,2211,1}, --
{10,2212,1}, --
{10,2215,1}, --
{10,2204,1}, --
{10,2205,1}, --
{10,2203,1}, --
{10,2216,1}, --
{10,2202,1}, --
{10,2210,1}, --
{10,2206,1}, --
{10,2121,1}, --
{10,2196,1}, --
{10,2173,1}, --
{10,2142,1}, --
{10,2138,1}, --
{10,2132,1}, --
{10,2172,1}, --
{10,2126,1}, --
{10,2125,1}, --
{10,2201,1}, --
{10,2136,1}, --
{10,2198,1}, --
{10,2141,1}, --
{10,2199,1}, --
{10,2130,1}, --
{10,2171,1}, --
{10,2200,1}, --
{10,2133,1}, --
{10,2135,1}, --
{10,2661,1}, --
{10,2170,1}, --
{10,2132,1}, --
{10,2131,1}, --
{10,2197,1}, --
{10,2319,1}, --
{10,2161,1}, --
{10,2129,1}, --
{10,2144,1}, --
{10,2158,1}, --
{10,2318,1}, --
{10,2128,1}, --
{10,2160,1}, --
{10,3956,1}, --
{10,2148,1}, --
{10,2155,1}, --
{10,2152,1}, --
{10,2156,1}, --
{10,2159,1}, --
{10,2134,1}, --
{10,2150,1}, --
{10,2145,1}, --
{10,2149,1}, --
{10,2147,1}, --
{10,2146,1}, --
{10,2151,1}, --
{10,2143,1}, --
{10,5022,1}, --
{10,2153,1}, --
{10,2154,1}, --
{10,2162,1}, --
{10,2163,1}, --
{10,2184,1}, --
{10,2181,1}, --
{10,2182,1}, --
{10,2183,1}, --
{10,2185,1}, --
{10,2186,1}, --
{10,2187,1}, --
{10,2188,1}, --
{10,2189,1}, --
{10,2190,1}, --
{10,2191,1}, --
{10,2666,1}, --
{10,2671,1}, --
{10,2689,1}, --
{10,2691,1}, --
{10,2691,1}, --
{10,2696,1}, --
{10,2667,1}, --
{10,2679,1}, --
{10,2686,1}, --
{10,2668,1}, --
{10,2690,1}, --
{10,2684,1}, --
{10,2681,1}, --
{10,2673,1}, --
{10,2674,1}, --
{10,2676,1}, --
{10,2677,1}, --
{10,2685,1}, --
{10,2683,1}, --
{10,2680,1}, --
{10,2675,1}, --
{10,2687,1}, --
{10,2695,1}, --
{10,2787,1}, --
{10,2788,1}, --
{10,2789,1}, --
{10,2790,1}, --
{10,2791,1}, --
{10,2792,1}, --
{10,2795,1}, --
{10,2796,1}, --
{10,2678,1}, --
{10,2672,1}, --
{10,2669,1}, --
{10,2670,1}, --
{10,2688,1}, --
{10,2328,1}, --
{10,5678,1}, --
{10,6541,1}, --
{10,6542,1}, --
{10,6543,1}, --
{10,6544,1}, --
{10,6545,1}, --
{10,1987,1}, --
{10,1991,1}, --
{10,1992,1}, --
{10,1993,1}, --
{10,1994,1}, --
{10,1995,1}, --
{10,1996,1}, --
{10,1997,1}, --
{10,3939,1}, --
{10,5927,1}, --
{10,5950,1}, --
{10,1988,1}, --
{10,1998,1}, --
{10,1999,1}, --
{10,2000,1}, --
{10,2001,1}, --
{10,2002,1}, --
{10,2003,1}, --
{10,2004,1}, --
{10,2365,1}, --
{10,3940,1}, --
{10,3960,1}, --
{10,5926,1}, --
{10,5949,1}, --
{10,1947,1}, --
{10,1948,1}, --
{10,1949,1}, --
{10,2120,1}, --
{10,2550,1}, --
{10,2553,1}, --
{10,2554,1}, --
{10,2580,1}, --
{10,2420,1}, --
{10,5710,1}, --
{10,5015,1}, --
{10,5801,1}, --
{10,5865,1}, --
{10,5875,1}, --
{10,5876,1}, --
{10,5877,1}, --
{10,5878,1}, --
{10,5879,1}, --
{10,5880,1}, --
{10,5881,1}, --
{10,5882,1}, --
{10,5883,1}, --
{10,5884,1}, --
{10,5885,1}, --
{10,5886,1}, --
{10,5887,1}, --
{10,5888,1}, --
{10,5889,1}, --
{10,5890,1}, --
{10,5891,1}, --
{10,5892,1}, --
{10,5893,1}, --
{10,5894,1}, --
{10,5895,1}, --
{10,5896,1}, --
{10,5897,1}, --
{10,5898,1}, --
{10,5899,1}, --
{10,5900,1}, --
{10,5901,1}, --
{10,5902,1}, --
{10,5903,1}, --
{10,5904,1}, --
{10,5905,1}, --
{10,5906,1}, --
{10,5919,1}, --
{10,5920,1}, --
{10,5921,1}, --
{10,5922,1}, --
{10,5923,1}, --
{10,5924,1}, --
{10,5925,1}, --
{10,5930,1}, --
{10,5939,1}, --
{10,5946,1}, --
{10,5947,1}, --
{10,5948,1}, --
{10,5952,1}, --
{10,5954,1}, --
{10,6093,1}, --
{10,6105,1}, --
{10,6106,1}, --
{10,6107,1}, --
{10,6095,1}, --
{10,6096,1}, --
{10,6097,1}, --
{10,6098,1}, --
{10,6099,1}, --
{10,6100,1}, --
{10,6101,1}, --
{10,6102,1}, --
{10,6528,1}, --
{10,6531,1}, --
{10,6566,1}, --
{10,6567,1}, --
{10,6568,1}, --
{10,5080,1}, --
{10,5097,1}, --
{10,5480,1}, --
{10,5791,1}, --
{10,5792,1}, --
{10,5804,1}, --
{10,5808,1}, --
{10,5809,1}, --
{10,5810,1}, --
{10,5907,1}, --
{10,5908,1}, --
{10,2798,1} --
}
PRESENT_STORAGE = 5463 -- storage ID
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if (getPlayerStorageValue(cid, PRESENT_STORAGE) < 1) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
cantidad = math.random(5,50)
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, cantidad)
doPlayerRemoveItem(cid, 2160, 15)
setPlayerStorageValue(cid, PRESENT_STORAGE, 1)
npcHandler:say('Toma tu regalo!', cid)
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hahahaha!! |PLAYERNAME|, me has encontrado toma este {obsequio}, es uno de los cinco mil que tengo para regalar.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'obsequio'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Quieres tu obsequio??'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
random_items = {
{10,2263,1}, --
{10,10309,1}, --
{10,10313,1}, --
{10,11211,1}, --
{10,8927,1}, --
{10,7453,1}, --
{10,2503,1}, --
{10,11240,1}, --
{10,8821,1}, --
{10,10016,1}, --
{10,10570,1}, --
{10,6433,1}, --
{10,9735,1}, --
{10,2504,1}, --
{10,2469,1}, --
{10,12647,1}, --
{10,10503,1}, --
{10,9969,1}, --
{10,2217,1}, --
{10,2184,1}, --
{10,7735,1}, --
{10,8851,1}, --
{10,12649,1}, --
{10,8925,1}, --
{10,7450,1}, --
{10,2437,1}, --
{10,7409,1}, --
{10,8903,1}, --
{10,7457,1}, --
{10,8931,1}, --
{10,2447,1}, --
{10,8928,1}, --
{10,5791,1}, --
{10,5792,1}, --
{10,5804,1}, --
{10,5808,1}, --
{10,5809,1}, --
{10,5810,1}, --
{10,5907,1}, --
{10,5908,1}, --
{10,2798,1} --
}
PRESENT_STORAGE = 5463 -- storage ID
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if (getPlayerStorageValue(cid, PRESENT_STORAGE) < 1) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
cantidad = math.random(5,50)
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, cantidad)
doPlayerRemoveItem(cid, 11402, 1)
setPlayerStorageValue(cid, PRESENT_STORAGE, 1)
npcHandler:say('Toma tu regalo!', cid)
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hahahaha!! |PLAYERNAME|, me has encontrado di {change}, es uno de los cinco mil que tengo para regalar.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Quieres tu obsequio??'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
random_items = {
{10,2263,1}, --
{10,10309,1}, --
{10,10313,1}, --
{10,11211,1}, --
{10,8927,1}, --
{10,7453,1}, --
{10,2503,1}, --
{10,11240,1}, --
{10,8821,1}, --
{10,10016,1}, --
{10,10570,1}, --
{10,6433,1}, --
{10,9735,1}, --
{10,2504,1}, --
{10,2469,1}, --
{10,12647,1}, --
{10,10503,1}, --
{10,9969,1}, --
{10,2217,1}, --
{10,2184,1}, --
{10,7735,1}, --
{10,8851,1}, --
{10,12649,1}, --
{10,8925,1}, --
{10,7450,1}, --
{10,2437,1}, --
{10,7409,1}, --
{10,8903,1}, --
{10,7457,1}, --
{10,8931,1}, --
{10,2447,1}, --
{10,8928,1}, --
{10,5791,1}, --
{10,5792,1}, --
{10,5804,1}, --
{10,5808,1}, --
{10,5809,1}, --
{10,5810,1}, --
{10,5907,1}, --
{10,5908,1}, --
{10,2798,1} --
}
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
cantidad = math.random(5,50)
if subType > 1 then
count = subType .. " "
end
break
end
doPlayerAddItem(cid, reward, cantidad)
doPlayerRemoveItem(cid, 11402, 1)
npcHandler:say('Toma tu regalo!', cid)
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hahahaha!! |PLAYERNAME|, me has encontrado di {change}, es uno de los cinco mil que tengo para regalar.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Quieres tu obsequio??'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
random_items = {
{10,2263,1}, --
{10,10309,1}, --
{10,10313,1}, --
{10,11211,1}, --
{10,8927,1}, --
{10,7453,1}, --
{10,2503,1}, --
{10,11240,1}, --
{10,8821,1}, --
{10,10016,1}, --
{10,10570,1}, --
{10,6433,1}, --
{10,9735,1}, --
{10,2504,1}, --
{10,2469,1}, --
{10,12647,1}, --
{10,10503,1}, --
{10,9969,1}, --
{10,2217,1}, --
{10,2184,1}, --
{10,7735,1}, --
{10,8851,1}, --
{10,12649,1}, --
{10,8925,1}, --
{10,7450,1}, --
{10,2437,1}, --
{10,7409,1}, --
{10,8903,1}, --
{10,7457,1}, --
{10,8931,1}, --
{10,2447,1}, --
{10,8928,1}, --
{10,5791,1}, --
{10,5792,1}, --
{10,5804,1}, --
{10,5808,1}, --
{10,5809,1}, --
{10,5810,1}, --
{10,5907,1}, --
{10,5908,1}, --
{10,2798,1} --
}
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
cantidad = math.random(5,50)
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, cantidad)
doPlayerRemoveItem(cid, 11402, 1)
npcHandler:say('Toma tu regalo!', cid)
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hahahaha!! |PLAYERNAME|, me has encontrado di {change}, es uno de los cinco mil que tengo para regalar.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Quieres tu obsequio??'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
random_items = {
{10,2263,1}, --
{10,10309,1}, --
{10,10313,1}, --
{10,11211,1}, --
{10,8927,1}, --
{10,7453,1}, --
{10,2503,1}, --
{10,11240,1}, --
{10,8821,1}, --
{10,10016,1}, --
{10,10570,1}, --
{10,6433,1}, --
{10,9735,1}, --
{10,2504,1}, --
{10,2469,1}, --
{10,12647,1}, --
{10,10503,1}, --
{10,9969,1}, --
{10,2217,1}, --
{10,2184,1}, --
{10,7735,1}, --
{10,8851,1}, --
{10,12649,1}, --
{10,8925,1}, --
{10,7450,1}, --
{10,2437,1}, --
{10,7409,1}, --
{10,8903,1}, --
{10,7457,1}, --
{10,8931,1}, --
{10,2447,1}, --
{10,8928,1}, --
{10,5791,1}, --
{10,5792,1}, --
{10,5804,1}, --
{10,5808,1}, --
{10,5809,1}, --
{10,5810,1}, --
{10,5907,1}, --
{10,5908,1}, --
{10,2798,1} --
}
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
cantidad = math.random(5,50)
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, cantidad)
doPlayerRemoveItem(cid, 11402, 1)
npcHandler:say('Toma tu regalo!', cid)
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hahahaha!! |PLAYERNAME|, me has encontrado di {change}, es uno de los cinco mil que tengo para regalar.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Quieres tu obsequio??'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
random_items = {
{10,2263,1}, --
{10,10309,1}, --
{10,10313,1}, --
{10,11211,1}, --
{10,8927,1}, --
{10,7453,1}, --
{10,2503,1}, --
{10,11240,1}, --
{10,8821,1}, --
{10,10016,1}, --
{10,10570,1}, --
{10,6433,1}, --
{10,9735,1}, --
{10,2504,1}, --
{10,2469,1}, --
{10,12647,1}, --
{10,10503,1}, --
{10,9969,1}, --
{10,2217,1}, --
{10,2184,1}, --
{10,7735,1}, --
{10,8851,1}, --
{10,12649,1}, --
{10,8925,1}, --
{10,7450,1}, --
{10,2437,1}, --
{10,7409,1}, --
{10,8903,1}, --
{10,7457,1}, --
{10,8931,1}, --
{10,2447,1}, --
{10,8928,1}, --
{10,5791,1}, --
{10,5792,1}, --
{10,5804,1}, --
{10,5808,1}, --
{10,5809,1}, --
{10,5810,1}, --
{10,5907,1}, --
{10,5908,1}, --
{10,2798,1} --
}
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
cantidad = math.random(5,50)
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, cantidad)
if doPlayerRemoveItem(cid, 11402, 1) then
npcHandler:say('Toma tu regalo!', cid)
else
npcHandler:say('Hahahaha! Que dijiste ya lo hice tonto, no seas tramposo ya sabes donde estoy!', cid)
end
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hahahaha!! |PLAYERNAME|, me has encontrado di {change}, es uno de los cinco mil que tengo para regalar.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Quieres tu obsequio??'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
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
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
npcHandler:say(getPlayerSex(cid) == 0 and "Well hello there lovely lady! How may I help you today?" or "Well hello sir, how may I help you today?", cid)
Topic[cid] = 0
npcHandler:addFocus(cid)
elseif msgcontains(msg, "cape") and npcHandler:isFocused(cid) then
npcHandler:say("I can give you a new {cape} in exchange for a dirty one.", cid)
Topic[cid] = 1
elseif Topic[cid] == 1 then
if msgcontains(msg, "yes") then
if doPlayerRemoveItem(cid, 11402, 1) then
npcHandler:say("Here you are.", cid)
doPlayerAddItem(cid, 2654, 1)
doPlayerAddItem(cid, 2649, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
Topic[cid] = 0
else
npcHandler:say("You do not have a dirt cape to exchange.", cid)
Topic[cid] = 0
end
elseif msgcontains(msg, "no") then
npcHandler:say("Okay then.", cid)
Topic[cid] = 0
end
elseif(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") and npcHander:isFocused(cid) then
npcHandler:say("Good bye.", cid, TRUE)
Topic[cid] = nil
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "job") then
npcHandler:say("I can give you a new {cape} in exchange for a dirty one.", cid)
Topic[cid] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
random_items = {
{5,2112,1}, -- 0.5% to get teddy bear
{20,6512,1}, -- 2% to get santa doll
{40,2114,1}, -- 4% to get piggy bank
{80,2111,5}, -- 8% to get 5 snowballs
{80,2688,8}, -- 8% to get 8 candy canes
{80,2110,1}, -- 8% to get doll
{400,2674,15}, -- 40% to get 15 red apples
{450,2675,10}, -- 45% to get 10 oranges
{1000,2687,8} -- 100% to get 8 cookies
}
PRESENT_STORAGE = 54163 -- storage ID
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
function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if doPlayerRemoveItem(cid, 11402, 1) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, subType)
npcHandler:say('toma tu premio ' .. count .. getItemNameById(reward) .. ' para ti.', cid)
else
npcHandler:say('Ladron vete de aqui antes que te corte la cabeza.', cid)
end
else
npcHandler:say('regresa cuando tengas el item.', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Gracias |PLAYERNAME|.por venir. si me das el item Tibioras box yo te dare un regalo dime {trade}.")
local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})
local node = keywordHandler:addKeyword({'trade'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tienes el item Tibioras box {yes} o {no}?'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
Permisos de este foro:
No puedes responder a temas en este foro.
|
|