NPC Help
Posted: Wed Jul 16, 2014 11:13 pm
Ok I came up with this script, had setup once with when trade it took items but was with quest on it, and some players couldn't use npc so I changed it. But now it wont take the items you trade and would like it too. Here is the script, maybe someone might be able see how get to take the traded items at least
Code: Select all
-----------------------------------
-- Area: Ru'Lude Gardens
-- NPC: MagianMoogle
-- Type: Standard NPC
-----------------------------------
package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/globals/missions");
require("scripts/zones/RuLude_Gardens/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
count = trade:getItemCount();
itemQuality = 0;
if (trade:getItemCount() == 24) then
if(trade:hasItemQty(3115,12, 3135,12) and count == 24) then --
player:addItem(11069);
player:addItem(11109);
player:addItem(11129);
player:addItem(11149);
player:addItem(11089);
elseif(trade:hasItemQty(3142,12, 3122,12) and count == 24) then --
player:addItem(11076);
player:addItem(11136);
player:addItem(11156);
player:addItem(11096);
player:addItem(11116);
elseif(trade:hasItemQty(3140,12, 3120,12) and count == 24) then --
player:addItem(11074);
player:addItem(11114);
player:addItem(11154);
player:addItem(11134);
player:addItem(11094);
elseif(trade:hasItemQty(3136,12, 3116,12) and count == 24) then --
player:addItem(11070);
player:addItem(11110);
player:addItem(11090);
player:addItem(11130);
player:addItem(11150);
elseif(trade:hasItemQty(3131,12, 3111,12) and count == 24) then --
player:addItem(11065);
player:addItem(11085);
player:addItem(11145);
player:addItem(11105);
player:addItem(11125);
elseif(trade:hasItemQty(3138,12, 3118,12) and count == 24) then --
player:addItem(11072);
player:addItem(11092);
player:addItem(11152);
player:addItem(11112);
player:addItem(11132);
elseif(trade:hasItemQty(3148,12, 3128,12) and count == 24) then --
player:addItem(11082);
player:addItem(11102);
player:addItem(11122);
player:addItem(11162);
player:addItem(11142);
elseif(trade:hasItemQty(3133,12, 3113,12) and count == 24) then --
player:addItem(11067);
player:addItem(11127);
player:addItem(11087);
player:addItem(11107);
player:addItem(11147);
elseif(trade:hasItemQty(3134,12, 3114,12) and count == 24) then --
player:addItem(11068);
player:addItem(11108);
player:addItem(11148);
player:addItem(11088);
player:addItem(11128);
elseif(trade:hasItemQty(3130,12, 3110,12) and count == 24) then --
player:addItem(11064);
player:addItem(11144);
player:addItem(11124);
player:addItem(11084);
player:addItem(11104);
elseif(trade:hasItemQty(3149,12, 3129,12) and count == 24) then --
player:addItem(11083);
player:addItem(11103);
player:addItem(11143);
player:addItem(11123);
player:addItem(11163);
elseif(trade:hasItemQty(3147,12, 3127,12) and count == 24) then --
player:addItem(11081);
player:addItem(11141);
player:addItem(11101);
player:addItem(11121);
player:addItem(11161);
elseif(trade:hasItemQty(3126,12, 3146,12) and count == 24) then --
player:addItem(11080);
player:addItem(11120);
player:addItem(11100);
player:addItem(11140);
player:addItem(11160);
elseif(trade:hasItemQty(3125,12, 3145,12) and count == 24) then --
player:addItem(11079);
player:addItem(11159);
player:addItem(11099);
player:addItem(11119);
player:addItem(11139);
elseif(trade:hasItemQty(3143,12, 3123,12) and count == 24) then --
player:addItem(11077);
player:addItem(11137);
player:addItem(11097);
player:addItem(11157);
player:addItem(11117);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x025d, 0, 231, 10);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x025d and option == 1002) then
player:tradeComplete();
player:addItem(objecttrade);
player:messageSpecial(ITEM_OBTAINED,objecttrade);
end
end;