What I've been trying to do, is make it so that you can trade as much gil as you want, and it will give you however many plates you're supposed to get. I figured that a lot of people would enjoy this so you don't have to keep trading over and over.
Here's the code. (dsp\scripts\zones\Aht_Urhgan_Whitegate\npcs\Sanraku.lua)
Code: Select all
if(trade:getItemCount() == 1) then
if(trade:hasItemQty(2477,1)) then -- Trade Soul Plate
zeni = math.random(1,200); -- random value since soul plates aren't implemented yet.
player:tradeComplete();
player:addPoint(ZENI,zeni);
player:startEvent(0x038E,zeni);
elseif(trade:hasItem(65535) == true) then -- Trade gil for plates
if(trade:hasItemQty(65535, >= 1000) then -- If you traded more than 1000
local paid = trade:ItemQty(65535); -- Enumerate how much you paid
paid = paid / 1000; -- Divide how much you paid by 1000 to find how many plates you get
local disc = 0; -- Set an integer for the while loop
while(disc < paid + 1) then
player:addItem(2477,1); -- Incrementing disc until it equals how much you paid / 1000, adding a plate
disc++;
end
end
"...Function code continues"
Code: Select all
if(trade:hasItemQty(65535, >= 1000) then
Now, I know that this is probably mostly wrong, but based on normal logic this should work. Does anyone know where I'm going wrong?