i use the old version of dynamic npc cuz i like it ... and my problem is i want this npc to announce when the player get the items....
//Made by Lunar
//Version 1.0
//12.28.08
prontera,156,156,5, script Flame Master 899,{
mes "[Dynamic Quest NPC]";
mes "Which quest would you like to do?";
set .i,select(.Menu$);
next;
goto Quest_Setup1;
OnInit:
set .BuildQuest,1;
set .Menu$,"";
set .i,1;
goto Quest_Setup1;
Quest_Display:
if(.BuildQuest) {
if(compare(getarg(0),"Stop Quest Loading")) {
set .BuildQuest,0;
end;
}
set .Menu$,.Menu$+getarg(0)+":";
set .i,.i+1;
goto Quest_Setup1;
}
mes "[" + getarg(0) + "]";
mes "I require the following:";
for(set @i,1; getarg(@i)!=0; set @i,@i+2) mes "^FF0000"+((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
mes "^000000In exchange, I will give you:^0000FF";
for(set @i,@i+1; getarg(@i)!=0; set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
if(select("Exchange:No thanks")==2) close;
for(set @i,1; getarg(@i)!=0; set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
next;
mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
close;
}
for(set @i,1; getarg(@i)!=0; set @i,@i+2) delitem getarg(@i),getarg(@i+1);
for(set @i,@i+1; getarg(@i)!=0; set @i,@i+2) getitem getarg(@i),getarg(@i+1);
close;
Quest_Setup1:
switch(.i) {
case 1: callsub Quest_Display,"Dark_Flame",7047,100,4031,200,932,150,983,5,0,31144,1,0,"announce";
case 2: callsub Quest_Display,"Dark_Blue_Flame",7047,100,4031,200,932,150,978,5,0,31145,1,0,"announce";
case 3: callsub Quest_Display,"Yellow_Flame",7047,100,4031,200,932,150,976,5,0,31146,1,0,"announce";
case 4: callsub Quest_Display,"Orange_Flame",7047,100,4031,200,932,150,980,5,0,31147,1,0,"announce";
case 5: callsub Quest_Display,"Blue_Flame",7047,100,4031,200,932,150,978,5,0,31148,1,0,"announce";
case 6: callsub Quest_Display,"Red_Flame",7047,100,4031,200,932,150,975,5,0,31149,1,0,"announce";
case 6: callsub Quest_Display,"Holy_Flame",7047,100,4031,200,932,150,982,5,0,31150,1,0,"announce";
default: callsub Quest_Display,"Stop Quest Loading";
}
}
also this one... i want also this to announce when the player get the items
//===== Script ===============================================
//= Code Breaker [v1.1]
//===== By: ==================================================
//= Xantara
//===== Additional Comments: =================================
//= 1.0 Initial Release
//= 1.1 Took out unused .@skip variable
// Implemented KeyWorld's createCode optimization
//============================================================
splendide,214,174,5 script Code Breaker 106,{
function gmPanel;
function validGuess;
function createCode;
function getCode;
function evaluateGuess;
function winGame;
while(1)
{
if( getgmlevel() >= .minGMlvl )
gmPanel();
mes .NPC$;
mes "Hello. Want to play Code Breaker?";
next;
switch(select("- Lets play!:- No thanks.:- Information")){
case 1:
mes .NPC$;
mes "What level of difficulty do you want to play Code Breaker in?";
next;
set .@l, select("- Easy:- Medium:- Hard");
createCode();
mes .NPC$;
while( .@guesses != .CB_Guess[.@l] )
{
mes "Guess a 3 digit number:";
mes "# of Tries: ^FF0000"+ .@guesses +"^000000 / ^3355FF"+ .CB_Guess[.@l] +"^000000";
next;
input .@num;
if(validGuess(.@num)) {
if(.@num == getCode())
winGame(.@l);
else
evaluateGuess(.@num);
set .@guesses, .@guesses + 1;
}
}
next;
mes .NPC$;
mes "I'm sorry! You did not win the game. The number was ^FF0000"+ getCode() +"^000000 Try again.";
close;
case 2:
mes .NPC$;
mes "See ya around!";
close;
case 3:
mes .NPC$;
mes "Objective of the game is to guess a 3 digit number where none of the digits repeat.";
next;
mes .NPC$;
mes "There are 3 difficulty settings depending on the number of guesses.";
for( set .@i,1; .@i < getarraysize(.CB_Guess); set .@i,.@i+1 )
mes "- "+ .CB_Diff$[.@i] +": "+ .CB_Guess[.@i] +" Tries";
next;
mes .NPC$;
mes "I will give you a clue in regards to your previous guess. Code guide:";
mes "- ^FF0000C^000000 stands for the number of numbers that are correct and in the right position.";
next;
mes .NPC$;
mes "I will give you a clue in regards to your previous guess. Code guide:";
mes "- ^FF0000N^000000 stands for the number of correct numbers that are in the wrong position.";
next;
mes .NPC$;
mes "Prizes are as follows:";
for( set .@i,1; .@i < getarraysize(.CB_Diff$); set .@i,.@i+1 )
mes "- "+ .CB_Diff$[.@i] +": ^FF0000"+ $CB_Prize[.@i+3] +"^000000x ^FF0000"+ getitemname($CB_Prize[.@i])+"^000000";
break;
}
next;
}
function gmPanel {
while(1) {
mes .NPC$;
mes "Hello GM. What can I do for you?";
next;
set .@select, select("- Edit Easy Prize:- Edit Medium Prize:- Edit Hard Prize:- Player Mode");
if(.@select == 4)
break;
mes .NPC$;
mes "Mode: Editing "+ .CB_Diff$[.@select] +" Prize";
mes "Insert new prize ^FF0000item ID^000000";
next;
input .@id;
mes .NPC$;
mes "Mode: Editing "+ .CB_Diff$[.@select] +" Prize";
mes "Insert new prize ^FF0000amount^000000";
next;
input .@amt;
next;
mes .NPC$;
mes "Mode: Editing "+ .CB_Diff$[.@select] +" Prize";
mes "Are you sure you want to change the prize to ^FF0000"+ .@amt +"^000000x ^FF0000"+ getitemname(.@id) +"^000000?";
next;
if(select("No, it's wrong!:Yes, I'm sure.")==2){
mes .NPC$;
mes "Mode: Editing "+ .CB_Diff$[.@select] +" Prize";
mes "Done!";
set $CB_Prize[.@select], .@id;
set $CB_Prize[.@select+3], .@amt;
next;
}
}
}
function validGuess {
set .@guess, getarg(0);
if( .@guess < 100 || .@guess > 999 ) {
mes "^FF0000Invalid Guess. Must be a 3 digit number.^000000";
mes " ";
return 0;
}
set .@n1, .@guess / 100;
set .@n2, (.@guess % 100) / 10;
set .@n3, .@guess % 10;
if( (.@n1 == .@n2) || (.@n1 == .@n3) || (.@n2 == .@n3) ) {
mes "^FF0000Invalid Guess. Do not use a number more than once.^000000";
mes " ";
return 0;
}
return 1;
}
function createCode {
for ( setarray .@list,1,2,3,4,5,6,7,8,9; .@i<3; set .@i,.@i+1 ) {
set .@j, rand(9-.@i);
set @CB_code[.@i+1], .@list[.@j];
deletearray .@list[.@j], 1;
}
}
function getCode {
set .@n1, @CB_code[1];
set .@n2, @CB_code[2];
set .@n3, @CB_code[3];
return ( (.@n1 * 100) + (.@n2 * 10) + .@n3 );
}
function evaluateGuess {
set .@g[1], getarg(0) / 100;
set .@g[2], (getarg(0) % 100) / 10;
set .@g[3], getarg(0) % 10;
if( .@g[1] == @CB_code[1] ) set .@C,.@C + 1;
if( .@g[2] == @CB_code[2] ) set .@C,.@C + 1;
if( .@g[3] == @CB_code[3] ) set .@C,.@C + 1;
if( (.@g[1] == @CB_code[2]) || (.@g[1] == @CB_code[3]) ) set .@N,.@N + 1;
if( (.@g[2] == @CB_code[1]) || (.@g[2] == @CB_code[3]) ) set .@N,.@N + 1;
if( (.@g[3] == @CB_code[1]) || (.@g[3] == @CB_code[2]) ) set .@N,.@N + 1;
mes .NPC$;
mes "Last guess ^3355FF"+ getarg(0) +"^000000 had ^FF0000"+ .@C +"^000000 C and ^FF0000"+ .@N +"^000000 N";
mes " ";
return;
}
function winGame {
set .@d, getarg(0);
mes .NPC$;
mes "Congratulations, you cracked the code!";
mes "Difficulty: ^3355FF"+ .CB_Diff$[.@d] +"^000000";
next;
mes .NPC$;
mes "Here is your prize. Enjoy!";
getitem $CB_Prize[.@d], $CB_Prize[.@d+3];
close;
}
OnInit:
// ---- CONFIG ------------------------------------------------------------------------------------
// NPC Name
set .NPC$, "[ Code Breaker ]";
// Minimum GM Level for GM Panel. [Default: 60]
set .minGMlvl, 60;
// Number of Guesses per Difficulty (Easy, Medium, Hard) [Default: 5, 3, 2]
setarray .CB_Guess[1], 5, 3, 2;
// ---- END OF CONFIG -----------------------------------------------------------------------------
setarray .CB_Diff$[1], "Easy", "Medium", "Hard";
if(!$CB_Prize[1])
setarray $CB_Prize[1], 909,909,909, 1,2,3;
end;
}
Question
Byakuran
i use the old version of dynamic npc cuz i like it ... and my problem is i want this npc to announce when the player get the items....
also this one... i want also this to announce when the player get the items
Link to comment
Share on other sites
3 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.