Jump to content
  • 0

Give a quest to all character in account


Yuna

Question


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   5
  • Joined:  03/16/16
  • Last Seen:  

Is it possible to give a certain quest to ALL the characters in an account through a script?
For example, when character A received the quest, Character B, C & D (which are in the same account) also receive the quest.
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  255
  • Reputation:   232
  • Joined:  07/24/13
  • Last Seen:  

1 hour ago, Yuna said:
Is it possible to give a certain quest to ALL the characters in an account through a script?
For example, when character A received the quest, Character B, C & D (which are in the same account) also receive the quest.
/* setaccountquest(1001); */
function	script	setaccountquest	{
	.@quest_id = getarg(0);
	setquest .@quest_id;
	query_sql("SELECT char_id FROM `char` WHERE account_id = "+getcharid(3)+" AND char_id != "+getcharid(0)+";", .@char_id);
	sleep2 100;
	query_sql("SELECT time FROM `quest` WHERE char_id = "+getcharid(0)+" AND `quest_id` = "+.@quest_id+";", .@timestamp);
	for(set .@i,0; .@i < getarraysize(.@char_id); .@i++)
		query_sql("INSERT IGNORE INTO `quest` (`char_id`, `quest_id`, `state`, `time`, `count1`, `count2`, `count3`) VALUES ("+.@char_id[.@i]+", "+.@quest_id+", '1', '"+.@timestamp+"', 0, 0, 0);");
	return;
}
/* completeaccountquest(1001); */
function	script	completeaccountquest	{
	.@quest_id = getarg(0);
	completequest .@quest_id;
	query_sql("SELECT char_id FROM `char` WHERE account_id = "+getcharid(3)+" AND char_id != "+getcharid(0)+";", .@char_id);
	for(set .@i,0; .@i < getarraysize(.@char_id); .@i++)
		query_sql("UPDATE `quest` SET `state` = '2' WHERE `char_id` = "+.@char_id[.@i]+" AND `quest_id` = "+.@quest_id+";");
	return;
}
/* eraseaccountquest(1001); */
function	script	eraseaccountquest	{
	.@quest_id = getarg(0);
	erasequest .@quest_id;
	query_sql("SELECT char_id FROM `char` WHERE account_id = "+getcharid(3)+" AND char_id != "+getcharid(0)+";", .@char_id);
	for(set .@i,0; .@i < getarraysize(.@char_id); .@i++)
		query_sql("DELETE FROM `quest` WHERE `char_id` = "+.@char_id[.@i]+" AND `quest_id` = "+.@quest_id+";");
	return;
}
/* changeaccountquest(1001,1002); */
function	script	changeaccountquest	{
	.@quest_id1 = getarg(0);
	.@quest_id2 = getarg(1);
	changequest .@quest_id1, .@quest_id2;
	query_sql("SELECT char_id FROM `char` WHERE account_id = "+getcharid(3)+" AND char_id != "+getcharid(0)+";", .@char_id);
	for(set .@i,0; .@i < getarraysize(.@char_id); .@i++)
		query_sql("UPDATE `quest` SET `quest_id` = "+.@quest_id2+" WHERE `char_id` = "+.@char_id[.@i]+" AND `quest_id` = "+.@quest_id1+" AND `state` != '2';");
	return;
}

 

Edited by Balfear
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

#is_q1_ready = 1; //Start quest for all characters in ID

then just check account variables.

if(#is_q1_ready){

//Do something.

}

Link to comment
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.   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...