Page 1 of 1

Zeni Plates

Posted: Thu Jan 24, 2013 9:40 am
by twistedvengeance
So I've noticed that you can't take pictures to receive Zeni NM Plates, and that people have done a workaround of just paying gil to get plates.

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"
However, it's spitting an error about

Code: Select all

if(trade:hasItemQty(65535, >= 1000) then
something about the >=
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?

Re: Zeni Plates

Posted: Thu Jan 24, 2013 11:27 am
by kjLotus
hasItemQty expects a number, not a boolean

Code: Select all

if( !lua_isnil(L,-1) && lua_isnumber(L,-1) &&
    !lua_isnil(L,-2) && lua_isnumber(L,-2) )
from what i can tell, you can only specify an exact number to check for in hasItemQty.

If you're still interested in making it work like that, you'll probably need another lua binding for checking the greater than/equal to condition

edit: OR look at the other bindings in lua_trade_container.cpp / lua_trade_container.h

maybe getGil