I'm having problems with 2 npcs using input. It seems like, it's not outputing the right variable/characters inputted. For the case of build manager, the last letter is missing, so if you're gonna input hello, it will show hell, and if you will input a single letter, it shows blank.
Im using the build manager sccript by Cretino
//===== Hercules Script ======================================
//= Build Manager
//===== By: ==================================================
//= Cretino
//= kerbiii (Found a bug.)
//===== Current Version: =====================================
//= 1.0b (Added option to check max level of base and job (Can be disabled))
//===== Description: =========================================
//= Saves and loads build saved by the player. (Stats and/or Skills)
//===== Additional Comments: =================================
//= 1.0 Initial version [Cretino]
// TODO: Need revise all script with comments for spelling errors.
// Little improvement applied [Cretino]
// Fixed typo error in variable '.load_status_cost' (Thanks to [kerbiii]:[Hercules])
// Added option to check max level of base and job (Can be disabled) [Cretino]
//============================================================
prontera,210,196,6 script Build Manager 4_M_MINSTREL,{
function check_skills;
.@npc_name$ = " ";
PROFILE_START_MENU:
mes .@npc_name$;
if (.check_max_lv == true)
{
if (NextJobExp > 0 || BaseLevel < MAX_LEVEL)
{
mes "Sorry ^FF0000" + strcharinfo(0) + "^000000,";
mes "but you need reach the max level of Base and Job to use my services.";
close;
}
}
mes "Hey ^FF0000" + strcharinfo(0) + "^000000, what do you want?";
.@selected = select("Skills profile:Stats profile:Cancel");
switch(.@selected)
{
next;
case 1:
if (BaseClass == Job_Novice)
{
.@eac = eaclass();
if ((.@eac&EAJ_UPPERMASK) != EAJ_SUPER_NOVICE)
{
mes .@npc_name$;
mes "Sorry ^FF0000" + strcharinfo(0) + "^000000, but ^FF0000" + jobname(Class) + "^000000 can't use skills profile.";
close;
}
}
goto PROFILE_SKILLS_MAIN;
break;
case 2:
goto PROFILE_STATS_MAIN;
break;
case 3:
mes .@npc_name$;
mes "Come back whenever you need me!";
close;
break;
}
PROFILE_SKILLS_MAIN:
mes .@npc_name$;
mes "What do you want?";
.@selected = select("Create new skills profile:See my skills profiles:Reset my skills:Back");
switch(.@selected)
{
next;
case 1:
mes .@npc_name$;
getskilllist;
if (@skilllist_count == 0)
{
mes "Sorry ^FF0000" + strcharinfo(0) + "^000000, but you don't have any skill to create a skills profile.";
close;
}
mes "Input the skills profile name:";
input .@profile_name$;
next;
.@profile_name$ = replacestr(.@profile_name$, ":", "");
if (.@profile_name$ == "" || compare(.@profile_name$, ":"))
{
mes .@npc_name$;
mes "Invalid skills profile name.";
mes "^FF0000" + .@profile_name$ + "^000000";
next;
goto PROFILE_SKILLS_MAIN;
}
for(.@i = 0; .@i < @skilllist_count; .@i++)
{
if ((check_skills(@skilllist_id[.@i]) == true) || (@skilllist_lv[.@i] <= 0) || (@skilllist_id[.@i] <= 0))
continue;
if (@skilllist_flag[.@i] == 0)
{
.@skilllist_id[.@i] = @skilllist_id[.@i];
.@skilllist_lv[.@i] = @skilllist_lv[.@i];
}
}
.@size = getarraysize(.@skilllist_id);
mes .@npc_name$;
if (.@size != 0)
{
if (Zeny - .create_skills_cost < 0)
{
mes "You don't have ^FF0000" + callfunc("F_InsertComma", .create_skills_cost, 3, ".") + "^000000z to create your skills profile.";
close;
}
mes "Skills profile: ^FF0000" + .@profile_name$ + "^000000";
Zeny -= .create_skills_cost;
.@pos = getarraysize(#skills_profile);
#skills_profile[.@pos] = ++#skills_profile_count; // '#skills_profile_count' is used only to generate unique profile id.
.@var_name$ = "#skilllist_" + #skills_profile[.@pos];
setd .@var_name$ + "_name$", .@profile_name$;
setd .@var_name$ + "_count", .@size;
setd .@var_name$ + "_class", Class;
setd .@var_name$ + "_cost", skillpointcount() - SkillPoint;
for(.@i = 0; .@i < .@size; .@i++)
{
setd .@var_name$ + "_lv" + "[" + .@i + "]", .@skilllist_lv[.@i];
setd .@var_name$ + "_id" + "[" + .@i + "]", .@skilllist_id[.@i];
}
resetskill;
deletearray .@skilllist_id;
deletearray .@skilllist_lv;
last_skills_profile = 0;
mes " ";
mes "Your skills profile have been created.";
}
else
mes "You don't have any skill to create a skills profile.";
next;
goto PROFILE_SKILLS_MAIN;
break;
case 2:
mes .@npc_name$;
if (getarraysize(#skills_profile) != 0)
{
PROFILE_SKILLS_SELECT:
mes "Choose your skills profile:";
.@menu$ = "";
if (getarraysize(#skills_profile) > .freeloop_size_active)
.@free = freeloop(true);
for(.@i = 0; .@i < getarraysize(#skills_profile); .@i++)
{
.@menu$ += "^FF0000" + getd("#skilllist_" + #skills_profile[.@i] + "_name$") + "^000000" + ":";
if (.@i + 1 == getarraysize(#skills_profile))
.@menu$ += "Back";
}
if (.@free == true)
.@free = freeloop(false);
.@selected = select(.@menu$);
if (.@selected == getarraysize(#skills_profile) + 1)
{
next;
goto PROFILE_SKILLS_MAIN;
}
.@profile_id = (.@selected - 1);
.@var_name$ = "#skilllist_" + #skills_profile[.@profile_id];
next;
PROFILE_SKILLS_INFO:
mes .@npc_name$;
mes "What do you want?";
mes " ";
mes "Skills profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
.@selected = select("Load:Delete:Back");
switch(.@selected)
{
next;
mes .@npc_name$;
case 1:
if (getd(.@var_name$ + "_class") != Class)
{
mes "You can't load a skills profile of ^FF0000" + jobname(getd(.@var_name$ + "_class")) + "^000000, because you are ^FF0000" + jobname(Class) + "^000000.";
next;
mes .@npc_name$;
goto PROFILE_SKILLS_SELECT;
}
if (Zeny - .load_skills_cost < 0)
{
mes "You don't have ^FF0000" + callfunc("F_InsertComma", .create_skills_cost, 3, ".") + "^000000z to load your skills profile.";
close;
}
if (last_skills_profile != #skills_profile[.@profile_id])
resetskill;
else
{
mes "You're already using this profile.";
mes "Skills profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
next;
goto PROFILE_SKILLS_INFO;
}
if (SkillPoint - getd(.@var_name$ + "_cost") >= 0)
{
mes "Loading skills profile...";
mes "This may take awhile.";
SkillPoint -= getd(.@var_name$ + "_cost");
Zeny -= .load_skills_cost;
for(.@i = 0; .@i < getd(.@var_name$ + "_count"); .@i++)
{
if ((getd(.@var_name$ + "_id" + "[" + .@i + "]") <= 0) || (getd(.@var_name$ + "_lv" + "[" + .@i + "]") <= 0))
continue;
if (getd(.@var_name$ + "_id" + "[" + .@i + "]") == RK_HUNDREDSPEAR)
{
// NOTE: Have any bug in skill 'Hundred Spear'. (ID: RK_HUNDREDSPEAR)
mes " ";
mes "Failed to load:";
mes "^FF0000Hundred Spear^000000 Lv: ^FF0000" + getd(.@var_name$ + "_lv" + "[" + .@i + "]") + "^000000";
mes "You get back ^FF0000" + getd(.@var_name$ + "_lv" + "[" + .@i + "]") + "^000000 skill points.";
SkillPoint += getd(.@var_name$ + "_lv" + "[" + .@i + "]");
}
else
skill getd(.@var_name$ + "_id" + "[" + .@i + "]"), getd(.@var_name$ + "_lv" + "[" + .@i + "]"), 0;
}
mes " ";
mes "Your skills profile have been loaded.";
last_skills_profile = #skills_profile[.@profile_id];
}
else
{
mes "You don't have sufficient skill points to load your skills profile.";
mes "You need more ^FF0000" + (getd(.@var_name$ + "_cost") - SkillPoint) + "^000000 skill points.";
if (last_skills_profile != 0)
{
next;
mes .@npc_name$;
mes "Going back to the previous skills profile.";
mes "Skills profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
resetskill;
.@var_name$ = "#skilllist_" + last_skills_profile;
if (SkillPoint - getd(.@var_name$ + "_cost") >= 0)
{
SkillPoint -= getd(.@var_name$ + "_cost");
for(.@i = 0; .@i < getd(.@var_name$ + "_count"); .@i++)
{
if ((getd(.@var_name$ + "_id" + "[" + .@i + "]") <= 0) || (getd(.@var_name$ + "_lv" + "[" + .@i + "]") <= 0))
continue;
if (getd(.@var_name$ + "_id" + "[" + .@i + "]") == RK_HUNDREDSPEAR)
{
// NOTE: Have any bug in skill 'Hundred Spear'. (ID: RK_HUNDREDSPEAR)
mes " ";
mes "Failed to load:";
mes "^FF0000Hundred Spear^000000 Lv: ^FF0000" + getd(.@var_name$ + "_lv" + "[" + .@i + "]") + "^000000";
mes "You get back ^FF0000" + getd(.@var_name$ + "_lv" + "[" + .@i + "]") + "^000000 skill points.";
SkillPoint += getd(.@var_name$ + "_lv" + "[" + .@i + "]");
}
else
skill getd(.@var_name$ + "_id" + "[" + .@i + "]"), getd(.@var_name$ + "_lv" + "[" + .@i + "]"), 0;
}
}
else
{
next;
mes .@npc_name$;
mes "Fail to back to the previous skills profile.";
mes "Skills profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
last_skills_profile = 0;
}
}
}
next;
goto PROFILE_SKILLS_INFO;
break;
case 2:
mes "You sure you want to delete the skills profile?";
mes "Skills profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
if (select("No:Yes") == 1)
{
next;
goto PROFILE_SKILLS_INFO;
}
next;
mes .@npc_name$;
mes "Skills profile ^FF0000" + getd(.@var_name$ + "_name$") + "^000000 deleted.";
if (last_skills_profile == #skills_profile[.@profile_id])
last_skills_profile = 0;
setd .@var_name$ + "_count", 0;
setd .@var_name$ + "_cost", 0;
setd .@var_name$ + "_class", 0;
setd .@var_name$ + "_name$", "";
deletearray getd(.@var_name$ + "_lv");
deletearray getd(.@var_name$ + "_id");
deletearray #skills_profile[.@profile_id], 1;
next;
if (getarraysize(#skills_profile) != 0)
{
mes .@npc_name$;
goto PROFILE_SKILLS_SELECT;
}
else
goto PROFILE_SKILLS_MAIN;
break;
case 3:
goto PROFILE_SKILLS_SELECT;
break;
}
}
else
mes "You don't have any skills profile.";
next;
goto PROFILE_SKILLS_MAIN;
break;
case 3:
mes .@npc_name$;
if (Zeny - .reset_skills_cost >= 0)
{
Zeny -= .reset_skills_cost;
last_skills_profile = 0;
resetskill;
mes "Your skills have been reset.";
}
else
mes "You don't have ^FF0000" + callfunc("F_InsertComma", .reset_skills_cost, 3, ".") + "^000000z to reset your skills.";
close;
break;
case 4:
goto PROFILE_START_MENU;
break;
}
PROFILE_STATS_MAIN:
mes .@npc_name$;
mes "What do you want?";
.@selected = select("Create new stats profile:See my stats profiles:Reset my stats:Back");
switch(.@selected)
{
next;
case 1:
mes .@npc_name$;
if (Zeny - .create_status_cost < 0)
{
mes "You don't have ^FF0000" + callfunc("F_InsertComma", .create_status_cost, 3, ".") + "^000000z to create your stats profile.";
close;
}
mes "Input the stats profile name:";
input .@profile_name$;
next;
.@profile_name$ = replacestr(.@profile_name$, ":", "");
if (.@profile_name$ == "" || compare(.@profile_name$, ":"))
{
mes .@npc_name$;
mes "Invalid stats profile name.";
mes "^FF0000" + .@profile_name$ + "^000000";
next;
goto PROFILE_STATS_MAIN;
}
.@last_status = StatusPoint;
for(.@i = bStr; .@i < (bLuk + 1); .@i++)
{
.@value = readparam(.@i);
if (.@value > 1)
{
.@statslist_value[.@j] = .@value - 1;
.@statslist_id[.@j] = .@i;
.@j++;
}
}
mes .@npc_name$;
if (.@j != 0)
{
mes "Stats profile: ^FF0000" + .@profile_name$ + "^000000";
mes "Stats:";
Zeny -= .create_status_cost;
resetstatus;
.@pos = getarraysize(#stats_profile);
#stats_profile[.@pos] = ++#stats_profile_count; // '#stats_profile_count' is used only to generate unique profile id.
.@var_name$ = "#statslist_" + #stats_profile[.@pos];
setd .@var_name$ + "_name$", .@profile_name$;
setd .@var_name$ + "_count", .@j;
setd .@var_name$ + "_cost", StatusPoint - .@last_status;
for(.@i = 0; .@i < .@j; .@i++)
{
setd .@var_name$ + "_value" + "[" + .@i + "]", .@statslist_value[.@i];
setd .@var_name$ + "_id" + "[" + .@i + "]", .@statslist_id[.@i];
mes "^00FF00" + .stats_name$[(.@statslist_id[.@i] - bStr)] + "^000000 = ^0000FF" + .@statslist_value[.@i] + "^000000";
}
.@j = 0;
deletearray .@statslist_value;
deletearray .@statslist_id;
last_stats_profile = 0;
mes " ";
mes "Your stats profile have been created.";
}
else
mes "You don't have any spending points in stats to create your stats profile.";
next;
goto PROFILE_STATS_MAIN;
break;
case 2:
mes .@npc_name$;
if (getarraysize(#stats_profile) != 0)
{
PROFILE_STATS_SELECT:
mes "Choose your stats profile:";
.@menu$ = "";
if (getarraysize(#stats_profile) > .freeloop_size_active)
.@free = freeloop(true);
for(.@i = 0; .@i < getarraysize(#stats_profile); .@i++)
{
.@menu$ += "^FF0000" + getd("#statslist_" + #stats_profile[.@i] + "_name$") + "^000000" + ":";
if (.@i + 1 == getarraysize(#stats_profile))
.@menu$ += "Back";
}
if (.@free == true)
.@free = freeloop(false);
.@selected = select(.@menu$);
if (.@selected == getarraysize(#stats_profile) + 1)
{
next;
goto PROFILE_STATS_MAIN;
}
.@profile_id = (.@selected - 1);
.@var_name$ = "#statslist_" + #stats_profile[.@profile_id];
next;
PROFILE_STATS_INFO:
mes .@npc_name$;
mes "What do you want?";
mes " ";
mes "Stats profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
mes "Stats:";
for(.@i = 0; .@i < getd(.@var_name$ + "_count"); .@i++)
mes "^00FF00" + .stats_name$[(getd(.@var_name$ + "_id" + "[" + .@i + "]") - bStr)] + "^000000 = ^0000FF" + getd(.@var_name$ + "_value" + "[" + .@i + "]") + "^000000";
.@selected = select("Load:Delete:Back");
switch(.@selected)
{
next;
mes .@npc_name$;
case 1:
if (Zeny - .load_status_cost < 0)
{
mes "You don't have ^FF0000" + callfunc("F_InsertComma", .create_skills_cost, 3, ".") + "^000000z to load your stats profile.";
close;
}
if (last_stats_profile != #stats_profile[.@profile_id])
resetstatus;
else
{
mes "You're already using this stats profile.";
mes "Stats profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
next;
goto PROFILE_STATS_INFO;
}
if (StatusPoint - getd(.@var_name$ + "_cost") >= 0)
{
mes "Loading stats profile...";
mes "This may take awhile.";
Zeny -= .load_status_cost;
StatusPoint -= getd(.@var_name$ + "_cost");
for(.@i = 0; .@i < getd(.@var_name$ + "_count"); .@i++)
{
mes "^00FF00" + .stats_name$[(getd(.@var_name$ + "_id" + "[" + .@i + "]") - bStr)] + "^000000 = ^0000FF" + getd(.@var_name$ + "_value" + "[" + .@i + "]") + "^000000";
statusup2 getd(.@var_name$ + "_id" + "[" + .@i + "]"), getd(.@var_name$ + "_value" + "[" + .@i + "]");
}
mes " ";
mes "Your stats profile have been loaded.";
last_stats_profile = #stats_profile[.@profile_id];
}
else
{
mes "You don't have sufficient stats points to load your stats profile.";
mes "You need more ^FF0000" + (getd(.@var_name$ + "_cost") - StatusPoint) + "^000000 stats points.";
if (last_stats_profile != 0)
{
next;
mes .@npc_name$;
mes "Going back to the previous stats profile.";
mes "Stats profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
resetstatus;
.@var_name$ = "#statslist_" + last_stats_profile;
if (StatusPoint - getd(.@var_name$ + "_cost") >= 0)
{
StatusPoint -= getd(.@var_name$ + "_cost");
for(.@i = 0; .@i < getd(.@var_name$ + "_count"); .@i++)
statusup2 getd(.@var_name$ + "_id" + "[" + .@i + "]"), getd(.@var_name$ + "_value" + "[" + .@i + "]");
}
else
{
next;
mes .@npc_name$;
mes "Fail to back to the previous stats profile.";
mes "Stats profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
last_stats_profile = 0;
}
}
}
next;
goto PROFILE_STATS_INFO;
break;
case 2:
mes "You sure you want to delete the stats profile?";
mes "Stats profile: ^FF0000" + getd(.@var_name$ + "_name$") + "^000000";
if (select("No:Yes") == 1)
{
next;
goto PROFILE_STATS_INFO;
}
next;
mes .@npc_name$;
mes "Stats profile ^FF0000" + getd(.@var_name$ + "_name$") + "^000000 deleted.";
if (last_stats_profile == #stats_profile[.@profile_id])
last_stats_profile = 0;
setd .@var_name$ + "_count", 0;
setd .@var_name$ + "_cost", 0;
setd .@var_name$ + "_name$", "";
deletearray getd(.@var_name$ + "_value");
deletearray getd(.@var_name$ + "_id");
deletearray #stats_profile[.@profile_id], 1;
next;
if (getarraysize(#stats_profile) != 0)
{
mes .@npc_name$;
goto PROFILE_STATS_SELECT;
}
else
goto PROFILE_STATS_MAIN;
break;
case 3:
goto PROFILE_STATS_SELECT;
break;
}
}
else
mes "You don't have any stats profile.";
next;
goto PROFILE_STATS_MAIN;
break;
case 3:
mes .@npc_name$;
if (Zeny - .reset_status_cost >= 0)
{
Zeny -= .reset_status_cost;
last_stats_profile = 0;
resetstatus;
mes "Your stats have been reset.";
}
else
mes "You don't have ^FF0000" + callfunc("F_InsertComma", .reset_status_cost, 3, ".") + "^000000z to reset your stats.";
close;
break;
case 4:
goto PROFILE_START_MENU;
break;
}
OnInit:
// Cost to reset player stats
.reset_status_cost = 0;
// Cost to reset player skills
.reset_skills_cost = 0;
// Cost to create a new stats profile
.create_status_cost = .reset_status_cost * 2;
// Cost to create a new skills profile
.create_skills_cost = .reset_skills_cost * 2;
// Cost to load a stats profile
.load_status_cost = .reset_status_cost * 2;
// Cost to load a skills profile
.load_skills_cost = .reset_skills_cost * 2;
// Will check if player have max base level and job level to access the npc. (Max Level = 'MAX_LEVEL' constant)
// false = Disabled
.check_max_lv = false;
// ONLY CHANGE IF YOU KNOW WHAT YOU'RE DOING !!
setarray .stats_name$[0], "Str", "Agi", "Vit", "Int", "Dex", "Luk";
.freeloop_size_active = 128;
end;
function check_skills {
if (getarg(0) == NV_FIRSTAID || getarg(0) == NV_BASIC)
return true;
if (BaseClass == Job_Swordman)
{
if (getarg(0) == SM_MOVINGRECOVERY || getarg(0) == SM_FATALBLOW || getarg(0) == SM_AUTOBERSERK)
return true;
}
else if (BaseClass == Job_Mage)
{
if (getarg(0) == MG_ENERGYCOAT)
return true;
}
else if (BaseClass == Job_Archer)
{
if (getarg(0) == AC_MAKINGARROW || getarg(0) == AC_CHARGEARROW)
return true;
}
else if (BaseClass == Job_Acolyte)
{
if (getarg(0) == AL_HOLYLIGHT)
return true;
}
else if (BaseClass == Job_Merchant)
{
if (getarg(0) == MC_CARTREVOLUTION || getarg(0) == MC_CHANGECART || getarg(0) == MC_LOUD)
return true;
}
else if (BaseClass == Job_Thief)
{
if (getarg(0) == TF_SPRINKLESAND || getarg(0) == TF_BACKSLIDING || getarg(0) == TF_PICKSTONE || getarg(0) == TF_THROWSTONE)
return true;
}
if (BaseJob == Job_Knight)
{
if (getarg(0) == KN_CHARGEATK)
return true;
}
else if (BaseJob == Job_Priest)
{
if (getarg(0) == PR_REDEMPTIO)
return true;
}
else if (BaseJob == Job_Wizard)
{
if (getarg(0) == WZ_SIGHTBLASTER)
return true;
}
else if (BaseJob == Job_Blacksmith)
{
if (getarg(0) == BS_UNFAIRLYTRICK || getarg(0) == BS_GREED)
return true;
}
else if (BaseJob == Job_Hunter)
{
if (getarg(0) == HT_PHANTASMIC)
return true;
}
else if (BaseJob == Job_Assassin)
{
if (getarg(0) == AS_SONICACCEL || getarg(0) == AS_VENOMKNIFE)
return true;
}
else if (BaseJob == Job_Crusader)
{
if (getarg(0) == CR_SHRINK)
return true;
}
else if (BaseJob == Job_Monk)
{
if (getarg(0) == MO_KITRANSLATION || getarg(0) == MO_BALKYOUNG)
return true;
}
else if (BaseJob == Job_Sage)
{
if (getarg(0) == SA_ELEMENTWIND || getarg(0) == SA_CREATECON || getarg(0) == SA_ELEMENTWATER
|| getarg(0) == SA_ELEMENTGROUND || getarg(0) == SA_ELEMENTFIRE)
return true;
}
else if (BaseJob == Job_Rogue)
{
if (getarg(0) == RG_CLOSECONFINE)
return true;
}
else if (BaseJob == Job_Alchemist)
{
if (getarg(0) == AM_BIOETHICS)
return true;
}
else if (BaseJob == Job_Bard)
{
if (getarg(0) == BA_PANGVOICE)
return true;
}
else if (BaseJob == Job_Dancer)
{
if (getarg(0) == DC_WINKCHARM)
return true;
}
return false;
}
}
And also, this thing doesn't work too, can someone correct this? Thanks!
input .@Pass$;
if (.@Pass$ == "0") {
mes " ";
mes "Alright, you can always talk me to again if you changed your mind.";
close;
}
I'm having problems with 2 npcs using input. It seems like, it's not outputing the right variable/characters inputted. For the case of build manager, the last letter is missing, so if you're gonna input hello, it will show hell, and if you will input a single letter, it shows blank.
Im using the build manager sccript by Cretino
And also, this thing doesn't work too, can someone correct this? Thanks!
Share this post
Link to post
Share on other sites