Jump to content
  • 0

[Code] Request 1 Check.


Question

Posted

Hello there!!

 

I try to edit one quest and i need 2 check ,

1 check is working fine

is check for pvps , but i dont know how to add the second,

i m unskiled for java and i m searching for hours to find solution but i cant ...

 

as u see in code have check for pvp count,

>=20

i need also 1 check about time to able this quest to be done every 24hours

can u some write me check for time & pvp ?

 

 

 

 

 

def onTalk (self,npc,player):
     htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
     st = player.getQuestState(qn)
     if not st : return htmltext

     npcId = npc.getNpcId()
     id = st.getState()
     Pvp = player.getPvpKills()
     cond = st.getInt("cond")
     if id == CREATED :
         if Pvp>=20 :
             htmltext = "30078-01.htm"
         else:
             htmltext = "<html><body>This quest can only be taken by characters PvP count is more than 200 and higher!</body></html>"
             st.exitQuest(1)

Recommended Posts

  • 0
Posted

Here is the current quest and pvp i change pvp check i try to add time check also but always

i get errors on my gameserver :/

 

class Quest (JQuest) :

def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

def onEvent (self,event,st) :
     htmltext = event
     if event == "30078-02.htm" :
        st.setState(STARTED)
        st.set("cond","1")
        st.playSound("ItemSound.quest_accept")
     return htmltext

def onTalk (self,npc,player):
     htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
     st = player.getQuestState(qn)
     if not st : return htmltext

     npcId = npc.getNpcId()
     id = st.getState()
     Pvp = player.getPvpKills()
     cond = st.getInt("cond")
     if id == CREATED :
         if Pvp>=150 and Pvp<=400 :
             htmltext = "30078-01.htm"
         else:
             htmltext = "<html><body>This quest can only be taken by characters PvP count is more than 150 and up to 400!</body></html>"
             st.exitQuest(1)
     elif cond==1 :
         if st.getQuestItemsCount(BOX_OF_COOKIES)>=20 :
            htmltext = "30078-04.htm"
            st.giveItems(FARM_COIN,3000)
            st.takeItems(BOX_OF_COOKIES,-1)
            st.playSound("ItemSound.quest_finish")
            st.exitQuest(1)
         else :
            htmltext = "30078-03.htm"
     return htmltext

 

i add it here

class Quest (JQuest) :

def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

def onEvent (self,event,st) :
     htmltext = event
     if event == "30078-02.htm" :
        st.setState(STARTED)
        st.set("cond","1")
        st.playSound("ItemSound.quest_accept")
     	player.removeEnterCooldownAfter24h();
 return htmltext

def onTalk (self,npc,player):
     htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
     st = player.getQuestState(qn)
     if not st : return htmltext

     npcId = npc.getNpcId()
     id = st.getState()
     Pvp = player.getPvpKills()
     cond = st.getInt("cond")
     if id == CREATED :
         if Pvp>=150 and Pvp<=400 and  :
             htmltext = "30078-01.htm"
         else:
             htmltext = "<html><body>This quest can only be taken by characters PvP count is more than 150 and up to 400!</body></html>"
             st.exitQuest(1)
    			if (!player.canEnterQuest())
		{
			player.sendMessage("You must wait at least 24 hours since your last taken the quest");
			return;
		}
elif cond==1 :
         if st.getQuestItemsCount(BOX_OF_COOKIES)>=20 :
            htmltext = "30078-04.htm"
            st.giveItems(FARM_COIN,3000)
            st.takeItems(BOX_OF_COOKIES,-1)
            st.playSound("ItemSound.quest_finish")
            st.exitQuest(1)
         else :
            htmltext = "30078-03.htm"
     return htmltext

 

  • 0
Posted

Timer can't be kept on quests variables, because if the player removes the quest, variable is dropped.

 

The task as xdem said is pointless, a server restart and you lose information. And the code on L2PcInstance is totally useless to say the least...

 

Easier is, if you got numerous quests following that scheme, to add L2J system about daily quests (kamaloka and such).

 

It can be saved on ServerVariables, if you got such a thing on L2JFrozen. Each variablecould be QXXX_objId, with timer as value. If you haven't any daily system, and don't want to, that's your only possibility.

  • 0
Posted

Timer can't be kept on quests variables, because if the player removes the quest, variable is dropped.

 

The task as xdem said is pointless, a server restart and you lose information. And the code on L2PcInstance is totally useless to say the least...

 

Easier is, if you got numerous quests following that scheme, to add L2J system about daily quests (kamaloka and such).

 

It can be saved on ServerVariables, if you got such a thing on L2JFrozen. Each variablecould be QXXX_objId, with timer as value. If you haven't any daily system, and don't want to, that's your only possibility.

 

 

so its really difficult to code this.. and work normaly , i mean save time when player go out and when server do restart..

i have read the most quests.. no1 have something like this..

 

 

maybe if i find money to pay some1 to do it :/

  • 0
Posted

 

so its really difficult to code this.. and work normaly , i mean save time when player go out and when server do restart..

i have read the most quests.. no1 have something like this..

 

 

maybe if i find money to pay some1 to do it :/

 

fss its not, the simpliest way is, add column at characters.sql named "QuestTimer" with default 0,

then its simple, at the checks check if QuestTimer<currentTimeMilis() return;

else we store the currenttimeMilis at questTimer, and start the quest... I think its simple now

  • 0
Posted

 

so its really difficult to code this.. and work normaly , i mean save time when player go out and when server do restart..

i have read the most quests.. no1 have something like this..

 

 

maybe if i find money to pay some1 to do it :/

Overall that's 5-7 lines of code in your script. But continue to say it's difficult.

 

On L2JFrozen, deleteGlobalQuestVar / saveGlobalQuestVar(

  • 0
Posted

Overall that's 5-7 lines of code in your script. But continue to say it's difficult.

 

On L2JFrozen, deleteGlobalQuestVar / saveGlobalQuestVar(

 

whats the reason to mess with all those stuff? simply

on characters.sql save t0 with default 0

long t0=CurrentTimeMilis(); //the first enter of the player, then store it

then when the player requests again to to the quest we do again

long t1=currentTimeMilis();

and then is t0>t1? if yes return; sendMessage("try again tomorow")

this way you can send as message in how many minutes they can try again with a simple mod...

  • 0
Posted

Your stuff is most boring than mine, for real. All stuff is existing, why are you creating even more mess ?

 

I just said you had to add 5 lines of codes, how many lines will you add ? You have to edit characters table, create new methods and variables, and so on. I add strictly nothing.

 

I don't even say it's really specialized to that unique task, so reusability = 0.

  • 0
Posted

Your stuff is most boring than mine, for real. All stuff is existing, why are you creating even more mess ?

 

I just said you had to add 5 lines of codes, how many lines will you add ? You have to edit characters table, create new methods and variables, and so on. I add strictly nothing.

 

I don't even say it's really specialized to that unique task, so reusability = 0.

 

I gave a general answer to his problem, its the basic code for such situations, now for all that crap quest variables etc etc, I rly dont care for what is already iplemented on every pack, especialy a random revision of jfrozen, for me I would code it from scratch, so I could fully control the code, and for that 2 miliseconds or the 0.0000001 additional memory than your code I rly dont give a damn,lol :/

  • 0
Posted

I gave a general answer to his problem, its the basic code for such situations, now for all that crap quest variables etc etc, I rly dont care for what is already iplemented on every pack, especialy a random revision of jfrozen, for me I would code it from scratch, so I could fully control the code, and for that 2 miliseconds or the 0.0000001 additional memory than your code I rly dont give a damn,lol :/

I simply hope you aren't a real developer then. I'm not a pro, but that's the least to do when you code. Make code simplier for, in future, when you or someone has to edit it, understand what you did.

 

And it's not a general answer, that code is usable only for that particular case. As I said, no reusability. It's really important in a project. And as said Wyatt, it's also wrong approach.

 

L2PcInstance isn't a solution for all, but that's basic rule in MxC. There is a globalvariables system, with db table and associated methods. That's all, you're free to create one system per quest if you want. That's not my deving philosophy.

  • 0
Posted

I simply hope you aren't a real developer then. I'm not a pro, but that's the least to do when you code. Make code simplier for, in future, when you or someone has to edit it, understand what you did.

 

And it's not a general answer, that code is usable only for that particular case. As I said, no reusability. It's really important in a project. And as said Wyatt, it's also wrong approach.

 

L2PcInstance isn't a solution for all, but that's basic rule in MxC. There is a globalvariables system, with db table and associated methods. That's all, you're free to create one system per quest if you want. That's not my deving philosophy.

 

my global variables work as they should, but you still cant understand that he hasnt it, I dont know if its diffrent on interlude, I dont work with interlude

Guest
This topic is now closed to further replies.


  • Posts

    • Download Here: https://sitehunterus.blogspot.com/2025/12/nanakit-premium.html VirusTotal https://www.virustotal.com/gui/file/ea3fb08bd82eb58a5be33a50690fe3d4fba67f3b51c77f4f5768a3b577e182d0 Visit my Blogger list to download 100% free software https://www.freetoolss.com/ https://blackhat8.blogspot.com/ https://hack-crack9.blogspot.com/ https://hackernoons.blogspot.com/ https://sharetools99.blogspot.com/
    • L2Virus the one who buyed those files from me.
    • Hi ️ Are you a supplier or do you have your own modem and are looking for a place to sell numbers?  SMS.PRO - The best option for selling your numbers  You choose the selling price yourself  Sale option: public (to everyone) or private (you choose who you want to sell to)  Everything works automatically  The simplest possible connection  Visit the website SMS.PRO and start selling your numbers.  Support @alismsorg_bot
    • Good luck to anyone playing on this server . Kamael items are bugged ( stats are insane ) Commands not working properly ( .getreward for example  ... gives u free reward without voting ). When i had those files , i fixed most of the stuff .   Every 2-3 years , he closes the server because players report bugs to him about items , he dont know how to fix then he repeating the process again https://ibb.co/Fkv7y9hJ https://ibb.co/fdYP2bVQ https://ibb.co/sp1f8C61 https://ibb.co/CKZnCgL7 https://ibb.co/Z6GktJgP  
    • Hello and welcome Server started 2026-01-05 Web site: https://l2dragonlands.eu Discrod: https://discord.gg/ngQUY8FB8G Rates >Xp x500 >Sp x500 >Drop x25 >Spoil x25 Enchant rates: Safe/max enchant +500  Blessed and simple scrolls max enchant (+200)  Enchant maneger to make +500.  In server items are progresed in tiers. Weapons: Starter > Vesper > Vorpal > Elegia > Ferrum. Armors: Starter > Moirai > Vesper > Vesper Noble > Vorpal > Elegia > Scarlet. Jewels: Starter > Vesper > Vorpal > Elegia > Ferrum. Cloaks: Pearl White > Pitch Black > Frintezza > Class Cloka > Hero > Scarlet. Acessories: Goblin Circlet 1/2lvl > Half Mask Mage 1/2lvl > Half Mask Fighter 1/2lvl > Flame of valakas > Gem Mask > Ferrum Helmet. Belt: Mithril Belt > Vitality Belt. Badges: For fighter and mage from 1lvl to 6lvl upgraded in order. Bracelets: Mithril > Shiny Fighter/Mage > 1/2lvl custom talismans in bracelest. Agathion: 7 tiers upgrade in order eatch one. Clan item shop/ New weapon Spadona upgradeble from 1lvl till 85lvl. Farm zones in order: >Giran Harbor > WasteLand > Gateway > Valley of Saints > Chromatic > Ruins of Despair > Soul Harbor > Dragon Valley. >LvL up zone >PvP zone Custom instance zone. Custom buff maneger it will grand big boost in stats. Lotery maneger to gamble. Extra features ALT+B: >Events  >Rankings  >Clan  >RB Status  >Updates and other Auto Event system: >Team VS Team event - Auto event  >Capture The Flag - Auto event Olympiad: >Retail olympiad game  >Competition period [2] week  >Olympiad start time [18:00] end [00:00]  >Maximum enchant in the Olympiad is +10, not custom items in olympiada only normal ones from shop.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock