Jump to content
  • 0

Question

Posted

Hello i have this qquest working properly tested more than 10 times.

But i am not sure why a player can take the quest again and again after completed.

I want the quest to be done only 1 time by a player.

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package quests.Q701_PathOfNoblesseTwo;


import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;


public class Q701_PathOfNoblesseTwo extends Quest
{
private static final String qn = "Q701_PathOfNoblesseTwo";


// Item
private static final int GRAVE_ROBBERS_HEAD = 1474;
private static final int CARADINES_LETTER = 7678;
private static final int CARADINES_LETTER_1 = 7679;


public Q701_PathOfNoblesseTwo()
{
super(701, qn, "Path Of Noblesse Two");


setItemsIds(GRAVE_ROBBERS_HEAD);


addStartNpc(50011); // Exemia
addTalkId(50011);


addKillId(21353, 21354, 21355); // Varka Silenos Scout, Varka Silenos Hunter, Varka Silenos Shaman
}


@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;


if (event.equalsIgnoreCase("50011-03.htm"))
{
st.setState(STATE_STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}


return htmltext;
}


@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg();
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;


switch (st.getState())
{
case STATE_CREATED:
if (player.getLevel() < 75)
htmltext = "50011-01.htm";
else
htmltext = "50011-02.htm";
break;


case STATE_STARTED:
if (st.getInt("cond") == 1)
htmltext = "50011-04.htm";
else
{
htmltext = "50011-05.htm";
st.takeItems(GRAVE_ROBBERS_HEAD, -1);
st.takeItems(CARADINES_LETTER, -1);
st.giveItems(CARADINES_LETTER_1, 1);
st.rewardItems(57, 3000000);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;

//I Add this 4 lines but still players can do it. 
//Can someone correct it please?
case STATE_COMPLETED:
htmltext = getAlreadyCompletedMsg();
break;
}


return htmltext;
}


@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
{
QuestState st = checkPlayerCondition(player, npc, "cond", "1");
if (st == null)
return null;


if (st.dropItemsAlways(GRAVE_ROBBERS_HEAD, 1, 1000))
st.set("cond", "2");


return null;
}


public static void main(String[] args)
{
new Q701_PathOfNoblesseTwo();
}
}

 

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

Your quest is kinda wrong coded, compare it with any another quest. You messed onTalk and onAdvEvent

 

For example this

st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);

Is supposed to be onAdvEvent, while you put in onTalk. Rework the quest.

 

 

Moved to request dev help.

Edited by SweeTs
  • 0
Posted

Your quest is kinda wrong coded, compare it with any another quest. You messed onTalk and onAdvEvent

 

For example this

st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);

Is supposed to be onAdvEvent, while you put in onTalk. Rework the quest.

 

 

Moved to request dev help.

 

Well this quest is the Q272_WrathOfAncestors from aCis.

I just change the NCPs and mobs and rewards..

  • 0
Posted (edited)

Oh, indeed, Then ignore what I said, I don't rly busy about quests, but that's a lil bit interesting. Some quests are coded like this you, another is coded on the example I told. Else, this quest has old/new writting style, since roko reworked them.

 

Well, I guess you have to wait for Tyky or someone who code quests :D

 

 

Btw, what about the original quest? Have you tried to change only the st.exitQuest(false) and see if you can take it again?

Edited by SweeTs
  • 0
Posted

Oh, indeed, Then ignore what I said, I don't rly busy about quests, but that's a lil bit interesting. Some quests are coded like this you, another is coded on the example I told. Else, this quest has old/new writting style, since roko reworked them.

 

Well, I guess you have to wait for Tyky or someone who code quests :D

 

 

Btw, what about the original quest? Have you tried to change only the st.exitQuest(false) and see if you can take it again?

Well if i leave it this way for now it will cause error or something?

Also i change this:

htmltext = "50011-05.htm";
st.takeItems(GRAVE_ROBBERS_HEAD, -1);
st.takeItems(CARADINES_LETTER, -1);
st.giveItems(CARADINES_LETTER_1, 1);
st.rewardItems(57, 3000000);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);

with this you said:

htmltext = "50011-05.htm";
st.takeItems(GRAVE_ROBBERS_HEAD, -1);
st.takeItems(CARADINES_LETTER, -1);
st.giveItems(CARADINES_LETTER_1, 1);
st.rewardItems(57, 3000000);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(true);

and still not working.

I need to make it work because i have to create more than 20 Quests..

  • 0
Posted (edited)

exitQuest(true) makes it repeatable, leave it false.

 

Cleanup variables from this player from character_quests and try anew. Check content of character_quests for this player on every new state you make (notably the end).

 

While you recoded/tested it, it maybe stucked on a particular state. Another probability is you didn't correctly reloaded, or you forget to update script on your server, as your code seems ok (almost nothing to do to change a quest from repeatable to one time).

Edited by Tryskell

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • 2 euros/h I will need you to mostly follow my main with 3 chars logged from same computer and respond to my messages. Payments daily via paypal. Estimated number of hours needed: 30 I basically need someone to help me boost my supports first 3 days of server's grand opening. Server is opening this Friday at 6pm Paris time and I need you until midnight on Friday and ~12h on Saturday and ~12h on Sunday. Add me on telegram if interested @nikola91ns
    • 📢 L2Elixir Open Beta Announcement Get ready! The Open Beta starts on Saturday, November 15th at 21:00 (UTC +2). Don’t miss it — follow the countdown on our official website! Now then, we present to you our OPEN BETA exclusive event:   Here’s how it works briefly: 1) An NPC named ‘The Judge’ will spawn in Giran for the first 30 minutes of the OPEN BETA. This NPC will spawn at exactly 21:00 UTC+2 on Saturday 15th November 2025. 2) Interact with this NPC and your master account will be given special privileges to obtain Legendary starter pack for all game accounts created. 3) Having spoken to the NPC will allow for all new characters to start with a legendary starter pack on the official launch day on 28th November 2025, 21:00 UTC+2. 4) ‘The Judge’ will reward the first 2 players and 2 more Random participants with a PREMIUM Account which will be activated on 28th November 2025!!! 4) Send message to @Ray on Forum or Discord with your Forum name to get Legendary Role on Discord! Good luck! Legendary starter pack:
    • Hello everyone!   The gates of Aden are opening, prepare for the ultimate adventure and claim your place among legends. Our server launch is getting closer.. Adventurers of Aden, the wait is over! On November 28th, 2025, a new era begins. Get ready to step into the epic world of Lineage 2, where legends are forged, battles are relentless, and glory awaits the brave. https://www.l2ertheia.eu/news:server-launch/
    • - New Features in Anosim https://anosim.net -   You can now share your numbers with others via a unique link - no need to give them access to your account! How to Share Number https://prnt.sc/K83lxOjS-Fyb   How to Revoke Accsess: https://prnt.sc/jkVIQS2lhxvA   --- --- --- --- --- --- --- New OTP / SMS Activation Locations: - USA  - Australia - Honduras - Kenia
    • How to Create Multi-Accounts For TikTok, Youtube, Gmail....   Short Guide to Managing Multiple TikTok Accounts TikTok's anti-spam systems detect duplicate accounts via device IDs, IP addresses, and behavior. To avoid bans, follow these methods. 1. For 3-5 Accounts (Easiest) Use TikTok's built-in feature to add accounts in your app settings. Limitation: Frequent switching on the same device/IP can still trigger restrictions. 2. For Bulk Accounts (Safest) To make each account appear unique, you need to mask your digital footprint. Unique Emails & Proxies: Use a separate email and a residential/mobile proxy (e.g., MoMoProxy) for each account. Avoid free proxies. Anti-Detect Browsers: Use tools like AdsPower or Multilogin to create unique browser profiles, each with its own proxy and randomized digital fingerprint.   MoMoProxy Integrate with Adspower Browser   Process: In each unique browser profile, log into a separate Gmail and then create the TikTok account. 3. For One Device (Limited Use) Use app cloners like Parallel Space (Android) or Dual Space (iOS). Limitation: Not foolproof, as TikTok can sometimes detect cloned apps. Key Best Practices to Avoid Bans: Isolation: Use one proxy and one device/browser profile per account. Warm-Up: Act organically—watch videos, like, and comment—before posting content. Appear Unique: Use different usernames, bios, and profile pictures for each account. Avoid VPNs: Standard VPN IPs are often detected and flagged.   Youtube Video On How to Create TikTok Accounts  https://youtu.be/ZUihXj7BO4M  
  • Topics

×
×
  • Create New...

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