Jump to content
  • 0

How to make it announce


Question

Posted

How can i make this script announce when someone complete the quest?

job_sage.gat,107,172,5, script Dolly 114,{
mes "Which item do you want?";
switch(select("Alice Doll:Bennit Doll:Defolty Doll:Glaris Doll:Lif Doll:Little Angel Doll:Sorin Doll:Tanigumi Doll:Telling Doll:W Doll:Zaha Doll:Cancel")) {
 case 1: callsub Quest,2210,1,5141,1,7047,500,0,5137,1,0;
 case 2: callsub Quest,2210,1,5141,1,1060,500,0,5344,1,0;
 case 3: callsub Quest,2210,1,5141,1,1034,500,0,5137,1,0;
 case 4: callsub Quest,2210,1,5141,1,7122,150,1034,200,0,5341,1,0;
 case 5: callsub Quest,2210,1,5141,1,7142,1,1060,150,0,5253,1,0;
 case 6: callsub Quest,2254,1,5141,1,7104,350,0,5344,1,0;
 case 7: callsub Quest,2210,1,5141,1,7152,300,0,5342,1,0;
 case 8: callsub Quest,2210,1,5141,1,1048,400,0,5526,1,0;
 case 9: callsub Quest,2210,1,5141,1,1020,200,1034,200,0,5343,1,0;
 case 10: callsub Quest,2210,1,5141,1,1060,500,0,5345,1,0;
 case 11: callsub Quest,2210,1,5141,1,1020,400,7166,400,0,5464,1,0;
 default:
  mes "So you don't want anything? Come back when you do!";
  close;
}
Quest:
next;
mes "I require the following:^FF0000";
for(set @i,0; getarg(@i)!=0; set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
mes "^000000In exchange, I will give you:^00FF00";
set @i,@i+1;
for(set @i,@i; getarg(@i) != 0; set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
if(select("Exchange:No thanks")==2) close;
for(set @i,0; getarg(@i) != 0; set @i,@i+2) {
 if(countitem(getarg(@i))<getarg(@i+1)) {
  next;
  mes "You do not have enough of " + getitemname(getarg(@i));
  mes "Required: " + getarg(@i+1);
  mes "Current: " + countitem(getarg(@i));
  mes "Needed: ^FF0000 " + (getarg(@i+1)-countitem(getarg(@i)));
  close;
 }
}
for(set @i,0; getarg(@i) != 0; set @i,@i+2) delitem getarg(@i),getarg(@i+1);
set @i,@i+1;
for(set @i,@i; getarg(@i) != 0; set @i,@i+2) getitem getarg(@i),getarg(@i+1);
close;
}
}

5 answers to this question

Recommended Posts

Posted
for(set @i,@i; getarg(@i) != 0; set @i,@i+2) getitem getarg(@i),getarg(@i+1);
announce strcharinfo(0)+"  has compleeted the quest.",0;          <---------------------
close;

Posted (edited)

hmm,

your script doesn't make use of dynamic menu

I already spotted that this part is being repeated

switch(select("Alice Doll:Bennit Doll:Defolty Doll:Glaris Doll:

case 1: callsub Quest,2210,1,5141,1,7047,500,0,5137,1,0;

case 2: callsub Quest,2210,1,5141,1,1060,500,0,5344,1,0;

case 3: callsub Quest,2210,1,5141,1,1034,500,0,5137,1,0;

I suggest this kind of script is better to make use of 2-dimension array and I provide an example

prontera,156,179,5	script	Dolly	100,{
mes "Which item do you want?";
next;
.@s = select( .menu$ ) -1;
if ( .@s == .total_quest ) {
	mes "So you don't want anything? Come back when you do!";
	close;
}
mes "I require the following:^FF0000";
.@size = getarraysize( getd(".quest"+ .@s ) );
for ( .@i = 1; .@i < .@size; .@i += 2 )
	mes getd( ".quest"+ .@s +"["+( .@i +1 )+"]" ) +" "+ getitemname( getd( ".quest"+ .@s +"["+ .@i +"]" ) );
mes "^000000In exchange, I will give you:^00FF00";
mes getitemname( getd( ".quest"+ .@s +"[0]") );
next;
if ( select("Exchange:No thanks") ==2 ) close;
for ( .@i = 1; .@i < .@size; .@i += 2 ) {
	if ( countitem( getd( ".quest"+ .@s +"["+ .@i +"]" ) ) < getd( ".quest"+ .@s +"["+( .@i +1 )+"]" ) ) {
		mes "You do not have enough of "+ getitemname( getd( ".quest"+ .@s +"["+ .@i +"]" ) );
		mes "Required: "+ getd( ".quest"+ .@s +"["+( .@i +1 )+"]" );
		mes "Current: "+ countitem( getd( ".quest"+ .@s +"["+ .@i +"]" ) );
		mes "Needed: ^FF0000 "+( getd( ".quest"+ .@s +"["+( .@i +1 )+"]" ) - countitem( getd( ".quest"+ .@s +"["+ .@i +"]" ) ) );
		close;
	}
}
for ( .@i = 1; .@i < .@size; .@i += 2 )
	delitem getd( ".quest"+ .@s +"["+ .@i +"]" ), getd( ".quest"+ .@s +"["+( .@i +1 )+"]" );
getitem getd( ".quest"+ .@s +"[0]" ), 1;
announce strcharinfo(0) +" has gotten a "+ getitemname( getd( ".quest"+ .@s +"[0]" ) ), 0;
close;

OnInit:
setarray .quest0, 5137, 2210,1,5141,1,7047,500;
setarray .quest1, 5344, 2210,1,5141,1,1060,500;
setarray .quest2, 5137, 2210,1,5141,1,1034,500;
setarray .quest3, 5341, 2210,1,5141,1,7122,150,1034,200;
setarray .quest4, 5253, 2210,1,5141,1,7142,1,1060,150;
setarray .quest5, 5344, 2254,1,5141,1,7104,350;
setarray .quest6, 5342, 2210,1,5141,1,7152,300;
setarray .quest7, 5526, 2210,1,5141,1,1048,400;
setarray .quest8, 5343, 2210,1,5141,1,1020,200,1034,200;
setarray .quest9, 5345, 2210,1,5141,1,1060,500;
setarray .quest10, 5464, 2210,1,5141,1,1020,400,7166,400;

for ( .@i = 0; getd( ".quest"+ .@i ); .@i++ ) {
	.menu$ = .menu$ + getitemname( getd( ".quest"+ .@i ) ) +":";
	.total_quest++;
}
.menu$ = .menu$ +"Cancel";
end;
}

the 1st index of every setarray is the reward item, since your script only has 1 kind of reward item anyways

Edited by AnnieRuru
Posted

hmm,

your script doesn't make use of dynamic menu

I already spotted that this part is being repeated

switch(select("Alice Doll:Bennit Doll:Defolty Doll:Glaris Doll:

case 1: callsub Quest,2210,1,5141,1,7047,500,0,5137,1,0;

case 2: callsub Quest,2210,1,5141,1,1060,500,0,5344,1,0;

case 3: callsub Quest,2210,1,5141,1,1034,500,0,5137,1,0;

I suggest this kind of script is better to make use of 2-dimension array and I provide an example

prontera,156,179,5	script	Dolly	100,{
mes "Which item do you want?";
next;
.@s = select( .menu$ ) -1;
if ( .@s == .total_quest ) {
	mes "So you don't want anything? Come back when you do!";
	close;
}
mes "I require the following:^FF0000";
.@size = getarraysize( getd(".quest"+ .@s ) );
for ( .@i = 1; .@i < .@size; .@i += 2 )
	mes getd( ".quest"+ .@s +"["+( .@i +1 )+"]" ) +" "+ getitemname( getd( ".quest"+ .@s +"["+ .@i +"]" ) );
mes "^000000In exchange, I will give you:^00FF00";
mes getitemname( getd( ".quest"+ .@s +"[0]") );
next;
if ( select("Exchange:No thanks") ==2 ) close;
for ( .@i = 1; .@i < .@size; .@i += 2 ) {
	if ( countitem( getd( ".quest"+ .@s +"["+ .@i +"]" ) ) < getd( ".quest"+ .@s +"["+( .@i +1 )+"]" ) ) {
		mes "You do not have enough of "+ getitemname( getd( ".quest"+ .@s +"["+ .@i +"]" ) );
		mes "Required: "+ getd( ".quest"+ .@s +"["+( .@i +1 )+"]" );
		mes "Current: "+ countitem( getd( ".quest"+ .@s +"["+ .@i +"]" ) );
		mes "Needed: ^FF0000 "+( getd( ".quest"+ .@s +"["+( .@i +1 )+"]" ) - countitem( getd( ".quest"+ .@s +"["+ .@i +"]" ) ) );
		close;
	}
}
for ( .@i = 1; .@i < .@size; .@i += 2 )
	delitem getd( ".quest"+ .@s +"["+ .@i +"]" ), getd( ".quest"+ .@s +"["+( .@i +1 )+"]" );
getitem getd( ".quest"+ .@s +"[0]" ), 1;
announce strcharinfo(0) +" has gotten a "+ getitemname( getd( ".quest"+ .@s +"[0]" ) ), 0;
close;

OnInit:
setarray .quest0, 5137, 2210,1,5141,1,7047,500;
setarray .quest1, 5344, 2210,1,5141,1,1060,500;
setarray .quest2, 5137, 2210,1,5141,1,1034,500;
setarray .quest3, 5341, 2210,1,5141,1,7122,150,1034,200;
setarray .quest4, 5253, 2210,1,5141,1,7142,1,1060,150;
setarray .quest5, 5344, 2254,1,5141,1,7104,350;
setarray .quest6, 5342, 2210,1,5141,1,7152,300;
setarray .quest7, 5526, 2210,1,5141,1,1048,400;
setarray .quest8, 5343, 2210,1,5141,1,1020,200,1034,200;
setarray .quest9, 5345, 2210,1,5141,1,1060,500;
setarray .quest10, 5464, 2210,1,5141,1,1020,400,7166,400;

for ( .@i = 0; getd( ".quest"+ .@i ); .@i++ ) {
	.menu$ = .menu$ + getitemname( getd( ".quest"+ .@i ) ) +":";
	.total_quest++;
}
.menu$ = .menu$ +"Cancel";
end;
}

the 1st index of every setarray is the reward item, since your script only has 1 kind of reward item anyways

actually after 0, is reward id array.

example: case 3: callsub Quest,2210,1,5141,1,1034,500,0,5137,1,5344,2,5137,3,0;

i kinda like your script but it cant set for multi reward id rite?

Posted (edited)

hi, i have a quest script that announce who ever complete the quest if you want try this one..

& Sorry Annie and Emistry for just giving him a different quest script



- shop quest_shop -1,501:50
prt_are_in,120,89,3, script Quest NPC 512,{
set @i,0;
mes "[shop Quest NPC]";
mes "Which item do you wish to obtain?";
mes "Select only one.";
callshop "quest_shop",1;
npcshopattach "quest_shop";
end;

OnBuyItem:
if(.BuildQuest) {
for(set .e,0; !compare(getarg(.e+1)+"","Zeny"); set .e,.e+2) {}
npcshopadditem "quest_shop",getarg(.e+2),getarg(.e)*compare(getarg(.e+1)+"","SZeny");
setarray .Shop[.i],getarg(.e+2);
set .i,.i+1;
goto Quest_Setup;
}
if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
mes "[shop Quest NPC]";
mes "I require the following:";
for(set @i,0; !compare(getarg(@i+1)+"","Zeny"); 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) + "]";
if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
mes "^000000In exchange, I will give you:^0000FF";
for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
case 1:
for(set @i,0; !compare(getarg(@i+1)+"","Zeny"); 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;
}
if(Zeny < getarg(@i)) {
next;
mes "You do not have enough Zeny.";
mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
close;
}
for(set @i,0; !compare(getarg(@i+1)+"","Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
set Zeny,Zeny-getarg(@i);
for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
if (compare(getarg(@i,0)+"","announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all;
close;
case 2:
set @bottomview, getlook(3);
set @topview, getlook(4);
set @midview, getlook(5);
addtimer 1000, strnpcinfo(3)+"::On_Leave";
set @equip,getiteminfo(@bought_nameid, 5);
set @view, getiteminfo(@bought_nameid, 11);
if(@equip != -1 && @view > 0) {
if(@equip & 1) atcommand "@changelook 3 " + @view;
if(@equip & 256) atcommand "@changelook 1 " + @view;
if(@equip & 512) atcommand "@changelook 2 " + @view;
}
next;
goto OnBuyItem;
case 3:
close;
}
On_Leave:
atcommand "@changelook 1 " + @topview;
atcommand "@changelook 2 " + @midview;
atcommand "@changelook 3 " + @bottomview;
set @equip,0;
set @view,0;
set @topview,0;
set @midview,0;
set @bottomview,0;
end;
OnInit:
npcshopitem "quest_shop",0,0;
set .BuildQuest,1;
set .i,1;
Quest_Setup:
switch(.i) {
default: set .BuildQuest,0; set .e,0; set .i,0; end;
case 1: callsub OnBuyItem,item id1,quantity,item id2,quantity,0,"SZeny",QUEST ITEM ID,QUANTITY,"announce";
}
}

Edited by jigsgfx

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...