- Joined
- Apr 12, 2007
- Messages
- 15
- Reaction score
- 0
Hello,
I have been working on a Custom NPC trader in Jscript for some days now, i cant see where the problem is..
Ingame the npc just tell me this:
It should be a trader who gives SP for Glittering medals, since SP is mush worth in my server :happy:..
Here is the __init__.py file (ITS NEW I Editted it)
And here is the HTM file in data/html/default/...
And here should the NPC Start when u press Who are you?
Please help me, or tell me if there is a syntex error or something heh, this is my first jscript.
Thanks
I have been working on a Custom NPC trader in Jscript for some days now, i cant see where the problem is..
Ingame the npc just tell me this:
![Sonixdk - [HELP] Custom NPC, with jscript quest - RaGEZONE Forums Sonixdk - [HELP] Custom NPC, with jscript quest - RaGEZONE Forums](https://forum.ragezone.com/images/404_image.png)
It should be a trader who gives SP for Glittering medals, since SP is mush worth in my server :happy:..
Here is the __init__.py file (ITS NEW I Editted it)
Code:
###*********************************
### SpellPoint Trader
### By Sonix
###*********************************
qn = "5050_SPtrader"
QuestId = 5050
QuestName = "SPtrader"
QuestDesc = "custom"
InitialHtml = "1.htm"
#NPC that being involved
NPC=[37056]
#Item that will be traded
GMedal = 6393
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent (self,event,st) :
htmltext = event
#Buy 10000 SP for 1 Glittering Medal
if event == "1":
if st.getQuestItemsCount(GMedal) >= 1:
st.takeItems(GMedal,1)
st.addExpAndSp(0,10000)
htmltext = "You have succesfully purchased 10000 extra SP."
else:
htmltext = "You do not have enough items."
#Buy 50000 SP for 5 Glittering Medal
if event == "2":
if st.getQuestItemsCount(GMedal) >= 5:
st.takeItems(GMedal,5)
st.addExpAndSp(0,50000)
htmltext = "You have succesfully purchased 50000 extra SP."
else:
htmltext = "You do not have enough items."
#Buy 100000 SP for 10 Glittering Medal
if event == "3":
if st.getQuestItemsCount(GMedal) >= 10:
st.takeItems(GMedal,10)
st.addExpAndSp(0,100000)
htmltext = "You have succesfully purchased 100000 extra SP."
else:
htmltext = "You do not have enough items."
if event == "0":
htmltext = "Training has been canceled."
if htmltext != event:
st.setState(COMPLETED)
st.exitQuest(1)
return htmltext
def onTalk (Self,npc,player):
npcId = npc.getNpcId()
st = player.getQuestState(qn)
htmltext = "<html><body>I have nothing to say to you.</body></html>"
st.set("cond","0")
st.setState(STARTED)
return InitialHtml
### Quest class and state definition
QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
CREATED = State('Start', QUEST)
STARTED = State('Started', QUEST)
COMPLETED = State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(37056)
# SP Trader Reilu
QUEST.addTalkId(37056)
And here is the HTM file in data/html/default/...
Code:
<html><title>SP Trader - Reilu</title>
<body>
Reilu:<br>
Hi Stranger
<br>
<a action="bypass -h npc_%objectId%_Quest 1007_spt">Who are you?</a>
</body>
</html>
And here should the NPC Start when u press Who are you?
Code:
<html><body>SP Trader Reilu:<br><br>
I am Reilu and i am expert in train SP... <br>
But i dont train you for free, If you get me <font color="FFBB00">Glittering Medals</font> i will train you.<br><br>
<center>
<a action="bypass -h Quest 1007_SPt 3.htm"> 10000 SP </a><br>
<a action="bypass -h Quest 1007_SPt 4.htm"> 50000 SP </a><br>
<a action="bypass -h Quest 1007_SPt 5.htm"> 100000 SP </a><br>
<a action="bypass -h Quest 1007_SPt 2.htm"> How to get those Medals? </a></center><br>
</body></html>
Please help me, or tell me if there is a syntex error or something heh, this is my first jscript.
Thanks
Last edited: