Jump to content

Custom Quest Error


amarhat

Recommended Posts

Hello, I'm trying to incorporate quest custom in l2jsunrise, but I can't do it. Copy the quest (Q00258_BringWolfPelts), rename it to (Q10506_BringWolfPelts1) ... create a new npc for the quest "32890" embed it in the Q1060_BringWolfPelts1.java

 

Original BringWolfPelts

 

Quote

/*
 * Copyright (C) 2004-2013 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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.Q00258_BringWolfPelts;

import java.util.HashMap;
import java.util.Map;

import l2r.gameserver.enums.QuestSound;
import l2r.gameserver.model.actor.L2Npc;
import l2r.gameserver.model.actor.instance.L2PcInstance;
import l2r.gameserver.model.quest.Quest;
import l2r.gameserver.model.quest.QuestState;
import l2r.gameserver.model.quest.State;

/**
 * Bring Wolf Pelts (258)
 * @author xban1x
 */
public final class Q00258_BringWolfPelts extends Quest
{
    // Npc
    private static final int LECTOR = 30001;
    // Item
    private static final int WOLF_PELT = 702;
    // Monsters
    private static final int[] MONSTERS = new int[]
    {
        20120, // Wolf
        20442, // Elder Wolf
    };
    // Rewards
    private static final Map<Integer, Integer> REWARDS = new HashMap<>();
    
    static
    {
        REWARDS.put(390, 1); // Cotton Shirt
        REWARDS.put(29, 6); // Leather Pants
        REWARDS.put(22, 9); // Leather Shirt
        REWARDS.put(1119, 13); // Short Leather Gloves
        REWARDS.put(426, 16); // Tunic
    }
    
    // Misc
    private static final int MIN_LVL = 3;
    private static final int WOLF_PELT_COUNT = 40;
    
    public Q00258_BringWolfPelts()
    {
        super(258, Q00258_BringWolfPelts.class.getSimpleName(), "Bring Wolf Pelts");
        addStartNpc(LECTOR);
        addTalkId(LECTOR);
        addKillId(MONSTERS);
        registerQuestItems(WOLF_PELT);
    }
    
    @Override
    public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    {
        final QuestState st = player.getQuestState(getName());
        if ((st != null) && event.equalsIgnoreCase("30001-03.html"))
        {
            st.startQuest();
            return event;
        }
        return null;
    }
    
    @Override
    public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
    {
        final QuestState st = killer.getQuestState(getName());
        if ((st != null) && st.isCond(1))
        {
            st.giveItems(WOLF_PELT, 1);
            if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT)
            {
                st.setCond(2, true);
            }
            else
            {
                st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
            }
        }
        return super.onKill(npc, killer, isSummon);
    }
    
    @Override
    public String onTalk(L2Npc npc, L2PcInstance player)
    {
        final QuestState st = getQuestState(player, true);
        String htmltext = getNoQuestMsg(player);
        if (st == null)
        {
            return htmltext;
        }
        
        switch (st.getState())
        {
            case State.CREATED:
            {
                htmltext = (player.getLevel() >= MIN_LVL) ? "30001-02.htm" : "30001-01.html";
                break;
            }
            case State.STARTED:
            {
                switch (st.getCond())
                {
                    case 1:
                    {
                        htmltext = "30001-04.html";
                        break;
                    }
                    case 2:
                    {
                        if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT)
                        {
                            final int chance = getRandom(16);
                            for (Map.Entry<Integer, Integer> reward : REWARDS.entrySet())
                            {
                                if (chance < reward.getValue())
                                {
                                    st.giveItems(reward.getKey(), 1);
                                    break;
                                }
                            }
                            st.exitQuest(true, true);
                            htmltext = "30001-05.html";
                            break;
                        }
                    }
                }
                break;
            }
        }
        return htmltext;
    }
}
 

 

Edited Quest

 

Quote

/*
 * Copyright (C) 2004-2013 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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.Q10506_BringWolfPelts1;

import java.util.HashMap;
import java.util.Map;

import l2r.gameserver.enums.QuestSound;
import l2r.gameserver.model.actor.L2Npc;
import l2r.gameserver.model.actor.instance.L2PcInstance;
import l2r.gameserver.model.quest.Quest;
import l2r.gameserver.model.quest.QuestState;
import l2r.gameserver.model.quest.State;

/**
 * Bring Wolf Pelts (258)
 * @author xban1x
 */
public final class Q10506_BringWolfPelts1 extends Quest
{
    // Npc
    private static final int LECTOR = 32890;
    // Item
    private static final int WOLF_PELT = 702;
    // Monsters
    private static final int[] MONSTERS = new int[]
    {
        20120, // Wolf
        20442, // Elder Wolf
    };
    // Rewards
    private static final Map<Integer, Integer> REWARDS = new HashMap<>();
    
    static
    {
        REWARDS.put(390, 1); // Cotton Shirt
        REWARDS.put(29, 6); // Leather Pants
        REWARDS.put(22, 9); // Leather Shirt
        REWARDS.put(1119, 13); // Short Leather Gloves
        REWARDS.put(426, 16); // Tunic
    }
    
    // Misc
    private static final int MIN_LVL = 3;
    private static final int WOLF_PELT_COUNT = 40;
    
    public Q10506_BringWolfPelts1()
    {
        super(10506, Q10506_BringWolfPelts1.class.getSimpleName(), "Bring Wolf Pelts");
        addStartNpc(LECTOR);
        addTalkId(LECTOR);
        addKillId(MONSTERS);
        registerQuestItems(WOLF_PELT);
    }
    
    @Override
    public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    {
        final QuestState st = player.getQuestState(getName());
        if ((st != null) && event.equalsIgnoreCase("32890-03.html"))
        {
            st.startQuest();
            return event;
        }
        return null;
    }
    
    @Override
    public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
    {
        final QuestState st = killer.getQuestState(getName());
        if ((st != null) && st.isCond(1))
        {
            st.giveItems(WOLF_PELT, 1);
            if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT)
            {
                st.setCond(2, true);
            }
            else
            {
                st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
            }
        }
        return super.onKill(npc, killer, isSummon);
    }
    
    @Override
    public String onTalk(L2Npc npc, L2PcInstance player)
    {
        final QuestState st = getQuestState(player, true);
        String htmltext = getNoQuestMsg(player);
        if (st == null)
        {
            return htmltext;
        }
        
        switch (st.getState())
        {
            case State.CREATED:
            {
                htmltext = (player.getLevel() >= MIN_LVL) ? "32890-02.htm" : "32890-01.html";
                break;
            }
            case State.STARTED:
            {
                switch (st.getCond())
                {
                    case 1:
                    {
                        htmltext = "32890-04.html";
                        break;
                    }
                    case 2:
                    {
                        if (st.getQuestItemsCount(WOLF_PELT) >= WOLF_PELT_COUNT)
                        {
                            final int chance = getRandom(16);
                            for (Map.Entry<Integer, Integer> reward : REWARDS.entrySet())
                            {
                                if (chance < reward.getValue())
                                {
                                    st.giveItems(reward.getKey(), 1);
                                    break;
                                }
                            }
                            st.exitQuest(true, true);
                            htmltext = "32890-05.html";
                            break;
                        }
                    }
                }
                break;
            }
        }
        return htmltext;
    }
}
 

 

QUEST NPC BYPASS

 

Quote

<html><body>Trader Lector:<br>
I may be a merchant now, but I used to be a <font color="LEVEL">Leather Cutter.</font> I used to work for Duke Van Dyke in my early days. During the Elmore War, I made hundreds of leather armors for the Duke's soldiers in ten days. Even after retiring, I still practice making leather armor from time to time to keep my skills sharp.<br>
A few days ago, Consul Sir Windawood came to see me himself and asked me to make fifty leather armors for the newly established militia. I can make that many on my own, but I don't have enough materials. I need quite a few more <font color="LEVEL">wolf pelts.</font> Can I ask you to find them for me?<br>
<a action="bypass -h Quest Q10506_BringWolfPelts1 32890-03.html">Say that you'll help.</a>
</body></html>

 

And when starting the server I have an error.

 

[22:43:02] WARN: Failed loading: (C:\Server\game\data\scripts\quest\Q10506_BringWolfPelts1\Q10506_BringWolfPelts1.java) @ scripts.ini:13 - Reason: doesnt exists or is not a file.
 
What is missing ?

 

I Copy this Post  in this forum....

 

https://maxcheaters.com/topic/245452-how-can-i-make-a-custom-quest-hf/

https://maxcheaters.com/topic/234528-custom-quest/

 

 

Edited by amarhat
Link to comment
Share on other sites

You need to add the script path in your script loading list. (forgot the name since I did not touch l2 for more that 2 years xd) Its usually in the same folder where your quest folders are.

Edit: "questmasterhandler.java"

  • Like 1
Link to comment
Share on other sites

On 2/12/2023 at 7:55 AM, Finn said:

You need to add the script path in your script loading list. (forgot the name since I did not touch l2 for more that 2 years xd) Its usually in the same folder where your quest folders are.

Edit: "questmasterhandler.java"

 

Yes! i d it ! but i have this error !

 

[22:43:02] WARN: Failed loading: (C:\Server\game\data\scripts\quest\Q10506_BringWolfPelts1\Q10506_BringWolfPelts1.java) @ scripts.ini:13 - Reason: doesnt exists or is not a file.

 

"questmasterhandler.java" i not in my package ! My file name is  SCRIPT.INI in  game\data\

 

Quote

# This file contains a list of scripts that should be loaded by the GameServer
# The path is relative to the scripts folder, for example scripts/event.py would
# require the following entry:
# event.py
#
# Note: You can also load an script during server runtime using the Admin Panel

# Global Loader
handlers/loader/GlobalLoader.java

conquerablehalls/flagwar/BanditStronghold/BanditStronghold.java
conquerablehalls/flagwar/WildBeastReserve/WildBeastReserve.java

quest/Q10506_BringWolfPelts1/Q10506_BringWolfPelts1.java

 

If Put the rute of quest  in this file i have the error in console ! I do not know what to do.....

 

 

 

Link to comment
Share on other sites

did u set the class for it? same file just scroll down. also activate custom quests in your setting file. dont know how sunrise handles it. might be different.

Edited by Finn
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Finn said:

did u set the class for it? same file just scroll down. also activate custom quests in your setting file. dont know how sunrise handles it. might be different.

Thx !  Its Works !  I had not registered all the files in the handlers loaders !!!!!

 

Thx So much ! ! 

 

Link to comment
Share on other sites

  • Vision locked this topic
Guest
This topic is now closed to further replies.


×
×
  • Create New...