Jump to content
  • 0
Sign in to follow this  
fiction

H> unlock menu with certain requeriments

Question

Hi, i'm wondering if is possible to unlock menu option of a NPC with certain requeriments.

For example, the NPC give 3 menu options.

- The first one will be in black (available), because is the default option

- The second one will be in gray (unavailable), until the character complete certain requeriment (quest chain for example).

    When the character complete the previous quest chain and talk again to the npc, the menu will turn in black meaning that the option is available for use.

- The third option, is the same logic that the previous one (second option).

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

why not?

prontera,155,185,5	script	quest	1_F_MARIA,{
	mes "quest giver";
	next;
	for ( .@i = 0; .@i < 3; ++.@i )
		.@menu$[.@i] = sprintf( _$( "%sQuest %d" ), F_MesColor((quest > .@i *2)? C_GRAY : C_BLACK), .@i +1 );
	.@s = select( implode( .@menu$, ":" ) ) -1;
	.@state = .@s *2;
	if ( quest > .@state ) {
		mes "you have completed this quest";
		close;
	}
	else if ( quest < .@state ) {
		mes "you can't take this quest yet.";
		close;
	}
	mesf "Go talk to npc %d", .@s +1;
	quest = .@state +1;
	close;
}
function	script	F_quest_state	{
	.@npcid = getarg(0);
	.@state = (.@npcid -1) *2 +1;
	if ( quest == .@state ) {
		dispbottom sprintf( _$( "complete %d" ), .@npcid );
		quest = .@state +1;
	}
	end;
}
prontera,150,180,5	script	npc 1	1_F_MARIA,{ F_quest_state(1); }
prontera,155,180,5	script	npc 2	1_F_MARIA,{ F_quest_state(2); }
prontera,160,180,5	script	npc 3	1_F_MARIA,{ F_quest_state(3); }

prontera,160,185,5	script	reset	1_F_MARIA,{ quest = 0; }

 

and this is quest log with achievement system

{
	Id: 49920
	Name: "Quest 1"
},
{
	Id: 49921
	Name: "Quest 2"
},
{
	Id: 49922
	Name: "Quest 3"
},
	[49920] = {
		Title = "Quest 1",
		IconName = "ico_nq.bmp",
		Description = {
			"Talk to <NAVI>NPC 1<INFO>prontera,150,180,</INFO></NAVI>"
		},
		Summary = "Talk to NPC 1",
		NpcSpr = "1_F_MARIA",
		NpcNavi = "prontera",
		NpcPosX = 150,
		NpcPosY = 180,
	},
	[49921] = {
		Title = "Quest 2",
		IconName = "ico_nq.bmp",
		Description = {
			"Talk to <NAVI>NPC 2<INFO>prontera,155,180,</INFO></NAVI>"
		},
		Summary = "Talk to NPC 2",
		NpcSpr = "1_F_MARIA",
		NpcNavi = "prontera",
		NpcPosX = 155,
		NpcPosY = 180,
	},
	[49922] = {
		Title = "Quest 3",
		IconName = "ico_nq.bmp",
		Description = {
			"Talk to <NAVI>NPC 3<INFO>prontera,160,180,</INFO></NAVI>"
		},
		Summary = "Talk to NPC 3",
		NpcSpr = "1_F_MARIA",
		NpcNavi = "prontera",
		NpcPosX = 160,
		NpcPosY = 180,
	}
{
	Id: 109993
	Name: "Custom Quest"
	Type: "ACH_QUEST"
	Objectives: {
		*1: {
			Description: "Complete Quest 1"
		}
		*2: {
			Description: "Complete Quest 2"
		}
		*3: {
			Description: "Complete Quest 3"
		}
	}
	Points: 0
},
	[109993] = {
		UI_Type = 0,
		group = "CHATTING",
		major = 4,
		minor = 0,
		title = "Custom Quest",
		content = {
			summary = "Visit the Quest Giver",
			details = "Visit the Quest Giver."
		},
		resource = {
			[1] = { text = "Complete Quest 1" },
			[2] = { text = "Complete Quest 2" },
			[3] = { text = "Complete Quest 3" }
		},
		score = 0
	},
prontera,155,185,5	script	quest	1_F_MARIA,{
	mes "quest giver";
	next;
	for ( .@i = 0; .@i < 3; ++.@i )
		.@menu$[.@i] = sprintf( _$( "%sQuest %d" ), F_MesColor((questprogress( 49920+ .@i ) == 2)? C_GRAY : C_BLACK), .@i +1 );
	.@s = select( implode( .@menu$, ":" ) ) -1;
	.@qid = 49920+ .@s;
	if ( questprogress(.@qid) == 2 ) {
		mes "you have completed this quest";
		close;
	}
	else if ( .@qid == 49920 ); // break;
	else if ( questprogress(.@qid -1) != 2 ) {
		mes "you can't take this quest yet.";
		close;
	}
	mesf "Go talk to npc %d", .@s +1;
	if ( questprogress(.@qid) == 0 )
		setquest .@qid;
	close;
}
function	script	F_quest_state	{
	.@npcid = getarg(0);
	.@qid = .@npcid -1 + 49920;
	if ( questprogress(.@qid) == 1 ) {
		completequest .@qid;
		dispbottom sprintf( _$( "complete %d" ), .@npcid );
		achievement_progress 109993, .@npcid, 1, 1;
	}
	end;
}
prontera,150,180,5	script	npc 1	1_F_MARIA,{ F_quest_state(1); }
prontera,155,180,5	script	npc 2	1_F_MARIA,{ F_quest_state(2); }
prontera,160,180,5	script	npc 3	1_F_MARIA,{ F_quest_state(3); }

prontera,160,185,5	script	reset	1_F_MARIA,{
	for ( .@i = 49920; .@i <= 49922; ++.@i )
		if ( questprogress(.@i) )
			erasequest(.@i);
	end;
}

 

have fun playing with it :P

actually this is very simple script, just wanna play around a little bit

Share this post


Link to post
Share on other sites
  • 0

@AnnieRuru what is the way to breakdown the menu in separate case.

For example, if the player have complete a "x" quest, the first option will do something, and the other another thing and so on

 

@edit

  NVM, I solved what I was looking for

Edited by fiction
solved

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.