Jump to content
  • 0

Q511_olympiadStarter


Question

Posted

Hi EveryOne.

I tried to rewrite Quest 551_OlympiadStarter from l2rebellion  to L2jserver.

I need help from users because i have some misunderstanding.

The Problem is that i cant remake  st.setState(2); st.setState(3); st.setState(1);

 

Sorry Maby its wrong dissision.

 

L2Rebellion Quest Script

package l2r.scripts.quests;

import l2r.extensions.scripts.ScriptFile;
import l2r.gameserver.model.L2Player;
import l2r.gameserver.model.L2SubClass;
import l2r.gameserver.model.entity.olympiad.Olympiad;
import l2r.gameserver.model.instances.L2NpcInstance;
import l2r.gameserver.model.quest.Quest;
import l2r.gameserver.model.quest.QuestState;

public class _551_OlympiadStarter extends Quest
  implements ScriptFile
{
  private static final int _npc = 31688;
  private static final int _olymp3 = 17238;
  private static final int _olymp5 = 17239;
  private static final int _olymp10 = 17240;
  private static final int _olympChest = 17169;

  public _551_OlympiadStarter()
  {
    super(false);
    addStartNpc(31688);
    addTalkId(new int[] { 31688 });
    addQuestItem(new int[] { 17169 });
    addQuestItem(new int[] { 17240 });
    addQuestItem(new int[] { 17239 });
    addQuestItem(new int[] { 17238 });
  }

  public String onEvent(String paramString, QuestState paramQuestState, L2NpcInstance paramL2NpcInstance)
  {
    L2Player localL2Player = paramQuestState.getPlayer();
    int i = paramQuestState.getCond();
    String str = paramString;
    if (paramQuestState == null)
      return str;
    if (paramL2NpcInstance.getNpcId() == 31688)
    {
      if (i == 1)
        if (paramString.equals("31688-03.htm"))
        {
          paramQuestState.setState(2);
          paramQuestState.setCond(Olympiad.getCompetitionDone(localL2Player.getObjectId()));
          paramQuestState.setCond(1);
          paramQuestState.playSound(SOUND_ACCEPT);
        }
        else if (paramString.equals("exchange"))
        {
          if ((paramQuestState.getQuestItemsCount(17238) >= 1L) || (paramQuestState.getQuestItemsCount(17239) >= 1L) || (paramQuestState.getQuestItemsCount(17240) >= 1L))
          {
            if ((i == 2) && (paramQuestState.getQuestItemsCount(17238) >= 1L))
            {
              paramQuestState.giveItems(17169, 1L);
              paramQuestState.takeItems(17238, 1L);
              paramQuestState.playSound(SOUND_ITEMGET);
            }
            if ((i == 3) && (paramQuestState.getQuestItemsCount(17239) >= 1L))
            {
              paramQuestState.giveItems(17169, 2L);
              paramQuestState.takeItems(17239, 1L);
              paramQuestState.playSound(SOUND_ITEMGET);
            }
            if ((i == 4) && (paramQuestState.getQuestItemsCount(17240) >= 1L))
            {
              paramQuestState.giveItems(17169, 4L);
              paramQuestState.takeItems(17240, 1L);
              paramQuestState.playSound(SOUND_ITEMGET);
              paramQuestState.setState(3);
              paramQuestState.playSound(SOUND_FINISH);
              paramQuestState.exitCurrentQuest(false);
            }
            return "31688-06.htm";
          }
          return "31688-07.htm";
        }
      return "31688-05.htm";
    }
    return str;
  }

  public String onTalk(L2NpcInstance paramL2NpcInstance, QuestState paramQuestState)
  {
    L2Player localL2Player = paramQuestState.getPlayer();
    String str = "noquest";
    if (paramQuestState == null)
      return str;
    if (Olympiad._inCompPeriod)
    {
      if ((localL2Player.getLevel() >= 75) && (localL2Player.getActiveClass().isBase()) && (localL2Player.isNoble()))
      {
        if (paramQuestState.getState() == 3)
          return "31688-01.htm";
        return "31688-00.htm";
      }
      return "31688-02.htm";
    }
    return "31688-08.htm";
  }

}

 

L2jServer Quest Script

import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.base.SubClass;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;

public class Q551_OlympiadStarter extends Quest
{
  private static final String qn = "Q551_OlympiadStarter";
  //Npc
  private static final int OlyManager = 31688;
  //Items
  private static final int _olymp3 = 17238;
  private static final int _olymp5 = 17239;
  private static final int _olymp10 = 17240;
  private static final int _olympChest = 17169;
  
  public String onEvent(String event, QuestState st, L2PcInstance player, L2NpcInstance npc)
  {
    String htmltext = event;
    if (st == null)
        htmltext = getNoQuestMsg(player);
    
        if (npc.getNpcId() == 31688)
        {
            if (event.equals("31688-03.htm"))
            {
                st.setState(2);
                st.set("cond","Olympiad.getCompetitionDone(Player.getObjectId())");
                st.set("cond", "1");
                st.playSound("ItemSound.quest_accept");
            }
            else if (event.equals("exchange"))
            {
                if ((st.getQuestItemsCount(17238) >= 1L) || (st.getQuestItemsCount(17239) >= 1L) || (st.getQuestItemsCount(17240) >= 1L))
                {
                    if ((i == 2) && (st.getQuestItemsCount(17238) >= 1L))
                    {
                        st.giveItems(17169, 1L);
                        st.takeItems(17238, 1L);
                        st.playSound("ItemSound.quest_itemget");
                    }
                    if ((i == 3) && (st.getQuestItemsCount(17239) >= 1L))
                    {
                        st.giveItems(17169, 2L);
                        st.takeItems(17239, 1L);
                        st.playSound("ItemSound.quest_itemget");
                    }
                    if ((i == 4) && (st.getQuestItemsCount(17240) >= 1L))
                    {
                        st.giveItems(17169, 4L);
                        st.takeItems(17240, 1L);
                        st.playSound("ItemSound.quest_itemget");
                        st.setState(3);
                        st.playSound("ItemSound.quest_finish");
                        st.exitQuest(false);
                    }
                    return "31688-06.htm";
                }
                return "31688-07.htm";
            }
                return "31688-05.htm";
            }
    return htmltext;
  }
  public String onTalk(L2NpcInstance npc, L2PcInstance player)
  {
        String htmltext = getNoQuestMsg(player);
        QuestState st = player.getQuestState(qn);
    
        if (st == null)
            return htmltext;        
            
        if (Olympiad._inCompPeriod)
        {
            if ((player.getLevel() >= 75)  && (player.isNoble()))
            {
                if (st.getInt("cond") == 3)
                    htmltext ="31688-01.htm";
                else
                    htmltext ="31688-00.htm";
            }
            else 
                htmltext ="31688-02.htm";            
        }
        else
           htmltext ="31688-08.htm";
    return htmltext; 
  }  
  
  public Q551_OlympiadStarter(int questId, String name, String descr)
  {
    super(questId, name, descr);
    addStartNpc(OlyManager);
    addTalkId(OlyManager);   
    questItemIds = new int[] {_olymp3}; 
    questItemIds = new int[] {_olymp5};    
    questItemIds = new int[] {_olymp10};
    questItemIds = new int[] {_olympChest};
  }  
  
    public static void main(String[] args)
    {
        new Q551_OlympiadStarter(551, qn, "Olympiad Starter");
    }  
}  

 

Html Files

31688-01.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Данное задание выполняется раз в сутки, по таймеру. Каждое утро в 6:30 таймер сбрасывается<br>
<br>
</body>
</html>
____________
31688-02.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Я немогу позволить тебе выполнить это задание!<br>
(Этот квест могут выполнять только персонажи выше 75 уровня основным классом)<br>
<br>
</body>
</html>
___________
31688-03.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Всё что тебе надо сделать - провести на олимпиаде 10 матчей. Мы не смотрим на исход, мы смотрим на твою смелость! Почему бы не подраться за хорошую награду?!<br>
Награда:<br>
Olympiad Match 3 Participation Certificate - за 3 проведенных матча.</br>
Olympiad Match 5 Participation Certificate - за 5 проведенных матчей.</br>
Olympiad Match 10 Participation Certificate- за 10 проведенных матчей.<br>
<a action="bypass -h Quest _551_OlympiadStarter 31688-05.htm">Я согласен.</a><br>
<br>
</body>
</html>
____________
31688-05.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Ты готов доказать свою смелость?<br>
<a action="bypass -h Quest _551_OlympiadStarter exchange">Да</a><br>
<br>
</body>
</html>
____________
31688-06.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Ты отлично справился, вот твоя награда!<br>
<br>
</body>
</html>
___________
31688-07.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Тебе не обмануть меня!<br>
(У вас недостаточно квестовых предметов)
<br>
</body>
</html>
___________
31688-08.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Олимпиада ещё не началась!<br>
<br>
</body>
</html>

1 answer to this question

Recommended Posts

  • 0
Posted

setState refers to one of the possible enum states, aka State.CREATED, State.STARTED && State.COMPLETED.

 

Following code is wrong :

questItemIds = new int[] {_olymp3}; 
    questItemIds = new int[] {_olymp5};    
    questItemIds = new int[] {_olymp10};
    questItemIds = new int[] {_olympChest};

, must be written :

questItemIds = new int[] {_olymp3, _olymp5, _olymp10, _olympChest};

 

Finally, if you have only one NPC in that script, the check about npcId are useless. The only use of that check is to differentiate behavior according of the NPC.

 

Exemple : you got 1 NPC to start and speak, and 4 mobs registered on onKill. There's no need for npcId check on onTalk and onAdvEvent, but there's (perhaps, not even sure, if all mobs got same behavior it's pointless) surely a check on npcId.

 

I say that, I say nothing :P.

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

    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server!  Create your free account here
    • Dalam World — This is a new gaming project that brings together all the mechanics of your favorite games! I want to say right away that the game will run on all devices: Windows, Linux, macOS (Intel/Apple)! The Dalam World client features advanced graphics that will look great! The client also provides stable FPS even with a huge number of players! Dalam World is not a Salve or Chronicle client ported upward — it’s a completely remade game on its own proprietary game engine! Dalam World servers allow more than 100,000 people to exist in a single world without virtual instances, thanks to server technologies built with Elixir and Rust! Dalam World is the childhood game we love so much! From each of our favorite MMOs we took only the best elements! Low system requirements will let the game run on an old laptop! We redesigned the game so there are no bots or real-money traders! Game website: https://Dalam.World Game forum: https://Dalam.World/forums/ For arbitragers: https://careers.dalam.world/ Discord: https://discord.gg/vbQ347nuxd Telegram: https://t.me/+u1DNZPzscaRmNjYx Opening July 16, 2026 at 16:00 UTC!  
    • I'll give you my wallet if you want, haha
    • To make up for some of the waiting time we’re hosting a 3v3 Tournament on open Beta, and this time we’re raising the stakes with a $1,300 prize pool 💰   🏆 PRIZE POOL BREAKDOWN (Over 2000$ Worth of prices total)   🥇 1st Place — $700 🥈 2nd Place —$300 🥉 3rd Place — $200 🏅 4th Place — $100  5th -6th Place - $100 in Gold Coins each    All Participating Teams: $50 in Gold!   All Prices will be Paid out instantly after the tour, no waiting time and conditions. This is not simply a marketing move, we want to give back to the community.   📅 Date: Wednesday 06.05.2026 ⏰ Time: 20:00 Central European Timezone (Berlin) 📍Format: 3v3   ⚔️Why join? Cash Prices for top 4 and rewards for all participants Payments to winners sent out straight after the tournament - No waiting time or rules that you have to play live server to obtain the reward. Clean format, smooth matches, and solid prize pool and a chance to experience our brand new files   📝How to join: Form your 3-player team Group Leader Sign up here: ⁠📍・3v3-tour-registration (Include Name of Group, Name of Group Leader)   Be ready on match day!     A separate post with rules for the tournament and class setups will follow shortly.   Tag your teammates, lock in your roster, and get ready to compete. We'll be happy to see you on the OBT!   💬 Questions? Ask in ⁠🎫・ticket or send us a message   See you on L2Dark! 😏   Discord: https://discord.gg/FAJwnFpb8M
    • You should check if that condition is supported by your current sources. You can find this in  DocumentBase#parsePlayerCondition If it isnt there and you want to follow the same pattern of the other item conditions, create a custom condition to parse the classId (or multiple class ids) (there are examples to copy the code). Alternatively, you can create your own condition handler. Your condition should look like this: <cond msgId="1518"> <or> <player classId="ADVENTURER" /> <player classId="PALADIN" /> </or> </cond> or <cond msgId="1518"> <or> <player classId="93" /> <player classId="5" /> </or> </cond>  
  • 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..