Today i have a new question (and need support for becaus im newbie :P).
I want to create a question progression function/script that'll interact with some quests npc(or every single one). Course this progression i want its only for mob hunting and item collect.
I found a script that made quest and have the @checkquest command(i want a command too) but unfortunately the script have some limitations and obviously i dont have the knowledge to modify it and a plus, it is in SQL(i know nothing in SQL).
Here's the code:
// Custom atcommand: @checkquest
bindatcmd "checkquest","QuestSysEvents::OnPCLoginEvent";
set $@QSys,1; // Quest System loaded
end;
}
- script QuestSysEvents -1,{
OnNPCKillEvent:
if(!$@q_tab) end;
set .KilledMob,killedrid;
// Player in Party?
if(getcharid(1) != 0)
addrid(2,1,getcharid(1));
if(getarraysize(@quest_mobid) < 1)
query_sql "SELECT `mob_id` , `mob_am` , `req_am` , `npc_id` , `quest_id` FROM `quest_player` WHERE `char_id` = '"+getcharid(0)+"'",@quest_mobid,@quest_mobam,@quest_mobreq,@quest_npcid,@quest_qid;
for ( set .@m,0; .@m < getarraysize(@quest_mobid); set .@m,.@m + 1)
if(@quest_mobid[.@m] == killedrid)
if(@quest_mobam[.@m] < @quest_mobreq[.@m]) {
set @quest_mobam[.@m],@quest_mobam[.@m] + 1;
query_sql "SELECT `npc_name` , `npc_map` FROM `quest_npc` WHERE `npc_id` = '"+@quest_npcid[.@m]+"'",.@n_name$,.@n_map$;
dispbottom .@n_name$+"@"+.@n_map$+": Caça - "+getmonsterinfo(killedrid,MOB_NAME)+" : "+@quest_mobam[.@m]+"/"+@quest_mobreq[.@m],0x00FF00;
} else if(@quest_mobam[.@m] >= @quest_mobreq[.@m])
continue;
end;
OnPCLogoutEvent:
for ( set .@m,0; .@m < getarraysize(@quest_mobid); set .@m,.@m + 1)
query_sql "UPDATE `quest_player` SET `mob_am` = '"+@quest_mobam[.@m]+"' WHERE `npc_id` = '"+@quest_npcid[.@m]+"' AND `mob_id` = '"+@quest_mobid[.@m]+"' AND `quest_id` = '"+@quest_qid[.@m]+"'";
end;
OnPCLoginEvent:
if(!$@q_tab) end;
query_sql "SELECT DISTINCT `quest_id` , `npc_id` FROM `quest_player` WHERE `char_id` = '"+getcharid(0)+"'",.@q_id,.@n_id;
set .@n$,"[Quest System]";
if(getarraysize(.@q_id) < 1) {
dispbottom .@n$+": Você não tem missões ativas.";
end;
}
dispbottom .@n$+": Você tem"+getarraysize(.@q_id)+" Missões ativas.";
dispbottom .@n$+": Eu vou agora listá-los por NPC com as informações sobre o NPC:";
// Updating SQL Entries for Monster Hunting before displaying Quest Progress
for ( set .@m,0; .@m < getarraysize(@quest_mobid); set .@m,.@m + 1)
query_sql "UPDATE `quest_player` SET `mob_am` = '"+@quest_mobam[.@m]+"' WHERE `npc_id` = '"+@quest_npcid[.@m]+"' AND `mob_id` = '"+@quest_mobid[.@m]+"' AND `quest_id` = '"+@quest_qid[.@m]+"' AND `char_id` = '"+getcharid(0)+"'";
// Displaying Quest Progress
for ( set .@l,0; .@l < getarraysize(.@q_id); set .@l,.@l + 1) {
set .@q_name$,0;
set .@q_type,0;
deletearray .@req1[0],getarraysize(.@req1);
deletearray .@req2[0],getarraysize(.@req2);
query_sql "SELECT `quest_name` , `quest_type` FROM `quest_list` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"'",.@q_name$,.@q_type;
dispbottom " [* ====== Quest - "+.@q_name$+" - Progress: ====== *] ";
dispbottom " > Type: "+( (.@q_type == 1)?"Caça":"Item Coletar");
if(.@q_type == 1)
query_sql "SELECT `mob_id` , `mob_am` FROM `quest_list` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"'",.@req1,.@req2;
else
query_sql "SELECT `item_id` , `item_am` FROM `quest_list` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"'",.@req1,.@req2;
for ( set .@p,0; .@p < getarraysize(.@req1); set .@p,.@p + 1)
if(.@q_type == 1) {
query_sql "SELECT `mob_am` FROM `quest_player` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"' AND `char_id` = '"+getcharid(0)+"' AND `mob_id` = '"+.@req1[.@p]+"'",.@m_got;
dispbottom " > Mob#"+(.@p+1)+": "+getmonsterinfo(.@req1[.@p],MOB_NAME)+" - "+.@m_got+"/"+.@req2[.@p];
} else
dispbottom " > Item#"+(.@p+1)+": "+getitemname(.@req1[.@p])+" - "+countitem(.@req1[.@p])+"/"+.@req2[.@p];
query_sql "SELECT `npc_name` , `npc_map` , `npc_x` , `npc_y` FROM `quest_npc` WHERE `npc_id` = '"+.@n_id[.@l]+"'",.@n_name$,.@n_map$,.@n_x,.@n_y;
dispbottom " > From "+.@n_name$+", located at: "+.@n_map$+", X: "+.@n_x+", Y: "+.@n_y;
}
end;
}
i have o idea how to reproduce the SQL parts of the code in to a normal code.
Thanks for everyone that read this and try to help me.
Question
Rizta
Hello everyone.
Today i have a new question (and need support for becaus im newbie :P).
I want to create a question progression function/script that'll interact with some quests npc(or every single one). Course this progression i want its only for mob hunting and item collect.
I found a script that made quest and have the @checkquest command(i want a command too) but unfortunately the script have some limitations and obviously i dont have the knowledge to modify it and a plus, it is in SQL(i know nothing in SQL).
Here's the code:
// Custom atcommand: @checkquest bindatcmd "checkquest","QuestSysEvents::OnPCLoginEvent"; set $@QSys,1; // Quest System loaded end; } - script QuestSysEvents -1,{ OnNPCKillEvent: if(!$@q_tab) end; set .KilledMob,killedrid; // Player in Party? if(getcharid(1) != 0) addrid(2,1,getcharid(1)); if(getarraysize(@quest_mobid) < 1) query_sql "SELECT `mob_id` , `mob_am` , `req_am` , `npc_id` , `quest_id` FROM `quest_player` WHERE `char_id` = '"+getcharid(0)+"'",@quest_mobid,@quest_mobam,@quest_mobreq,@quest_npcid,@quest_qid; for ( set .@m,0; .@m < getarraysize(@quest_mobid); set .@m,.@m + 1) if(@quest_mobid[.@m] == killedrid) if(@quest_mobam[.@m] < @quest_mobreq[.@m]) { set @quest_mobam[.@m],@quest_mobam[.@m] + 1; query_sql "SELECT `npc_name` , `npc_map` FROM `quest_npc` WHERE `npc_id` = '"+@quest_npcid[.@m]+"'",.@n_name$,.@n_map$; dispbottom .@n_name$+"@"+.@n_map$+": Caça - "+getmonsterinfo(killedrid,MOB_NAME)+" : "+@quest_mobam[.@m]+"/"+@quest_mobreq[.@m],0x00FF00; } else if(@quest_mobam[.@m] >= @quest_mobreq[.@m]) continue; end; OnPCLogoutEvent: for ( set .@m,0; .@m < getarraysize(@quest_mobid); set .@m,.@m + 1) query_sql "UPDATE `quest_player` SET `mob_am` = '"+@quest_mobam[.@m]+"' WHERE `npc_id` = '"+@quest_npcid[.@m]+"' AND `mob_id` = '"+@quest_mobid[.@m]+"' AND `quest_id` = '"+@quest_qid[.@m]+"'"; end; OnPCLoginEvent: if(!$@q_tab) end; query_sql "SELECT DISTINCT `quest_id` , `npc_id` FROM `quest_player` WHERE `char_id` = '"+getcharid(0)+"'",.@q_id,.@n_id; set .@n$,"[Quest System]"; if(getarraysize(.@q_id) < 1) { dispbottom .@n$+": Você não tem missões ativas."; end; } dispbottom .@n$+": Você tem"+getarraysize(.@q_id)+" Missões ativas."; dispbottom .@n$+": Eu vou agora listá-los por NPC com as informações sobre o NPC:"; // Updating SQL Entries for Monster Hunting before displaying Quest Progress for ( set .@m,0; .@m < getarraysize(@quest_mobid); set .@m,.@m + 1) query_sql "UPDATE `quest_player` SET `mob_am` = '"+@quest_mobam[.@m]+"' WHERE `npc_id` = '"+@quest_npcid[.@m]+"' AND `mob_id` = '"+@quest_mobid[.@m]+"' AND `quest_id` = '"+@quest_qid[.@m]+"' AND `char_id` = '"+getcharid(0)+"'"; // Displaying Quest Progress for ( set .@l,0; .@l < getarraysize(.@q_id); set .@l,.@l + 1) { set .@q_name$,0; set .@q_type,0; deletearray .@req1[0],getarraysize(.@req1); deletearray .@req2[0],getarraysize(.@req2); query_sql "SELECT `quest_name` , `quest_type` FROM `quest_list` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"'",.@q_name$,.@q_type; dispbottom " [* ====== Quest - "+.@q_name$+" - Progress: ====== *] "; dispbottom " > Type: "+( (.@q_type == 1)?"Caça":"Item Coletar"); if(.@q_type == 1) query_sql "SELECT `mob_id` , `mob_am` FROM `quest_list` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"'",.@req1,.@req2; else query_sql "SELECT `item_id` , `item_am` FROM `quest_list` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"'",.@req1,.@req2; for ( set .@p,0; .@p < getarraysize(.@req1); set .@p,.@p + 1) if(.@q_type == 1) { query_sql "SELECT `mob_am` FROM `quest_player` WHERE `npc_id` = '"+.@n_id[.@l]+"' AND `quest_id` = '"+.@q_id[.@l]+"' AND `char_id` = '"+getcharid(0)+"' AND `mob_id` = '"+.@req1[.@p]+"'",.@m_got; dispbottom " > Mob#"+(.@p+1)+": "+getmonsterinfo(.@req1[.@p],MOB_NAME)+" - "+.@m_got+"/"+.@req2[.@p]; } else dispbottom " > Item#"+(.@p+1)+": "+getitemname(.@req1[.@p])+" - "+countitem(.@req1[.@p])+"/"+.@req2[.@p]; query_sql "SELECT `npc_name` , `npc_map` , `npc_x` , `npc_y` FROM `quest_npc` WHERE `npc_id` = '"+.@n_id[.@l]+"'",.@n_name$,.@n_map$,.@n_x,.@n_y; dispbottom " > From "+.@n_name$+", located at: "+.@n_map$+", X: "+.@n_x+", Y: "+.@n_y; } end; }
i have o idea how to reproduce the SQL parts of the code in to a normal code.
Thanks for everyone that read this and try to help me.
NPC: Quest System SQL
by: llchrisll
Link to comment
Share on other sites
1 answer 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.