-
[Tut]How To Analize NPC Scripts
Hey, Feel free to read this if you need it, but keep the flaming to a minimum ^_^ this is my first guide, And SaintsIan Taught me some of my JS and helped me correct my scripts
and for future reference, Else means if the first if statement is false, and if statements are listing if a situation is true or false, and No its not boolean
So here i go!
Code:
/*
@ Author : Snow
@
@ NPC = NAME
@ Map = MAP
@ NPC MapId = MAPID
@ Function = Rebirth Player
@
*/
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}else if (mode == 0){
cm.sendOk("Ok, talk to me when your sure you want to #bRebirth#k.");
cm.dispose();
}else{
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Welcome, great hero. You have been through a long and challenging road, and you have become immensely strong. If you bring me a Maple Coin,I can use my magic to increase your power even further, and surpass your limits! You will become a level 1 Beginner again, but you will keep your stats the same and all the Skill in you Hot Keys. Do you wish to be reborn? #b(Note: Please Make Sure you Have Room for all your Equipment in your Inventory. Also Make Sure you use all your SP. As it won't Be useable in your next Job. )#k" );
}else if (status == 1) {
if(cm.getChar().getLevel() < 200){
cm.sendOk("Sorry, You have to be level 200 to rebirth.");
cm.dispose();
}else{
cm.sendOk("#bGood-Job#k, you have qualified for a #eRebirth#n.");
}
}else if (status == 2) {
cm.getChar().levelUp();
cm.unequipEverything()
cm.changeJob(net.sf.odinms.client.MapleJob.BEGINNER);
cm.sendNext("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
cm.getChar().setLevel(2);
cm.dispose();
}
}
}
Credits to ryoku for making the script,
Now for the actual explaining part xD
This little segment here states the variable in the script, so whenever you see status it will represent 0 so if i wrote
var poop = 24; then whenever i used poop in the script it would represent the number 24. ill go into that further on
Next!
Code:
function start(){
status = -1;
action(1,0,0);
}
What i believe this means is that the status begins at -1, so the script is starting the script with a status of -1 and the action is stated with this part of the script
Code:
function action(mode, type, selection) {
so that means that (mode, type, selection) is equivelent to (1,0,0) which states that mode is used here so if i wanted to used selection i assume it would be (0,0,1)
Next!
Code:
if (mode == -1) {
cm.dispose();
this is exiting chat, using the bottom left corner of chat, leave option or pressing esc
Next!
Code:
}else if (mode == 0){
cm.sendOk("Ok, talk to me when you're sure you want to be #bReborn#k.");
cm.dispose();
this is the No selection of the sendYesNo part of the script, and to make this a bit less confusing ill point out that these come before the actual YesNo part of the script due to the fact that the script goes from lowest to highest, so mode couldnt just go from 3 - (-1) right? that wouldnt make much sense
Next!
Code:
}else{
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Hi i'm Mr.Pickall Blah Blah);
this little segment kept me confused for a whole 3 minuites! so lets start with mode, since we just finished doing the No selection part of the script, this is most likely the Yes! so if mode == 1 (yes). Remember back in the beginning of the script the function stated status to start -1? well this is where this part comes in This means status + 1 basically, so if we have a status of -1 and we add 1 to it, then status then becomes 0.. its simple math, therefore thats where the If statement makes sense if (status == 0);, im not too positive about the status++ or status-- but most the scripts ive looked at it seems that way, now the status-- is confusing me, if you know please post below and i will credit you for the info,
Next!
Code:
}else if (status == 1) {
if(cm.getChar().getLevel() < 200){
cm.sendOk("Sorry, You have to be level 200 to rebirth.");
cm.dispose();
}else{
cm.sendOk("#bGood-Job#k, you have qualified for a #eRebirth#n.");
}
right so this little part is choosing yes but if u notice
Code:
if(cm.getchar().getLevel() < 200){
that checks level, so lets bring back to math <,>,= is a comparison Correct? right so if we do 2 > 3 thats false because that means 2 is bigger than 3, you get the picture so if Level < 200 which is minimum level for rebirth, and the else statment just tells you that you qualified.
Code:
}else if (status == 2) {
cm.getChar().levelUp();
cm.unequipEverything()
cm.changeJob(net.sf.odinms.client.MapleJob.BEGINNER);
cm.sendNext("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
cm.getChar().setLevel(2);
cm.dispose();
}
}
}
This part is after the sendOk was sent, it Levels you up to 1, unequips everything, makes you a beginner and ends the script!
hopefully this was helpful, Please PLEASE tell me if i made a mistake somewhere or you need clarification on something, ill be sure to give you credits
and if you need it here are commands for npcs
Code:
cm.[Commands]
dispose
Ends the conversation with an NPC.
How to use: cm.dispose();
sendNext
Shows a conversation window with a 'Next' button.
How to use: cm.sendNext("[text]");
sendPrev
Shows a conversation window with a 'Prev' (previous) button.
How to use: cm.sendPrev("[text]");
sendNextPrev
Shows a conversation window with a 'Next' and 'Prev' button (see above).
How to use: cm.sendNextPrev("[text]");
sendOk
Shows a conversation window with an 'Ok' button.
How to use: cm.sendOk("[text]");
sendYesNo
Shows a conversation window with a 'Yes' and 'No' button, 'No' ends the conversation unless otherwise stated.
How to use: cm.sendYesNo("[text]");
sendAcceptDecline
Shows a conversation window with an 'Accept' and 'Decline' button. 'Decline' ends the conversation unless otherwise stated.
How to use: cm.sendAcceptDecline("[text]");
sendSimple
Shows a conversation window with no buttons.
How to use: cm.sendAcceptSimple("[text]");
sendStyle
Shows a style-select window.
How to use: cm.sendStyle("[Text]", [variable]); // You'll need to delcare the variable in a Var statement.
warp
Warps the player to a map.
How to use: cm.warp([mapid], [portal]); // Set [portal] as 0 if you want default.
openShop
Opens a shop window.
How to use: cm.openShop([shopid]);
haveItem
Checks if the player has an item (in their inventories or equipped).
How to use: cm.haveItem([itemid]);
gainItem
Gives the player an item/takes an item from a player.
How to use: cm.gainItem([itemid],[ammount]); // Change [ammount] to -[ammount] to take an item.
changeJob
Changes the job of the player.
How to use: cm.changeJob([jobid]);
getJob
Finds out what job the player has.
How to use: cm.getJob();
startQuest
Starts a quest.
How to use: cm.startQuest([questid]);
completeQuest
Finishes a quest.
How to use: cm.completeQuest([questid]);
forfeitQuest
Forfeits a quest.
How to use: cm.forfeitQuest([questid]);
getMeso
Finds out how many mesos a player has.
How to use: cm.getMeso();
gainMeso
Gives a player mesos/takes mesos from a player.
How to use: cm.gainMeso([ammount]); // use -[ammount] to take mesos.
gainExp
Gives a player exp/takes exp from a player.
How to use: cm.gainExp([ammount]); // use -[ammount] to take exp.
getLevel
Finds out the level of the player.
How to use: cm.getLevel();
teachSkill
Teaches a player a skill.
How to use: cm.teachSkill([skillid],[skilllevel],[maxskilllevel]);
isGM
Finds out if the player is a GM or not.
How to use: cm.isGM();
get[Stat]
Finds out the [Stat] of the player. [Stat] being: HP, MP, STR, DEX, INT, LUK.
How to use: cm.get[Stat]();
--
Some of the above can be used in IF statements. Here is an example of the Thief 1st Job Advancement:
Code:
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
if (cm.getLevel() >= 10 && cm.getChar().getDex() >= 25) {
cm.sendNext("So you decided to become a #rThief#k?");
} else {
cm.sendOk("Train a bit more and I can show you the way of the #rThief#k.")
cm.dispose();
}
} else if (status == 1) {
cm.sendNextPrev("It is an important and final choice. You will not be able to turn back.");
} else if (status == 2) {
cm.sendYesNo("Do you want to become a #rThief#k?");
} else if (status == 3) {
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
cm.changeJob(net.sf.odinms.client.MapleJob.THIEF);
cm.sendOk("So be it! Now go, and go with pride.");
cm.dispose();
}
}
}[/CODE
Breaking this section of code apart line by line will show you some examples of how some of these NPC-related commands can be used:
Quote:
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
if (cm.getLevel() >= 10 && cm.getChar().getDex() >= 25) {
cm.sendNext("So you decided to become a #rThief#k?");
} else {
cm.sendOk("Train a bit more and I can show you the way of the #rThief#k.")
cm.dispose();
}
} else if (status == 1) {
cm.sendNextPrev("It is an important and final choice. You will not be able to turn back.");
} else if (status == 2) {
cm.sendYesNo("Do you want to become a #rThief#k?");
} else if (status == 3) {
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
cm.changeJob(net.sf.odinms.client.MapleJob.THIEF);
cm.sendOk("So be it! Now go, and go with pride.");
cm.dispose();
}
}
}
__________________________________________________ ______________________
MapleJob.[Job]
These can be used with the MapleJob. statements:
BEGINNER
WARRIOR
FIGHTER
CRUSADER
HERO
PAGE
WHITEKNIGHT
PALADIN
SPEARMAN
DRAGONKNIGHT
DARKKNIGHT
MAGICIAN
FP_WIZARD
FP_MAGE
FP_ARCHMAGE
IL_WIZARD
IL_MAGE
IL_ARCHMAGE
CLERIC
PRIEST
BISHOP
BOWMAN
HUNTER
RANGER
BOWMASTER
CROSSBOWMAN
SNIPER
CROSSBOWMASTER
THIEF
ASSASSIN
HERMIT
NIGHTLORD
BANDIT
CHIEFBANDIT
SHADOWER
GM
SUPERGM
Example:
Quote:
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.SUPERGM)) {
cm.sendNext("Hi, GM!");
}
These can be used to easily code a Job Advancing NPC.
__________________________________________________ ______________________
NPC Text Commands
#b = Blue text.
#c[itemid]# Shows how many [itemid] the player has in their inventory.
#d = Purple text.
#e = Bold text.
#f[imagelocation]# - Shows an image inside the .wz files.
#g = Green text.
#h # - Shows the name of the player.
#i[itemid]# - Shows a picture of the item.
#k = Black text.
#l - Selection close.
#m[mapid]# - Shows the name of the map.
#n = Normal text (removes bold).
#o[mobid]# - Shows the name of the mob.
#p[npcid]# - Shows the name of the NPC.
#q[skillid]# - Shows the name of the skill.
#r = Red text.
#s[skillid]# - Shows the image of the skill.
#t[itemid]# - Shows the name of the item.
#v[itemid]# - Shows a picture of the item.
#x - Returns "0%" (need more information on this).
#z[itemid]# - Shows the name of the item.
#B[%]# - Shows a 'progress' bar.
#F[imagelocation]# - Shows an image inside the .wz files.
#L[number]# Selection open.
\r\n - Moves down a line.
THANKS TO woainioh for these commands! the link is [ame="http://forum.ragezone.com/showthread.php?t=397511"]here[/ame]
And if you want me to help you with a different script or need clarification on your script dont be shy!
Credits : Me for writing this tutorial and explaining the script
woainioh for all the npc stuff listed above, his thread is found [ame="http://forum.ragezone.com/showthread.php?t=397511"]here[/ame]
ryoku for the script the script link is [ame="http://forum.ragezone.com/showthread.php?t=409263"]here[/ame]
saintsian for teaching me my JS
(Your name here if you Help or correct me!)
HOPE YOU LIKED THIS Guide!DONT FLAME ME FOR POSTING SUCH A FALIURE Guide!
Thanks for reading! :drinks_no:drinks_no:drinks_no
PLEASE PRESS THE THANKS BUTTON IF THIS HELPED
-
Re: [Guide]How I Analize Scripts
-
Re: [Guide]How I Analize Scripts
Thanks! Hopefully this thread helped you!
_______
Need A Team For A New Maplestory Private Server Click![/quote]
-
Re: [Guide]How To Analize Scripts
It's a good guide. Thanks =)
-
Re: [Guide]How To Analize Scripts
-
Re: [Guide]How To Analize Scripts
Quote:
Originally Posted by
chuayaowei
It's a good guide. Thanks =)
thanks, i was expecting something like
Omg Noob get off ragezone!
o.0
-
Re: [Guide]How To Analize NPC Scripts
"OMG DUDE GTFO OF RAGEZONE"
lol jk. Dude, good job.
-
Re: [Guide]How To Analize NPC Scripts
go way devon! but i gotto make some edits to my script
-
Re: [Guide]How To Analize NPC Scripts
@ gtx911 and chuayaowei
Good job as all you 2 say. Say WHY it is or something else, quit trying to up your post count.
Nice for people who don't know how to read JAVA, I've been able to read it without even knowing what the hell JAVA is, sort of common sense...
-
Re: [Guide]How To Analize NPC Scripts
Nicejob for a first guide.
-
Re: [Guide]How To Analize NPC Scripts
lol thx @Leimone
@DaichiKokujo
u talkin to me?
-
Re: [Guide]How To Analize NPC Scripts
Great guide. Can u create in otha guides like how to create commands or npc functions etc.? Not to annoy you or anything
-
Re: [Guide]How To Analize NPC Scripts
im still trying to learn that myself, but ill post that ASAP
i just needa figure a couple things out, almost have it down
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
im still trying to learn that myself, but ill post that ASAP
i just needa figure a couple things out, almost have it down
That would be great ^^! Im just tryin to learn to make commands and notices and u know all the basics. If some1 would create a guide like that a lot of more servers would be more customized and maybe ppl would end the "RRR" (Repack Release Rampage) in the release section.
-
Re: [Guide]How To Analize NPC Scripts
well i would make a guide with my knowledge so far, but being at flamezone dont really feel like it, lol ima just clarify and test my stuff before i post
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
well i would make a guide with my knowledge so far, but being at flamezone dont really feel like it, lol ima just clarify and test my stuff before i post
Didnt u say that about this guide o.o? u said u were expecting flame but did not recieve any o.o?
-
Re: [Guide]How To Analize NPC Scripts
yea, but this was with certainty on my ability to give a basis on analizing the script was good enough to make a guide, my java skills are quite down the drain ^_^
and do u want the old or new command system?
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
yea, but this was with certainty on my ability to give a basis on analizing the script was good enough to make a guide, my java skills are quite down the drain ^_^
and do u want the old or new command system?
O it doesnt matter im just trying to learn how to create commands or maybe, notices for items or otha things :P Im basically tryin to learn as much as i can
-
Re: [Guide]How To Analize NPC Scripts
the new and old command system are different in a way
so it would make sense to clarify
-
Re: [Guide]How To Analize NPC Scripts
Alrite the new command system :)
-
Re: [Guide]How To Analize NPC Scripts
for the v.59 base correct?
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
for the v.59 base correct?
uhh well my server is running on v.55 but i guess v.59 is fine too
-
Re: [Guide]How To Analize NPC Scripts
ill just make 2 guides to avoid the hassle
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
ill just make 2 guides to avoid the hassle
Ok that would be great, goodluk and great job ^^
-
Re: [Guide]How To Analize NPC Scripts
thx if u add me on msn (Removed) i can tell you when im done with it
-
Re: [Guide]How To Analize NPC Scripts
wow you are a fag!
Quote:
And not to mention i self taught java script=p
Incase you didnt know, i was the one helping u, before you didnt even know what if and else was and && or ||
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
SaintsIan
wow you are a fag!
Incase you didnt know, i was the one helping u, before you didnt even know what if and else was and && or ||
o.0
you didnt really help, u just taught me the expressions of && and || and your definition of status was kinda wrong, but ill mention u in there then
-
Re: [Guide]How To Analize NPC Scripts
Quote:
o.0
you didnt really help, u just taught me the expressions of && and || and your definition of status was kinda wrong, but ill mention u in there then
nevermind, it doesnt really matter anymore. The next idiot that ask me to check their NPC script and asks me why it doesnt work, or explain how to make an npc or that other stuff, i will remember to tell them to fuck off. Never knew you were that type of person....
good guide anyways, cya
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
DaichiKokujo
@ gtx911 and chuayaowei
Good job as all you 2 say. Say WHY it is or something else, quit trying to up your post count.
Nice for people who don't know how to read JAVA, I've been able to read it without even knowing what the hell JAVA is, sort of common sense...
It's a good guide for those who don't know how to read a npc script. we are saying nice but everyone knows what we meant. If you don't then STFU.
Why should we increase our post counts? You think we got nothing better to do? GTFO
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
chuayaowei
It's a good guide for those who don't know how to read a npc script. we are saying nice but everyone knows what we meant. If you don't then STFU.
Why should we increase our post counts? You think we got nothing better to do? GTFO
Agreed we need to drill Java into people's brains
-
Re: [Guide]How To Analize NPC Scripts
Yeap. this is good for those that are too lazy to properly study the functions =] it works too! and the only thing i can say for java is... if you learn php, java coding in a way is like coding php, cf and other stuff :D, you will realize learning java will make it easier for u to code php or the other way around
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
fdjkr12
很完善的教學,
感謝您的大力分享!
wtf?
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
wtf?
Relax. My chinese kinda sucks but he is praising you for doing it beautifully
-
Re: [Guide]How To Analize NPC Scripts
isnt english mandatory at rz?
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
fdjkr12
很完善的教學,
感謝您的大力分享!
Translated with a translator. lol.
"The very perfect teaching, thanks your share vigorously!"
-
Re: [Guide]How To Analize NPC Scripts
LOL...... im struggling on my DEV ahhhhh Ring Effects™
-
Re: [Guide]How To Analize NPC Scripts
Well, Nice explained, and I just have to say, Nice job
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
Good Job .. it's very cool.. and helpful ... :D
ummm... just a suggest : you would say : "Having trouble with NPC Scripting" instead of JavaScripting... i guess
and you would post this also ?! :scratch:
Code:
Examples for (#f[imagelocation]# - one of the NPC Text Commands) :
#fUI/UIWindow.img/QuestIcon/3/0# = Select Item.
#fUI/UIWindow.img/QuestIcon/4/0# = Reward.
#fUI/UIWindow.img/QuestIcon/5/0# = Question Mark Box.
#fUI/UIWindow.img/QuestIcon/6/0# = Fame.
#fUI/UIWindow.img/QuestIcon/7/0# = Meso.
#fUI/UIWindow.img/QuestIcon/8/0# = EXP.
#fUI/UIWindow.img/QuestIcon/9/0# = Pet Closeness.
like in woainioh - npc commands thread...
-
Re: [Guide]How To Analize NPC Scripts
This can be helpful for me since I'm still learning the basics of Java.
-
Re: [Guide]How To Analize NPC Scripts
nice job man ! keep up the good work.
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
smaker_2
Good Job .. it's very cool.. and helpful ... :D
ummm... just a suggest : you would say : "Having trouble with NPC Scripting" instead of JavaScripting... i guess
and you would post this also ?! :scratch:
Code:
Examples for (#f[imagelocation]# - one of the NPC Text Commands) :
#fUI/UIWindow.img/QuestIcon/3/0# = Select Item.
#fUI/UIWindow.img/QuestIcon/4/0# = Reward.
#fUI/UIWindow.img/QuestIcon/5/0# = Question Mark Box.
#fUI/UIWindow.img/QuestIcon/6/0# = Fame.
#fUI/UIWindow.img/QuestIcon/7/0# = Meso.
#fUI/UIWindow.img/QuestIcon/8/0# = EXP.
#fUI/UIWindow.img/QuestIcon/9/0# = Pet Closeness.
like in woainioh - npc commands thread...
personally i think this is self explanitory if you look, ill explain it here
[CODE] #fUI/UIWindow.img/QuestIcon/3/0# = Select Item.[/CODE[ #fUi is obviously a selection if you look at the image posted by woainioh you can infer that all this does is display an image, ill try to find all the image extensions for you
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
LoOpEd
LOL...... im struggling on my DEV ahhhhh Ring Effects™
i cant dev that stuff, do you have packets?[Omg] sorry for double post T.T
-
Re: [Guide]How To Analize NPC Scripts
hey, Can you please tell me what's wrong with my code ? I made it from what I did understand from the theards and codes.
PHP Code:
/*
Made by MyLove [GM] of MyLoveStory (C)
*/
var wui = 1;
function start(){
status = -1;
action(0,0,1);
}
cm.sendSimple ("hello im #bTommy#, And Im MyLoveStory GM event holder.\r\nTalk to me when you finish the Event to get your reward. \r\n#L0##bWhat is this event ?!#k #l\r\n#L1##bHmm, Ok i will start the event.#k #l\r\n#L2##bCan I have my reward?#k #l\r\n#L3##bNothing.#k #l ");
}
function action(mode, type, selection) {
cm.dispose();
if (selection == 0) {
cm.sendPrev("This is an custom GM event event for MyLoveStory, All what you got to do is \r\ncollecting 200 #i[4031095]# and then talking to me to get your reward");
cm.dispose();
} else if (selection == 1) {
cm.sendPrev("OK, Good luck");
cm.dispose();
} else if (selection == 2) {
cm.sendYesNo("So, I think you got the item, Do you want yo get your reward ?");
} else if
cm.haveItem(4031095, 200);
if cm.gainItem(4031095, -200);
cm.gainMeso(50000000);
cm.gainItem(1702119, 1):
cm.warp(100000000);
cm.dispose();
} else if (selection == 3) {
cm.sendOk("Dont waste my TIME");
cm.dispose();
}
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
reminds me of weaxers awsome guides like wz unpacking and xml editing super edititon and blahh so awsome. thanks for this its really good.
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
no problem xD i should be thanking you. now i can code more npc's then i do already <3
-
Re: [Guide]How To Analize NPC Scripts
Could you find out/add how to spawn monsters? :):)
-
Re: [Guide]How To Analize NPC Scripts
cm.spawnMob(monsterID)
(saw in another thread, not 100%)
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
desert123100
cm.spawnMob(monsterID)
(saw in another thread, not 100%)
I put that in my thread! o-o
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
desert123100
cm.spawnMob(monsterID)
(saw in another thread, not 100%)
please dont post....
the retard of rz
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
DennisEatsFood
Could you find out/add how to spawn monsters? :):)
you needa compile NPCConversationManager.java
-
Re: [Guide]How To Analize NPC Scripts
nice work clysse.
if ppl wants help ill give them this guide link
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
Hey Clysse can u copy and paste your script and add things for me? I need to make a npc that when ur lvl 200 make you lvl 201 because a server put the dammage cap to 201 and at 200 ppl are bugged...Tyvm!
-
Re: [Guide]How To Analize NPC Scripts
cm.sendAcceptSimple doesnt exist, its cm.sendSimple
-
Re: [Guide]How To Analize NPC Scripts
:-) Great work!
Though, this does seem like a copy-paste of Woan's guide. with some edits.
;-) Nonetheless, great work.
-
Re: [Guide]How To Analize NPC Scripts
I suggest that beginners should read this.
-
Re: [Guide]How To Analize NPC Scripts
:-D Welcome back, Carter!
And yes, I agree. It sure would help stop the leechers.
:-/ But if you think about it, it would cause more spoon-feeders.
-
Re: [Guide]How To Analize NPC Scripts
Thanks. Who are you btw?
And if it does cause it, the action "lock" will help. ;]
-
Re: [Guide]How To Analize NPC Scripts
:-) Haa.
I'm just a lurker who finally registered.
-
Re: [Guide]How To Analize NPC Scripts
LolWbCarter<3.
And this guide is perfect. ;]
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Mr_Python
:-) Great work!
Though, this does seem like a copy-paste of Woan's guide. with some edits.
;-) Nonetheless, great work.
provide a link, i wrote this guide all by hand before typing it up, so please stop attempting anything..
but seriously, link me
-
Re: [Guide]How To Analize NPC Scripts
Quote:
sendSimple
Shows a conversation window with no buttons.
How to use: cm.sendAcceptSimple("[text]");
sendAcceptSimple = failed
@Mr_Python: It's not a copy of woan's guide, but the commands were copied, especially since he SAID HE COPIED THEM HIMSELF
Learn to read..
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
RMZero213
sendAcceptSimple = failed
@Mr_Python: It's not a copy of woan's guide, but the commands were copied, especially since he SAID HE COPIED THEM HIMSELF
Learn to read..
oh i didnt realize he was accusing me for copying the commands 0.o
Yea and what RMZero said, in the thread i clearly said HE provided me with all the commands
-
Re: [Guide]How To Analize NPC Scripts
Just to "clear" a bit, this is pretty correct tutorial, only to clariffy, that..
Quote:
this is the No selection of the sendYesNo part of the script, and to make this a bit less confusing ill point out that these come before the actual YesNo part of the script due to the fact that the script goes from lowest to highest, so mode couldnt just go from 3 - (-1) right? that wouldnt make much sense
This also apply to sendNextPrev, when status-- in the case of the button "Previous", mode goes to 0 too.
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
XxOsirisxX
Just to "clear" a bit, this is pretty correct tutorial, only to clariffy, that..
This also apply to sendNextPrev, when status-- in the case of the button "Previous", mode goes to 0 too.
i was just doing the script in my tutorial, that should be common sense
-
Re: [Guide]How To Analize NPC Scripts
Yea i read your guide on Analyzing scripts and it was VERY useful, however i found that you should probably include what mode,type, and selection means and what they do in the script. And if it's possible to make a guide or update your guide on how to script quests? I know it's very similar to what you taught in the guide but it would be very helpful
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
gamerzneed
Yea i read your guide on Analyzing scripts and it was VERY useful, however i found that you should probably include what mode,type, and selection means and what they do in the script. And if it's possible to make a guide or update your guide on how to script quests? I know it's very similar to what you taught in the guide but it would be very helpful
just stick to using mode, those are the only scripts ive seen, if you want to do selection you can use a #L0# in your script, then to script quests is pretty easy, just make it like an exchange quest, so like
' bring me back 200 blue snail shells' and then based off my tutorial attempt to write a check for 200 blue snail shells
-
Re: [Guide]How To Analize NPC Scripts
*COUGH*
Replace
PHP Code:
cm.unequipEverything()
With
PHP Code:
cm.unequipEverything();
*COUGH*
-
Re: [Guide]How To Analize NPC Scripts
go into more detail, and this is a excellent guide
at guy above, you added a semi colon, dont overwhelm your self, its ovbiously a mistake.
And by more detail, i meant explain why you need a status, what is mode? Why must if be defined using a function. If u cant i will, i did something like this on CEF. Its fun =]
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
DrFusion
go into more detail, and this is a excellent guide
at guy above, you added a semi colon, dont overwhelm your self, its ovbiously a mistake.
And by more detail, i meant explain why you need a status, what is mode? Why must if be defined using a function. If u cant i will, i did something like this on CEF. Its fun =]
and status = variable to represent time periods of the script, i think =x
mode must be defined in the function because function illustrates something that occurs throughout the entire script, and since this script runs off mode it must be defined in function
and im not quite sure what mode is
,
please do help with this thread DrFusion, cause im still uncertain with a few things myself, as soon as you begin to help ill provide your name in credits and edit the thread with important info
-
Re: [Guide]How To Analize NPC Scripts
mode = 0 == status == 0 < decline.
status being a variable shows us that it can be changed, for example.
var dickface = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.sendOk("Booo!!!");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (dickface == 0) {
cm.sendOk("lololol");
}ekse if (dickface == 1){
cm.sendOk("lolol");
if mode = 0, status kicks in else status = - aka no function.
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
DrFusion
mode = 0 == status == 0 < decline.
status being a variable shows us that it can be changed, for example.
var dickface = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.sendOk("Booo!!!");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (dickface == 0) {
cm.sendOk("lololol");
}ekse if (dickface == 1){
cm.sendOk("lolol");
if mode = 0, status kicks in else status = - aka no function.
using that logic, status would be a function within the script, or else a var status would be needed
-
Re: [Guide]How To Analize NPC Scripts
"was this script helpfull"
heck YEAH!
good job, I really need this xD
I made some events with this info, so I will give some credit to you :P
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Benjidude
"was this script helpfull"
heck YEAH!
good job, I really need this xD
I made some events with this info, so I will give some credit to you :P
awesome :)
glad to see im helping
-
Re: [Guide]How To Analize NPC Scripts
thanks, ill use it when scripting more NPCs other than sera F3
:D
-
Re: [Guide]How To Analize NPC Scripts
Hey clysse, could you edit ur guide, and analyse 'var' and stuff xD
-
Re: [Guide]How To Analize NPC Scripts
Quote:
//Orange of Painstory
//Edited by bendanx3
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendSimple("Hello #h #, Welcome to #rPainStory#k\r\nDid you kill some retarded monsters summoned by the GMs? Did you get any funny looking tickets or trinklets??\r\nTrade your funny items for smexy items!!! \r\n \r\nWhat would you like to trade? \r\n#L1##bTrade 1 #v5220001# for 100 white scrolls#k#l \r\n \r\n#L2##bTrade 1 #v5220010# for Bow-tie(Green)#k#l \r\n \r\n#L3##bTrade 1 #v5220020# for 10 Gold Sack of Mesos#k#l \r\n \r\n#L4##bTrade 1 #v5221000# for 10,000NX Points#k#l \r\n \r\n#L5##bTrade 1 #v4031543# for 12,000NX Points#k#l \r\n \r\n#L6##bTrade 1 #v4031544# for 15,000NX Points#k#l \r\n \r\n#L7##bTrade 1 #v4031545# for 18,000NX Points#k#l \r\n \r\n#L8##bTrade 1 #v4031592# for 20,000NX Points#k#l \r\n \r\n#L9##bTrade 1 #v4140301# for 25,000NX Points#k#l \r\n \r\n#L10##bTrade 300 #v5200002# for 144 Slots Genesis Bandana#k#l \r\n\r\n");
} else if (status == 1) {
if (selection == 1) {
if (cm.itemQuantity(5220001) >= 1) {
cm.gainItem(5220001, -1);
cm.gainItem(2340000, 100);
cm.dispose();
} else {
cm.sendOk("You don't have any #v5220001#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 2) {
if (cm.itemQuantity(5220010) >= 1) {
cm.gainItem(5220010, -1);
cm.gainItem(1122001, 1);
cm.dispose();
} else {
cm.sendOk("You don't have any #v5220010#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 3) {
if (cm.itemQuantity(5220020) >= 1) {
cm.gainItem(5220020, -1);
cm.gainItem(5200002, 10);
cm.dispose();
} else {
cm.sendOk("You don't have any #v5220020#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 4) {
if (cm.itemQuantity(5221000) >= 1) {
cm.gainItem(5221000, -1);
cm.gainNX(10000);
cm.dispose();
} else {
cm.sendOk("You don't have any #v5221000#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 5) {
if (cm.itemQuantity(4031543) >= 1) {
cm.gainItem(4031543, -1);
cm.gainNX(12000);
cm.dispose();
}
} else {
cm.sendOk("You don't have any #v4031543#. Please come back when you have one.");
cm.dispose();
} else if (selection == 6) {
if (cm.itemQuantity(4031544) >= 1) {
cm.gainItem(4031544, -1);
cm.gainNX(15000);
cm.dispose();
} else {
cm.sendOk("You don't have any #v4031544#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 7) {
if (cm.itemQuantity(4031545) >= 1) {
cm.gainItem(4031545, -1);
cm.gainNX(18000);
cm.dispose();
} else {
cm.sendOk("You don't have any #v4031545#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 8) {
if (cm.itemQuantity(4031592) >= 1) {
cm.gainItem(4031592, -1);
cm.gainNX(20000);
cm.dispose();
} else {
cm.sendOk("You don't have any #v4031592#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 9) {
if (cm.itemQuantity(4140301) >= 1) {
cm.gainItem(4140301, -1);
cm.gainNX(25000);
cm.dispose();
} else {
cm.sendOk("You don't have any #v4140301#. Please come back when you have one.");
cm.dispose();
}
} else if (selection == 10) {
if (cm.itemQuantity(5200002) >= 300) {
cm.gainItem(5200002, 300);
cm.gainItem(1002553, 1);
cm.dispose();
} else {
cm.sendOk("You don't have enough #v5200002#. Please come back when you have one.");
cm.dispose();
}
}
}
}
}
}
}
}
}
}
}
Can you help me analize this script? i don't seem to spot any mistake.
-
Re: [Guide]How To Analize NPC Scripts
no such thing as cm.itemQuantity unless added into your NPCCoversationManager.java
@ BenjiDude
var is variable
so you can set a variable to a string (text) or numbers, or even an equation,
Var Penis = 5+12
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
Clysse
Hey, Feel free to read this if you need it, but keep the flaming to a minimum ^_^ this is my first guide, And SaintsIan Taught me some of my JS and helped me correct my scripts
and for future reference, Else means if the first if statement is false, and if statements are listing if a situation is true or false, and No its not boolean
So here i go!
Code:
/*
@ Author : Snow
@
@ NPC = NAME
@ Map = MAP
@ NPC MapId = MAPID
@ Function = Rebirth Player
@
*/
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}else if (mode == 0){
cm.sendOk("Ok, talk to me when your sure you want to #bRebirth#k.");
cm.dispose();
}else{
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Welcome, great hero. You have been through a long and challenging road, and you have become immensely strong. If you bring me a Maple Coin,I can use my magic to increase your power even further, and surpass your limits! You will become a level 1 Beginner again, but you will keep your stats the same and all the Skill in you Hot Keys. Do you wish to be reborn? #b(Note: Please Make Sure you Have Room for all your Equipment in your Inventory. Also Make Sure you use all your SP. As it won't Be useable in your next Job. )#k" );
}else if (status == 1) {
if(cm.getChar().getLevel() < 200){
cm.sendOk("Sorry, You have to be level 200 to rebirth.");
cm.dispose();
}else{
cm.sendOk("#bGood-Job#k, you have qualified for a #eRebirth#n.");
}
}else if (status == 2) {
cm.getChar().levelUp();
cm.unequipEverything()
cm.changeJob(net.sf.odinms.client.MapleJob.BEGINNER);
cm.sendNext("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
cm.getChar().setLevel(2);
cm.dispose();
}
}
}
Credits to ryoku for making the script,
Now for the actual explaining part xD
This little segment here states the variable in the script, so whenever you see status it will represent 0 so if i wrote
var poop = 24; then whenever i used poop in the script it would represent the number 24. ill go into that further on
Next!
Code:
function start(){
status = -1;
action(1,0,0);
}
What i believe this means is that the status begins at -1, so the script is starting the script with a status of -1 and the action is stated with this part of the script
Code:
function action(mode, type, selection) {
so that means that (mode, type, selection) is equivelent to (1,0,0) which states that mode is used here so if i wanted to used selection i assume it would be (0,0,1)
Next!
Code:
if (mode == -1) {
cm.dispose();
this is exiting chat, using the bottom left corner of chat, leave option or pressing esc
Next!
Code:
}else if (mode == 0){
cm.sendOk("Ok, talk to me when you're sure you want to be #bReborn#k.");
cm.dispose();
this is the No selection of the sendYesNo part of the script, and to make this a bit less confusing ill point out that these come before the actual YesNo part of the script due to the fact that the script goes from lowest to highest, so mode couldnt just go from 3 - (-1) right? that wouldnt make much sense
Next!
Code:
}else{
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Hi i'm Mr.Pickall Blah Blah);
this little segment kept me confused for a whole 3 minuites! so lets start with mode, since we just finished doing the No selection part of the script, this is most likely the Yes! so if mode == 1 (yes). Remember back in the beginning of the script the function stated status to start -1? well this is where this part comes in
This means status + 1 basically, so if we have a status of -1 and we add 1 to it, then status then becomes 0.. its simple math, therefore thats where the If statement makes sense if (status == 0);, im not too positive about the status++ or status-- but most the scripts ive looked at it seems that way, now the status-- is confusing me, if you know please post below and i will credit you for the info,
Next!
Code:
}else if (status == 1) {
if(cm.getChar().getLevel() < 200){
cm.sendOk("Sorry, You have to be level 200 to rebirth.");
cm.dispose();
}else{
cm.sendOk("#bGood-Job#k, you have qualified for a #eRebirth#n.");
}
right so this little part is choosing yes but if u notice
Code:
if(cm.getchar().getLevel() < 200){
that checks level, so lets bring back to math <,>,= is a comparison Correct? right so if we do 2 > 3 thats false because that means 2 is bigger than 3, you get the picture so if Level < 200 which is minimum level for rebirth, and the else statment just tells you that you qualified.
Code:
}else if (status == 2) {
cm.getChar().levelUp();
cm.unequipEverything()
cm.changeJob(net.sf.odinms.client.MapleJob.BEGINNER);
cm.sendNext("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
cm.getChar().setLevel(2);
cm.dispose();
}
}
}
This part is after the sendOk was sent, it Levels you up to 1, unequips everything, makes you a beginner and ends the script!
hopefully this was helpful, Please PLEASE tell me if i made a mistake somewhere or you need clarification on something, ill be sure to give you credits
and if you need it here are commands for npcs
Code:
cm.[Commands]
dispose
Ends the conversation with an NPC.
How to use: cm.dispose();
sendNext
Shows a conversation window with a 'Next' button.
How to use: cm.sendNext("[text]");
sendPrev
Shows a conversation window with a 'Prev' (previous) button.
How to use: cm.sendPrev("[text]");
sendNextPrev
Shows a conversation window with a 'Next' and 'Prev' button (see above).
How to use: cm.sendNextPrev("[text]");
sendOk
Shows a conversation window with an 'Ok' button.
How to use: cm.sendOk("[text]");
sendYesNo
Shows a conversation window with a 'Yes' and 'No' button, 'No' ends the conversation unless otherwise stated.
How to use: cm.sendYesNo("[text]");
sendAcceptDecline
Shows a conversation window with an 'Accept' and 'Decline' button. 'Decline' ends the conversation unless otherwise stated.
How to use: cm.sendAcceptDecline("[text]");
sendSimple
Shows a conversation window with no buttons.
How to use: cm.sendAcceptSimple("[text]");
sendStyle
Shows a style-select window.
How to use: cm.sendStyle("[Text]", [variable]); // You'll need to delcare the variable in a Var statement.
warp
Warps the player to a map.
How to use: cm.warp([mapid], [portal]); // Set [portal] as 0 if you want default.
openShop
Opens a shop window.
How to use: cm.openShop([shopid]);
haveItem
Checks if the player has an item (in their inventories or equipped).
How to use: cm.haveItem([itemid]);
gainItem
Gives the player an item/takes an item from a player.
How to use: cm.gainItem([itemid],[ammount]); // Change [ammount] to -[ammount] to take an item.
changeJob
Changes the job of the player.
How to use: cm.changeJob([jobid]);
getJob
Finds out what job the player has.
How to use: cm.getJob();
startQuest
Starts a quest.
How to use: cm.startQuest([questid]);
completeQuest
Finishes a quest.
How to use: cm.completeQuest([questid]);
forfeitQuest
Forfeits a quest.
How to use: cm.forfeitQuest([questid]);
getMeso
Finds out how many mesos a player has.
How to use: cm.getMeso();
gainMeso
Gives a player mesos/takes mesos from a player.
How to use: cm.gainMeso([ammount]); // use -[ammount] to take mesos.
gainExp
Gives a player exp/takes exp from a player.
How to use: cm.gainExp([ammount]); // use -[ammount] to take exp.
getLevel
Finds out the level of the player.
How to use: cm.getLevel();
teachSkill
Teaches a player a skill.
How to use: cm.teachSkill([skillid],[skilllevel],[maxskilllevel]);
isGM
Finds out if the player is a GM or not.
How to use: cm.isGM();
get[Stat]
Finds out the [Stat] of the player. [Stat] being: HP, MP, STR, DEX, INT, LUK.
How to use: cm.get[Stat]();
--
Some of the above can be used in IF statements. Here is an example of the Thief 1st Job Advancement:
Code:
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
if (cm.getLevel() >= 10 && cm.getChar().getDex() >= 25) {
cm.sendNext("So you decided to become a #rThief#k?");
} else {
cm.sendOk("Train a bit more and I can show you the way of the #rThief#k.")
cm.dispose();
}
} else if (status == 1) {
cm.sendNextPrev("It is an important and final choice. You will not be able to turn back.");
} else if (status == 2) {
cm.sendYesNo("Do you want to become a #rThief#k?");
} else if (status == 3) {
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
cm.changeJob(net.sf.odinms.client.MapleJob.THIEF);
cm.sendOk("So be it! Now go, and go with pride.");
cm.dispose();
}
}
}[/CODE
Breaking this section of code apart line by line will show you some examples of how some of these NPC-related commands can be used:
Quote:
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
if (cm.getLevel() >= 10 && cm.getChar().getDex() >= 25) {
cm.sendNext("So you decided to become a #rThief#k?");
} else {
cm.sendOk("Train a bit more and I can show you the way of the #rThief#k.")
cm.dispose();
}
} else if (status == 1) {
cm.sendNextPrev("It is an important and final choice. You will not be able to turn back.");
} else if (status == 2) {
cm.sendYesNo("Do you want to become a #rThief#k?");
} else if (status == 3) {
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.BEGINNER)) {
cm.changeJob(net.sf.odinms.client.MapleJob.THIEF);
cm.sendOk("So be it! Now go, and go with pride.");
cm.dispose();
}
}
}
__________________________________________________ ______________________
MapleJob.[Job]
These can be used with the MapleJob. statements:
BEGINNER
WARRIOR
FIGHTER
CRUSADER
HERO
PAGE
WHITEKNIGHT
PALADIN
SPEARMAN
DRAGONKNIGHT
DARKKNIGHT
MAGICIAN
FP_WIZARD
FP_MAGE
FP_ARCHMAGE
IL_WIZARD
IL_MAGE
IL_ARCHMAGE
CLERIC
PRIEST
BISHOP
BOWMAN
HUNTER
RANGER
BOWMASTER
CROSSBOWMAN
SNIPER
CROSSBOWMASTER
THIEF
ASSASSIN
HERMIT
NIGHTLORD
BANDIT
CHIEFBANDIT
SHADOWER
GM
SUPERGM
Example:
Quote:
if (cm.getJob().equals(net.sf.odinms.client.MapleJob.SUPERGM)) {
cm.sendNext("Hi, GM!");
}
These can be used to easily code a Job Advancing NPC.
__________________________________________________ ______________________
NPC Text Commands
#b = Blue text.
#c[itemid]# Shows how many [itemid] the player has in their inventory.
#d = Purple text.
#e = Bold text.
#f[imagelocation]# - Shows an image inside the .wz files.
#g = Green text.
#h # - Shows the name of the player.
#i[itemid]# - Shows a picture of the item.
#k = Black text.
#l - Selection close.
#m[mapid]# - Shows the name of the map.
#n = Normal text (removes bold).
#o[mobid]# - Shows the name of the mob.
#p[npcid]# - Shows the name of the NPC.
#q[skillid]# - Shows the name of the skill.
#r = Red text.
#s[skillid]# - Shows the image of the skill.
#t[itemid]# - Shows the name of the item.
#v[itemid]# - Shows a picture of the item.
#x - Returns "0%" (need more information on this).
#z[itemid]# - Shows the name of the item.
#B[%]# - Shows a 'progress' bar.
#F[imagelocation]# - Shows an image inside the .wz files.
#L[number]# Selection open.
\r\n - Moves down a line.
THANKS TO woainioh for these commands! the link is
here
And if you want me to help you with a different script or need clarification on your script dont be shy!
Credits : Me for writing this tutorial and explaining the script
woainioh for all the npc stuff listed above, his thread is found
here
ryoku for the script the script link is
here
saintsian for teaching me my JS
(Your name here if you Help or correct me!)
HOPE YOU LIKED THIS Guide!DONT FLAME ME FOR POSTING SUCH A FALIURE Guide!
Thanks for reading! :drinks_no:drinks_no:drinks_no
PLEASE GIVE ME REPUTATION FOR THIS THREAD, i think ragezone made a reputation system...
Nice work! you are good scripter! i'll use it on my npcx..
-
Re: [Guide]How To Analize NPC Scripts
You should add
cm.spawnMob
:O:O
I think that's it
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
thyeway
Nice work! you are good scripter! i'll use it on my npcx..
I dont see how this shows that he is a good 'scripter'
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
DennisEatsFood
You should add
cm.spawnMob
:O:O
I think that's it
im not adding in that cause that requires java coding and i havnt made a tutorial on java coding
-
Re: [Guide]How To Analize NPC Scripts
Wow... Java scripts just look ridiculously messy, and hard to follow. It's much easier in Vana. To prove it, I'll convert the same original script into a nice, clean, easy to understand Vana version :)
Original Script
Code:
/*
@ Author : Snow
@
@ NPC = NAME
@ Map = MAP
@ NPC MapId = MAPID
@ Function = Rebirth Player
@
*/
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}else if (mode == 0){
cm.sendOk("Ok, talk to me when your sure you want to #bRebirth#k.");
cm.dispose();
}else{
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Welcome, great hero. You have been through a long and challenging road, and you have become immensely strong. If you bring me a Maple Coin,I can use my magic to increase your power even further, and surpass your limits! You will become a level 1 Beginner again, but you will keep your stats the same and all the Skill in you Hot Keys. Do you wish to be reborn? #b(Note: Please Make Sure you Have Room for all your Equipment in your Inventory. Also Make Sure you use all your SP. As it won't Be useable in your next Job. )#k" );
}else if (status == 1) {
if(cm.getChar().getLevel() < 200){
cm.sendOk("Sorry, You have to be level 200 to rebirth.");
cm.dispose();
}else{
cm.sendOk("#bGood-Job#k, you have qualified for a #eRebirth#n.");
}
}else if (status == 2) {
cm.getChar().levelUp();
cm.unequipEverything()
cm.changeJob(net.sf.odinms.client.MapleJob.BEGINNER);
cm.sendNext("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
cm.getChar().setLevel(2);
cm.dispose();
}
}
}
Vana Version
Code:
if state == 0 then
addText("Welcome, great hero. You have been through a long and challenging road, and you have become immensely strong. If you bring me a Maple Coin,I can use my magic to increase your power even further, and surpass your limits! You will become a level 1 Beginner again, but you will keep your stats the same and all the Skill in you Hot Keys. Do you wish to be reborn? #b(Note: Please Make Sure you Have Room for all your Equipment in your Inventory. Also Make Sure you use all your SP. As it won't Be useable in your next Job.#k");
sendYesNo();
elseif state == 1 then
if getSelected() = 1 then
if getLevel() >= 200 then
addText("#bGood-Job#k, you have qualified for a #eRebirth#n.");
setLevel(2);
setJob(0);
else
addText("Sorry, You have to be level 200 to rebirth.");
sendOK();
endNPC();
end
else
addText("Ok, talk to me when your sure you want to #bRebirth#k.");
sendOK();
endNPC();
end
elseif state == 2 then
addText("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
sendNext();
endNPC();
end
-
Re: [Guide]How To Analize NPC Scripts
Nice Guide! i will use it for my server.
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
nessnull
Wow... Java scripts just look ridiculously messy, and hard to follow. It's much easier in Vana. To prove it, I'll convert the same original script into a nice, clean, easy to understand Vana version :)
Original Script
Code:
/*
@ Author : Snow
@
@ NPC = NAME
@ Map = MAP
@ NPC MapId = MAPID
@ Function = Rebirth Player
@
*/
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}else if (mode == 0){
cm.sendOk("Ok, talk to me when your sure you want to #bRebirth#k.");
cm.dispose();
}else{
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Welcome, great hero. You have been through a long and challenging road, and you have become immensely strong. If you bring me a Maple Coin,I can use my magic to increase your power even further, and surpass your limits! You will become a level 1 Beginner again, but you will keep your stats the same and all the Skill in you Hot Keys. Do you wish to be reborn? #b(Note: Please Make Sure you Have Room for all your Equipment in your Inventory. Also Make Sure you use all your SP. As it won't Be useable in your next Job. )#k" );
}else if (status == 1) {
if(cm.getChar().getLevel() < 200){
cm.sendOk("Sorry, You have to be level 200 to rebirth.");
cm.dispose();
}else{
cm.sendOk("#bGood-Job#k, you have qualified for a #eRebirth#n.");
}
}else if (status == 2) {
cm.getChar().levelUp();
cm.unequipEverything()
cm.changeJob(net.sf.odinms.client.MapleJob.BEGINNER);
cm.sendNext("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
cm.getChar().setLevel(2);
cm.dispose();
}
}
}
Vana Version
Code:
if state == 0 then
addText("Welcome, great hero. You have been through a long and challenging road, and you have become immensely strong. If you bring me a Maple Coin,I can use my magic to increase your power even further, and surpass your limits! You will become a level 1 Beginner again, but you will keep your stats the same and all the Skill in you Hot Keys. Do you wish to be reborn? #b(Note: Please Make Sure you Have Room for all your Equipment in your Inventory. Also Make Sure you use all your SP. As it won't Be useable in your next Job.#k");
sendYesNo();
elseif state == 1 then
if getSelected() = 1 then
if getLevel() >= 200 then
addText("#bGood-Job#k, you have qualified for a #eRebirth#n.");
setLevel(2);
setJob(0);
else
addText("Sorry, You have to be level 200 to rebirth.");
sendOK();
endNPC();
end
else
addText("Ok, talk to me when your sure you want to #bRebirth#k.");
sendOK();
endNPC();
end
elseif state == 2 then
addText("Enjoy your rebirth!(Note: You will have to Change Channels For the Full Effect to Take Place.");
sendNext();
endNPC();
end
its not that JS is messy, its just that Vana runs off c++ which in turn makes it more compiled and more clean, Javascript dynamic and runs off prototypes using first class functions
-
Re: [Guide]How To Analize NPC Scripts
not to flame or anything...I found a guide that is like almost the same:http://forum.ragezone.com/f427/relea...ommans-397511/
-
Re: [Guide]How To Analize NPC Scripts
Quote:
not to flame or anything...I found a guide that is like almost the same:[Release] OdinMS NPC editing commans
It's not flaming, the thread owner doesn't care, we dont really care. thanks for trying.
And the difference between http://forum.ragezone.com/f427/relea...ommans-397511/
and this one is that this one is an analysis and explanation whereas the other one is straight to the point commands, it doesnt really tell u how to create an npc from scratch, see the difference or do you need help?
-
Re: [Guide]How To Analize NPC Scripts
-
Re: [Guide]How To Analize NPC Scripts
also not to flame but this is JAVA not JAVASCRIPT. you link in your sig you need to change it. its miss leading
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
~_AustraliaMS_~
not to be mean or anything but GTFO
-
Re: [Guide]How To Analize NPC Scripts
Nice job man I really need to try this.
-
Re: [Guide]How To Analize NPC Scripts
Quote:
Originally Posted by
holthelper
also not to flame but this is JAVA not JAVASCRIPT. you link in your sig you need to change it. its miss leading
i smell a retard.
THIS IS JAVASCRIPT
JAVA IS COMPLETELY DIFFERENT>
u say you are a coder, if you dont know what your talking about just leave
-
Re: [Guide]How To Analize NPC Scripts
nice guide good work very helpful~
-
Re: [Guide]How To Analize NPC Scripts
You mispelled "Analyze". Just saying.
-
Re: [Guide]How To Analize NPC Scripts