NPC Help

Post Reply
soulsin
Posts: 102
Joined: Sun Mar 17, 2013 9:06 am

NPC Help

Post by soulsin » 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;
[GM] Soulsin

User avatar
Signature
Posts: 126
Joined: Fri May 02, 2014 3:44 am

Re: NPC Help

Post by Signature » Thu Jul 17, 2014 12:27 am

if(trade:hasItemQty(3115,12, 3135,12) and count == 24) then --

Code: Select all

player:tradeComplete();
player:addItem(11069);
player:addItem(11109);
player:addItem(11129);
player:addItem(11149);
player:addItem(11089);
Last edited by Signature on Thu Jul 17, 2014 12:29 am, edited 1 time in total.

soulsin
Posts: 102
Joined: Sun Mar 17, 2013 9:06 am

Re: NPC Help

Post by soulsin » Thu Jul 17, 2014 12:28 am

I got that at the bottom but still keeping items and giving the reward items
[GM] Soulsin

User avatar
Signature
Posts: 126
Joined: Fri May 02, 2014 3:44 am

Re: NPC Help

Post by Signature » Thu Jul 17, 2014 12:30 am

if(trade:hasItemQty(3115,12, 3135,12) and count == 24) then --
player:tradeComplete();
player:addItem(11069);
player:addItem(11109);
player:addItem(11129);
player:addItem(11149);
player:addItem(11089);

soulsin
Posts: 102
Joined: Sun Mar 17, 2013 9:06 am

Re: NPC Help

Post by soulsin » Thu Jul 17, 2014 12:37 am

Ok I will try that then and see if works. all that gear listed I mod in so something players get farming the seals.
[GM] Soulsin

soulsin
Posts: 102
Joined: Sun Mar 17, 2013 9:06 am

Re: NPC Help

Post by soulsin » Thu Jul 17, 2014 12:44 am

Thank you that worked. Still a lot more to do, but least got that outta the way
[GM] Soulsin

User avatar
Signature
Posts: 126
Joined: Fri May 02, 2014 3:44 am

Re: NPC Help

Post by Signature » Thu Jul 17, 2014 1:01 am

You might want to try this... instead of your not working cut scene.



if(trade:hasItemQty(3115,12, 3135,12) and count == 24) then --
player:tradeComplete();
player:addItem(11069);
player:addItem(11109);
player:addItem(11129);
player:addItem(11149);
player:addItem(11089);
player:startEvent(0x278D);

soulsin
Posts: 102
Joined: Sun Mar 17, 2013 9:06 am

Re: NPC Help

Post by soulsin » Thu Jul 17, 2014 1:14 am

Ok kool thanks. Soon I get gear mod in, gonna commit it so others can use it too, and also few other things.
[GM] Soulsin

soulsin
Posts: 102
Joined: Sun Mar 17, 2013 9:06 am

Re: NPC Help

Post by soulsin » Thu Jul 17, 2014 9:58 am

Ok I added in the player:startEvent(0x278D); which it crash the server.
[GM] Soulsin

bluekirby0
Developer
Posts: 707
Joined: Sun Jul 22, 2012 12:11 am

Re: NPC Help

Post by bluekirby0 » Thu Jul 17, 2014 3:08 pm

Do NOT add any items until the event is complete...not only will messages run over your event but it makes it possible to get duplicate rewards.

Post Reply