X
Xikini
Guest
The Forgotten Server, version 0.3.7_SVN (Crying Damson)
I want an npc which will trade with demonic essence instead of gold coins.
Ideally the npc would have these functions.
trade -> which item would you like to trade? or would like to to know the items you can trade?
can trade -> loops and checks for all items in table, and sends "I trade demonic essences for thing1, thing2, and thing3.
thing1 -> check for item name in table
-> I can sell you that item for ..check item price in table.. . Would you like to do that?
yes ->check price from table -> check if player has enough essence -> give item from table.
The harder part..
If a person wants thing1, but thing1 comes in different colours, ask if want a specific one, or a random one for less price.
thing2 -> I can sell you thing2 for ..check price.. or I can give you a random thing2 for ..otherPrice.. . Would you like thing2 or random?
thing2 -> checkprice -> check player essence -> give item.
random -> checkprice -> check player essence -> give item+ add actionID from table.
Some id's to work with.
essence = 6500
brown backpack = 1988
dwarven ring = 2213
life ring = 2168
knife = 2403
present box = 1990 (random item box, I will script an action to give random item onUse.)
Guessing the table would need these in it..
I'm not really looking for a script..
I'm more looking for how to access the table, and keep the position within the table saved while talking with the npc.
I'm just terrible with loops and tables.
I want an npc which will trade with demonic essence instead of gold coins.
Ideally the npc would have these functions.
trade -> which item would you like to trade? or would like to to know the items you can trade?
can trade -> loops and checks for all items in table, and sends "I trade demonic essences for thing1, thing2, and thing3.
thing1 -> check for item name in table
-> I can sell you that item for ..check item price in table.. . Would you like to do that?
yes ->check price from table -> check if player has enough essence -> give item from table.
The harder part..
If a person wants thing1, but thing1 comes in different colours, ask if want a specific one, or a random one for less price.
thing2 -> I can sell you thing2 for ..check price.. or I can give you a random thing2 for ..otherPrice.. . Would you like thing2 or random?
thing2 -> checkprice -> check player essence -> give item.
random -> checkprice -> check player essence -> give item+ add actionID from table.
Some id's to work with.
essence = 6500
brown backpack = 1988
dwarven ring = 2213
life ring = 2168
knife = 2403
present box = 1990 (random item box, I will script an action to give random item onUse.)
Guessing the table would need these in it..
Code:
[1] = {item = "knife", type = weapon, itemID = 2403, price = 100, randomPrice = 0, actionID = 0},
[2] = {item = "brown backpack", type = backpack, itemID = 1988, price = 100, randomPrice = 20, actionID = 45055},
[3] = {item = "dwarven ring", type = ring, itemID = 2213, price = 200, randomPrice = 40, actionID = 45056},
[4] = {item = "life ring", type = ring, itemID = 2168, price = 200, randomPrice = 40, actionID = 45056}
I'm not really looking for a script..
I'm more looking for how to access the table, and keep the position within the table saved while talking with the npc.
I'm just terrible with loops and tables.