Python Doesn't Work Propertly...
Hi, I Have A Little Problem With A Shop That I Have Made With Enchanted Items...
All People can Buy The First Item In Each Section... But, The other ones doesn't work... How I Can Fix That??
Here Is Python Code:
Code:
import sys
from com.l2jfree.gameserver.model.actor.instance import L2PcInstance
from com.l2jfree.gameserver.model.quest import State
from com.l2jfree.gameserver.model.quest import QuestState
from com.l2jfree.gameserver.model.quest.jython import QuestJython as JQuest
qn = "99942_DynastyAShop"
NPC=[1991]
QuestId = 99942
QuestName = "DynastyAShop"
QuestDesc = "custom"
InitialHtml = "1.htm"
ADENA_ID=6673
ENCHANT=20
print "Cargado Custom: SHOP ENCHANTED"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st) :
htmltext = event
if st.getQuestItemsCount(ADENA_ID) <= 5000 :
htmltext = "<html><head><body>No Tienes Adena.<br></body></html>"
else:
#Dynasty Breast Plate - Bard
if event == "1":
st.takeItems(ADENA_ID,5000)
st.giveItems(9420,1,ENCHANT)
st.giveItems(9424,1,ENCHANT)
st.giveItems(9423,1,ENCHANT)
st.giveItems(9422,1,ENCHANT)
st.giveItems(9421,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Breast Plate - Force Master
if event == "2":
st.takeItems(ADENA_ID,5000)
st.giveItems(9423,1,ENCHANT)
st.giveItems(9421,1,ENCHANT)
st.giveItems(9424,1,ENCHANT)
st.giveItems(9419,1,ENCHANT)
st.giveItems(9422,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Breast Plate - Shield Master
if event == "3":
st.takeItems(ADENA_ID,5000)
st.giveItems(9423,1,ENCHANT)
st.giveItems(9421,1,ENCHANT)
st.giveItems(9424,1,ENCHANT)
st.giveItems(9417,1,ENCHANT)
st.giveItems(9422,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Breast Plate - Weapon Master
if event == "4":
st.takeItems(ADENA_ID,5000)
st.giveItems(9423,1,ENCHANT)
st.giveItems(9421,1,ENCHANT)
st.giveItems(9424,1,ENCHANT)
st.giveItems(9418,1,ENCHANT)
st.giveItems(9422,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Tunic - Enchanter
if event == "5":
st.takeItems(ADENA_ID,5000)
st.giveItems(9434,1,ENCHANT)
st.giveItems(9439,1,ENCHANT)
st.giveItems(9438,1,ENCHANT)
st.giveItems(9440,1,ENCHANT)
st.giveItems(9437,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Tunic - Healer
if event == "6":
st.takeItems(ADENA_ID,5000)
st.giveItems(9433,1,ENCHANT)
st.giveItems(9439,1,ENCHANT)
st.giveItems(9438,1,ENCHANT)
st.giveItems(9440,1,ENCHANT)
st.giveItems(9437,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Tunic - Summoner
if event == "7":
st.takeItems(ADENA_ID,5000)
st.giveItems(9435,1,ENCHANT)
st.giveItems(9439,1,ENCHANT)
st.giveItems(9438,1,ENCHANT)
st.giveItems(9440,1,ENCHANT)
st.giveItems(9437,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Tunic - Wizard
if event == "8":
st.takeItems(ADENA_ID,5000)
st.giveItems(9436,1,ENCHANT)
st.giveItems(9439,1,ENCHANT)
st.giveItems(9438,1,ENCHANT)
st.giveItems(9440,1,ENCHANT)
st.giveItems(9437,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Leather Armor - Bow Master
if event == "9":
st.takeItems(ADENA_ID,5000)
st.giveItems(9427,1,ENCHANT)
st.giveItems(9429,1,ENCHANT)
st.giveItems(9428,1,ENCHANT)
st.giveItems(9430,1,ENCHANT)
st.giveItems(9431,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Leather Armor - Dagger Master
if event == "10":
st.takeItems(ADENA_ID,5000)
st.giveItems(9426,1,ENCHANT)
st.giveItems(9429,1,ENCHANT)
st.giveItems(9428,1,ENCHANT)
st.giveItems(9430,1,ENCHANT)
st.giveItems(9431,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Leather Armor - Enchanter
if event == "11":
st.takeItems(ADENA_ID,5000)
st.giveItems(10168,1,ENCHANT)
st.giveItems(9429,1,ENCHANT)
st.giveItems(9428,1,ENCHANT)
st.giveItems(9430,1,ENCHANT)
st.giveItems(9431,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Leather Armor - Force Master
if event == "12":
st.takeItems(ADENA_ID,5000)
st.giveItems(10126,1,ENCHANT)
st.giveItems(9429,1,ENCHANT)
st.giveItems(9428,1,ENCHANT)
st.giveItems(9430,1,ENCHANT)
st.giveItems(9431,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Leather Armor - Summoner
if event == "13":
st.takeItems(ADENA_ID,5000)
st.giveItems(10214,1,ENCHANT)
st.giveItems(9429,1,ENCHANT)
st.giveItems(9428,1,ENCHANT)
st.giveItems(9430,1,ENCHANT)
st.giveItems(9431,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
#Dynasty Leather Armor - Weapon Master
if event == "14":
st.takeItems(ADENA_ID,5000)
st.giveItems(10127,1,ENCHANT)
st.giveItems(9429,1,ENCHANT)
st.giveItems(9428,1,ENCHANT)
st.giveItems(9430,1,ENCHANT)
st.giveItems(9431,1,ENCHANT)
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
def onTalk (self,npc,player):
st = player.getQuestState(qn)
htmltext = "<html><head><body><center>I Have Nothing To Say You.</center></body></html>"
st.setState(State.STARTED)
return InitialHtml
QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
for npcId in NPC:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)
Thx For All =)
Re: Python Doesn't Work Propertly...
and what does the error say??
Re: Python Doesn't Work Propertly...
No errors... it doesn't work. It allow you tu buy the first item in the list... but the others one not....
Re: Python Doesn't Work Propertly...
try to give to each item a name, like on quest does. For example, this is from an arrogant search quest:
TITANS_POWERSTONE = 4287
HANELLINS_FIRST_LETTER = 4288
HANELLINS_SECOND_LETTER = 4289
HANELLINS_THIRD_LETTER = 4290
FIRST_KEY_OF_ARK = 4291
SECOND_KEY_OF_ARK = 4292
THIRD_KEY_OF_ARK = 4293
WHITE_FABRIC_1 = 4294 #to use on Platinum Tribe Shamans/Overlords
BLOODED_FABRIC = 4295
HANELLINS_WHITE_FLOWER = 4394
HANELLINS_RED_FLOWER = 4395
HANELLINS_YELLOW_FLOWER = 4396
BOOK_OF_SAINT = 4397 # Ark2 (after fight with Elberoth)
BLOOD_OF_SAINT = 4398 # Ark1 (after fight with Angel Killer)
BRANCH_OF_SAINT = 4399 # Ark3 (after fight with Shadowfang)
WHITE_FABRIC_0 = 4400 #talk to Hanellin to see what to do (for companions)
WHITE_FABRIC_2 = 5232 #to use on Guardian Angels and Seal Angels
Dunno if it would work, but you does not loose nothing trying :P
Re: Python Doesn't Work Propertly...
there is no difference, if he assigns those ID's to a variable and use the variable, or hard code it in the script.
try to remove that enchant amount part and see if that works...
Re: Python Doesn't Work Propertly...
Without enchant part... doesn't works... i think that it fails on....
st.setState(COMPLETED)
because when i exit from char... i go to DB and happears 99942_DynastyAShop (Status: STARTED)
Re: Python Doesn't Work Propertly...
well to avoid this kind of situations, I removed st.setState(COMPLETED) part and it still works great...
but I don't think, that that's your case...
just try to align the return part and st.setState part...
st.giveItems(9441,1,ENCHANT)
return "1.htm"
st.setState(COMPLETED)
and see if it works...
Re: Python Doesn't Work Propertly...
Re: Python Doesn't Work Propertly...
Aggg... it doesn't work.... If i delete it... Says me an error and no load the script =)