Yuna Posted February 22, 2020 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 96 Reputation: 5 Joined: 03/16/16 Last Seen: May 30, 2023 Share Posted February 22, 2020 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. Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted February 22, 2020 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted February 22, 2020 (edited) 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 February 22, 2020 by Balfear 1 Quote Link to comment Share on other sites More sharing options...
0 Start_ Posted February 23, 2020 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: Yesterday at 02:57 AM Share Posted February 23, 2020 #is_q1_ready = 1; //Start quest for all characters in ID then just check account variables. if(#is_q1_ready){ //Do something. } Quote Link to comment Share on other sites More sharing options...
Question
Yuna
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.