Re: My first code more complex code
And its changeJobById not changeJob
Posted via Mobile Device
Re: My first code more complex code
Quote:
Originally Posted by
Standardize
PHP Code:
var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
}else{
status--;
}
if (status == 0) {
cm.sendSimple("Hello. Would you like to become a cygnus knight? Choose which job: \r\n #L0#DawnWarrior#l \r\n #L1#BlazeWizard #l \r\n #L2#ThunderBreaker #l \r\n #L3#NightWalker #l \r\n #L4#WindArcher #l");
} else if (status == 1) {
if (selection == 0) {
---if (cm.getLevel(10);) { ---
cm.sendOk("Congrats, you are now a DawnWarrior!");
cm.changeJob(1100);
cm.dispose();
}else{
cm.sendOk("I'm sorry, you need to train more.");
cm.dispose();
}
} else if (selection == 1) {
---cm.getLevel(10);---
cm.sendOk("Congrats, you are now a BlazeWizard!");
cm.changeJob(1200);
cm.dispose();
}else{
cm.sendOk("I'm sorry, you need to train more.");
cm.dispose();
} else if (selection == 2) {
---cm.getLevel(10);---
cm.sendOk("Congrats, you are now a ThunderBreaker!");
cm.changeJob(1500);
cm.dispose();
}else{
cm.sendOk("I'm sorry, you need to train more.");
cm.dispose();
cm.dispose();
} else if (selection == 3) {
--- cm.getLevel(10);---
cm.sendOk("Congrats, you are now a Nightwalker!");
cm.changeJob(1400);
cm.dispose();
}else{
cm.sendOk("I'm sorry, you need to train more.");
cm.dispose();
} else if (selection == 4) {
---cm.getLevel(10);---
cm.sendOk("Congrats, you are now a WindArcher!");
cm.changeJob(1300);
cm.dispose();
}else{
cm.sendOk("I'm sorry, you need to train more.");
cm.dispose();
}
}
}
The lines with --- <code> --- are the parts where there are errors.
You're also missing a dispose block.
thanks man. ALso your code is alot more simpler haha! oh and when I job advance using your code, after it works and yeah then the npc says its not working :O
Re: My first code more complex code
You're probably missing the jobName function. Here it is.
public MapleJob getJobName(int id) {
return MapleJob.getById(id);
}
Put this in NPCConversationManager under scripting.npc
Re: My first code more complex code
Quote:
Originally Posted by
Standardize
You're probably missing the jobName function. Here it is.
public MapleJob getJobName(int id) {
return MapleJob.getById(id);
}
Put this in NPCConversationManager under scripting.npc
wait where exactly do I put that? oh and your script doesn't check if the guy is level 10 and above. can you also make it say to train and comeback if it isn't?
Hmmph do u know how I can also stop the skills being maxed? Oh and maybe you know how do I advance? after level 30 and stuff
Re: My first code more complex code
I'm pretty sure its cm.getLevel() >9
Posted via Mobile Device
Re: My first code more complex code
I clearly stated to put it in NPCConversationManager, under scripting.npc
PHP Code:
function start() { // opening dialog.
cm.sendSimple("Hello. Would you like to become a cygnus knight? Choose which job: \r\n #L0#DawnWarrior#l\r\n#L1#BlazeWizard#l\r\n#L2#WindArcher#l\r\n#L3#NightWalker#l\r\n#L4#ThunderBreaker#l");
}
function action(m,t,s) {
if (m > 0) {
if (cm.getLevel() >= 10 && (s >= 0 && s <= 4)) {
cm.changeJobById(1100 + 100*s); // job change
cm.sendOk("You are now a " + cm.getJobName(1100 + 100*s) + ". Congratulations."); // dialog
} else {
cm.sendOk("You are not level 10. Train, and come back later.");
}
}
cm.dispose();
}
rewritten. I'm getting sloppy. :(
Re: My first code more complex code
Quote:
Originally Posted by
Standardize
I clearly stated to put it in NPCConversationManager, under scripting.npc
PHP Code:
function start() { // opening dialog.
cm.sendSimple("Hello. Would you like to become a cygnus knight? Choose which job: \r\n #L0#DawnWarrior#l\r\n#L1#BlazeWizard#l\r\n#L2#WindArcher#l\r\n#L3#NightWalker#l\r\n#L4#ThunderBreaker#l");
}
function action(m,t,s) {
if (m > 0) {
if (cm.getLevel() >= 10) {
cm.changeJobById(1100 + 100*s); // job change
cm.sendOk("You are now a " + cm.getJobName() + ". Congratulations."); // dialog
} else {
cm.sendOk("You are not level 10. Train, and come back later.");
}
}
cm.dispose();
}
rewritten. I'm getting sloppy. :(
Where is that exactly? and do you know what kind of system I should implement to advance the jobs oh and how do i not let the skills be maxed?
Okay that thing you told me to put in, its alredy in my NPConversationmanager but in the batch error it talks about getjobname unkown source
Re: My first code more complex code
If you have
PHP Code:
public MapleJob getJobName(int id) {
return MapleJob.getById(id);
}
in NPCConversationhandler.java, it should be fine.(?)
Re: My first code more complex code
@tiredguy
Not necessarily.
@lordpeter
He calls getJobName() but the method he gave you requires a parameter...
also the name of the method makes no sense, unless of course MapleJob overrides toString.
and, not bad scripting standardize.
Posted via Mobile Device
Re: My first code more complex code
@Soulfist:
If you use the method, it would return SUPERGM from MapleJob.java if you did cm.getJobName(910), which is indeed the job name. There would be no need for a conversion into a string.
@lordpeter:
If you want a job advancer for all jobs, you'll have to search for one.
Re: My first code more complex code
Quote:
Originally Posted by
Standardize
@Soulfist:
If you use the method, it would return SUPERGM from MapleJob.java if you did cm.getJobName(910), which is indeed the job name. There would be no need for a conversion into a string.
@lordpeter:
If you want a job advancer for all jobs, you'll have to search for one.
I made sure if cm.jobname and all that is in it, it is. But the error is still there.
Re: My first code more complex code
Re: My first code more complex code
Quote:
Originally Posted by
Standardize
Did you compile?
LOL, ofcource, btw Its not glitching anymore for some reason.... And I made sure I did everything (including compile) before when it was glitching. Oh well, thanks.
Re: My first code more complex code
Quote:
Originally Posted by
Standardize
PHP Code:
function start() { // opening dialog.
cm.sendSimple("Hello. Would you like to become a cygnus knight? Choose which job: \r\n #L0#DawnWarrior#l\r\n#L1#BlazeWizard#l\r\n#L2#WindArcher#l\r\n#L3#NightWalker#l\r\n#L4#ThunderBreaker#l");
}
function action(m,t,s) {
if (m > 0) {
if (cm.getLevel() >= 10) {
cm.changeJobById(1100 + 100*s); // job change
cm.sendOk("You are now a " + cm.getJobName() + ". Congratulations."); // dialog
} else {
cm.sendOk("You are not level 10. Train, and come back later.");
}
}
cm.dispose();
}
rewritten. I'm getting sloppy. :(
Nice, I can have any job I want! :) gg