Jump to content
  • 0

Question

Posted

And so, my hands got to a quest. Wrote the script, did the dialogue. Compiled, the starting NPC appeared quest dialogue, and there are 3 on 3, it should give the quest. But 0 reactions. I remembered that he still had a client pohimichit. To file questname-e add one line to go square and the first condition. I try but same...

 

It is in the client:

1 800 1 a,TotiSecrets\0 a,Go to master\0 u,Идите к.\\n\0 0 0 -115888.00000000 43568.00000000 524.00000000 17 23 0 a,Trader Erinu\0 1 1 0 50010 -115888.00000000 43568.00000000 524.00000000 a,No Requirements\0 u,Новинка сезона Деревня Kamael! Раскупайте принадлежности, сделанные из П.\0 0 0 0 0 0 243

 

Piece of script:

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

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

 

800-03.htm - then have to add square. But in this dialogue 0 reactions.

Smart heds help advice, maybe I have something somewhere forgot?

3 answers to this question

Recommended Posts

  • 0
Posted

Even if the event would be wrong, you would have default HTM. The code simply don't go to that method, it stops before.

 

If you show "03" and onAdvEvent section, you suggest you successfuly spoke to the guy clicking on Quest, he shows "01", you try "03" and it fails.

 

If I'm wrong consider to give more details. If I'm right, consider to give more details.

 

So, in any case, give more details.

  • 0
Posted

package silentium.scripts.quests;

import java.util.Arrays;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import silentium.commons.utils.Rnd;
import silentium.gameserver.instancemanager.FourSepulchersManager;
import silentium.gameserver.model.actor.L2Npc;
import silentium.gameserver.model.actor.instance.L2PcInstance;
import silentium.gameserver.model.quest.Quest;
import silentium.gameserver.model.quest.QuestState;
import silentium.gameserver.properties.GameServerProperties;
import silentium.gameserver.scripting.ScriptFile;
import silentium.gameserver.utils.Util;

public class Q800_TotiSecret extends Quest implements ScriptFile
{
private static final Logger _log = LoggerFactory.getLogger(Q800_TotiSecret.class.getName());

private static final String qn = "Q800_TotiSecret";

//NPC
private static final int POWER_MASTER = 50010;
private static final int NPC_1 = 30862;
private static final int NPC_2 = 31742;
private static final int NPC_3 = 30694;

//private static final int KILL_1 = 31458;
//private static final int KILL_2 = 31459;
//private static final int KILL_3 = 31412;

//Items
//private static final int ITEM_1 = 7251;
//private static final int ITEM_2 = 7252;
//private static final int ITEM_3 = 7253;
//private static final int ITEM_4 = 7254;
private static final int ITEM_1 = 10042;

// Rewards
private static final int REWARD_1 = 10041;

public Q800_TotiSecret(final int scriptId, final String name, final String dname, final String path)
{
	super(scriptId, name, dname, path);

	questItemIds = new int[]
	{
		ITEM_1,
	};

	addStartNpc(POWER_MASTER);
	addTalkId(POWER_MASTER);
	addTalkId(NPC_1);
	addTalkId(NPC_2);
	addTalkId(NPC_3);

	/*addKillId(KILL_1);
	addKillId(KILL_2);
	addKillId(KILL_3);*/
}

public static void onLoad()
{
	new Q800_TotiSecret(800, "Q800_TotiSecret", "TotiSecret", "Quests");
	if (GameServerProperties.PRINT_QUESTS_LOADING)
	{
		_log.info("Loaded: scripts.quests.Q800_TotiSecret");
	}
}

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

	if ("800-03.htm".equalsIgnoreCase(event)) 
	{
		st.set("cond", "1");
		st.setState(QuestState.STARTED);
		st.playSound(QuestState.SOUND_ACCEPT);
	}
	else if ("801-05.htm".equalsIgnoreCase(event)) 
	{
		st.set("cond", "2");
		st.playSound(QuestState.SOUND_MIDDLE);
	}
	else if ("802-03.htm".equalsIgnoreCase(event)) 
	{
		st.set("cond", "3");
		st.playSound(QuestState.SOUND_MIDDLE); 
	}
	else if ("802-06.htm".equalsIgnoreCase(event))
	{
		st.set("cond", "5");
		st.playSound(QuestState.SOUND_MIDDLE); 
	}
	else if ("801-07.htm".equalsIgnoreCase(event)) 
	{
		st.set("cond", "6");
		st.playSound(QuestState.SOUND_MIDDLE); 
	}
	else if ("803-03.htm".equalsIgnoreCase(event))
	{
		st.set("cond", "7");
		st.playSound(QuestState.SOUND_MIDDLE); 
	}
	else if ("803-06.htm".equalsIgnoreCase(event))
	{
		st.set("cond", "9");
		st.playSound(QuestState.SOUND_MIDDLE); 
	}
	return htmltext;
}

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

	switch (st.getState())
	{
		case QuestState.CREATED:
			if (player.getLevel() >= 80)
			{
				htmltext = "800-1.htm";
			}
			else
			{
				htmltext = "800-00.htm";
				st.exitQuest(true);
			}
			break;

		case QuestState.STARTED:
			final int cond = st.getInt("cond");
			switch (npc.getNpcId())
			{
				case NPC_1:
					if (cond == 1)
					{
						htmltext = "801-1.htm";
					}
					else if (cond == 5)
					{
						htmltext = "801-1.htm";
					}
					else if (cond == 10)
					{
						htmltext = "801-8.htm";
					}
					break;

				case NPC_2:
					if (cond == 2)
					{
						htmltext = "802-1.htm";
					}
					else if (cond == 3)
					{
						htmltext = "802-4.htm";
					}
					else if (cond == 4)
					{
						htmltext = "802-5.htm";
					}
					break;

				case NPC_3:
					if (cond == 6)
					{
						htmltext = "803-1.htm";
					}
					else if (cond == 8)
					{
						htmltext = "803-4.htm";
					}
					break;
			}
			break;

		case QuestState.COMPLETED:
			htmltext = Quest.getAlreadyCompletedMsg();
			break;
	}

	return htmltext;
}
/*@Override
public String onKill(final L2Npc npc, final L2PcInstance player, final boolean isPet)
{
	final QuestState st = player.getQuestState(qn);
	if ((st == null) || !st.isStarted() || !player.isSubClassActive())
	{
		return null;
	}

	final int npcId = npc.getNpcId();		

	if (npcId == KILL_1)
	{
		if (checkPlayerCondition(player, npc, "cond", "3"))
		{
			if (st.dropQuestItems(ITEM_1, 1, 40, 25000))
			{
				st.set("cond", "4");
				st.playSound(QuestState.SOUND_MIDDLE);
			}
		}
	}

	if (npcId == KILL_2)
	{
		if (checkPlayerCondition(player, npc, "cond", "7"))
		{
			if (st.dropQuestItems(ITEM_2, 1, 500, 25000))
			{
				st.set("cond", "8");
				st.playSound(QuestState.SOUND_MIDDLE);
			}
		}
	}

	if (npcId == KILL_3)
	{
		if (checkPlayerCondition(player, npc, "cond", "9"))
		{
			if (!st.hasQuestItems(ITEM_3))
			{
				st.set("cond", "10");
				st.playSound(QuestState.SOUND_MIDDLE);
			}
		}
	}

	return null;
}*/
}

 

When i clik "Quest" oll OK, show 800-1 then i press button and show dialog 800-2 then 800-3 but in 800-3 quest not give to chartoper

  • 0
Posted

It's simple, event is named "800-03.htm", if it follows what you already did, by convention, your htm should be named "800-3.htm".

 

Fix either event names or HTM names. And try to use a unique convention for file naming.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...