/*
||======================================================||
||======================================================||
|| NPC: ||
||======================================================||
|| Quest Maker ||
||======================================================||
|| Version 1.2.2 ||
||======================================================||
|| Made by Streiker ||
||======================================================||
|| Updates: ||
|| (5 latests) ||
|| ||
|| Version 1.0.1: ||
|| Fixed: requisites and rewards count. ||
|| ||
|| Version 1.1: ||
|| Added a dynamic next menu. ||
|| ||
|| Version 1.2: ||
|| Fixed: small bug in the menu (small for ||
|| fix, but you can't use the npc normally. ||
|| Fixed: $@quiz in the menu. ||
|| Changed the functions. ||
|| ||
|| Version 1.2.1: ||
|| Fixed: wrong english (maybe pendent). ||
|| Minor changes. ||
|| ||
|| Version 1.2.2: ||
|| Fixed: forgot a var cleaning. ||
||======================================================||
|| Description: ||
|| ||
|| A dynamic quest maker, allow variables and items, and||
|| items and variables requirements. ||
||======================================================||
|| Additional Comments: ||
|| ||
|| Just read the info of the callsubs to know how add to||
|| add quests. ||
||======================================================||
||======================================================||
*/
- script quest -1,{
function Add_Quest ;
function Add_Items ;
function Add_Vars ;
function Add_Rew1 ;
function Add_Rew2 ;
OnInit:
// Add_Quest, "Name";
// Add a new quest to the script.
// Add_Items, id, amount, {id}, {amount}.
// Add items requirements to the last added quest.
// Add_Vars, "variable", "name to show", amount, {"variable"}, {"name to show"}, {amount}.
// Add variables requirements to the last added quest.
// Add_Rew1, id, amount, {id}, {amount}.
// Add item rewards to the last added quest.
// Add_Rew2, "variable", "name to show", amount, {"variable"}, {"name to show"}, {amount}.
// Add variables rewards to the last added quest.
// Utilicen esto para probar el script, lo he probado y funciona :) .
Add_Quest ( "Red Potion" ) ;
Add_Items ( 512, 10 ) ;
Add_Vars ( "zeny", "Zenys", 100 ) ;
Add_Rew1 ( 501, 1 ) ;
Add_Rew2 ( "zeny", "Zenys", 1 );
end ;
function Add_Quest {
set $@quest, $@quest + 1;
setd "$@quest_"+ $@quest +"$", getarg ( 0 );
return ;
}
function Add_Items {
while ( getarg ( .@a, 0 ) != 0 ) {
set .@b, .@b + 1;
setd "$@quest_1_1_"+ .@b +"_"+ $@quest, getarg ( .@a );
setd "$@quest_1_2_"+ .@b +"_"+ $@quest, getarg ( .@a + 1 );
set .@a, .@a + 2;
}
setd "$@quest_1_4_"+ $@quest, .@b;
return ;
}
function Add_Vars {
while ( getarg ( .@a, "" ) != "" ) {
set .@b, .@b + 1;
setd "$@quest_2_1_"+ .@b +"_"+ $@quest +"$", getarg ( .@a );
setd "$@quest_2_2_"+ .@b +"_"+ $@quest +"$", getarg ( .@a + 1 );
setd "$@quest_2_3_"+ .@b +"_"+ $@quest, getarg ( .@a + 2 );
set .@a, .@a + 3;
}
setd "$@quest_2_4_"+ $@quest, .@b;
return ;
}
function Add_Rew1 {
while ( getarg ( .@a, 0 ) != 0 ) {
set .@b, .@b + 1;
setd "$@quest_3_1_"+ .@b +"_"+ $@quest, getarg ( .@a );
setd "$@quest_3_2_"+ .@b +"_"+ $@quest, getarg ( .@a + 1 );
set .@a, .@a + 2;
}
setd "$@quest_3_4_"+ $@quest, .@b;
return ;
}
function Add_Rew2 {
while ( getarg ( .@a, "" ) != "" ) {
set .@b, .@b + 1;
setd "$@quest_4_1_"+ .@b +"_"+ $@quest +"$", getarg ( .@a );
setd "$@quest_4_2_"+ .@b +"_"+ $@quest +"$", getarg ( .@a + 1 );
setd "$@quest_4_3_"+ .@b +"_"+ $@quest, getarg ( .@a + 2 );
set .@a, .@a + 3;
}
setd "$@quest_4_4_"+ $@quest, .@b;
return ;
}
}
prontera,132,215,4 script Quests 410,{
while ( 1 ) {
set .@a$,"^2b86b5Quests^000000";
mes .@a$;
mes "Hi "+ strcharinfo ( 0 ) +".";
mes "Which quest do you want to do?";
while ( set ( .@a, .@a + 1 ) <= .@g )
setd ".@m"+ .@a +"$", "";
set .@h, 0;
set .@a, 1;
set .@c, 0;
set .@g, 1;
set .@b, 0;
set .@f, 0;
while ( .@a <= $@quest ) {
set .@a, .@a + 1;
setd ".@m"+ .@g +"$", getd ( ".@m"+ .@g +"$" ) + getd ( "$@quest_"+ .@a +"$" )+":";
if ( ! ( .@a % 59 ) ) {
setd ".@m"+ .@g +"$", getd ( ".@m"+ .@g +"$" ) + "^a41111Next^000000:";
set .@g, .@g + 1;
}
}
next ;
while ( ( ! .@b ) || ( .@b == 60 ) ) {
set .@h, .@h + 1;
set .@b, select ( getd ( ".@m"+ .@h +"$" ) );
}
mes .@a$;
mes "Requisites of this quest:";
while ( .@c <= getd ( "$@quest_1_4_"+ .@b ) ) {
set .@c, .@c + 1;
mes "^4ca24c"+ countitem ( getd ( "$@quest_1_1_"+ .@b +"_"+ .@c ) ) +"^000000/^a61616"+ getd ( "$@quest_1_2_"+ .@b +"_"+ .@c ) +"^000000 "+ getitemname ( getd ( "$@quest_1_1_"+ .@b +"_"+ .@c ) );
}
set .@c, 0;
while ( .@c <= getd ( "$@quest_2_4_"+ .@b ) ) {
set .@c, .@c + 1;
mes "^4ca24c"+ getd ( getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ) ) +"^000000/^a61616"+ getd ( "$@quest_2_3_"+ .@b +"_"+ .@c ) +"^000000 "+ getd ( "$@quest_2_2_"+ .@b +"_"+ .@c +"$" );
}
next;
mes .@a$;
set .@c, 0;
mes "Rewards of this quest:";
if ( getd ( "$@quest_3_4_"+ .@b ) ) mes "---Items---";
while ( .@c < getd ( "$@quest_3_4_"+ .@b ) ) {
set .@c, .@c + 1;
mes getd ( "$@quest_3_2_"+ .@b +"_"+ .@c ) +" "+ getitemname ( getd ( "$@quest_3_1_"+ .@b +"_"+ .@c ) );
}
set .@c, 0;
if ( getd ( "$@quest_4_4_"+ .@b ) ) mes "---Variables---";
while ( .@c < getd ( "$@quest_4_4_"+ .@b ) ) {
set .@c, .@c + 1;
mes getd ( "$@quest_4_3_"+ .@b +"_"+ .@c ) +" "+ getd ( "$@quest_4_2_"+ .@b +"_"+ .@c +"$" );
}
next;
mes .@a$;
mes "Do you have the required?";
set .@d, select ( "Yes", "No, thanks" );
next;
mes .@a$;
if ( .@d == 1 ) {
set .@c, 0;
while ( .@c <= getd ( "$@quest_1_4_"+ .@b ) ) {
set .@c, .@c + 1;
if ( countitem ( getd ( "$@quest_1_1_"+ .@b +"_"+ .@c ) ) < getd ( "$@quest_1_2_"+ .@b +"_"+ .@c ) ) {
set .@e, getd ( "$@quest_1_2_"+ .@b +"_"+ .@c ) - countitem ( getd ( "$@quest_1_1_"+ .@b +"_"+ .@c ) );
mes "I'm sorry, but you need "+ .@e +" "+ getitemname ( getd ( "$@quest_1_1_"+ .@b +"_"+ .@c ) ) +" more.";
set .@f, .@f + 1;
}
}
set .@c, 0;
while ( .@c <= getd ( "$@quest_2_4_"+ .@b ) ) {
set .@c, .@c + 1;
if ( getd ( getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ) ) < getd ( "$@quest_2_3_"+ .@b +"_"+ .@c ) ) {
set .@e, getd ( "$@quest_2_3_"+ .@b +"_"+ .@c ) - getd ( getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ) );
mes "I'm sorry, but you need "+ getd ( "$@quest_2_3_"+ .@b +"_"+ .@c ) +"^000000 "+ getd ( "$@quest_2_2_"+ .@b +"_"+ .@c +"$" ) +" more.";
set .@f, .@f + 1;
}
}
if ( ! ( .@f ) ) {
emotion 21 ;
next ;
mes .@a$;
mes "You have all!";
mes "Here are your rewards!";
set .@c, 0;
while ( .@c <= getd ( "$@quest_1_4_"+ .@b ) ) {
set .@c, .@c + 1;
delitem getd ( "$@quest_1_1_"+ .@b +"_"+ .@c ), getd ( "$@quest_1_2_"+ .@b +"_"+ .@c );
}
set .@c, 0;
while ( .@c <= getd ( "$@quest_2_4_"+ .@b ) ) {
set .@c, .@c + 1;
setd getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ), getd ( getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ) ) - getd ( "$@quest_2_3_"+ .@b +"_"+ .@c );
}
set .@c, 0;
while ( .@c <= getd ( "$@quest_3_4_"+ .@b ) ) {
set .@c, .@c + 1;
getitem getd ( "$@quest_3_1_"+ .@b +"_"+ .@c ), getd ( "$@quest_3_2_"+ .@b +"_"+ .@c ) ;
dispbottom "You earned "+ getd ( "$@quest_3_2_"+ .@b +"_"+ .@c ) +" "+ getitemname ( getd ( "$@quest_3_1_"+ .@b +"_"+ .@c ) );
}
set .@c, 0;
while ( .@c <= getd ( "$@quest_4_4_"+ .@b ) ) {
set .@c, .@c + 1;
setd getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ), getd ( getd ( "$@quest_2_1_"+ .@b +"_"+ .@c +"$" ) ) + getd ( "$@quest_4_3_"+ .@b +"_"+ .@c );
dispbottom "You earned "+ getd ( "$@quest_4_3_"+ .@b +"_"+ .@c ) +" "+ getd ( "$@quest_4_2_"+ .@b +"_"+ .@c +"$" );
}
}
else emotion 23 ;
next ;
}
else mes "Well, come to see me when you're brave.";
}
set .@a, 1;
if ( ! ( .@f ) || ( .@d == 2 ) ) close ;
}