- Joined
- Apr 4, 2009
- Messages
- 110
- Reaction score
- 14
Problem resolved. Please delete this thread.
Last edited:
/**
--------------------------------
Server:
Ragezone
--------------------------------
NPC Title:
Job Advance Script
--------------------------------
Created by:
Ryuuzi~
--------------------------------
Version:
1.0 - Script Started
--------------------------------
**/
var level = cm.getPlayer().getLevel();
var no = "You cannot job advance using this NPC.";
function start() {
cm.sendYesNo("Congrats on reaching #bLevel " + level + "#k. Would you like to job advance?");
}
function action(mode, type, selection) {
if (mode != 1) {
cm.sendOk("I see. Well come back when you decide to Job Advance.");
cm.dispose();
return;
} else {
if (level >= 10 && level < 30) {
if (cm.getPlayer().getJobById() == 0) {
cm.changeJobById(501);
cm.getPlayer().dropMessage("You have reached the First Job Advancement. Congrats.");
cm.dispose();
} else {
cm.sendOk(no);
cm.dispose();
}
} else if (level >= 30 && level < 70) {
if (cm.getPlayer().getJobById() == 501) {
cm.changeJobById(530);
cm.getPlayer().dropMessage("You have reached the Second Job Advancement. Congrats.");
cm.dispose();
} else {
cm.sendOk(no);
cm.dispose();
}
} else if (level >= 70 && level < 120) {
if (cm.getPlayer().getJobById() == 530) {
cm.changeJobById(531);
cm.getPlayer().dropMessage("You have reached the Third Job Advancement. Congrats.");
cm.dispose();
} else {
cm.sendOk(no);
cm.dispose();
}
} else if (level >= 120) {
if (cm.getPlayer().getJobId() == 531) {
cm.changeJobById(532);
cm.getPlayer().dropMessage("You have reached the Fourth Job Advancement. Congrats.");
cm.dispose();
} else {
cm.sendOk(no);
cm.dispose();
}
}
}
}
/**
--------------------------------
Server:
Ragezone
--------------------------------
NPC Title:
Job Advance Script
--------------------------------
Created by:
Ryuuzi~
--------------------------------
Version:
1.0 - Script Started
--------------------------------
**/
var jobs = [[0, 501, 530, 531], [501, 530, 531, 532]];
var level = [10, 30, 70, 120];
var newJob;
function start() {
while (var i < jobs[0].length) {
if ((jobs[0][i] == cm.getPlayer().getJobId()) && (jobs[1][i] != cm.getPlayer().getJobId()) && (jobs[1][i] > cm.getPlayer().getJobId()) && (level[i] <= cm.getPlayer.getLevel())) {
newJob = jobs[1][i];
}
i++;
}
cm.changeJobById(newJob);
cm.dropMessage("You have made a Job Advancement.");
cm.dispose();
}
On the 1st script heres the error :
"cm" is not defined. ((Unknown source)#17) in (Unknown source) at line number 17.
private static final int FIRST_JOB = 0, SECOND_JOB = 1, THIRD_JOB = 2, FOURTH_JOB = 3, **** = 4;
public String advance()
{
int currJob = this.getJobId();
int changeTo;
String job = "";
if (currJob == 0 || currJob == 1000 || currJob == 3000 || currJob == 3001 || (currJob >= 2000 && currJob <= 2003))
{ //**** YOU BEGINNER
switch (currJob)
{
case 0:
case 1000:
case 3000:
return "Choose your destiny first!";
case 2000: //Aran
changeTo = 2100;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 1st job as a " + this.getJobName(changeTo) + "!";
case 2001: //Evan
changeTo = 2200;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 1st job as a " + this.getJobName(changeTo) + "!";
case 2002: //Mercedes
changeTo = 2300;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 1st job as a " + this.getJobName(changeTo) + "!";
case 2003: //Phantom
changeTo = 2400;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 1st job as a " + this.getJobName(changeTo) + "!";
case 3001: //Demon Slayer
changeTo = 3100;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 1st job as a " + this.getJobName(changeTo) + "!";
}
}
if ((currJob > 0 && currJob < 2200) || (currJob > 2218)) //Excluding Evan
{
switch (getJobType())
{
case FIRST_JOB:
if (currJob > 0 && currJob <= 500) //adventurers
{
return "**** you noob, what 2nd job do you want?";
} else {
if (currJob != 501) //Cannoneer
{
changeTo = currJob + 10;
this.changeJobById(changeTo);
} else {
changeTo = currJob + 29;
this.changeJobById(changeTo);
}
return "Congratulations! You've advanced to 2nd job as a " + this.getJobName(changeTo) + "!";
}
case SECOND_JOB:
changeTo = currJob + 1;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 3rd job as a " + this.getJobName(changeTo) + "!";
case THIRD_JOB:
changeTo = currJob + 1;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to 4th job as a " + this.getJobName(changeTo) + "!";
case FOURTH_JOB:
return "Silly noob, you can't advance hahahaha.";
case ****:
return "HACKER.";
default:
this.changeJobById(0);
return "STUPID NOOOBBBB";
}
} else {
if (currJob < 2218)
{
changeTo = currJob + 1;
this.changeJobById(changeTo);
return "Congratulations! You've advanced to " + this.getJobName(changeTo) + "!";
} else {
return "Silly noob, you can't advance hahahaha.";
}
}
}
private int getJobType()
{
String job = this.getJobId() +"";
if (job.endsWith("00") || job.equals("501"))
{
return FIRST_JOB;
} else if (job.endsWith("10") || job.endsWith("20") || job.endsWith("30")) {
return SECOND_JOB;
} else if (job.endsWith("11") || job.endsWith("21") || job.endsWith("31")) {
return THIRD_JOB;
} else if (job.endsWith("12") || job.endsWith("22") || job.endsWith("32")) {
return FOURTH_JOB;
}
return ****;
}
function start() {
cm.sendSimple("Would you like to become a #r Cannoneer? \r\n #L0# 1st Job Cannoneer #l \r\n #L1# 2nd Job Cannoneer #l \r\n #L2# 3rd Job Cannoneer #l \r\n #L3# 4th Job Cannoneer #l");
}
function action(mode, type, selection) {
if (mode == 1) { // Don't know if this is corre3ct mode for continue chat, but I'll assume it is.
if (selection == 0) // Should use brackets here, even though they wouldn't be necessary after closing the brackets after this; it's just a good coding habit.
if (cm.getPlayer().getLevel() == 10) { // Open bracket but never close. Also if they are over level 10 they cannot become 1st job.
cm.changeJob([501]); // Don't need the brackets; those are only used in terms of arrays. Also, I'm pretty sure the method is cm.changeJobById(int);
else if (selection == 1)
if (cm.getPlayer().getLevel() >= 30) { // Same here
cm.changeJob([530]);
else if (selection == 2)
if (cm.getPlayer().getLevel() >= 70) { // Same; but closed incorrectly
cm.changeJob([531]);
else if (selection == 3)
if (cm.getPlayer().getLevel() >= 120) {
cm.changeJob([532]);
}
cm.dispose();
}
function start() {
cm.sendSimple("Would you like to become a #r Cannoneer? \r\n #L0# 1st Job Cannoneer #l \r\n #L1# 2nd Job Cannoneer #l \r\n #L2# 3rd Job Cannoneer #l \r\n #L3# 4th Job Cannoneer #l");
}
function action(mode, type, selection) {
if (mode == 1) {
if (selection == 0) {
if (cm.getPlayer().getLevel() >= 10) {
cm.changeJobById(501);
}
} else if (selection == 1) {
if (cm.getPlayer().getLevel() >= 30) {
cm.changeJobById(530);
}
} else if (selection == 2) {
if (cm.getPlayer().getLevel() >= 70) {
cm.changeJobById(531);
}
} else if (selection == 3) {
if (cm.getPlayer().getLevel() >= 120) {
cm.changeJobById(532);
}
}
}
cm.dispose();
}
stuff = [[10, 0, 501], [30, 501, 530], [70, 530, 531], [120, 531, 532]];
function start() {
cm.sendSimple("Would you like to become a #r Cannoneer? \r\n #L0# 1st Job Cannoneer #l \r\n #L1# 2nd Job Cannoneer #l \r\n #L2# 3rd Job Cannoneer #l \r\n #L3# 4th Job Cannoneer #l");
}
function action(mode, type, selection) {
if (mode == 1) {
if (cm.getPlayer().getLevel() >= stuff[selection][0] && cm.getPlayer().getJob().getId() == stuff[selection][1]) {
cm.changeJob(stuff[selection][2]);
} else {
cm.sendOk(" Sorry.. you are either not a high enough level or you havn't made the previous job advancement. ");
}
}
cm.dispose();
}