Thys
New Member
- Joined
- Apr 8, 2013
- Messages
- 5
- Reaction score
- 0
Hello guys, makes some days that I am learning to program in LUA and min there was a doubt that not able to solve, I'm wanting to create an NPC that changes the price of items it sells, and before he change the price it checks if the player contains the storage value that I set up, if he has it assigns the new value and sends a message (which I created to test the function) is function should be performed at the time that the player appears in the NPC.
As a test I am using npc digger (selling pot in venore), soon after the line
I added this:
I am wanting to change the value of the Health Potion, that is, if the player has the storage value 2203 (which I setup) it will decrease 10, that is, by default the value of the Health Potion is 45, with the "discount" has to be 35
Well..He is validating certain, is not only changing the value, that is, it continues with the value of the local variable (which is 0).
Could help me??
To prove that the validation is being performed correctly, there's a print of the message that appears if the player has the storage value that I setup:

I hope to help, thanks
As a test I am using npc digger (selling pot in venore), soon after the line
Code:
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
I added this:
Code:
local value = 0
function onCreatureAppear(cid)
if(getPlayerStorageValue(cid,2203) == 2203 or getPlayerStorageValue(cid,2203) == 1 ) then
value = 10
doBroadcastMessage("OI THYAGO VOCE RECEBEU 10 DE DESCONTO NA MINHA LOJA", 22)
else
value = 5
end
return value
end
I am wanting to change the value of the Health Potion, that is, if the player has the storage value 2203 (which I setup) it will decrease 10, that is, by default the value of the Health Potion is 45, with the "discount" has to be 35
Code:
shopModule:addBuyableItem({'health potion'}, 7618, 45-value, 1, 'health potion')
Well..He is validating certain, is not only changing the value, that is, it continues with the value of the local variable (which is 0).
Could help me??
To prove that the validation is being performed correctly, there's a print of the message that appears if the player has the storage value that I setup:
I hope to help, thanks
Last edited: