Jump to content
  • 0

Problem with callfunc and arguments


invenuz

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  1
  • Reputation:   0
  • Joined:  02/11/16
  • Last Seen:  

I'm having trouble with Emistry's NPC Refiner. Somehow I can't make it to work. Im using a 3Ceam and I guess the problem has something to do with outdated variables. The system is telling me that there is no function or not enough arguments. How do I fix this? Thanks in advance.

 

NPC Script:

prontera,155,181,5 script Refiner 757,{
callfunc("RefineFunc",63,0,20,1,1,80,-3,50,20,512);
}
 
function script RefineFunc {
set .@arg_count = getargcount();
// show information
.@display_info = 1;
 
// this this value to your custom max refine if your server have different default max refine
.@server_max_refine = (( checkre(0) )? 20:10 );
 
// argument count checking
if( .@arg_count < 8 ){
message strcharinfo(0),"Insufficient Arg. Min. required 8 Args but received only "+.@arg_count;
return;
}
 
// save arg into a temp array.
while( .@i < .@arg_count ){
.@arg[.@i] = getarg( .@i );
.@i++;
}
 
// check max refine count ( remove this part if you have custom max refine )
if( .@arg[2] > .@server_max_refine ){
message strcharinfo(0),"[Arg:3] RefineFunc Max Refine must not exceed "+.@server_max_refine +" but received "+.@arg[2]+".";
return;
}
 
// Refine Count must not 0.
if( !.@arg[3] ){
message strcharinfo(0),"[Arg:4] RefineFunc Count must not 0.";
return;
}
 
// Refine rate must not negative.
if( .@arg[5] < 0 ){
message strcharinfo(0),"[Arg:6] RefineFunc Refine Rate must not Negative. Received "+.@arg[5];
return;
}
 
// Refine decrement must not positive. ( so they can differentiate it )
if( .@arg[6] > 0 ){
message strcharinfo(0),"[Arg:7] RefineFunc Failure Decrement must not Positive. Received "+.@arg[6];
return;
}
 
// Bonus Refine rate must not negative.
if( .@arg[8] < 0 ){
message strcharinfo(0),"[Arg:9] RefineFunc Bonus Rate must not Negative. Received "+.@arg[8];
return;
}
 
// check for required item for gaining bonus rate if any
if( .@arg[9] )
if( getitemname( .@arg[9] ) == "null" ){
message strcharinfo(0),"[Arg:10] RefineFunc Invalid Bonus Rate Item ID "+.@arg[9];
return;
}
 
// generate selection menu
.@i = 1;
while( .@i < 14 ){
.@equip_id = getequipid( .@i );
if( .@equip_id > 0 ){
.@equip_enableref = (( .@arg[4] )? getequipisenableref( .@i ):1 );
 
if( .@arg[0] & ( 1 << ( .@i-1 ) ) && .@equip_enableref ){
.@equip_refine = getequiprefinerycnt( .@i );
.@equip_slot = getitemslots( .@equip_id );
if( .@equip_refine >= .@arg[1] && .@equip_refine < .@arg[2] ){
set .@menu$,.@menu$ + ( ( .@equip_refine )?"+"+.@equip_refine+" ":"" ) + getitemname( .@equip_id ) + " ["+.@equip_slot+"]";
.@equipment_count++;
}
}
}
set .@menu$,.@menu$ + ":";
.@i++;
}
 
// check if any available equip to refine
if( !.@equipment_count ){
message strcharinfo(0),"Sorry, but you didnt have equipment that refined between "+.@arg[1]+" ~ "+.@arg[2]+" for refine.";
end;
}else{
 
// get equipment data
.@equip_part = select( .@menu$ );
.@equip_id = getequipid( .@equip_part );
.@equip_refine = getequiprefinerycnt( .@equip_part );
.@equip_slot = getitemslots( .@equip_id );
for( .@i = 0; .@i < 4; .@i++ )
.@equip_card[.@i] = getequipcardid( .@equip_part,.@i );
.@target_refine = .@equip_refine + .@arg[3];
 
// determine refine count
if( .@target_refine > .@arg[2] ) 
.@target_refine = .@arg[2];
else if( .@target_refine < 0 )
.@target_refine = 0;
if( .@equip_refine == .@target_refine ){
message strcharinfo(0),"That's your current refine rate.";
close;
}
 
.@success_rate = (( .@arg[5] )? .@arg[5]:getequippercentrefinery( .@equip_part ) );
 
// display information
if( .@display_info ){
mes "Target Refine : ";
mes "^0055FF"+( ( .@target_refine )?"+"+.@target_refine:"" )+" "+getitemname( .@equip_id )+" ["+.@equip_slot+"]^000000";
mes "Success Rate : ^777777"+.@success_rate+" %^000000";
if( .@success_rate < 100 ){
if( .@arg[8] ) mes "Bonus Rate : ^777777"+.@arg[8]+" %^000000";
if( .@arg[9] ){
mes "Required Item : ^FF0000"+getitemname( .@arg[9] )+"^000000";
mes " ";
mes "^777777**"+getitemname( .@arg[9] )+" is required for bonus rate^000000";
}
}
next;
}
 
if( select( "[^0055FF"+.@success_rate+"%^000000] "+( ( .@arg[3] < 0 )?"De-":"" )+"Refine to ^0055FF"+( ( .@target_refine )?"+"+.@target_refine:"" )+" "+getitemname( .@equip_id )+" ["+.@equip_slot+"]^000000","Cancel" ) == 1 ){
if( getequipisequiped( .@equip_part ) ){
 
// if it's not De-refine and below 100% success
if( .@arg[3] > 0 && .@success_rate < 100 ){
// calculate refine rate + bonus rate
if( .@arg[9] ){
if( countitem( .@arg[9] ) )
if( select( "Use ^0055FF"+getitemname( .@arg[9] )+"^000000 to increase Refine Rate","Continue" ) == 1 ){
.@success_rate += .@arg[8];
delitem .@arg[9],1;
}
 
}else{
.@success_rate += .@arg[8];
}
}
 
delequip .@equip_part;
// success and increase refine count
if( rand( 100 ) < .@success_rate ){
getitem2 .@equip_id,1,1,.@target_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
message strcharinfo(0),"Succesfully refined to +"+.@target_refine+" "+getitemname( .@equip_id );
specialeffect2 EF_REFINEOK;
close;
 
// failed and decrease refine count
}else if( .@arg[6] && .@arg[3] && rand( 100 ) < .@arg[7] ){
.@target_refine = ( .@equip_refine + .@arg[6] );
if( .@target_refine < 0 ) .@target_refine = 0;
getitem2 .@equip_id,1,1,.@target_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
message strcharinfo(0),"Failed and refine count dropped to +"+.@target_refine+" "+getitemname( .@equip_id );
 
// failed and destroy equip
}else{
message strcharinfo(0),"Failed to refine and destroyed "+getitemname( .@equip_id );
}
specialeffect2 EF_REFINEFAIL;
}
}
}
close;
}
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2373
  • Joined:  10/28/11
  • Last Seen:  

Please elaborate the problem you currently facing. Provide us with the following or more details if possible:

- Run-time server console errors/warnings (if any).

- Client side errors/warnings (if any).

- Any edits to scripts or source mods (if any).

Link to comment
Share on other sites

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.

×
×
  • Create New...