script_commands.txt 405 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206
  1. //===== rAthena Documentation================================
  2. //= rAthena Script Commands
  3. //===== By:==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated:========================================
  6. //= 20220308
  7. //===== Description:=========================================
  8. //= A reference manual for the rAthena scripting language.
  9. //= Commands are sorted depending on their functionality.
  10. //===========================================================
  11. This document is a reference manual for all the scripting commands and functions
  12. available in rAthena. It is not a simple tutorial. When people tell you to
  13. "Read The F***ing Manual", they mean this.
  14. This is not a place to teach you basic programming. This document will not teach
  15. you basic programming by itself. It's more of a reference for those who have at
  16. least a vague idea of what they want to do and want to know what tools they have
  17. available to do it. We've tried to keep it as simple as possible, but if you
  18. don't understand it, getting a clear book on programming in general will help
  19. better than yelling around the forum for help.
  20. A little learning never caused anyone's head to explode.
  21. Structure
  22. ---------
  23. The script commands are listed in no particular order, but are grouped by
  24. relative function.
  25. *Name of the command and parameters (if any).
  26. Descriptive text
  27. Small example if possible. Will usually be incomplete, it's there just to
  28. give you an idea of how it works in practice.
  29. To find a specific command, use Ctrl+F, (or whatever keys call up a search
  30. function in whatever you're reading this with) put an asterisk (*) followed by the command
  31. name, and it should find the command description for you.
  32. If you find anything missing, please let us know!
  33. Syntax
  34. ------
  35. Throughout this document, wherever a command wants an argument, it is given in
  36. <angle brackets>. This doesn't mean you should type the angle brackets. If an
  37. argument of a command is optional, it is given in {curly brackets}. You've
  38. doubtlessly seen this convention somewhere. If a command can optionally take
  39. an unspecified number of arguments, you'll see a list like this:
  40. command <argument>{,<argument>...<argument>}
  41. This still means they will want to be separated by commas.
  42. Where a command wants a string, it will be given in "quotes", if it's a number,
  43. it will be given without them. Normally, you can put an expression, like a bunch
  44. of functions or operators returning a value, in (round brackets) instead of most
  45. numbers. Round brackets will not always be required, but they're often a good
  46. idea.
  47. Wherever you refer to a map name, it's always 'map name' (.gat suffix is deprecated).
  48. Script loading structure
  49. ------------------------
  50. Scripts are loaded by the map server as referenced in the 'conf/map_athena.conf'
  51. configuration file, but in the default configuration, it doesn't load any script
  52. files itself. Instead, it loads the file 'npc/(pre-)re/scripts_main.conf' which itself
  53. contains references to other files. The actual scripts are loaded from txt
  54. files, which are linked up like this:
  55. npc: <path to a filename>
  56. Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the
  57. script contained in this file, which will make the script available. No file
  58. will get loaded twice to prevent possible errors.
  59. Another configuration file option of relevance is:
  60. delnpc: <path to a filename>
  61. This will unload a specified script filename from memory, which, while
  62. seemingly useless, may sometimes be required.
  63. Whenever '//' is encountered in a line upon reading, everything beyond this on
  64. that line is considered to be a comment and is ignored. This works wherever you
  65. place it.
  66. // This line will be ignored when processing the script.
  67. Block comments can also be used, where you can place /* and */ between any text you
  68. wish rAthena to ignore.
  69. Example:
  70. /* This text,
  71. * no matter which new line you start
  72. * is ignored, until the following
  73. * symbol is encountered: */
  74. The asterisks (*) in front of each line is a personal preference and is not required.
  75. Upon loading all the files, the server will execute all the top-level commands
  76. in them. No variables exist yet at this point, no commands can be called other
  77. than those given in this section. These commands set up the basic structure - create
  78. NPC objects, spawn monster objects, set map flags, etc. No code is actually
  79. executed at this point. The top-level commands are pretty confusing, since
  80. they aren't structured like you would expect (command name first), but rather,
  81. normally start with a map name.
  82. What's more confusing about the top-level commands is that most of them use a
  83. tab symbol to divide their arguments.
  84. To prevent problems and confusion, the tab symbols are written as '%TAB%'
  85. throughout this document, even though this makes the text a bit less readable.
  86. Using an invisible symbol to denote arguments is one of the bad things about
  87. this language.
  88. Here is a list of valid top-level commands:
  89. ** Set a map flag:
  90. <map name>%TAB%mapflag%TAB%<flag>
  91. This will, upon loading, set a specified map flag on a map you like. These are
  92. normally in files inside 'npc/mapflag' and are loaded first, so by the time the
  93. server's up, all the maps have the flags they should have. Map flags determine
  94. the behavior of the map in various situations. For more details, see 'setmapflag'
  95. and 'doc/mapflags.txt'.
  96. ** Create a permanent monster spawn:
  97. <map name>{,<x>{,<y>{,<xs>{,<ys>}}}}%TAB%monster%TAB%<monster name>{,<monster level>}%TAB%<mob id>,<amount>{,<delay1>{,<delay2>{,<event>{,<mob size>{,<mob ai>}}}}}
  98. Map name is the name of the map the monsters will spawn on. x,y are the
  99. coordinates where the mob should spawn. If xs and ys are non-zero, they
  100. specify the 'radius' of a spawn-rectangle area centered at x,y.
  101. Putting zeros instead of these coordinates will spawn the monsters randomly.
  102. Note this is only the initial spawn zone, as mobs random-walk, they are free
  103. to move away from their specified spawn region.
  104. Monster name is the name the monsters will have on screen, and has no relation
  105. whatsoever to their names anywhere else. It's the mob id that counts, which
  106. identifies monster record in 'mob_db.yml' database of monsters. If the mob name
  107. is given as "--ja--", the 'japanese name' field from the monster database is
  108. used, (which, in rAthena, actually contains an English name) if it's "--en--",
  109. it's the 'english name' from the monster database (which contains an uppercase
  110. name used to summon the monster with a GM command).
  111. You can specify a custom level to use for the mob different from the one of
  112. the database by adjoining the level after the name with a comma. eg:
  113. "Poring,50" for a name will spawn a monster with name Poring and level 50.
  114. Amount is the amount of monsters that will be spawned when this command is
  115. executed, it is affected by spawn rates in 'battle_athena.conf'.
  116. Delay1 and delay2 control monster respawn delays - the first one is the fixed
  117. base respawn time, and the second is random variance on top of the base time.
  118. Both values are given in milliseconds (1000 = 1 second).
  119. Note that the server also enforces a minimum respawn delay of 5 seconds.
  120. Event is a script event to be executed when the mob is killed. The event must
  121. be in the form "NPCName::OnEventName" to execute, and the event name label
  122. should start with "On". As with all events, if the NPC is an on-touch NPC, the
  123. player who triggers the script must be within 'trigger' range for the event to
  124. work.
  125. There are two optional fields for monster size and AI.
  126. Natural enemies for AI monsters are normal monsters.
  127. <mob size> can be:
  128. Size_Small (0)
  129. Size_Medium (1)
  130. Size_Large (2)
  131. <mob ai> can be:
  132. AI_NONE (0) (default)
  133. AI_ATTACK (1) (attack/friendly)
  134. AI_SPHERE (2) (Alchemist skill)
  135. AI_FLORA (3) (Alchemist skill)
  136. AI_ZANZOU (4) (Kagerou/Oboro skill)
  137. AI_LEGION (5) (Sera skill)
  138. AI_FAW (6) (Mechanic skill)
  139. AI_WAVEMODE (7) Normal monsters will ignore attack from AI_WAVEMODE monsters
  140. Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able
  141. to be detected on the map with the SC_BOSSMAPINFO status (used by Convex Mirror).
  142. ** NPC names
  143. /!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
  144. NPC names are kinda special and are formatted this way:
  145. <Display name>{::<Unique name>}
  146. All NPCs need to have a unique name that is used for identification purposes.
  147. When you have to identify a NPC by its name, you should use <Unique name>.
  148. If <Unique name> is not provided, use <Display name> instead.
  149. The client has a special feature when displaying names:
  150. if the display name contains a '#' character, it hides that part of the name.
  151. ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
  152. <Display name> must be at most 24 characters in length.
  153. <Unique name> must be at most 24 characters in length.
  154. ** Define a warp point
  155. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  156. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp2%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  157. This will define a warp NPC that will warp a player between maps, and while most
  158. arguments of that are obvious, some deserve special mention.
  159. SpanX and SpanY will make the warp sensitive to a character who didn't step
  160. directly on it, but walked into a zone which is centered on the warp from
  161. coordinates and is SpanX in each direction across the X axis and SpanY in each
  162. direction across the Y axis.
  163. Warp NPC objects also have a name, because you can use it to refer to them later
  164. with 'enablenpc'/'disablenpc'
  165. Facing of a warp object is irrelevant, it is not used in the code and all
  166. current scripts have a zero in there.
  167. Unlike 'warp', 'warp2' will also be triggered by hidden player.
  168. ** Define an NPC object.
  169. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  170. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  171. This will place an NPC object on a specified map at the specified location, and
  172. is a top-level command you will use the most in your custom scripting. The NPCs
  173. are triggered by clicking on them, and/or by walking in their trigger area, if
  174. defined, see that below.
  175. Facing is a direction the NPC sprite will face in. Not all NPC sprites have
  176. different images depending on the direction you look from, so for some facing
  177. will be meaningless. Facings are counted counterclockwise in increments of 45
  178. degrees, where 0 means facing towards the top of the map. (So to turn the sprite
  179. towards the bottom of the map, you use facing 4, and to make it look southeast
  180. it's facing 5.)
  181. Sprite ID is the sprite number or constant used to display this particular NPC.
  182. You may also use a monster's ID instead to display a monster sprite for this NPC.
  183. It is possible to use a job sprite as well, but you must first define it as a
  184. monster sprite in 'mob_avail.yml', a full description on how to do this is not
  185. in the scope of this manual.
  186. A '-1' Sprite ID will make the NPC invisible (and unclickable).
  187. A '111' Sprite ID will make an NPC which does not have a sprite, but is still
  188. clickable, which is useful if you want to make a clickable object of the 3D
  189. terrain.
  190. TriggerX and triggerY, if given, will define an area, centered on NPC and
  191. spanning triggerX cells in every direction across X and triggerY in every
  192. direction across Y. Walking into that area will trigger the NPC. If no
  193. 'OnTouch:' special label is present in the NPC code, the execution will start
  194. from the beginning of the script, otherwise, it will start from the 'OnTouch:'
  195. label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
  196. used in this case.
  197. The code part is the script code that will execute whenever the NPC is
  198. triggered. It may contain commands and function calls, descriptions of which
  199. compose most of this document. It has to be in curly brackets, unlike elsewhere
  200. where we use curly brackets, these do NOT signify an optional parameter.
  201. ** Define a 'floating' NPC object.
  202. -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  203. This will define an NPC object not triggerable by normal means. This would
  204. normally mean it's pointless since it can't do anything, but there are
  205. exceptions, mostly related to running scripts at specified time, which is what
  206. these floating NPC objects are for. More on that below.
  207. ** Define a shop/cashshop/itemshop/pointshop NPC.
  208. -%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>{,discount},<itemid>:<price>{,<itemid>:<price>...}
  209. <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>{,discount},<itemid>:<price>{,<itemid>:<price>...}
  210. -%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  211. <map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  212. -%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  213. <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  214. -%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  215. <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  216. <map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<stock>{,<itemid>:<price>:<stock>...}
  217. Note: Additionally barter shops can be defined in npc/barters.yml
  218. This will define a shop NPC, which, when triggered (which can only be done by
  219. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  220. NPCs and you can't change the prices otherwise than by editing the script
  221. itself.
  222. The Item ID is the number of item in the 'db/item_db.yml' database. If Price is set
  223. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  224. price you gave will be used for this item, which is how you create differing
  225. prices for items in different shops.
  226. Optionally you can specify the discount option and set it to "yes" or "no", to enable or disable discounting.
  227. There are other types of shops available:
  228. cashshop - use "cashshop" in place of "shop" to use the Cash Shop interface, allowing
  229. you to buy items with special points that are stored as account variables
  230. called #CASHPOINTS and #KAFRAPOINTS. This type of shop will not allow you to sell
  231. items at it, only make purchases. The layout used to define sale items still count, and
  232. "<price>" refers to how many points will be spent purchasing the them.
  233. "itemshop" and "pointshop" use the Shop interface, allowing you to buy items with a specific
  234. item or special points from a variable. 'pointshop' only supports permanent character variables,
  235. temporary character variables, permanent local account variables or permanent global account
  236. variables. These variables must be of integer type, not string. 'discount' flag is an
  237. optional value which makes the price at that shop become affected by discount skill.
  238. "marketshop" can have limited quantity of an item in stock.
  239. Use -1 in the stock field to have unlimited stock in a marketshop.
  240. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  241. warp/warp2: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  242. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  243. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  244. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  245. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  246. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  247. Warp duplicates inherit the target location.
  248. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  249. NPC duplicates inherit the script code.
  250. The rest (name, location, facing, sprite ID, span/trigger area)
  251. is obtained from the definition of the duplicate (not inherited).
  252. ** Define a function object
  253. function%TAB%script%TAB%<function name>%TAB%{<code>}
  254. This will define a function object, callable with the 'callfunc' command (see
  255. below). This object will load on every map server separately, so you can get at
  256. it from anywhere. It's not possible to call the code in this object by
  257. anything other than the 'callfunc' script command.
  258. The code part is the script code that will execute whenever the function is
  259. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  260. we use curly brackets, these do NOT signify an optional parameter.
  261. Once an object is defined which has a 'code' field to its definition, it
  262. contains script commands which can actually be triggered and executed.
  263. ~ RID? GID? ~
  264. What a RID is and why do you need to know
  265. -----------------------------------------
  266. Most scripting commands and functions will want to request data about a
  267. character, store variables referenced to that character, send stuff to the
  268. client connected to that specific character. Whenever a script is invoked by a
  269. character, it is passed a so-called RID - this is the account ID number of a
  270. character that caused the code to execute by clicking on it, walking into its
  271. OnTouch zone, or otherwise.
  272. If you are only writing common NPCs, you don't need to bother with it. However,
  273. if you use functions, if you use timers, if you use clock-based script
  274. activation, you need to be aware of all cases when a script execution can be
  275. triggered without a RID attached. This will make a lot of commands and functions
  276. unusable, since they want data from a specific character, want to send stuff to
  277. a specific client, want to store variables specific to that character, and they
  278. would not know what character to work on if there's no RID.
  279. Unless you use 'attachrid' to explicitly attach a character to the script first.
  280. Whenever we say 'invoking character', we mean 'the character who's RID is
  281. attached to the running script. The script function "playerattached" can be
  282. used to check which is the currently attached player to the script (it will
  283. return 0 if the there is no player attached or the attached player no longer
  284. is logged on to the map-server).
  285. But what about GID?
  286. -------------------
  287. GID stands for the Game ID of something, this can either be the GID obtained
  288. through mobspawn (mob control commands) or the account ID of a character.
  289. Another way would be to right click on a mob, NPC or char as GM sprited char
  290. to view the GID.
  291. See also 'getpetinfo', 'getmercinfo', 'gethominfo', and 'geteleminfo'.
  292. This is mostly used for the new version of skill and the mob control commands
  293. implemented.
  294. Item and pet scripts
  295. --------------------
  296. Each item in the item database has three special fields - Script , EquipScript
  297. and UnEquipScript. The first is script code run every time a character equips the item,
  298. with the RID of the equipping character. Every time they unequip an item, all
  299. temporary bonuses given by the script commands are cleared, and all the scripts
  300. are executed once again to rebuild them. This also happens in several other
  301. situations (like upon login) but the full list is currently unknown.
  302. EquipScript is a piece of script code run whenever the item is used by a character
  303. by double-clicking on it. UnEquipScript runs whenever the
  304. equipment is unequip by a character
  305. Not all script commands work properly in the item scripts. Where commands and
  306. functions are known to be meant specifically for use in item scripts, they are
  307. described as such.
  308. Every pet in the pet database has a PetScript field, which determines pet
  309. behavior. It is invoked wherever a pet of the specified type is spawned.
  310. (hatched from an egg, or loaded from the char server when a character who had
  311. that pet following them connects) This may occur in some other situations as
  312. well. Don't expect anything other than commands definitely marked as usable in
  313. pet scripts to work in there reliably.
  314. Numbers
  315. -------
  316. Beside the common decimal numbers, which are nothing special whatsoever (though
  317. do not expect to use fractions, since ALL numbers are integer in this language),
  318. the script engine also handles hexadecimal numbers, which are otherwise
  319. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  320. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  321. to 'mes 0x10' it will print '16'.
  322. Number values can't exceed the limits of an integer variable: Any number
  323. greater than INT64_MAX (9223372036854775807) or smaller than INT64_MIN
  324. (-9223372036854775808) will be capped to those values and will cause a warning
  325. to be reported.
  326. Variables
  327. ---------
  328. The meat of every programming language is variables - places where you store
  329. data.
  330. In the rAthena scripting language, variable names are not case sensitive.
  331. Variables are divided into and uniquely identified by the combination of:
  332. prefix - determines the scope and extent (or lifetime) of the variable
  333. name - an identifier consisting of '_' and alphanumeric characters
  334. postfix - determines the type of the variable: integer or string
  335. Scope can be:
  336. global - global to all servers
  337. local - local to the server
  338. account - attached to the account of the character identified by RID
  339. character - attached to the character identified by RID
  340. npc - attached to the NPC
  341. scope - attached to the scope of the instance
  342. Extent can be:
  343. permanent - They still exist when the server resets.
  344. temporary - They cease to exist when the server resets.
  345. Prefix: scope and extent
  346. nothing - A permanent variable attached to the character, the default variable
  347. type. They are stored by char-server in the `char_reg_num` and
  348. `char_reg_str`.
  349. "@" - A temporary variable attached to the character.
  350. SVN versions before 2094 revision and RC5 version will also treat
  351. 'l' as a temporary variable prefix, so beware of having variable
  352. names starting with 'l' if you want full backward compatibility.
  353. "$" - A global permanent variable.
  354. They are stored by map-server in database table `mapreg`.
  355. "$@" - A global temporary variable.
  356. This is important for scripts which are called with no RID
  357. attached, that is, not triggered by a specific character object.
  358. "." - A NPC variable.
  359. They exist in the NPC and disappear when the server restarts or the
  360. NPC is reloaded. Can be accessed from inside the NPC or by calling
  361. 'getvariableofnpc'. Function objects can also have .variables which
  362. are accessible from inside the function, however 'getvariableofnpc'
  363. does NOT work on function objects.
  364. ".@" - A scope variable.
  365. They are unique to the instance and scope. Each instance has its
  366. own scope that ends when the script ends. Calling a function with
  367. callsub/callfunc starts a new scope, returning from the function
  368. ends it. When a scope ends, its variables are converted to values
  369. ('return .@var;' returns a value, not a reference).
  370. "'" - An instance variable.
  371. These are used with the instancing system and are unique to each
  372. instance type. Can be accessed from inside the instance or by calling
  373. 'getinstancevar'.
  374. "#" - A permanent local account variable.
  375. They are stored by char-server in the `acc_reg_num` table and
  376. `acc_reg_str`.
  377. "##" - A permanent global account variable stored by the login server.
  378. They are stored in the `global_acc_reg_num` table and
  379. `global_acc_reg_str`.
  380. The only difference you will note from normal # variables is when
  381. you have multiple char-servers connected to the same login server.
  382. The # variables are unique to each char-server, while the ## variables
  383. are shared by all these char-servers.
  384. Postfix: integer or string
  385. nothing - integer variable, can store positive and negative numbers, but only
  386. whole numbers (so don't expect to do any fractional math)
  387. '$' - string variable, can store text
  388. Examples:
  389. name - permanent character integer variable
  390. name$ - permanent character string variable
  391. @name - temporary character integer variable
  392. @name$ - temporary character string variable
  393. $name - permanent global integer variable
  394. $name$ - permanent global string variable
  395. $@name - temporary global integer variable
  396. $@name$ - temporary global string variable
  397. .name - NPC integer variable
  398. .name$ - NPC string variable
  399. .@name - scope integer variable
  400. .@name$ - scope string variable
  401. 'name - instance integer variable
  402. 'name$ - instance string variable
  403. #name - permanent local account integer variable
  404. #name$ - permanent local account string variable
  405. ##name - permanent global account integer variable
  406. ##name$ - permanent global account string variable
  407. If a variable was never set, it is considered to equal zero for integer
  408. variables or an empty string ("", nothing between the quotes) for string
  409. variables. Once you set it to that, the variable is as good as forgotten
  410. forever, and no trace remains of it even if it was stored with character or
  411. account data.
  412. Some variables are special, that is, they are already defined for you by the
  413. scripting engine. You can see the full list in 'src/map/script_constants.hpp', which
  414. is a file you should read, since it also allows you to replace lots of numbered
  415. arguments for many commands with easier to read text. The special variables most
  416. commonly used are all permanent character-based variables:
  417. Zeny - Amount of Zeny.
  418. Hp - Current amount of hit points.
  419. MaxHp - Maximum amount of hit points.
  420. Sp - Current spell points.
  421. MaxSp - Maximum amount of spell points.
  422. StatusPoint - Amount of status points remaining.
  423. SkillPoint - Amount of skill points remaining.
  424. BaseLevel - Character's base level.
  425. JobLevel - Character's job level.
  426. BaseExp - Amount of base experience points.
  427. JobExp - Amount of job experience points.
  428. NextBaseExp - Amount of base experience points needed to reach the next level.
  429. NextJobExp - Amount of job experience points needed to reach the next level.
  430. Weight - Amount of weight the character currently carries.
  431. MaxWeight - Maximum weight the character can carry.
  432. Sex - 0 if female, 1 if male.
  433. Class - Character's job.
  434. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  435. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  436. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  437. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  438. reached a 1-1 class, it will return Job_Novice.
  439. BaseJob - The character's 'normal' job, regardless of Upper value.
  440. For example, this will return Job_Acolyte for Acolyte,
  441. Baby Acolyte, and High Acolyte.
  442. Karma - The character's karma. Karma system is not fully functional, but
  443. this doesn't mean this doesn't work at all. Not tested.
  444. Manner - The character's manner rating. Becomes negative if the player
  445. utters words forbidden through the use of 'manner.txt' client-side
  446. file.
  447. Ap - Current amount of activity points.
  448. MaxAp - Maximum amount of activity points.
  449. While these behave as variables, do not always expect to just set them - it is
  450. not certain whether this will work for all of them. Whenever there is a command
  451. or a function to set something, it's usually preferable to use that instead. The
  452. notable exception is Zeny, which you can and often will address directly -
  453. setting it will make the character own this number of Zeny.
  454. If you try to set Zeny to a negative number, the script will be terminated with an error.
  455. Some source-end constants can also be accessed in scripts. This list is located in
  456. 'src/map/script_constants.hpp', which contains constants such as server defines and status options:
  457. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  458. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  459. VIP_SCRIPT, MIN_STORAGE
  460. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  461. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  462. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  463. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  464. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  465. Assigning variables
  466. --------- ---------
  467. Variables can be accessed and modified much like in other programming languages.
  468. .@x = 100;
  469. .@x = .@y = 100;
  470. Support for modifying variable values using 'set' is still supported (and required
  471. to exist for this new method to work) so previous scripts will continue to work.
  472. When assigning values, all operator methods are supported which exist in the below
  473. 'Operators' section. For instance:
  474. .@x += 100;
  475. .@x -= 100;
  476. .@x *= 2;
  477. .@x /= 2;
  478. .@x %= 5;
  479. .@x >>= 2;
  480. .@x <<= 2;
  481. Will all work. For more information on available operators, see the Operators section
  482. described below. All operators listed there may be placed in-front of the '=' sign
  483. when modifying variables to perform the action as required.
  484. Note:
  485. !! Currently the scripting engine does not support directly copying array variables.
  486. !! In order to copy arrays between variables the use of 'copyarray' function is still
  487. !! required.
  488. Strings
  489. -------
  490. To include symbol '"' in a string you should use prefix '\"'
  491. Arrays
  492. ------
  493. Arrays (in rAthena at least) are essentially a set of variables going under the
  494. same name. You can tell between the specific variables of an array with an
  495. 'array index', a number of a variable in that array:
  496. <variable name>[<array index>]
  497. All variable types can be used as arrays.
  498. Variables stored in this way, inside an array, are also called 'array elements'.
  499. Arrays are specifically useful for storing a set of similar data (like several
  500. item IDs for example) and then looping through it. You can address any array
  501. variable as if it was a normal variable:
  502. set .@arrayofnumbers[0],1;
  503. You can also do things like using a variable (or an expression, or even a
  504. value from another array) to get at an array value:
  505. set .@x,100;
  506. set .@arrayofnumbers[.@x],10;
  507. This will make .@arrayofnumbers[100] equal to 10.
  508. Index numbering always starts with 0 and arrays can hold over 2 billion
  509. variables. As such, the (guaranteed) allowed values for indices are in the
  510. range 0 ~ 2147483647.
  511. And array indexes probably can't be negative. Nobody tested what happens when
  512. you try to get a negatively numbered variable from an array, but it's not going
  513. to be pretty.
  514. Arrays can naturally store strings:
  515. .@menulines$[0] is the 0th element of the .@menulines$ array of strings. Notice
  516. the '$', normally denoting a string variable, before the square brackets that
  517. denotes an array index.
  518. Variable References
  519. -------------------
  520. //##TODO
  521. Operators
  522. ---------
  523. Operators are things you can do to variables and numbers. They are either the
  524. common mathematical operations or conditional operators
  525. + - will add two numbers. If you try to add two strings, the result will be a
  526. string glued together at the +. You can add a number to a string, and the
  527. result will be a string. No other math operators work with strings.
  528. - - will subtract two numbers.
  529. * - will multiply two numbers.
  530. / - will divide two numbers. Note that this is an integer division, i.e.
  531. 7/2 is not equal 3.5, it's equal 3.
  532. % - will give you the remainder of the division. 7%2 is equal to 1.
  533. There are also conditional operators. This has to do with the conditional
  534. command 'if' and they are meant to return either 1 if the condition is satisfied
  535. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  536. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  537. zero will also be True.)
  538. You can compare numbers to each other and you compare strings to each other, but
  539. you can not compare numbers to strings.
  540. == - Is true if both sides are equal. For strings, it means they are the same.
  541. >= - True if the first value is equal to, or greater than, the second value.
  542. <= - True if the first value is equal to, or less than, the second value
  543. > - True if the first value greater than the second value
  544. < - True if the first value is less than the second value
  545. != - True if the first value IS NOT equal to the second one
  546. Examples:
  547. 1 == 1 is True.
  548. 1<2 is True while 1>2 is False.
  549. .@x>2 is True if .@x is equal to 3. But it isn't true if .@x is 2.
  550. Only ' == ' and '!=' have been tested for comparing strings. Since there's no way
  551. to code a seriously complex data structure in this language, trying to sort
  552. strings by alphabet would be pointless anyway.
  553. Comparisons can be stacked in the same condition:
  554. && - Is True if and only if BOTH sides are true.
  555. ('1 == 1 && 2 == 2' is true. '2 == 1 && 1 == 1' is false.)
  556. || - Is True if either side of this expression is True.
  557. 1 == 1 && 2 == 2 is True.
  558. 1 == 1 && 2 == 1 is False.
  559. 1 == 1 || 2 == 1 is True.
  560. Logical bitwise operators work only on numbers, and they are the following:
  561. << - Left shift.
  562. >> - Right shift.
  563. Left shift moves the binary 1(s) of a number n positions to the left,
  564. which is the same as multiplying by 2, n times.
  565. In the other hand, Right shift moves the binary 1(s) of a number n positions
  566. to the right, which is the same as dividing by 2, n times.
  567. Example:
  568. set b,2;
  569. set a, b << 3;
  570. mes a;
  571. set a, a >> 2;
  572. mes a;
  573. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  574. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  575. & - And.
  576. | - Or.
  577. The bitwise operator AND (&) is used to test two values against each other,
  578. and results in setting bits which are active in both arguments. This can
  579. be used for a few things, but in rAthena this operator is usually used to
  580. create bit-masks in scripts.
  581. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  582. of one of the numbers is 1. This way a variable can hold several values we can check,
  583. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  584. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  585. that a player can have.
  586. A bit-mask basically is (ab)using the variables bits to set various options in
  587. one variable. With the current limit if variables it is possible to store 32
  588. different options in one variable (by using the bits on position 0 to 31).
  589. Example(s):
  590. - Basic example of the & operator, bit example:
  591. 10 & 2 = 2
  592. Why? :
  593. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  594. 2 = 2^1 (2), so in bits (same size) it would be 0010
  595. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  596. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  597. 0010, which is 2.
  598. - Basic example of creating and using a bit-mask:
  599. set .@options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  600. if (.@options & 1) mes "Option 1 is activated";
  601. if (.@options & 2) mes "Option 2 is activated";
  602. if (.@options & 4) mes "Option 3 is activated";
  603. if (.@options & 8) mes "Option 4 is activated";
  604. if (.@options & 16) mes "Options 5 is activated";
  605. This would return the messages about option 2, 3 and 5 being shown (since we've set
  606. the 2,4 and 16 bit to 1).
  607. ^ - Xor.
  608. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  609. numbers have the same value in the said position. On the other hand, it
  610. sets to 1 if they have different values in the said binary position.
  611. This is another way of setting and unsetting bits in bit-masks.
  612. Example:
  613. - First let's set the quests that are currently in progress:
  614. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  615. - After playing for a bit, the player starts another quest:
  616. if (inProgress&2 == 0) {
  617. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  618. set inProgress,inProgress^2;
  619. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  620. close;
  621. }
  622. - After spending some time reading info on Xor's, the player finally completes quest 1:
  623. if (inProgress&1 && isComplete) {
  624. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  625. set inProgress,inProgress^1;
  626. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  627. close;
  628. }
  629. Unary operators with only with a single number, which follows the operator, and
  630. are following:
  631. - - Negation.
  632. The sign of the number will be reversed. If the number was positive, it will
  633. become negative and vice versa.
  634. Example:
  635. set .@myvar,10;
  636. mes "Negative 10 is " + (-.@myvar);
  637. ! - Logical Not.
  638. Reverses the boolean result of an expression. True will become false and
  639. false will become true.
  640. Example:
  641. if (!callfunc("F_dosomething"))
  642. {
  643. mes "Doing something failed.";
  644. close;
  645. }
  646. ~ - Bitwise Not.
  647. Reverses each bit in a number, also known as one's complement. Cleared bits
  648. are set, and set bits are cleared.
  649. Example:
  650. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  651. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  652. Ternary operators take three expressions (numbers, strings or boolean), and are
  653. following:
  654. ?: - Conditional operator
  655. Very useful e.g. to replace
  656. if (Sex) mes "..."; else mes "...";
  657. clauses with simple
  658. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  659. or to replace any other simple if-else clauses. It might be worth
  660. mentioning that ?: has low priority and has to be enclosed with
  661. parenthesis in most (if not all) cases.
  662. Labels
  663. ------
  664. Within executable script code, some lines can be labels:
  665. <label name>:
  666. Labels are points of reference in your script, which can be used to route
  667. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  668. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  669. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  670. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  671. under 22 characters could be wise. It may only contain alphanumeric characters
  672. and underscore. In addition to labels you name yourself, there are also some
  673. special labels which the script engine will start execution from if a special
  674. event happens:
  675. OnClock<hour><minute>:
  676. OnMinute<minute>:
  677. OnHour<hour>:
  678. On<weekday><hour><minute>:
  679. OnDay<month><day>:
  680. This will execute when the server clock hits the specified date or time. Hours
  681. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  682. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  683. Remember the zero.
  684. OnInit:
  685. OnInterIfInit:
  686. OnInterIfInitOnce:
  687. OnInit will execute every time the scripts loading is complete, including when
  688. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  689. the map server connects to a char server, OnInterIfInitOnce will only execute
  690. once and will not execute if the map server reconnects to the char server later.
  691. OnAgitStart:
  692. OnAgitEnd:
  693. OnAgitInit:
  694. OnAgitStart2:
  695. OnAgitEnd2:
  696. OnAgitInit2:
  697. OnAgitStart3:
  698. OnAgitEnd3:
  699. OnAgitInit3:
  700. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  701. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  702. will do likewise for the end of WoE.
  703. OnAgitInit will run when data for all castles and all guilds that hold a castle
  704. is received by map-server from the char-server after initial connect.
  705. No RID will be attached while any of the above mentioned labels are triggered, so
  706. no character or account-based variables will be accessible, until you attach a
  707. RID with 'attachrid' (see below).
  708. The above also applies to, the last three labels, the only difference is that
  709. these labels are used exclusively for WoE SE, and are called independently.
  710. OnInstanceInit:
  711. This label will be executed when an instance is created and initialized through
  712. the 'instance_create' command. It will run again if @reloadscript is used while
  713. an instance is in progress.
  714. OnInstanceDestroy:
  715. This label will be executed when an instance is destroyed by a timeout, exceeding
  716. the keepalive time or through the 'instance_destroy' command. It will be called
  717. exactly before the instance will be destroyed and all other NPCs of the instance
  718. will still be available at this point of time.
  719. OnTouch:
  720. This label will be executed if a trigger area is defined for the NPC object it's
  721. in. If it isn't present, the execution will start from the beginning of the NPC
  722. code. The RID of the triggering character object will be attached.
  723. OnTouch_:
  724. Similar to OnTouch, but will only run one instance. Another character is
  725. chosen once the triggering character leaves the area.
  726. OnTouchNPC:
  727. Similar to OnTouch, but will only trigger for monsters. For this case, by using
  728. 'getattachedrid' will returns GID (ID that returned when use 'monster').
  729. OnPCLoginEvent:
  730. OnPCLogoutEvent:
  731. OnPCBaseLvUpEvent:
  732. OnPCJobLvUpEvent:
  733. It's pretty obvious when these four special labels will be invoked.
  734. OnPCDieEvent:
  735. This special label triggers when a player dies. The variable 'killerrid' is
  736. set to the ID of the killer.
  737. OnPCKillEvent:
  738. This special label triggers when a player kills another player. The variable
  739. 'killedrid' is set to the ID of the player killed.
  740. OnNPCKillEvent:
  741. This special label triggers when a player kills a monster without label.
  742. The variable 'killedrid' is set to the Class (mob ID) of the monster killed.
  743. The variable 'killedgid' is set to the ID (unique mob game ID) of the monster killed.
  744. OnPCLoadMapEvent:
  745. This special label triggers when a player steps in a map marked with the
  746. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  747. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  748. every time a player would change maps. Imagine the server load with 1,000 players
  749. (oh the pain...)
  750. OnWhisperGlobal:
  751. This special label triggers when a player whispers the NPC, and will run with the
  752. player's RID attached. It can accept up to ten parameters, which will be stored
  753. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  754. See 'doc/whisper_sys.txt' for further documentation.
  755. Only the special labels which are not associated with any script command are
  756. listed here. There are other kinds of labels which may be triggered in a similar
  757. manner, but they are described with their associated commands.
  758. OnNaviGenerate:
  759. This special label triggers when running the map-server-generator binary. It is used
  760. in combination with 'naviregisterwarp' to register extra warps for an npc.
  761. On<label name>:
  762. These special labels are used with Mob scripts mostly, and script commands
  763. that requires you to point/link a command to a mob or another NPC, giving a label
  764. name to start from. The label name can be any of your liking, but must be
  765. started with "On".
  766. Example:
  767. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  768. amatsu,13,152,4 script Master 767,{
  769. mes "Hi there";
  770. close;
  771. OnThisMobDeath:
  772. announce "Hey, " + strcharinfo(0) + " just killed a Poringz0rd!",bc_blue|bc_all;
  773. end;
  774. }
  775. Each time you kill one, that announce will appear in blue to everyone.
  776. "Global" labels
  777. There's a catch with labels and doevent. If you call a label (using doevent)
  778. and called label is in NPC that has trigger area, that label must end with
  779. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  780. usually happens since otherwise there would be no point calling the label with
  781. doevent, because OnTouch would do the job). For further reference look for
  782. npc_event in npc.cpp.
  783. Scripting commands and functions
  784. --------------------------------
  785. The commands and functions are listed here in no particular order. There's a
  786. difference between commands and functions - commands leave no 'return value'
  787. which might be used in a conditional statement, as a command argument, or stored
  788. in a variable. Calling commands as if they were functions will sometimes work,
  789. but is not advised, as this can lead to some hard to track errors. Calling
  790. functions as if they were commands will mess up the stack, so 'return' command
  791. will not return correctly after this happens in a particular script.
  792. All commands must end with a ';'.
  793. -------------------------
  794. From here on, we will have the commands sorted as follow:
  795. 1.- Basic commands.
  796. 2.- Information-retrieving commands.
  797. 3.- Checking commands.
  798. 4.- Player-related commands.
  799. 5.- Mob / NPC -related commands.
  800. 6.- Other commands.
  801. 7.- Instance commands.
  802. 8.- Quest Log commands.
  803. 9.- Battleground commands.
  804. 10.- Pet commands.
  805. 10.1.- The Pet AI commands.
  806. 11.- Homunculus commands.
  807. 12.- Mercenary commands.
  808. 13.- Party commands.
  809. 14.- Channel commands.
  810. 15.- Achievement commands.
  811. =====================
  812. |1.- Basic commands.|
  813. =====================
  814. ---------------------------------------
  815. *mes "<string>"{,"<string>"{,...}};
  816. This command will display a box on the screen for the invoking character, if no
  817. such box is displayed already, and will print the string specified into that
  818. box. There is normally no 'close' or 'next' button on this box, unless you
  819. create one with 'close' or 'next', and while it's open the player can't do much
  820. else, so it's important to create a button later. If the string is empty, it
  821. will show up as an empty line.
  822. mes "Text that will appear in the box";
  823. Colors
  824. ------
  825. Inside the string you may put color codes, which will alter the color of the
  826. text printed after them. The color codes are all '^<R><G><B>' and contain three
  827. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  828. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  829. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  830. whenever the client is drawing windows on screen, so printing text in that color
  831. will have kind of a weird effect. Once you've set a text's color to something,
  832. you have to set it back to black unless you want all the rest of the text be in
  833. that color:
  834. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  835. Notice that the text coloring is handled purely by the client. If you use non-
  836. English characters, the color codes might get screwed if they stick to letters
  837. with no intervening space. Separating them with spaces from the letters on
  838. either side solves the problem.
  839. Multiple Lines
  840. --------------
  841. To display multiple lines of message while only using a single 'mes' command,
  842. use the script command in the following format:
  843. mes "Line 1", "Line 2", "Line 3";
  844. This will display 3 different lines while only consuming a single line in
  845. the relevant script file.
  846. Navigation
  847. ----------
  848. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  849. using HTML-like labels:
  850. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  851. The "flag" parameter can be:
  852. 0: Do not open Navigation Window (default).
  853. 1: Open Navigation Window.
  854. The example below will make the [Tool Shop] text clickable and begin navigation
  855. to alberta (98,154) when clicked.
  856. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  857. See also 'navigateto', which can be used for certain NPC events.
  858. Items
  859. -----
  860. You can refer to items by using HTML-like links to certain items:
  861. <ITEMLINK>Display Name<INFO>Item ID</INFO></ITEMLINK>
  862. Where <Display Name> is the name that will be displayed for your link and
  863. <Item ID> being the ID of the item you want to link to when clicked.
  864. In 2015 the tag name was changed to <ITEM> resulting in the following syntax:
  865. <ITEM>Display Name<INFO>Item ID</INFO></ITEM>
  866. The following sample will open a preview window for Red Potion:
  867. mes "Did you ever consume a <ITEMLINK>Red Potion<INFO>501</INFO></ITEMLINK>?";
  868. // Or in 2015:
  869. mes "Did you ever consume a <ITEM>Red Potion<INFO>501</INFO></ITEM>?";
  870. NOTE: Be aware that item links are rendered incorrectly in 2015+ clients at the moment.
  871. URLs
  872. ----
  873. Similarly, you can create links to websites that launch in a new window:
  874. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  875. Quests
  876. ------
  877. You can link to a quest:
  878. <QUEST>Quest<INFO>1</INFO></QUEST>
  879. Message
  880. -------
  881. You can show a message from the msgstringtable:
  882. <MSG>1</MSG>
  883. Tips
  884. ----
  885. You can show a tip box:
  886. <TIPBOX>Show Tip<INFO>1</INFO></TIPBOX>
  887. ---------------------------------------
  888. *next;
  889. This command will display a 'next' button in the message window for the
  890. invoking character. Clicking on it will cause the window to clear and display
  891. a new one. Used to segment NPC-talking, next is often used in combination with
  892. 'mes' and 'close'.
  893. If no window is currently on screen, one will be created, but once the invoking
  894. character clicks on it, a warning is thrown on the server console and the script
  895. will terminate.
  896. mes "[Woman]";
  897. mes "This would appear on the page";
  898. next;
  899. // This is needed since it is a new page and the top will now be blank
  900. mes "[Woman]";
  901. mes "This would appear on the 2nd page";
  902. ---------------------------------------
  903. *clear;
  904. This command will clear the dialog text and continue the script without player interaction.
  905. Example:
  906. mes "This is how the 'clear' script command works.";
  907. sleep2 3000;
  908. clear; // This will clear the dialog and continue to the next one.
  909. mes "I will show you again.";
  910. sleep2 3000;
  911. clear;
  912. mes "Bye!";
  913. close;
  914. ---------------------------------------
  915. *close;
  916. This command will create a 'close' button in the message window for the invoking
  917. character. If no window is currently on screen, the script execution will end. This is one
  918. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  919. script execution will end, and the message box will disappear.
  920. mes "[Woman]";
  921. mes "I am finished talking to you. Click the close button.";
  922. close;
  923. mes "This command will not run at all, since the script has ended.";
  924. ---------------------------------------
  925. *close2;
  926. This command will create a 'close' button in the message window for the invoking
  927. character. WARNING: If no window is currently on screen, the script execution will halt
  928. indefinitely! See 'close'. There is one important difference, though - even though
  929. the message box will have closed, the script execution will not stop, and commands after
  930. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  931. make it stop in some other manner.
  932. mes "[Woman]";
  933. mes "I will warp you now.";
  934. close2;
  935. warp "place",50,50;
  936. end;
  937. Don't expect things to run smoothly if you don't make your scripts 'end'.
  938. ---------------------------------------
  939. *end;
  940. This command will stop the execution for this particular script. The two
  941. versions are perfectly equivalent. It is the normal way to end a script which
  942. does not use 'mes'.
  943. if (BaseLevel <= 10)
  944. npctalk "Look at that you are still a n00b";
  945. else if (BaseLevel <= 20)
  946. npctalk "Look at that you are getting better, but still a n00b";
  947. else if (BaseLevel <= 30)
  948. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  949. else if (BaseLevel <= 40)
  950. npctalk "Look at that you are almost 2nd profession";
  951. end;
  952. Without the use of 'end' it would travel through the labels until the end of the
  953. script. If you were lvl 10 or less, you would see all the speech lines, the use
  954. of 'end' stops this, and ends the script.
  955. ---------------------------------------
  956. *set <variable>,<expression>{,<char_id>};
  957. *set(<variable>,<expression>{,<char id>})
  958. This command will set a variable to the value that the expression results in.
  959. Variables may either be set through this command or directly, much like any
  960. other programming language (refer to the "Assigning variables" section).
  961. This is the most basic script command and is used a lot whenever you try to do
  962. anything more advanced than just printing text into a message box.
  963. set .@x,100;
  964. will make .@x equal 100.
  965. set .@x,1+5/8+9;
  966. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  967. integer in this language) and make .@x equal it.
  968. Returns the variable reference (since trunk r12870).
  969. ---------------------------------------
  970. *setd "<variable name>",<value>{,<char_id>};
  971. Works almost identically as set, except the variable name is identified as a string
  972. and can thus be constructed dynamically.
  973. This command is equivalent to:
  974. set getd("variable name"),<value>;
  975. Examples:
  976. setd ".@var$", "Poporing";
  977. mes .@var$; // Displays "Poporing".
  978. setd ".@" + .@var$ + "123$", "Poporing is cool";
  979. mes .@Poporing123$; // Displays "Poporing is cool".
  980. NOTE:
  981. 'char_id' only works for non-server variables.
  982. Player with Character ID 'char_id' must be online.
  983. ---------------------------------------
  984. *getd("<variable name>")
  985. Returns a reference to a variable, the name can be constructed dynamically.
  986. Refer to 'setd' for usage.
  987. This can also be used to set an array dynamically:
  988. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  989. Examples:
  990. set getd("$varRefence"), 1;
  991. set .@i, getd("$" + "pikachu");
  992. ---------------------------------------
  993. *getvariableofnpc(<variable>,"<npc name>")
  994. Returns a reference to a NPC variable (. prefix) from the target NPC.
  995. This can only be used to get . variables.
  996. Examples:
  997. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  998. getvariableofnpc(.var,"TargetNPC");
  999. //This will set the .v variable to the value of the TargetNPC's .var variable.
  1000. set .v, getvariableofnpc(.var,"TargetNPC");
  1001. //This will set the .var variable of TargetNPC to 1.
  1002. set getvariableofnpc(.var,"TargetNPC"), 1;
  1003. Note: even though function objects can have .variables,
  1004. getvariableofnpc will not work on them.
  1005. ---------------------------------------
  1006. *getvar <variable>,<char_id>;
  1007. Get variable value from the specified player. Only player/account variables
  1008. are allowed to be used (temporary character variable "@", permanent
  1009. character "", permanent local account "#", and permanent global account "##").
  1010. ---------------------------------------
  1011. *goto <label>;
  1012. This command will make the script jump to a label, usually used in conjunction
  1013. with other command, such as "if", but often used on its own.
  1014. ...
  1015. goto Label;
  1016. mes "This will not be seen";
  1017. end;
  1018. Label:
  1019. mes "This will be seen";
  1020. end;
  1021. This command should be avoided and only used if there is no other option.
  1022. ---------------------------------------
  1023. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  1024. This command will create a selectable menu for the invoking character. Only one
  1025. menu can be on screen at the same time.
  1026. Depending on what the player picks from the menu, the script execution will
  1027. continue from the corresponding label. (it's string-label pairs, not label-
  1028. string)
  1029. Options can be grouped together, separated by the character ':'.
  1030. menu "A:B",L_Wrong,"C",L_Right;
  1031. It also sets a special temporary character variable @menu, which contains the
  1032. number of option the player picked. (Numbering of options starts at 1.)
  1033. This number is consistent with empty options and grouped options.
  1034. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  1035. L_Wrong:
  1036. // If they click "A" or "B" they will end up here
  1037. // @menu == 1 if "A"
  1038. // @menu == 2 will never happen because the option is empty
  1039. // @menu == 3 if "B"
  1040. L_Impossible:
  1041. // Empty options are not displayed and therefore can't be selected
  1042. // this label will never be reached from the menu command
  1043. L_Right:
  1044. // If they click "C" they will end up here
  1045. // @menu == 5
  1046. If a label is '-', the script execution will continue right after the menu
  1047. command if that option is selected, this can be used to save you time, and
  1048. optimize big scripts.
  1049. menu "A::B:",-,"C",L_Right;
  1050. // If they click "A" or "B" they will end up here
  1051. // @menu == 1 if "A"
  1052. // @menu == 3 if "B"
  1053. L_Right:
  1054. // If they click "C" they will end up here
  1055. // @menu == 5
  1056. Both these examples will perform the exact same task.
  1057. If you give an empty string as a menu item, the item will not display. This
  1058. can effectively be used to script dynamic menus by using empty string for
  1059. entries that should be unavailable at that time.
  1060. You can do it by using arrays, but watch carefully - this trick isn't high
  1061. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1062. until you understand how it works.
  1063. Create a temporary array of strings to contain your menu items, and populate it
  1064. with the strings that should go into the menu at this execution, making sure not
  1065. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1066. this:
  1067. setarray .@possiblemenuitems$[0],<list of potential menu items>;
  1068. .@j = 0; // That's the menu lines counter.
  1069. // We loop through the list of possible menu items.
  1070. // .@i is our loop counter.
  1071. for( .@i = 0; .@i < getarraysize(.@possiblemenuitems$); .@i++ )
  1072. {
  1073. // That 'condition' is whatever condition that determines whether
  1074. // a menu item number .@i actually goes into the menu or not.
  1075. if (<condition>)
  1076. {
  1077. // We record the option into the list of options actually available.
  1078. .@menulist$[@j] = .@possiblemenuitems$[@i];
  1079. // We just copied the string, we do need its number for later
  1080. // though, so we record it as well.
  1081. .@menureference[@j] = .@i;
  1082. // Since we've just added a menu item into the list, we increment
  1083. // the menu lines counter.
  1084. .@j++;
  1085. }
  1086. // We go on to the next possible menu item.
  1087. }
  1088. This will create you an array .@menulist$ which contains the text of all items
  1089. that should actually go into the menu based on your condition, and an array
  1090. .@menureference, which contains their numbers in the list of possible menu items.
  1091. (Remember, arrays start with 0.) There's less of them than the possible menu
  1092. items you've defined, but the menu command can handle the empty lines - only if
  1093. they are last in the list, and if it's made this way, they are. Now comes a
  1094. dirty trick:
  1095. // X is whatever the most menu items you expect to handle.
  1096. menu .@menulist$[0],-,.@menulist$[1],-,...,.@menulist$[<X>],-;
  1097. This calls up a menu of all your items. Since you didn't copy some of the
  1098. possible menu items into the list, its end is empty and so no menu items will
  1099. show up past the end. But this menu call doesn't jump anywhere, it just
  1100. continues execution right after the menu command. (And it's a good thing it
  1101. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1102. know which ones to define if you don't know beforehand which options will end up
  1103. where in your menu?)
  1104. But how do you figure out which option the user picked? Enter the @menu.
  1105. @menu contains the number of option that the user selected from the list,
  1106. starting with 1 for the first option. You know now which option the user picked
  1107. and which number in your real list of possible menu items it translated to:
  1108. mes "You selected " + .@possiblemenuitems$[.@menureference[@menu-1]] + "!";
  1109. @menu is the number of option the user picked.
  1110. @menu-1 is the array index for the list of actually used menu items that we
  1111. made.
  1112. .@menureference[@menu-1] is the number of the item in the array of possible menu
  1113. items that we've saved just for this purpose.
  1114. And .@possiblemenuitems$[.@menureference[@menu-1]] is the string that we used to
  1115. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1116. You can set up a bunch of 'if (.@menureference[@menu-1] == X) goto Y' statements to
  1117. route your execution based on the line selected and still generate a different
  1118. menu every time, which is handy when you want to, for example, make users select
  1119. items in any specific order before proceeding, or make a randomly shuffled menu.
  1120. Kafra code bundled with the standard distribution uses a similar array-based
  1121. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1122. probably since that wasn't documented anywhere.
  1123. See also 'select', which is probably better in this particular case. Instead of
  1124. menu, you could use 'select' like this:
  1125. .@dummy = select(.@menulist$[0],.@menulist$[1],...,.@menulist$[<X>]);
  1126. For the purposes of the technique described above these two statements are
  1127. perfectly equivalent.
  1128. ---------------------------------------
  1129. *select("<option>"{,"<option>",...})
  1130. *prompt("<option>"{,"<option>",...})
  1131. This function is a handy replacement for 'menu' for some specific cases where
  1132. you don't want a complex label structure - like, for example, asking simple yes-
  1133. no questions. It will return the number of menu option picked, starting with 1.
  1134. Like 'menu', it will also set the variable @menu to contain the option the user
  1135. picked.
  1136. if (select("Yes:No" ) == 1)
  1137. mes "You said yes, I know.";
  1138. And like 'menu', the selected option is consistent with grouped options
  1139. and empty options.
  1140. 'prompt' works almost the same as select, except that when a character clicks
  1141. the Cancel button, this function will return 255 instead.
  1142. ---------------------------------------
  1143. *input(<variable>{,<min>{,<max>}})
  1144. This command will make an input box pop up on the client connected to the
  1145. invoking character, to allow entering of a number or a string. This has many
  1146. uses, one example would be a guessing game, also making use of the 'rand'
  1147. function:
  1148. mes "[Woman]";
  1149. mes "Try and guess the number I am thinking of.";
  1150. mes "The number will be between 1 and 10.";
  1151. next;
  1152. .@number = rand(1,10);
  1153. input .@guess;
  1154. if (.@guess == .@number) {
  1155. mes "[Woman]";
  1156. mes "Well done, that was the number I was thinking of!";
  1157. close;
  1158. } else {
  1159. mes "[Woman]";
  1160. mes "Sorry, that wasn't the number I was thinking of.";
  1161. close;
  1162. }
  1163. If you give the input command a string variable to put the input in, it will
  1164. allow the player to enter text. Otherwise, only numbers will be allowed.
  1165. mes "[Woman]";
  1166. mes "Please say HELLO";
  1167. next;
  1168. input .@var$;
  1169. if (.@var$ == "HELLO") {
  1170. mes "[Woman]";
  1171. mes "Well done, you typed it correctly.";
  1172. close;
  1173. } else {
  1174. mes "[Woman]";
  1175. mes "Sorry, you got it wrong.";
  1176. close;
  1177. }
  1178. Normally you may not input a negative number with this command.
  1179. This is done to prevent exploits in badly written scripts, which would
  1180. let people, for example, put negative amounts of Zeny into a bank script and
  1181. receive free Zeny as a result.
  1182. Since trunk r12192 the command has two optional arguments and a return value.
  1183. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1184. 'input_max_value' in script_athena.conf.
  1185. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1186. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1187. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1188. shorter than 'min' and 0 otherwise.
  1189. ---------------------------------------
  1190. *callfunc "<function>"{,<argument>,...<argument>};
  1191. *callfunc("<function>"{,<argument>,...<argument>})
  1192. This command lets you call up a function NPC. A function NPC can be called from
  1193. any script on any map server. Using the 'return' command it will come back to
  1194. the place that called it.
  1195. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1196. mes "[Woman]"
  1197. mes "Let's see if you win...";
  1198. callfunc "funcNPC";
  1199. mes "Well done, you have won!";
  1200. close;
  1201. }
  1202. function%TAB%script%TAB%funcNPC%TAB%{
  1203. .@win = rand(2);
  1204. if (.@win == 0)
  1205. return;
  1206. mes "Sorry, you lost.";
  1207. close;
  1208. }
  1209. You can pass arguments to your function - values telling it what exactly to do -
  1210. which will be available there with getarg() (see 'getarg')
  1211. Notice that returning is not mandatory, you can end execution right there.
  1212. If you want to return a real value from inside your function NPC, it is better
  1213. to write it in the function form, which will also work and will make the script
  1214. generally cleaner:
  1215. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1216. mes "[Man]"
  1217. mes "Gimme a number!";
  1218. next;
  1219. input .@number;
  1220. if (callfunc("OddFunc",.@number)) mes "It's Odd!";
  1221. close;
  1222. }
  1223. function%TAB%script%TAB%OddFunc%TAB%{
  1224. if (getarg(0)%2 == 0)
  1225. return 0;// it's even
  1226. return 1;// it's odd
  1227. }
  1228. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1229. may be called directly without the use of the 'callfunc' script command.
  1230. function<tab>script<tab>SayHello<tab>{
  1231. mes "Hello " + getarg(0);
  1232. return 0;
  1233. }
  1234. place,50,50,6<tab>script<tab>Man<tab>115,{
  1235. mes "[Man]";
  1236. SayHello strcharinfo(0);
  1237. close;
  1238. }
  1239. Note:
  1240. !! A user-defined function must be declared /before/ a script attempts to
  1241. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1242. !! (or loaded in a separate file first) before attempting to call them directly.
  1243. ---------------------------------------
  1244. *callsub <label>{,<argument>,...<argument>};
  1245. *callsub(<label>{,<argument>,...<argument>})
  1246. This command will go to a specified label within the current script (do NOT use
  1247. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1248. arguments given, if any, which can be recovered there with 'getarg'. When done
  1249. there, you should use the 'return' command to go back to the point from where
  1250. this label was called. This is used when there is a specific thing the script
  1251. will do over and over, this lets you use the same bit of code as many times as
  1252. you like, to save space and time, without creating extra NPC objects which are
  1253. needed with 'callfunc'. A label is not callable in this manner from another
  1254. script.
  1255. Example 1: callsub for checking (if checks pass, return to script)
  1256. callsub S_CheckFull, "guild_vs2",50;
  1257. switch( rand(4) ) {
  1258. case 0: warp "guild_vs2",9,50; end;
  1259. case 1: warp "guild_vs2",49,90; end;
  1260. case 2: warp "guild_vs2",90,50; end;
  1261. case 3: warp "guild_vs2",49,9; end;
  1262. }
  1263. ...
  1264. S_CheckFull:
  1265. if (getmapusers(getarg(0)) >= getarg(1)) {
  1266. mes "I'm sorry, this arena is full. Please try again later.";
  1267. close;
  1268. }
  1269. return;
  1270. Example 2: callsub used repeatedly, with different arguments
  1271. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1272. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos")) {
  1273. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1274. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1275. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1276. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1277. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1278. // etc
  1279. }
  1280. ...
  1281. S_DunWarp:
  1282. // getarg(0) = "map name"
  1283. // getarg(1) = x
  1284. // getarg(2) = y
  1285. if (Zeny >= 100) {
  1286. Zeny -= 100;
  1287. warp getarg(0),getarg(1),getarg(2);
  1288. } else {
  1289. mes "Dungeon warp costs 100 Zeny.";
  1290. }
  1291. close;
  1292. ---------------------------------------
  1293. *getarg(<index>{,<default_value>})
  1294. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1295. call you can specify variables that will make that call different from another
  1296. one. This function will return an argument the function or subroutine was
  1297. called with, and is the normal way to get them.
  1298. This is another thing that can let you use the same code more than once.
  1299. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1300. If no such argument was given, a zero is returned.
  1301. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1302. mes "[Woman]";
  1303. mes "Let's see if you win...";
  1304. callfunc "funcNPC",2;
  1305. mes "Well done, you have won!";
  1306. close;
  1307. }
  1308. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1309. mes "[Woman]";
  1310. mes "Let's see if you win...";
  1311. callfunc "funcNPC",5;
  1312. mes "Well done, you have won!";
  1313. close;
  1314. }
  1315. function%TAB%script%TAB%funcNPC%TAB%{
  1316. .@win = rand(getarg(0));
  1317. if (.@win == 0) return;
  1318. mes "Sorry, you lost.";
  1319. close;
  1320. |
  1321. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1322. stated as 2, so when the random number is generated by the 'rand' function, it
  1323. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1324. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1325. "woman2" less likely to say the player won.
  1326. You can pass multiple arguments in a function call:
  1327. callfunc "funcNPC",5,4,3;
  1328. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1329. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1330. If the target argument exists, it is returned.
  1331. Otherwise, if <default_value> is present it is returned instead,
  1332. if not the script terminates immediately.
  1333. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1334. ---------------------------------------
  1335. *getargcount()
  1336. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1337. call you can specify arguments. This function will return the number of arguments
  1338. provided.
  1339. Example:
  1340. callfunc "funcNPC",5,4,3;
  1341. ...
  1342. function%TAB%script%TAB%funcNPC%TAB%{
  1343. .@count = getargcount(); // 3
  1344. ...
  1345. }
  1346. ---------------------------------------
  1347. *return {<value>};
  1348. This command causes the script execution to leave previously called function
  1349. with callfunc or script with callsub and return to the location, where the call
  1350. originated from. Optionally a return value can be supplied, when the call was
  1351. done using the function form.
  1352. Using this command outside of functions or scripts referenced by callsub will
  1353. result in error and termination of the script.
  1354. callfunc "<your function>";// when nothing is returned
  1355. set <variable>,callfunc("<your function>");// when a value is being returned
  1356. ---------------------------------------
  1357. *function <function name>;
  1358. *<function name>{(<argument>,...<argument>)};
  1359. *function <function name> {
  1360. <code>
  1361. }
  1362. This works like callfunc, and is used for cleaner and faster scripting. The function
  1363. must be defined and used within a script, and works like a label with arguments.
  1364. Note that the name may only contain alphanumeric characters and underscore.
  1365. Usage:
  1366. 1. Declare the function.
  1367. function <function name>;
  1368. 2. Call the function anywhere within the script.
  1369. It can also return a value when used with parentheses.
  1370. <function name>;
  1371. 3. Define the function within the script.
  1372. <function name> {<code>}
  1373. Example:
  1374. prontera,154,189,4 script Item Seller 767,{
  1375. /* Function declaration */
  1376. function SF_Selling;
  1377. if (Zeny > 50) {
  1378. mes "Welcome!";
  1379. /* Function call */
  1380. SF_Selling;
  1381. }
  1382. else mes "You need 50z, sorry!";
  1383. close;
  1384. /* Function definition */
  1385. function SF_Selling {
  1386. mes "Would you like to buy a phracon for 50z?";
  1387. next;
  1388. if (select("Yes","No, thanks") == 1) {
  1389. Zeny -= Zeny;
  1390. getitem 1010,1;
  1391. mes "Thank you!";
  1392. }
  1393. return;
  1394. }
  1395. }
  1396. Example with parameters and return value:
  1397. prontera,150,150,0 script TestNPC 123,{
  1398. /* Function declaration */
  1399. function MyAdd;
  1400. mes "Enter two numbers.";
  1401. next;
  1402. input .@a;
  1403. input .@b;
  1404. /* Function call */
  1405. mes .@a + " + " + .@b + " = " + MyAdd(.@a,.@b);
  1406. close;
  1407. /* Function definition */
  1408. function MyAdd {
  1409. return getarg(0)+getarg(1);
  1410. }
  1411. }
  1412. ---------------------------------------
  1413. *is_function("<function name>")
  1414. This command checks whether a function exists.
  1415. It returns 1 if function is found, or 0 if it isn't.
  1416. Example:
  1417. function script try {
  1418. dothat;
  1419. }
  1420. - script test -1,{
  1421. .@try = is_function("try"); // 1
  1422. .@not = is_function("not"); // 0
  1423. }
  1424. ---------------------------------------
  1425. *if (<condition>) <statement>;
  1426. This is the basic conditional statement command, and just about the only one
  1427. available in this scripting language.
  1428. The condition can be any expression. All expressions resulting in a non-zero
  1429. value will be considered True, including negative values. All expressions
  1430. resulting in a zero are false.
  1431. If the expression results in True, the statement will be executed. If it isn't
  1432. true, nothing happens and we move on to the next line of the script.
  1433. if (1) mes "This will always print.";
  1434. if (0) mes "And this will never print.";
  1435. if (5) mes "This will also always print.";
  1436. if (-1) mes "Funny as it is, this will also print just fine.";
  1437. For more information on conditional operators see the operators section above.
  1438. Anything that is returned by a function can be used in a condition check without
  1439. bothering to store it in a specific variable:
  1440. if (strcharinfo(0) == "Daniel Jackson") mes "It is true, you are Daniel!";
  1441. More examples of using the 'if' command in the real world:
  1442. Example 1:
  1443. .@answer = 1;
  1444. input .@input;
  1445. if (.@input == .@answer)
  1446. close;
  1447. mes "Sorry, your answer is incorrect.";
  1448. close;
  1449. Example 2:
  1450. .@answer = 1;
  1451. input .@input;
  1452. if (.@input != .@answer)
  1453. mes "Sorry, your answer is incorrect.";
  1454. close;
  1455. Notice that examples 1 and 2 have the same effect.
  1456. Example 3:
  1457. .@count++;
  1458. mes "[Forgetful Man]";
  1459. if (.@count == 1) mes "This is the first time you have talked to me.";
  1460. if (.@count == 2) mes "This is the second time you have talked to me.";
  1461. if (.@count == 3) mes "This is the third time you have talked to me.";
  1462. if (.@count == 4) {
  1463. mes "This is the fourth time you have talked to me.";
  1464. mes "I think I am getting amnesia, I have forgotten about you...";
  1465. .@count = 0;
  1466. }
  1467. close;
  1468. Example 4:
  1469. mes "[Quest Person]";
  1470. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in db/item_db.yml
  1471. mes "Can you please bring me an apple?";
  1472. close;
  1473. }
  1474. mes "Oh, you brought an Apple!";
  1475. mes "I didn't want it, I just wanted to see one.";
  1476. close;
  1477. Example 5:
  1478. mes "[Person Checker]";
  1479. if ($@name$ == "") { // global variable not yet set
  1480. mes "Please tell me someones name";
  1481. next;
  1482. input $@name$;
  1483. $@name2$ = strcharinfo(0);
  1484. mes "[Person Checker]";
  1485. mes "Thank you.";
  1486. close;
  1487. }
  1488. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1489. mes "You are the person that " + $@name2$ + " just mentioned.";
  1490. mes "Nice to meet you!";
  1491. // reset the global variables
  1492. $@name$ = "";
  1493. $@name2$ = "";
  1494. close;
  1495. }
  1496. mes "You are not the person that " + $name2$ + " mentioned.";
  1497. close;
  1498. See 'strcharinfo' for an explanation of what this function does.
  1499. Example 6: Using complex conditions.
  1500. mes "[Multiple Checks]";
  1501. if (@queststarted == 1 && countitem(512) >= 5) {
  1502. mes "Well done, you have started the quest and brought me 5 Apples.";
  1503. @queststarted = 0;
  1504. delitem 512,5;
  1505. close;
  1506. }
  1507. mes "Please bring me 5 apples.";
  1508. @queststarted = 1;
  1509. close;
  1510. The script engine also supports nested 'if' statements:
  1511. if (<condition>)
  1512. dothis;
  1513. else
  1514. dothat;
  1515. If the condition isn't met, it'll do the action following the 'else'.
  1516. We can also group several actions depending on a condition:
  1517. if (<condition>) {
  1518. dothis1;
  1519. dothis2;
  1520. } else {
  1521. dothat1;
  1522. dothat2;
  1523. dothat3;
  1524. }
  1525. Remember that if you plan to do several actions upon the condition being false, and
  1526. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1527. the output of the condition, unless of course, you stop the execution of the script if the
  1528. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1529. Also, you can have multiple conditions nested or chained.
  1530. if (<condition 1>)
  1531. dothis;
  1532. else if (<condition 2>) {
  1533. dothat;
  1534. end;
  1535. } else
  1536. dothis;
  1537. ---------------------------------------
  1538. *jump_zero (<condition>),<label>;
  1539. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1540. If the condition is false (equal to zero) this command will immediately jump to
  1541. the specified label like in 'goto'. While 'if' is more generally useful, for
  1542. some cases this could be an optimization.
  1543. The main reason for this command is that other control statements, like
  1544. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1545. with this command when a script is parsed.
  1546. ---------------------------------------
  1547. *switch (expression);
  1548. The switch statement is similar to a series of if statements on the same expression.
  1549. In many occasions, you may want to compare the same variable (or expression)
  1550. with many different values, and execute a different piece of code depending
  1551. on which value it equals to. This is exactly what the switch statement is for.
  1552. It is important to understand how the switch statement is executed in order
  1553. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1554. In the beginning, no code is executed. Only when a case statement is found
  1555. with a value that matches the value of the switch expression the case statement(s)
  1556. will to executed. The parser continues to execute the statements until the end
  1557. of the switch block, or the first time it sees a break statement. If you don't
  1558. write a break statement at the end of a case's statement list, the parser will
  1559. go on executing the statements of the following case (fall-through).
  1560. Example 1:
  1561. switch(select("Yes:No")) {
  1562. case 1:
  1563. mes "You said yes!";
  1564. break;
  1565. case 2:
  1566. mes "Aww, why?";
  1567. break;
  1568. }
  1569. close;
  1570. The example above would work like a menu and would go to the first case if
  1571. the user selects option, otherwise, would go to the second one.
  1572. Example 2:
  1573. switch(getgroupid()) {
  1574. case 1:
  1575. mes "Wow, you're super!";
  1576. break;
  1577. case 2:
  1578. mes "A helping hand!";
  1579. break;
  1580. case 3:
  1581. mes "10001010010011";
  1582. break;
  1583. case 4:
  1584. mes "Yes, milord?";
  1585. break;
  1586. default:
  1587. mes "Hello there!";
  1588. break;
  1589. }
  1590. The example above would print a message depending on the player's groupid.
  1591. If there is no statement declared for the corresponding groupid, the script
  1592. would use the 'default' statement that applies to rest of possible values,
  1593. similar to 'else' in the if-else statement.
  1594. ---------------------------------------
  1595. *while (<condition>) <statement>;
  1596. This is probably the simplest and most frequently used loop structure. The 'while'
  1597. statement can be interpreted as "while <condition> is true, perform <statement>".
  1598. It is a pretest loop, meaning the conditional expression is tested before any of the
  1599. statements in the body of the loop are performed. If the condition evaluates to
  1600. false, the statement(s) in the body of the loop is/are never executed. If the
  1601. condition evaluates to true, the statement(s) are executed, then control transfers
  1602. back to the conditional expression, which is reevaluated and the cycle continues.
  1603. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1604. Example 1:
  1605. while (switch(select("Yes:No") == 2 ))
  1606. mes "You picked no.";
  1607. close;
  1608. Example 2: multiple statements
  1609. while (switch(select("Yes:No") == 2 )) {
  1610. mes "Why did you pick no?";
  1611. mes "You should pick yes instead!";
  1612. }
  1613. close;
  1614. Example 3: counter-controlled loop
  1615. .@i = 1;
  1616. while (.@i <= 5) {
  1617. mes "This line will print 5 times.";
  1618. .@i += 1;
  1619. }
  1620. close;
  1621. Example 4: sentinel-controlled loop
  1622. mes "Input 0 to stop";
  1623. input .@num;
  1624. while (.@num != 0) {
  1625. mes "You entered " + .@num;
  1626. input .@num;
  1627. }
  1628. close;
  1629. ---------------------------------------
  1630. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1631. Another pretest looping structure is the 'for' statement. It is considered a
  1632. specialized form of the 'while' statement, and is usually associated with counter-
  1633. controlled loops. Here are the steps of the 'for' statement: the initialize
  1634. statement is executed first and only once. The condition test is performed.
  1635. When the condition evaluates to false, the rest of the for statement is skipped.
  1636. When the condition evaluates to true, the body of the loop is executed, then the
  1637. update statement is executed (this usually involves incrementing a variable).
  1638. Then the condition is reevaluated and the cycle continues.
  1639. Example 1:
  1640. for( .@i = 1; .@i <= 5; .@i++ )
  1641. mes "This line will print 5 times.";
  1642. Example 2:
  1643. mes "This will print the numbers 1 - 5.";
  1644. for( .@i = 1; .@i <= 5; .@i++ )
  1645. mes "Number: " + .@i;
  1646. ---------------------------------------
  1647. *do { <statement>; } while (<condition>);
  1648. The 'do...while' is the only post-test loop structure available in this script
  1649. language. With a post-test, the statements are executed once before the condition
  1650. is tested. When the condition is true, the statement(s) are repeated. When the
  1651. condition is false, control is transferred to the statement following the
  1652. 'do...while' loop expression.
  1653. Example 1: sentinel-controlled loop
  1654. mes "This menu will keep appearing until you pick Cancel";
  1655. do {
  1656. .@menu = select("One:Two:Three:Cancel");
  1657. } while (.@menu != 4);
  1658. Example 2: counter-controlled loop
  1659. mes "This will countdown from 10 to 1.";
  1660. .@i = 10;
  1661. do {
  1662. mes .@i;
  1663. .@i -= 1;
  1664. } while (.@i > 0);
  1665. ---------------------------------------
  1666. *freeloop({<toggle>})
  1667. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1668. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1669. warn you if an infinite loop is detected.
  1670. The command will return the state of freeloop for the attached script, even if no
  1671. argument is provided.
  1672. Example:
  1673. freeloop(1); // enable script to loop freely
  1674. // be careful with what you do here
  1675. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1676. dothis;
  1677. // will sleep the script for 1ms when detect an infinity loop to
  1678. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1679. }
  1680. freeloop(0); // disable freeloop
  1681. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1682. dothis;
  1683. // throw an infinity loop error
  1684. }
  1685. ---------------------------------------
  1686. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1687. This command will allow you to quickly fill up an array in one go. Check the
  1688. Kafra scripts in the distribution to see this used a lot.
  1689. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1690. First value is the index of the first element of the array to alter. For
  1691. example:
  1692. setarray .@array[0],200,200,200;
  1693. setarray .@array[1],300,150;
  1694. will produce:
  1695. .@array[0]=200
  1696. .@array[1]=300
  1697. .@array[2]=150
  1698. ---------------------------------------
  1699. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1700. This command will change many array values at the same time to the same value.
  1701. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1702. // This will make all 6 values 0
  1703. cleararray .@array[0],0,6;
  1704. // This will make array element 0 change to 245
  1705. cleararray .@array[0],245,1;
  1706. // This will make elements 1 and 2 change to 345
  1707. cleararray .@array[1],345,2;
  1708. See 'setarray'.
  1709. ---------------------------------------
  1710. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1711. This command lets you quickly shuffle a lot of data between arrays, which is in
  1712. some cases invaluable.
  1713. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1714. // So we have made .@array[]
  1715. copyarray .@array2[0],@array[2],2;
  1716. // Now, .@array2[0] will be equal to .@array[2] (300) and
  1717. // .@array2[1] will be equal to .@array[3].
  1718. So using the examples above:
  1719. .@array[0] = 100
  1720. .@array[1] = 200
  1721. .@array[2] = 300
  1722. .@array[3] = 400
  1723. .@array[4] = 500
  1724. .@array[5] = 600
  1725. New Array:
  1726. .@array2[0] = 300
  1727. .@array2[1] = 400
  1728. .@array2[2] = 0
  1729. .@array2[3] = 0
  1730. Notice that .@array[4] and .@array[5] won't be copied to the second array, and it will return a
  1731. 0.
  1732. ---------------------------------------
  1733. *deletearray <array name>[<first value>]{,<how much to delete>};
  1734. This command will delete a specified number of array elements totally from an
  1735. array, shifting all the elements beyond this towards the beginning.
  1736. // This will delete array element 0, and move all the other array elements
  1737. // up one place.
  1738. deletearray .@array[0],1
  1739. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1740. // place, and move the other elements ups, so there are no gaps.
  1741. deletearray .@array[1],3
  1742. ---------------------------------------
  1743. *inarray <array name>,<value>;
  1744. This command returns the index of the first matching value found in the array.
  1745. It will return -1 if the value is not found.
  1746. setarray .@array[0], 100, 200, 300, 400, 500, 600, 100;
  1747. inarray(.@array[0], 200);
  1748. //return 1 because 200 is in index 1
  1749. //another way to say it that .@array[1] == 200
  1750. .@index = inarray(.@array[0], 600);
  1751. //.@index is now 5 because .@array[5] == 600
  1752. inarray(.@array[0], 100);
  1753. //while index 6 is also 100, the command will return the first instance it finds
  1754. //return 0 because .@array[0] == 100
  1755. inarray(.@array[0], 800);
  1756. //return -1 because 800 is not an element of the array .@array
  1757. For more details, see the sample in 'doc/sample/inarray.txt'.
  1758. ---------------------------------------
  1759. *countinarray <array name>{[<start index>]},<array name>{[<start index>]};
  1760. This command will check for matches between the array values and return the number of matches.
  1761. While being optional, if [<start index>] is supplied, the search will begin from the given index value.
  1762. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1763. .@variable = 100;
  1764. if(countinarray(.@array[0], .@variable))
  1765. mes "The number 100 was found in the array .@array";
  1766. countinarray(.@array[0], .@variable);
  1767. //return 1 because the number 100 is an element of the array .@array
  1768. setarray .@array2[0],100,500;
  1769. countinarray(.@array[0], .@array2[0]);
  1770. //return 2 because the numbers 100 and 500 are elements of the array .@array
  1771. setarray .@array3[0],100,700;
  1772. countinarray(.@array[0], .@array3[0]);
  1773. //return 1 because the number 100 is an element of the array .@array
  1774. //but the number 700 is not an element of the array .@array
  1775. //also you can change the position between the arrays in the command
  1776. if(countinarray(.@array[0], .@array3[0]) == countinarray(.@array3[0], .@array[0]))
  1777. //This is true
  1778. For more details, see the sample in 'doc/sample/inarray.txt'.
  1779. ---------------------------------------
  1780. ======================================
  1781. |2.- Information-retrieving commands.|
  1782. ======================================
  1783. ---------------------------------------
  1784. *strcharinfo(<type>{,<char_id>})
  1785. This function will return either the name, party name or guild name for the
  1786. invoking character. Whatever it returns is determined by type.
  1787. 0 - Character's name.
  1788. 1 - The name of the party they're in if any.
  1789. 2 - The name of the guild they're in if any.
  1790. 3 - The name of the map the character is in.
  1791. If a character is not a member of any party or guild, an empty string will be
  1792. returned when requesting that information.
  1793. ---------------------------------------
  1794. *convertpcinfo(<char_id>,<type>)
  1795. *convertpcinfo(<account_id>,<type>)
  1796. *convertpcinfo(<player_name>,<type>)
  1797. This function will return the information <type> for the
  1798. specified character. Whatever it returns is determined by type.
  1799. CPC_NAME - Character's name.
  1800. CPC_CHAR - Character ID.
  1801. CPC_ACCOUNT - Account ID.
  1802. If a character is not found (or not online) when requesting that information,
  1803. an empty string will be returned for CPC_NAME, 0 for other <type>.
  1804. ---------------------------------------
  1805. *strnpcinfo(<type>)
  1806. This function will return the various parts of the name of the calling NPC.
  1807. Whatever it returns is determined by type.
  1808. 0 - The NPC's display name (visible#hidden)
  1809. 1 - The visible part of the NPC's display name
  1810. 2 - The hidden part of the NPC's display name
  1811. 3 - The NPC's unique name (::name)
  1812. 4 - The name of the map the NPC is in.
  1813. ---------------------------------------
  1814. *getarraysize(<array name>)
  1815. This function returns highest index of the array that is filled.
  1816. Notice that zeros and empty strings at the end of this array are not
  1817. counted towards this number.
  1818. For example:
  1819. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1820. set .@arraysize,getarraysize(.@array);
  1821. This will make .@arraysize == 6. But if you try this:
  1822. setarray .@array[0], 100, 200, 300, 400, 500, 600, 0;
  1823. set .@arraysize,getarraysize(.@array);
  1824. .@arraysize will still equal 6, even though you've set 7 values.
  1825. ---------------------------------------
  1826. *getelementofarray(<array name>,<index>)
  1827. This command retrieves the value of the element of given array at given index.
  1828. This is equivalent to using:
  1829. <array name>[<index>]
  1830. The reason for this is, that this short form is internally converted into a call
  1831. to getelementofarray, when the script is loaded.
  1832. Also useful when passing arrays to functions or accessing another npc's arrays:
  1833. getelementofarray(getarg(0),<index>)
  1834. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1835. ---------------------------------------
  1836. *readparam(<parameter number>{,"<character name>"})
  1837. *readparam(<parameter number>{,<char_id>})
  1838. This function will return the specified stat of the invoking character, or, if a
  1839. character name or character id is specified, of that player. The stat can either
  1840. be a number or parameter name, defined in 'src/map/script_constants.hpp'.
  1841. Some example parameters:
  1842. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1843. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1844. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk, Ap, MaxAp
  1845. All of these also behave as variables, but don't expect to be able to just 'set'
  1846. them - some will not work for various internal reasons.
  1847. Example 1:
  1848. // Returns how many status points you haven't spent yet.
  1849. mes "Unused status points: " + readparam(9);
  1850. Using this particular information as a function call is not required. Typing this
  1851. will return the same result:
  1852. mes "Unused status points: " + StatusPoint;
  1853. Example 2:
  1854. You can also use this command to get stat values.
  1855. if (readparam(bVit) > 77)
  1856. mes "Only people with over 77 Vit are reading this!";
  1857. ---------------------------------------
  1858. *getcharid(<type>{,"<character name>"})
  1859. This function will return a unique ID number of the invoking character, or, if a
  1860. character name is specified, of that player.
  1861. Type is the kind of associated ID number required:
  1862. 0 - Character ID
  1863. 1 - Party ID
  1864. 2 - Guild ID
  1865. 3 - Account ID
  1866. 4 - Battle Ground ID
  1867. 5 - Clan ID
  1868. For most purposes other than printing it, a number is better to have than a name
  1869. (people do horrifying things to their character names).
  1870. If the character is not in a party or not in a guild, the function will return 0
  1871. if guild or party number is requested. If a name is specified and the character
  1872. is not found, 0 is returned.
  1873. If getcharid(0) returns a zero, the script got called not by a character and
  1874. doesn't have an attached RID. Note that this will cause the map server to
  1875. print "player not attached!" error messages, so it is preferred to use
  1876. "playerattached" to check for the character attached to the script.
  1877. if (getcharid(2) == 0)
  1878. mes "Only members of a guild are allowed here!";
  1879. ---------------------------------------
  1880. *getnpcid(<type>{,"<npc name>"});
  1881. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1882. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1883. to retrieve and can be one of the following:
  1884. 0 - NPC Game ID
  1885. If an invalid type is given or the NPC does not exist, 0 is returned.
  1886. ---------------------------------------
  1887. *getchildid({<char_id>})
  1888. *getmotherid({<char_id>})
  1889. *getfatherid({<char_id>})
  1890. These functions return the character ID of the attached player's child,
  1891. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1892. if (getmotherid()) mes "Your mother's ID is: " + getmotherid();
  1893. ---------------------------------------
  1894. *ispartneron({<char_id>})
  1895. This function returns 1 if the invoking character's marriage partner is
  1896. currently online and 0 if they are not or if the character has no partner.
  1897. ---------------------------------------
  1898. *getpartnerid({<char_id>})
  1899. This function returns the character ID of the invoking character's marriage
  1900. partner, if any. If the invoking character is not married, it will return 0,
  1901. which is a quick way to see if they are married:
  1902. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1903. if (getpartnerid()) mes "You're married already!";
  1904. ---------------------------------------
  1905. *getlook(<type>{,<char_id>})
  1906. This function will return the number for the current character look value
  1907. specified by type. See 'setlook' for valid look types.
  1908. This can be used to make a certain script behave differently for characters
  1909. dressed in black.
  1910. ---------------------------------------
  1911. *getsavepoint(<information type>{,<char_id>})
  1912. This function will return information about the invoking character's save point.
  1913. You can use it to let a character swap between several recorded save points.
  1914. Available information types are:
  1915. 0 - Map name (a string)
  1916. 1 - X coordinate
  1917. 2 - Y coordinate
  1918. ---------------------------------------
  1919. *getcharip({"<character name>"|<account id>|<char id>})
  1920. This function will return the IP address of the invoking character, or, if a player
  1921. is specified, of that character. A blank string is returned if no player is attached.
  1922. Examples:
  1923. // Outputs IP address of attached player.
  1924. mes "Your IP: " + getcharip();
  1925. // Outputs IP address of character "Silver".
  1926. mes "Silver's IP: " + getcharip("Silver");
  1927. ---------------------------------------
  1928. *vip_status(<type>,{"<character name>"})
  1929. Returns various information about a player's VIP status.
  1930. Valid types:
  1931. VIP_STATUS_ACTIVE - VIP status: true if the player is a VIP or false if not
  1932. VIP_STATUS_EXPIRE - VIP expire timestamp if the player is VIP or 0 if not
  1933. VIP_STATUS_REMAINING - VIP time remaining in seconds
  1934. NOTE: This command is only available if the VIP System is enabled.
  1935. ---------------------------------------
  1936. *vip_time <time>,{"<character name>"};
  1937. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1938. negative value will decrease time.
  1939. NOTE: This command is only available if the VIP System is enabled.
  1940. ---------------------------------------
  1941. *addspiritball <count>,<duration>{,<char_id>};
  1942. Adds spirit ball to player for 'duration' in milisecond.
  1943. ---------------------------------------
  1944. *delspiritball <count>{,<char_id>};
  1945. Deletes the spirit ball(s) from player.
  1946. ---------------------------------------
  1947. *countspiritball {<char_id>};
  1948. Counts the spirit ball that player has.
  1949. ---------------------------------------
  1950. *ignoretimeout <flag>{,<char_id>};
  1951. Disables the SECURE_NPCTIMEOUT function on the character invoking the script,
  1952. or by the given character ID/character name.
  1953. Valid flag:
  1954. 0 - Enabled SECURE_NPCTIMEOUT.
  1955. 1 - Disable SECURE_NPCTIMEOUT.
  1956. Note: SECURE_NPCTIMEOUT must be enabled for this to work.
  1957. ---------------------------------------
  1958. \\
  1959. 2,2 Item-related commands
  1960. \\
  1961. ---------------------------------------
  1962. *getequipid({<equipment slot>,<char_id>})
  1963. This function returns the item ID of the item slot that calls the script
  1964. on the invoking character or the specified equipment slot. If nothing is
  1965. equipped there, it returns -1.
  1966. Valid equipment slots are:
  1967. EQI_COMPOUND_ON (-1) - Item slot that calls this script (In context of item script) - exclusive to getequipid
  1968. EQI_ACC_L (0) - Accessory 1
  1969. EQI_ACC_R (1) - Accessory 2
  1970. EQI_SHOES (2) - Footgear (shoes, boots)
  1971. EQI_GARMENT (3) - Garment (mufflers, hoods, manteaux)
  1972. EQI_HEAD_LOW (4) - Lower Headgear (beards, some masks)
  1973. EQI_HEAD_MID (5) - Middle Headgear (masks, glasses)
  1974. EQI_HEAD_TOP (6) - Upper Headgear
  1975. EQI_ARMOR (7) - Armor (jackets, robes)
  1976. EQI_HAND_L (8) - Left hand (weapons, shields)
  1977. EQI_HAND_R (9) - Right hand (weapons)
  1978. EQI_COSTUME_HEAD_TOP (10) - Upper Costume Headgear
  1979. EQI_COSTUME_HEAD_MID (11) - Middle Costume Headgear
  1980. EQI_COSTUME_HEAD_LOW (12) - Lower Costume Headgear
  1981. EQI_COSTUME_GARMENT (13) - Costume Garment
  1982. EQI_AMMO (14) - Arrow/Ammunition
  1983. EQI_SHADOW_ARMOR (15) - Shadow Armor
  1984. EQI_SHADOW_WEAPON (16) - Shadow Weapon
  1985. EQI_SHADOW_SHIELD (17) - Shadow Shield
  1986. EQI_SHADOW_SHOES (18) - Shadow Shoes
  1987. EQI_SHADOW_ACC_R (19) - Shadow Accessory 2
  1988. EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
  1989. Notice that a few items occupy several equipment slots, and if the character is
  1990. wearing such an item, 'getequipid' will return its ID number for either slot.
  1991. Can be used to check if you have something equipped, or if you haven't got
  1992. something equipped:
  1993. if (getequipid(EQI_HEAD_TOP) == 2234)
  1994. mes "What a lovely Tiara you have on";
  1995. else
  1996. mes "Come back when you have a Tiara on";
  1997. close;
  1998. You can also use it to make sure people don't pass a point before removing an
  1999. item totally from them. Let's say you don't want people to wear Legion Plate
  2000. armor, but also don't want them to equip if after the check, you would do this:
  2001. if (getequipid(EQI_ARMOR) == 2341 || getequipid(EQI_ARMOR) == 2342) {
  2002. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  2003. close;
  2004. }
  2005. // the || is used as an or argument, there is 2341 and 2342 cause there are
  2006. // two different legion plate armors, one with a slot one without.
  2007. if (countitem(2341) > 0 || countitem(2432) > 0) {
  2008. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  2009. close;
  2010. }
  2011. mes "I will lets you pass.";
  2012. close2;
  2013. warp "place",50,50;
  2014. end;
  2015. ---------------------------------------
  2016. *getequipuniqueid(<equipment slot>{,<char_id>})
  2017. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  2018. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  2019. See 'getequipid' for a full list of valid equipment slots.
  2020. ---------------------------------------
  2021. *getequipname(<equipment slot>{,<char_id>})
  2022. Returns the jname of the item equipped in the specified equipment slot on the
  2023. invoking character, or an empty string if nothing is equipped in that position.
  2024. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  2025. what your are wearing, or maybe saving as a string variable.
  2026. See 'getequipid' for a full list of valid equipment slots.
  2027. if ( getequipname(EQI_HEAD_TOP) != "" )
  2028. mes "So you are wearing a " + getequipname(EQI_HEAD_TOP) + " on your head";
  2029. else
  2030. mes "You are not wearing any head gear";
  2031. ---------------------------------------
  2032. *getitemname(<item id>)
  2033. *getitemname(<aegis item name>)
  2034. Given the database ID number of an item, this function will return the text
  2035. stored in the 'Name' field in item_db_*.yml for text version
  2036. or 'name_english' field for SQL version.
  2037. ---------------------------------------
  2038. *getbrokenid(<number>{,<char_id>})
  2039. This function will search the invoking character's inventory for any broken
  2040. items, and will return their item ID numbers. Since the character may have
  2041. several broken items, 1 given as an argument will return the first one found, 2
  2042. will return the second one, etc. Will return 0 if no such item is found.
  2043. // Let's see if they have anything broken:
  2044. if (getbrokenid(1) == 0)
  2045. mes "You don't have anything broken, quit bothering me.";
  2046. else
  2047. // They do, so let's print the name of the first broken item:
  2048. mes "Oh, I see you have a broken " + getitemname(getbrokenid(1)) + " here!";
  2049. end;
  2050. ---------------------------------------
  2051. *getequipisequiped(<equipment slot>{,<char_id>})
  2052. This functions will return 1 if there is an equipment placed on the specified
  2053. equipment slot and 0 otherwise. For a list of equipment slots
  2054. see 'getequipid'. Function originally used by the refining NPCs:
  2055. if (getequipisequiped(EQI_HEAD_TOP)) {
  2056. mes "[Refiner]";
  2057. mes "That's a fine hat you are wearing there...";
  2058. close;
  2059. } else {
  2060. mes "[Refiner]";
  2061. mes "Do you want me to refine your dumb head?";
  2062. close;
  2063. }
  2064. ---------------------------------------
  2065. *getequipisenableref(<equipment slot>{,<char_id>})
  2066. Will return 1 if the item equipped on the invoking character in the specified
  2067. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  2068. see 'getequipid'.
  2069. if (getequipisenableref(EQI_HEAD_TOP)) {
  2070. mes "[Refiner]";
  2071. mes "Ok I can refine this";
  2072. close;
  2073. } else {
  2074. mes "[Refiner]";
  2075. mes "I can't refine this hat!...";
  2076. close;
  2077. }
  2078. ---------------------------------------
  2079. *getequiprefinerycnt(<equipment slot>{,<char_id>})
  2080. Returns the current number of pluses for the item in the specified equipment
  2081. slot. For a list of equipment slots see 'getequipid'.
  2082. Can be used to check if you have reached a maximum refine value, default for
  2083. this is +10:
  2084. if (getequiprefinerycnt(EQI_HEAD_TOP) < 10)
  2085. mes "I will now upgrade your " + getequipname(EQI_HEAD_TOP);
  2086. else
  2087. mes "Sorry, it's not possible to refine hats better than +10";
  2088. close;
  2089. ---------------------------------------
  2090. *getequipweaponlv({<equipment slot>{,<char_id>}})
  2091. This function returns the weapon level for the weapon equipped in the specified
  2092. equipment slot on the invoking character. For a list of equipment slots see
  2093. 'getequipid'.
  2094. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  2095. a weapon level.
  2096. If no item is equipped in this slot, or if it doesn't have a weapon level
  2097. according to the database, 0 will be returned.
  2098. Examples:
  2099. switch (getequipweaponlv(EQI_HAND_R)) {
  2100. case 1: mes "You are holding a lvl 1 weapon."; break;
  2101. case 2: mes "You are holding a lvl 2 weapon."; break;
  2102. case 3: mes "You are holding a lvl 3 weapon."; break;
  2103. case 4: mes "You are holding a lvl 4 weapon."; break;
  2104. case 5: mes "You are holding a lvl 5 weapon."; break;
  2105. case 6: mes "You are holding a lvl 6 weapon, hm, must be a custom design..."; break;
  2106. default: mes "Seems you don't have a weapon on."; break;
  2107. }
  2108. if (getequipid(EQI_HAND_L) == 0) {
  2109. mes "Seems you have nothing equipped here.";
  2110. close;
  2111. }
  2112. switch (getequipweaponlv(EQI_HAND_L)) {
  2113. case 0: mes "You are not holding a weapon, so it doesn't have a level."; break;
  2114. case 1: mes "You are holding a lvl 1 weapon."; break;
  2115. case 2: mes "You are holding a lvl 2 weapon."; break;
  2116. case 3: mes "You are holding a lvl 3 weapon."; break;
  2117. case 4: mes "You are holding a lvl 4 weapon."; break;
  2118. case 5: mes "You are holding a lvl 5 weapon."; break;
  2119. case 6: mes "You are holding a lvl 6 weapon, hm, must be a custom design..."; break;
  2120. }
  2121. ---------------------------------------
  2122. *getequiparmorlv({<equipment slot>{,<char_id>}})
  2123. This function returns the armor level for the item equipped in the specified
  2124. equipment slot on the invoking character. For a list of equipment slots see
  2125. 'getequipid'.
  2126. If no item is equipped in this slot, or if it doesn't have an armor level
  2127. according to the database, 0 will be returned.
  2128. if (getequipid(EQI_ARMOR) == 0) {
  2129. mes "Seems you have nothing equipped here.";
  2130. close;
  2131. }
  2132. switch (getequiparmorlv(EQI_ARMOR)) {
  2133. case 1: mes "You are wearing a lvl 1 armor."; break;
  2134. case 2: mes "You are wearing a lvl 2 armor."; break;
  2135. case 3: mes "You are wearing a lvl 3 armor, hm, must be a custom design..."; break;
  2136. }
  2137. ---------------------------------------
  2138. *getequippercentrefinery(<equipment slot>{,<enriched>,<char_id>})
  2139. This function calculates and returns the percent value chance to successfully
  2140. refine the item found in the specified equipment slot of the invoking character
  2141. by +1. There is no actual formula, the success rate for a given weapon level of
  2142. a certain refine level is found in the db/(pre-)re/refine_db.yml file. For a list of
  2143. equipment slots see 'getequipid'.
  2144. If enriched parameter is set to true, chance to successfully refine the item with
  2145. enriched material is returned instead.
  2146. These values can be displayed for the player to see, or used to calculate the
  2147. random change of a refine succeeding or failing and then going through with it
  2148. (which is what the official NPC refinery scripts use it for)
  2149. // This will find a random number from 0 - 99 and if that is equal to or more
  2150. // than the value recovered by this command it will go to L_Fail
  2151. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2152. ---------------------------------------
  2153. *getequiprefinecost(<equipment slot>,<type>,<information>{,<char id>})
  2154. This function returns refine cost for equipment in <equipment slot> based on
  2155. passed arguments <type> and <information>.
  2156. Valid cost types are:
  2157. REFINE_COST_NORMAL - For normal refining
  2158. REFINE_COST_HD - For refining with HD ores
  2159. REFINE_COST_ENRICHED - For refining with enriched ores
  2160. This function will return required cost for refining based on <information> argument.
  2161. Valid information types are:
  2162. REFINE_ZENY_COST - Zeny
  2163. REFINE_MATERIAL_ID - Material Item ID
  2164. This function will return -1 on failure. The function fails if the cost type
  2165. is invalid or if there is no item in the equipment slot.
  2166. ---------------------------------------
  2167. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2168. This function will count all the items with the specified ID number lying on the
  2169. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2170. number.
  2171. This is the only function around where a parameter may be either a string or a
  2172. number! If it's a number, it means that only the items with that item ID number
  2173. will be counted. If it is a string, it is assumed to mean the 'english name'
  2174. field from the item database.
  2175. ---------------------------------------
  2176. *getequipcardcnt(<equipment slot>)
  2177. This function will return the number of cards that have been compounded onto a
  2178. specific equipped item for the invoking character. See 'getequipid' for a list
  2179. of possible equipment slots.
  2180. ---------------------------------------
  2181. *getinventorylist {<char_id>};
  2182. This command sets a bunch of arrays with a complete list of whatever the
  2183. invoking character has in their inventory, including all the data needed to
  2184. recreate these items perfectly if they are destroyed. Here's what you get:
  2185. @inventorylist_id[] - array of item ids.
  2186. @inventorylist_idx[] - array of item inventory index.
  2187. @inventorylist_amount[] - their corresponding item amounts.
  2188. @inventorylist_equip[] - on which position the item is equipped (see EQP_* constants)
  2189. It will contain 0 if the item is not equipped.
  2190. @inventorylist_refine[] - for how much it is refined.
  2191. @inventorylist_identify[] - whether it is identified.
  2192. @inventorylist_attribute[] - whether it is broken.
  2193. @inventorylist_card1[] - These four arrays contain card data for the items.
  2194. @inventorylist_card2[] These data slots are also used to store names
  2195. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2196. @inventorylist_card4[] if the character owns an item made by a specific
  2197. craftsman.
  2198. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2199. @inventorylist_bound[] - the bound type of the items (see BOUND_* constants)
  2200. @inventorylist_enchantgrade[] - the enchantgrade of the items
  2201. @inventorylist_count - the number of items in these lists.
  2202. @inventorylist_option_id1[] - first array of random option IDs
  2203. @inventorylist_option_value1[] - first array of random option values
  2204. @inventorylist_option_parameter1[] - first array of random option parameters
  2205. @inventorylist_option_id2[] - second array of random option IDs
  2206. @inventorylist_option_value2[] - second array of random option values
  2207. @inventorylist_option_parameter2[] - second array of random option parameters
  2208. @inventorylist_option_id3[] - third array of random option IDs
  2209. @inventorylist_option_value3[] - third array of random option values
  2210. @inventorylist_option_parameter3[] - third array of random option parameters
  2211. @inventorylist_option_id4[] - fourth array of random option IDs
  2212. @inventorylist_option_value4[] - fourth array of random option values
  2213. @inventorylist_option_parameter4[] - fourth array of random option parameters
  2214. @inventorylist_option_id5[] - fifth array of random option IDs
  2215. @inventorylist_option_value5[] - fifth array of random option values
  2216. @inventorylist_option_parameter5[] - fifth array of random option parameters
  2217. @inventorylist_tradable - Returns if an item is tradable or not (Pass item_db.yml, bound, and rental restrictions).
  2218. @inventorylist_favorite - Returns if an item is favorite or not
  2219. This could be handy to save/restore a character's inventory, since no other
  2220. command returns such a complete set of data, and could also be the only way to
  2221. correctly handle an NPC trader for carded and named items who could resell them
  2222. - since NPC objects cannot own items, so they have to store item data in
  2223. variables and recreate the items.
  2224. Notice that the variables this command generates are all temporary, attached to
  2225. the character, and integer.
  2226. Be sure to use @inventorylist_count to go through these arrays, and not
  2227. 'getarraysize', because the arrays are not automatically cleared between runs
  2228. of 'getinventorylist'.
  2229. ---------------------------------------
  2230. *cardscnt()
  2231. This function will return the number of cards inserted into the equipment
  2232. from which the function is called.
  2233. This function is intended for use in item scripts.
  2234. ---------------------------------------
  2235. *getrefine()
  2236. This function will return the refine count of the equipment from which the
  2237. function is called.
  2238. This function is intended for use in item scripts.
  2239. ---------------------------------------
  2240. *getnameditem(<item id>,"<name to inscribe>"|<char id>);
  2241. *getnameditem("<item name>","<name to inscribe>"|<char id>);
  2242. This function is equivalent to using 'getitem', however, it will not just give
  2243. the character an item object, but will also inscribe it with a specified
  2244. character's name. You may not inscribe items with arbitrary strings, only with
  2245. names of characters that actually exist. While this isn't said anywhere
  2246. specifically, apparently, named items may not have cards in them, slots or no -
  2247. these data slots are taken by the character ID who's name is inscribed. Only one
  2248. remains free and it's not quite clear if a card may be there.
  2249. This function will return 1 if an item was successfully created and 0 if it
  2250. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2251. 'english name' from the item database as an item name and will return 0 if no
  2252. such item exists.
  2253. ---------------------------------------
  2254. *getitemslots(<item ID>)
  2255. This function will look up the item with the specified ID number in the database
  2256. and return the number of slots this kind of items has - 0 if they are not
  2257. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2258. someone messed up the item database. It will return -1 if there is no such item.
  2259. Example:
  2260. //.@slots now has the amount of slots of the item with ID 1205.
  2261. .@slots = getitemslots(1205);
  2262. ---------------------------------------
  2263. *getiteminfo(<item ID>,<type>)
  2264. *getiteminfo(<item name>,<type>)
  2265. *getiteminfo(<aegis item name>,<type>)
  2266. This function will look up the item with the specified ID number in the database
  2267. and return the info set by TYPE argument.
  2268. It will return -1 if there is no such item or "" if the aegis item name is requested.
  2269. Valid types are:
  2270. ITEMINFO_BUY (0) - Buy Price
  2271. ITEMINFO_SELL (1) - Sell Price
  2272. ITEMINFO_TYPE (2) - Type
  2273. ITEMINFO_MAXCHANCE (3) - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2274. if = 0, then monsters don't drop it at all (rare or a quest item)
  2275. if = 10000, then this item is sold in NPC shops only
  2276. ITEMINFO_GENDER (4) - Gender
  2277. ITEMINFO_LOCATIONS (5) - Location(s)
  2278. ITEMINFO_WEIGHT (6) - Weight
  2279. ITEMINFO_ATTACK (7) - ATK
  2280. ITEMINFO_DEFENSE (8) - DEF
  2281. ITEMINFO_RANGE (9) - Range
  2282. ITEMINFO_SLOT (10) - Slot
  2283. ITEMINFO_VIEW (11) - View
  2284. ITEMINFO_EQUIPLEVELMIN (12) - equipment LV
  2285. ITEMINFO_WEAPONLEVEL (13) - weapon LV
  2286. ITEMINFO_ALIASNAME (14) - AliasName
  2287. ITEMINFO_EQUIPLEVELMAX (15) - equipment LV Max
  2288. ITEMINFO_MAGICATTACK (16) - matk if RENEWAL is defined
  2289. ITEMINFO_ID (17) - item ID
  2290. ITEMINFO_AEGISNAME (18) - aegis item name
  2291. ITEMINFO_ARMORLEVEL (19) - armor LV
  2292. ITEMINFO_SUBTYPE (20) - Subtype
  2293. See the sample in 'doc/sample/getiteminfo.txt'.
  2294. ---------------------------------------
  2295. *getequipcardid(<equipment slot>,<card slot>)
  2296. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2297. This function returns CARD ID, CARD0_FORGE, CARD0_CREATE, or CARD0_PET (for card 0, if the item is produced).
  2298. It's useful for when you want to check whether an item contains cards or if it's signed.
  2299. ---------------------------------------
  2300. *mergeitem({,<char_id>});
  2301. Open merge item window to merge available item can be merged.
  2302. Examples
  2303. 1. See the NPC 'npc/re/other/merge_item.txt'.
  2304. 2. Simple usage:
  2305. mes "Let's check if any item can be merged.";
  2306. close2;
  2307. mergeitem;
  2308. end;
  2309. ---------------------------------------
  2310. *mergeitem2({<item_id>{,<char_id>}});
  2311. *mergeitem2({"<item name>"{,<char_id>}});
  2312. Merge all stackable items that separated by GUID flags
  2313. (UniqueId in item_db or in item_group).
  2314. If no item ID/name given, all possible items in player's inventory will be merged.
  2315. ---------------------------------------
  2316. *getequiptradability(<equipment slot>{,<char id>});
  2317. Returns true if the item in <equipment slot> is tradable.
  2318. Returns false otherwise.
  2319. ---------------------------------------
  2320. *identifyall({<type>{,<account_id>}});
  2321. Returns the count of unidentified items in the player inventory.
  2322. If <type> is true the command will identify all the unidentified items as well (default).
  2323. If <type> is false the command only returns the count of unidentified items.
  2324. ---------------------------------------
  2325. *getenchantgrade({<equipment slot>,<char_id>})
  2326. This function will return the enchantgrade of the equipment from which the
  2327. function is called or the specified equipment slot. If nothing is
  2328. equipped there, it returns -1.
  2329. Valid equipment slots are:
  2330. EQI_COMPOUND_ON - Item slot that calls this script (In context of item script) (default)
  2331. For a list of others equipment slots see 'getequipid'.
  2332. ---------------------------------------
  2333. *getitempos()
  2334. This function will return the equip position of the equipment from which the
  2335. function is called. (see EQP_* constants)
  2336. This function is intended for use in item scripts.
  2337. ---------------------------------------
  2338. //
  2339. 2,1.- End of item-related commands.
  2340. //
  2341. ---------------------------------------
  2342. *getmapxy("<variable for map name>",<variable for x>,<variable for y>{,<type>,"<search value>"})
  2343. This function will locate a character object, NPC object or pet's coordinates
  2344. and place their coordinates into the variables specified when calling it. It
  2345. will return 0 if the search was successful, and -1 if the parameters given were
  2346. not variables or the search was not successful.
  2347. Type is the type of object to search for:
  2348. BL_PC - Character object (default)
  2349. BL_NPC - NPC object
  2350. BL_PET - Pet object
  2351. BL_HOM - Homunculus object
  2352. BL_MER - Mercenary object
  2353. BL_ELEM - Elemental object
  2354. The search value is optional. If it is not specified, the location of the
  2355. invoking character will always be returned for types BL_PC and BL_PET,
  2356. the location of the NPC running this function for type BL_NPC.
  2357. If a search value is specified, for types BL_PC and BL_NPC, the
  2358. character or NPC with the specified name or GID will be located.
  2359. If type is BL_PET/BL_HOM/BL_MER/BL_ELEM, the search
  2360. will locate the current object of the character who's name/GID is given in the
  2361. search value, it will NOT locate the object by name.
  2362. Example:
  2363. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2364. mes "My name is Meh. I'm here so that Nyah can find me.";
  2365. close;
  2366. }
  2367. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2368. mes "My name is Nyah.";
  2369. mes "I will now search for Meh all across the world!";
  2370. if (getmapxy(.@mapname$, .@mapx, .@mapy, BL_NPC, "Meh") != 0) {
  2371. mes "I can't seem to find Meh anywhere!";
  2372. close;
  2373. }
  2374. mes "And I found him on map " + .@mapname$ + " at X:" + .@mapx + " Y:" + .@mapy + " !";
  2375. close;
  2376. }
  2377. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2378. ---------------------------------------
  2379. *mapid2name(<map ID>)
  2380. Returns the map name of the given map ID. Returns an empty string if given
  2381. map ID doesn't exist.
  2382. ---------------------------------------
  2383. *getgmlevel({<char_id>})
  2384. This function will return the (GM) level associated with the player group to which
  2385. the invoking character belongs. If this is somehow executed from a console command,
  2386. 99 will be returned, and 0 will be returned if the account has no GM level.
  2387. This allows you to make NPC's only accessible for certain GM levels, or behave
  2388. specially when talked to by GMs.
  2389. if (getgmlevel()) mes "What is your command, your godhood?";
  2390. ---------------------------------------
  2391. *getgroupid({<char_id>})
  2392. This function will return the group id to which the invoking player belongs.
  2393. ---------------------------------------
  2394. *gettimetick(<tick type>)
  2395. This function will return a tick depending on <tick type>:
  2396. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2397. system. This tick is an unsigned int which loops every ~50 days.
  2398. 1: The time, in seconds, since the start of the current day.
  2399. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2400. January 1st, 1970. Useful for reliably measuring time intervals.
  2401. ---------------------------------------
  2402. *gettime(<type>)
  2403. This function will return specified information about the current system time.
  2404. DT_SECOND - Seconds (of the current minute)
  2405. DT_MINUTE - Minutes (of the current hour)
  2406. DT_HOUR - Hour (of the current day)
  2407. DT_DAYOFWEEK - Week day (constants for MONDAY to SUNDAY are available)
  2408. DT_DAYOFMONTH - Day of the current month
  2409. DT_MONTH - Month (constants for JANUARY to DECEMBER are available)
  2410. DT_YEAR - Year
  2411. DT_DAYOFYEAR - Day of the year
  2412. DT_YYYYMMDD - current date in the form YYYYMMDD
  2413. It will only return numbers. If another type is supplied -1 will be returned.
  2414. if (gettime(DT_DAYOFWEEK) == SATURDAY) mes "It's a Saturday. I don't work on Saturdays.";
  2415. ---------------------------------------
  2416. *gettimestr(<"time format">,<max length>{,<time_tick>})
  2417. This function will return a string containing time data as specified by the
  2418. time format.
  2419. This uses the C function 'strfmtime', which obeys special format characters. For
  2420. a full description see, for example, the description of 'strfmtime' at
  2421. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2422. All the format characters given in there should properly work.
  2423. Max length is the maximum length of a time string to generate.
  2424. The example given in rAthena sample scripts works like this:
  2425. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2426. The example above will print the current date and time like 'YYYY-MM/DD HH:MM:SS'.
  2427. The following example will print the date and time when the player's VIP status
  2428. expires by the given <time_tick>:
  2429. mes gettimestr("%Y-%m/%d %H:%M:%S",21,vip_status(VIP_STATUS_EXPIRE));
  2430. ---------------------------------------
  2431. *getusers(<type>)
  2432. This function will return a number of users on a map or the whole server. What
  2433. it returns is specified by Type.
  2434. Type can be one of the following values, which control what will be returned:
  2435. 0 - Count of all characters on the map of the invoking character.
  2436. 1 - Count of all characters in the entire server.
  2437. 8 - Count of all characters on the map of the NPC the script is
  2438. running in.
  2439. ---------------------------------------
  2440. *getmapusers("<map name>")
  2441. This function will return the number of users currently located on the specified
  2442. map.
  2443. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2444. ---------------------------------------
  2445. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2446. This function will return the count of connected characters which are located
  2447. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2448. This is useful for maps that are split into many buildings, such as all the
  2449. "*_in" maps, due to all the shops and houses.
  2450. ---------------------------------------
  2451. *getunits(<type>{,<array_variable>[<first value>]})
  2452. *getmapunits(<type>,<"map name">{,<array_variable>[<first value>]})
  2453. *getareaunits(<type>,<"map name">,<x1>,<y1>,<x2>,<y2>{,<array_variable>[<first value>]})
  2454. The 'getunits' command will return the number of <type> objects active on the server.
  2455. The 'getmapunits' command will return the number of <type> objects active on the
  2456. specified <"map name">.
  2457. The 'getareaunits' command will return the number of <type> objects actively located
  2458. within the specified area where <x1>, <y1>, <x2>, <y2> form the area.
  2459. Type is the type of object to search for:
  2460. BL_PC - Character objects
  2461. BL_MOB - Monster objects
  2462. BL_PET - Pet objects
  2463. BL_HOM - Homunculus objects
  2464. BL_MER - Mercenary objects
  2465. BL_NPC - NPC objects
  2466. BL_ELEM - Elemental objects
  2467. If <array_variable> is provided:
  2468. - An int variable will return the list of GID.
  2469. - A string variable will return the list of names.
  2470. Example 1:
  2471. // getting the players count and building a string array of the names.
  2472. .@num = getunits(BL_PC,.@array$[0]);
  2473. mes "the number of Users Connected to the server is " + .@num + " .";
  2474. mes "list of Players names :";
  2475. freeloop(1); // for if the list was too big.
  2476. for(.@i=0;.@i<getarraysize(.@array$);.@i++)
  2477. mes (.@i + 1) + " " + .@array$[.@i];
  2478. freeloop(0);
  2479. end;
  2480. Example 2:
  2481. // getting the npc count in Prontera and building a string array of the names.
  2482. .@num = getmapunits(BL_NPC,"prontera",.@array$[0]);
  2483. mes "the number of NPCs in Prontera is " + .@num + " .";
  2484. mes "list of NPCs name :";
  2485. freeloop(1); // for if the list was too big.
  2486. for(.@i=0;.@i<getarraysize(.@array$);.@i++)
  2487. mes (.@i + 1) + " " + .@array$[.@i];
  2488. freeloop(0);
  2489. end;
  2490. Example 3:
  2491. // getting the monster count in Prontera with specific coordinates and building a int array of the GIDs.
  2492. .@num = getareaunits(BL_MOB,"prontera",154,186,159,182,.@array[0]);
  2493. mes "the number of Monsters in Prontera in that Coordinates is " + .@num + " .";
  2494. mes "list of Monsters GID :";
  2495. freeloop(1); // for if the list was too big.
  2496. for(.@i=0;.@i<getarraysize(.@array);.@i++)
  2497. mes (.@i + 1) + " " + .@array[.@i];
  2498. freeloop(0);
  2499. end;
  2500. ---------------------------------------
  2501. \\
  2502. 2,2.- Guild-related commands
  2503. \\
  2504. ---------------------------------------
  2505. *getguildname(<guild id>)
  2506. This function returns a guild's name given an ID number. If there is no such
  2507. guild, "null" will be returned.
  2508. Example:
  2509. mes "The guild " + getguildname(10007) + " are all nice people.";
  2510. ---------------------------------------
  2511. *getguildmember <guild id>{,<type>{,<array_variable>}};
  2512. This command will find all members of a specified guild and returns their names
  2513. (or character id or account id depending on the value of "type") into an array
  2514. of temporary global variables.
  2515. Upon executing this,
  2516. $@guildmembername$[] is a global temporary string array which contains all the
  2517. names of these guild members.
  2518. (only set when type is 0 or not specified)
  2519. $@guildmembercid[] is a global temporary number array which contains the
  2520. character id of these guild members.
  2521. (only set when type is 1)
  2522. $@guildmemberaid[] is a global temporary number array which contains the
  2523. account id of these guild members.
  2524. (only set when type is 2)
  2525. $@guildmembercount is the number of guild members that were found.
  2526. The guild members will be found regardless of whether they are online or offline.
  2527. Note that the names come in no particular order.
  2528. Be sure to use $@guildmembercount to go through this array, and not
  2529. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2530. If 'array_variable' is set, the result will be stored to that variable instead
  2531. using global variable.
  2532. For usage examples, see 'getpartymember'.
  2533. ---------------------------------------
  2534. *getguildmaster(<guild id>)
  2535. This function return the name of the master of the guild which has the specified
  2536. ID number. If there is no such guild, "null" will be returned.
  2537. Example 1:
  2538. // Prints the guild master of guild 10007, whoever that might be.
  2539. mes getguildmaster(10007) + " runs " + getguildname(10007);
  2540. Example 2:
  2541. // Checks if the character is the guild master of the specified guild.
  2542. .@GID = getcharid(2);
  2543. if (.@GID == 0) {
  2544. mes "Sorry, you are not in a guild.";
  2545. close;
  2546. }
  2547. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2548. mes "Sorry, you don't own the guild you are in.";
  2549. close;
  2550. }
  2551. mes "Welcome, guild master of " + getguildname(.@GID);
  2552. close;
  2553. ---------------------------------------
  2554. *getguildmasterid(<guild id>)
  2555. This function will return the character ID number of the guild master of the
  2556. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2557. ---------------------------------------
  2558. *is_guild_leader({<guild ID>})
  2559. This command will return true if the player attached to the script is the leader
  2560. of his/her guild, or, if a guild ID is specified, of that guild.
  2561. ---------------------------------------
  2562. *getcastlename("<map name>")
  2563. This function returns the name of the castle when given the map name for that
  2564. castle. The data is read from 'db/castle_db.yml'.
  2565. ---------------------------------------
  2566. *getcastledata("<map name>",<type of data>)
  2567. *setcastledata "<map name>",<type of data>,<value>;
  2568. This function returns the castle ownership information for the castle referred
  2569. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2570. Types of data correspond to `guild_castle` table columns:
  2571. CD_GUILD_ID - Guild ID.
  2572. CD_CURRENT_ECONOMY - Castle Economy score.
  2573. CD_CURRENT_DEFENSE - Castle Defense score.
  2574. CD_INVESTED_ECONOMY - Number of times the economy was invested in today.
  2575. CD_INVESTED_DEFENSE - Number of times the defense was invested in today.
  2576. CD_NEXT_TIME - unused
  2577. CD_PAY_TIME - unused
  2578. CD_CREATE_TIME - unused
  2579. CD_ENABLED_KAFRA - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2580. CD_ENABLED_GUARDIAN0 - Is 1 if the 1st guardian is present (Soldier Guardian)
  2581. CD_ENABLED_GUARDIAN1 - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2582. CD_ENABLED_GUARDIAN2 - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2583. CD_ENABLED_GUARDIAN3 - Is 1 if the 4th guardian is present (Archer Guardian)
  2584. CD_ENABLED_GUARDIAN4 - Is 1 if the 5th guardian is present (Archer Guardian)
  2585. CD_ENABLED_GUARDIAN5 - Is 1 if the 6th guardian is present (Knight Guardian)
  2586. CD_ENABLED_GUARDIAN6 - Is 1 if the 7th guardian is present (Knight Guardian)
  2587. CD_ENABLED_GUARDIAN7 - Is 1 if the 8th guardian is present (Knight Guardian)
  2588. All types of data have their meaning determined by War of Emperium scripts,
  2589. with exception of:
  2590. - CD_GUILD_ID that is always considered ID of the guild that owns the castle,
  2591. - CD_CURRENT_DEFENSE that is used in Guardians & Emperium HP calculations,
  2592. - CD_ENABLED_GUARDIANX that is always considered to hold guardian presence bits.
  2593. The 'setcastledata' command will behave identically, but instead of returning
  2594. values for the specified types of accessible data, it will alter them and cause
  2595. them to be sent to the char-server for storage.
  2596. Changing Guild ID or Castle Defense will trigger additional actions, like
  2597. recalculating guardians' HP.
  2598. ---------------------------------------
  2599. *getgdskilllv(<guild id>,<skill id>)
  2600. *getgdskilllv(<guild id>,"<skill name>")
  2601. This function returns the level of the skill <skill id> of the guild <guild id>.
  2602. If the guild does not have that skill, 0 is returned.
  2603. If the guild does not exist, -1 is returned.
  2604. Refer to 'db/(pre-)re/skill_db.yml' for the full list of skills. (GD_* are guild skills)
  2605. ---------------------------------------
  2606. *requestguildinfo <guild id>{,"<event label>"};
  2607. This command requests the guild data from the char server and merrily continues
  2608. with the execution. Whenever the guild information becomes available (which
  2609. happens instantly if the guild information is already in memory, or later, if it
  2610. isn't and the map server has to wait for the char server to reply) it will run
  2611. the specified event as in a 'donpcevent' call.
  2612. ---------------------------------------
  2613. *getmapguildusers("<map name>",<guild id>)
  2614. Returns the amount of characters from the specified guild on the given map.
  2615. Example:
  2616. mes "You have " + getMapGuildUsers("prontera",getcharid(2)) + " guild members in Prontera.";
  2617. ---------------------------------------
  2618. //
  2619. 2,2.- End of guild-related commands
  2620. //
  2621. ---------------------------------------
  2622. *getskilllv(<skill id>)
  2623. *getskilllv("<skill name>")
  2624. This function returns the level of the specified skill that the invoking
  2625. character has. If they don't have the skill, 0 will be returned. The full list
  2626. of character skills is available in 'db/(pre-)re/skill_db.yml'.
  2627. There are two main uses for this function, it can check whether the character
  2628. has a skill or not, and it can tell you if the level is high enough.
  2629. Example 1:
  2630. if (getskilllv(152))
  2631. mes "You have got the skill Throw Stone";
  2632. else
  2633. mes "You don't have Throw Stone";
  2634. close;
  2635. Example 2:
  2636. if (getskilllv(28) >= 5)
  2637. mes "Your heal lvl is 5 or more";
  2638. else if (getskilllv(28) == 10)
  2639. mes "Your heal lvl has been maxed";
  2640. else
  2641. mes "You heal skill is below lvl 5";
  2642. close;
  2643. ---------------------------------------
  2644. *getskilllist({<char_id>});
  2645. This command sets a bunch of arrays with a complete list of skills the
  2646. invoking character has. Here's what you get:
  2647. @skilllist_id[] - skill ids.
  2648. @skilllist_lv[] - skill levels.
  2649. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2650. @skilllist_count - number of skills in the above arrays.
  2651. While 'getskillv' is probably more useful for most situations, this is the
  2652. easiest way to store all the skills and make the character something else for a
  2653. while. Advanced job for a day? This could also be useful to see how many
  2654. skills a character has.
  2655. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2656. ---------------------------------------
  2657. *getrandmobid(<type>{,<flag>{,<level>}})
  2658. This command returns a random monster ID from the random monster group.
  2659. With <flag> you can apply certain restrictions which monsters of the group can be returned.
  2660. Returns 0 if one of the parameters is invalid or no monster could be found with the given parameters.
  2661. Valid <type> are:
  2662. MOBG_BRANCH_OF_DEAD_TREE
  2663. MOBG_PORING_BOX
  2664. MOBG_BLOODY_DEAD_BRANCH
  2665. MOBG_RED_POUCH_OF_SURPRISE
  2666. MOBG_CLASSCHANGE
  2667. MOBG_TAEKWON_MISSION
  2668. Valid <flag> are:
  2669. RMF_NONE = 0x00 - Apply no flags
  2670. RMF_DB_RATE = 0x01 - Apply the summon success chance found in the list (otherwise get any monster from the db)
  2671. RMF_CHECK_MOB_LV = 0x02 - Apply a monster level check
  2672. RMF_MOB_NOT_BOSS = 0x04 - Selected monster should not be a Boss type (default)
  2673. - (except those from MOBG_BLOODY_DEAD_BRANCH)
  2674. RMF_MOB_NOT_SPAWN = 0x08 - Selected monster must have normal spawn
  2675. RMF_MOB_NOT_PLANT = 0x10 - Selected monster should not be a Plant type
  2676. RMF_ALL = 0xFF - Apply all flags
  2677. ---------------------------------------
  2678. *getmonsterinfo(<mob ID>,<type>)
  2679. *getmonsterinfo(<mob name>,<type>)
  2680. This function will look up the monster with the specified <mob ID> or <mob name> in the
  2681. mob database and return the info set by <type> argument.
  2682. It will return -1 if there is no such monster (or the type value is invalid),
  2683. or "null" if you requested the monster's name.
  2684. Valid types are:
  2685. MOB_NAME - monster's japanese name, if there is no such monster "null" is returned
  2686. MOB_LV - monster's level
  2687. MOB_MAXHP - monster's maximum hp
  2688. MOB_BASEEXP - monster's base experience
  2689. MOB_JOBEXP - monster's job experience
  2690. MOB_ATK1 - monster's atk
  2691. MOB_ATK2 - monster's atk2
  2692. MOB_DEF - monster's def
  2693. MOB_MDEF - monster's mdef
  2694. MOB_RES - monster's res
  2695. MOB_MRES - monster's mres
  2696. MOB_STR - monster's str
  2697. MOB_AGI - monster's agi
  2698. MOB_VIT - monster's vit
  2699. MOB_INT - monster's int
  2700. MOB_DEX - monster's dex
  2701. MOB_LUK - monster's luk
  2702. MOB_RANGE - monster's range
  2703. MOB_RANGE2 - monster's range2
  2704. MOB_RANGE3 - monster's range3
  2705. MOB_SIZE - monster's size
  2706. MOB_RACE - monster's race
  2707. MOB_ELEMENT - monster's element(doesn't return the element level, only the element ID)
  2708. MOB_MODE - monster's mode
  2709. MOB_MVPEXP - monster's mvp experience
  2710. MOB_ID - monster's ID
  2711. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2712. ---------------------------------------
  2713. *getmobdrops(<mob id>)
  2714. This command will find all drops of the specified mob and return the item IDs
  2715. and drop percentages into arrays of temporary global variables.
  2716. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2717. Upon executing this,
  2718. $@MobDrop_item[] is a global temporary number array which contains the
  2719. item IDs of the monster's drops.
  2720. $@MobDrop_rate[] is a global temporary number array which contains the
  2721. drop percentages of each item. (1 = .01%)
  2722. $@MobDrop_nosteal[] is a global temporary number array which contains the
  2723. StealProtected flag of each item. (default false)
  2724. $@MobDrop_randomopt[] is a global temporary number array which contains the
  2725. random option group ID of each item. (default 0)
  2726. $@MobDrop_count is the number of item drops found.
  2727. Be sure to use $@MobDrop_count to go through the arrays, and not
  2728. 'getarraysize', because the temporary global arrays are not cleared between
  2729. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2730. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2731. the server will not clear the arrays for you, overwriting the values instead. So
  2732. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2733. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2734. belong to the new mob. $@MobDrop_count will always contain the correct number
  2735. (5), unlike 'getarraysize()' which would return 7 in this case.
  2736. Example:
  2737. // get a Mob ID from the user
  2738. input .@mob_id;
  2739. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2740. // immediately copy global temporary variables into scope variables,
  2741. // since we don't know when 'getmobdrops' will get called again for
  2742. // another mob, overwriting your global temporary variables
  2743. .@count = $@MobDrop_count;
  2744. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2745. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2746. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2747. for( .@i = 0; .@i < .@count; .@i++ ) {
  2748. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2749. }
  2750. } else {
  2751. mes "Unknown monster ID.";
  2752. }
  2753. close;
  2754. ---------------------------------------
  2755. *skillpointcount({<char_id>})
  2756. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2757. This command can be used to check the currently attached characters total amount of skill points.
  2758. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2759. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2760. Example 1:
  2761. .@skillPoints = skillpointcount();
  2762. mes "You have " + .@skillPoints + " skill points in total!";
  2763. Example 2:
  2764. if (skillpointcount() > 20)
  2765. mes "Wow, you have more then 20 Skill Points in total!";
  2766. ---------------------------------------
  2767. *getscrate(<effect type>,<base rate>{,<GID>})
  2768. This function will return the chance of a status effect affecting the invoking
  2769. character, in percent, modified by the their current defense against said
  2770. status. The 'base rate' is the base chance of the status effect being inflicted,
  2771. in percent.
  2772. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2773. You can see the full list of available effect types you can possibly inflict in
  2774. 'src/map/script_constants.hpp' under 'Eff_'.
  2775. ---------------------------------------
  2776. ========================
  2777. |3.- Checking commands.|
  2778. ========================
  2779. ---------------------------------------
  2780. *playerattached()
  2781. Returns the ID of the player currently attached to the script. It will return
  2782. 0 if no one is attached, or if the attached player no longer exists on the map
  2783. server. It is wise to check for the attached player in script functions that
  2784. deal with timers as there's no guarantee the player will still be logged on
  2785. when the timer triggers. Note that the ID of a player is actually their
  2786. account ID.
  2787. ---------------------------------------
  2788. *getattachedrid();
  2789. Returns RID from running script. Script may not be attached to any RID like
  2790. a floating script or function and will return 0.
  2791. ---------------------------------------
  2792. *isloggedin(<account id>{,<char id>})
  2793. This function returns 1 if the specified account is logged in and 0 if they
  2794. aren't. You can also pass the char id to check for both account and char id.
  2795. ---------------------------------------
  2796. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2797. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2798. *checkweight2(<id_array>,<amount_array>);
  2799. These functions will compute and return 1 if the total weight of the specified
  2800. number of specific items does not exceed the invoking character's carrying
  2801. capacity, and 0 otherwise. It is important to see if a player can carry the
  2802. items you expect to give them, failing to do that may open your script up to
  2803. abuse or create some very unfair errors.
  2804. The second function will check an array of items and amounts, and also
  2805. returns 1 on success and 0 on failure.
  2806. The functions, in addition to checking to see if the player is capable of
  2807. holding a set amount of items, also ensure the player has room in their
  2808. inventory for the item(s) they will be receiving.
  2809. Like 'getitem', this function will also accept an 'english name' from the
  2810. database as an argument.
  2811. Example 1:
  2812. if (checkweight(512,10)) {
  2813. getitem 512,10;
  2814. } else {
  2815. mes "Sorry, you cannot hold this amount of apples!";
  2816. }
  2817. Example 2:
  2818. setarray .@item[0],512,513,514;
  2819. setarray .@amount[0],10,5,5;
  2820. if (!checkweight2(.@item,.@amount)) {
  2821. mes "Sorry, you cannot hold this amount of fruit!";
  2822. }
  2823. ---------------------------------------
  2824. *basicskillcheck()
  2825. This function will return the state of the configuration option
  2826. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2827. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2828. it is by default, characters must have a certain number of basic skill levels to
  2829. sit, request a trade, use emotions, etc. Making your script behave differently
  2830. depending on whether the characters must actually have the skill to do all these
  2831. things might in some cases be required.
  2832. ---------------------------------------
  2833. *checkoption(<option number>{,<char_id>})
  2834. *checkoption1(<option number>{,<char_id>})
  2835. *checkoption2(<option number>{,<char_id>})
  2836. *setoption <option number>{,<flag>{,<char_id>}};
  2837. The 'setoption' series of functions check for a so-called option that is set on
  2838. the invoking character. 'Options' are used to store status conditions and a lot
  2839. of other non-permanent character data of the yes-no kind. For most common cases,
  2840. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2841. functions, but there are some options which you cannot get at this way. They
  2842. return 1 if the option is set and 0 if the option is not set.
  2843. Option numbers valid for the first (option) version of this command are:
  2844. 0x1 - Sight in effect.
  2845. 0x2 - Hide in effect.
  2846. 0x4 - Cloaking in effect.
  2847. 0x8 - Cart number 1 present.
  2848. 0x10 - Falcon present.
  2849. 0x20 - Peco Peco present.
  2850. 0x40 - GM Perfect Hide in effect.
  2851. 0x80 - Cart number 2 present.
  2852. 0x100 - Cart number 3 present.
  2853. 0x200 - Cart number 4 present.
  2854. 0x400 - Cart number 5 present.
  2855. 0x800 - Orc head present.
  2856. 0x1000 - The character is wearing a wedding sprite.
  2857. 0x2000 - Ruwach is in effect.
  2858. 0x4000 - Chasewalk in effect.
  2859. 0x8000 - Flying or Xmas suit.
  2860. 0x10000 - Sighttrasher.
  2861. 0x100000 - Warg present.
  2862. 0x200000 - The character is riding a warg.
  2863. Option numbers valid for the second version (opt1) of this command are:
  2864. 1 - Petrified.
  2865. 2 - Frozen.
  2866. 3 - Stunned.
  2867. 4 - Sleeping.
  2868. 6 - Petrifying (the state where you can still walk)
  2869. Option numbers valid for the third version (opt2) of this command are:
  2870. 0x1 - Poisoned.
  2871. 0x2 - Cursed.
  2872. 0x4 - Silenced.
  2873. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2874. 0x10 - Blinded.
  2875. 0x80 - Deadly poisoned.
  2876. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2877. for several states, but the functions will return true if at least one of them
  2878. is in effect.
  2879. 'setoption' will set options on the invoking character. There are no second and
  2880. third versions of this command, so you can only change the values in the first
  2881. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2882. the option will be added to what the character currently has; if 0, the option is removed.
  2883. This is definitely not a complete list of available option flag numbers. Ask a
  2884. core developer (or read the source: src/map/status.hpp) for the full list.
  2885. ---------------------------------------
  2886. *setcart {<type>{,<char_id>}};
  2887. *checkcart({<char_id>});
  2888. If <type> is 0 this command will remove the cart from the character.
  2889. Otherwise it gives the invoking character a cart. The cart given will be
  2890. cart number <type> and will work regardless of whether the character is a
  2891. merchant class or not.
  2892. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2893. The accompanying function will return 1 if the invoking character has a cart
  2894. (any kind of cart) and 0 if they don't.
  2895. if (checkcart()) mes "But you already have a cart!";
  2896. ---------------------------------------
  2897. *setfalcon {<flag>{,<char_id>}};
  2898. *checkfalcon({<char_id>});
  2899. If <flag> is 0 this command will remove the falcon from the character.
  2900. Otherwise it gives the invoking character a falcon. The falcon will be there
  2901. regardless of whether the character is a hunter or not. It will (probably) not
  2902. have any useful effects for non-hunters though.
  2903. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2904. The accompanying function will return 1 if the invoking character has a falcon
  2905. and 0 if they don't.
  2906. if (checkfalcon()) mes "But you already have a falcon!";
  2907. ---------------------------------------
  2908. *setriding {<flag>{,<char_id>}};
  2909. *checkriding({<char_id>});
  2910. If <flag> is 0 this command will remove the mount from the character.
  2911. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2912. series class), a GrandPeco (if they are a Crusader series class), or
  2913. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2914. this will not work at all if they aren't of a class which can ride.
  2915. Note: the character needs to have the skill KN_RIDING to gain a mount
  2916. The accompanying function will return 1 if the invoking character is riding a
  2917. bird and 0 if they aren't.
  2918. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2919. ---------------------------------------
  2920. *setdragon {<color>{,<char_id>}};
  2921. *checkdragon({<char_id>});
  2922. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2923. It will return 1 if successful, 0 otherwise.
  2924. The available colors are:
  2925. 1 - Green Dragon (default)
  2926. 2 - Brown Dragon
  2927. 3 - Gray Dragon
  2928. 4 - Blue Dragon
  2929. 5 - Red Dragon
  2930. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2931. The accompanying function will return 1 if the invoking character is riding a
  2932. dragon and 0 if they aren't.
  2933. ---------------------------------------
  2934. *setmadogear {<flag>{,<type>{,<char_id>}}};
  2935. *checkmadogear({<char_id>});
  2936. If <flag> is false this command will remove the mount from the character.
  2937. Otherwise it gives the invoking character a Mado (if they are a Mechanic and have the skill NC_MADOLICENCE).
  2938. When using client version PACKETVER_MAIN_NUM >= 20191120 or PACKETVER_RE_NUM >= 20191106
  2939. the <type> flag can be used to specify a specific madogear.
  2940. Types:
  2941. MADO_ROBOT (default)
  2942. MADO_SUIT
  2943. The accompanying function will return 1 if the invoking character has a
  2944. Mado and 0 if they don't.
  2945. ---------------------------------------
  2946. *setmounting {<char_id>};
  2947. *ismounting({<char_id>});
  2948. The 'setmounting' function toggles cash mount for the invoking character.
  2949. It will return 1 if successful, 0 otherwise.
  2950. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2951. The accompanying function will return 1 if the invoking character has a
  2952. cash mount and 0 if they don't.
  2953. ---------------------------------------
  2954. *checkwug({<char_id>});
  2955. This function will return 1 if the invoking character has a
  2956. warg and 0 if they don't.
  2957. ---------------------------------------
  2958. *checkvending({"<Player Name>"})
  2959. Checks if the player is vending or has has a buyingstore. Additionally
  2960. it gives you the information whether the player uses autotrade or not.
  2961. Name is optional, and defaults to the attached player if omitted.
  2962. The returned value is bitmask of.
  2963. 0 = doesn't have a vending or buyingstore (which also means he can't use autotrade)
  2964. 1 = normal vending
  2965. 2 = using @autotrade
  2966. 4 = has a buyingstore
  2967. Examples:
  2968. //This will check Aaron's state
  2969. .@state = checkvending("Aaron");
  2970. if (.@state&1)
  2971. mes "Aaron is currently vending!";
  2972. if (.@state&4)
  2973. mes "Aaron has a buying store!";
  2974. if (.@state&2)
  2975. mes "Aaron is autotrading!";
  2976. ---------------------------------------
  2977. *checkchatting({"<Player Name>"})
  2978. Checks if the player is in a chatroom.
  2979. Name is optional, and defaults to the attached player if omitted.
  2980. Returns 1 if they are in a chat room, 0 if they are not.
  2981. Examples:
  2982. //This will check if the attached player in a chat room or not.
  2983. if (checkchatting())
  2984. mes "You are currently in a chat room!";
  2985. ---------------------------------------
  2986. *checkidle({"<Player Name>"})
  2987. Returns the time, in seconds, that the specified player has been idle.
  2988. Name is optional, and defaults to the attached player if omitted.
  2989. ---------------------------------------
  2990. *checkidlehom({"<Player Name>"})
  2991. Returns the time, in seconds, that the specified player has been idle for homunculus item/exp share.
  2992. Name is optional, and defaults to the attached player if omitted.
  2993. This will only work if 'hom_idle_no_share' and 'idletime_hom_option' are enabled (see '/conf/battle/homunc.conf').
  2994. ---------------------------------------
  2995. *checkidlemer({"<Player Name>"})
  2996. Returns the time, in seconds, that the specified player has been idle for mercenary item share.
  2997. Name is optional, and defaults to the attached player if omitted.
  2998. This will only work if 'mer_idle_no_share' and 'idletime_mer_option' are enabled (see '/conf/battle/drops.conf').
  2999. ---------------------------------------
  3000. *agitcheck()
  3001. *agitcheck2()
  3002. *agitcheck3()
  3003. These function will let you check whether the server is currently in WoE:FE mode
  3004. (agitcheck()), WoE:SE mode (agitcheck2()), or WoE:TE mode (agitcheck3()) and will
  3005. return true if War of Emperium is on and false if it isn't.
  3006. ---------------------------------------
  3007. *isnight()
  3008. *isday()
  3009. These functions will return 1 or 0 depending on whether the server is in night
  3010. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  3011. the other way around. They can be used interchangeably, pick the one you like
  3012. more:
  3013. // These two are equivalent:
  3014. if (isday()) mes "I only prowl in the night.";
  3015. if (isnight() != 1) mes "I only prowl in the night.";
  3016. ---------------------------------------
  3017. *checkre(<type>)
  3018. Checks if a renewal feature is enabled or not in renewal.hpp, and returns 1 if
  3019. enabled and 0 for disabled.
  3020. The renewal feature to check is determined by the number <type>.
  3021. 0 - RENEWAL enabled (game renewal server mode)
  3022. 1 - RENEWAL_CAST (renewal cast time)
  3023. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  3024. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  3025. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  3026. 5 - RENEWAL_ASPD (renewal ASPD)
  3027. ---------------------------------------
  3028. \\
  3029. 3,1.- Item-related commands
  3030. \\
  3031. ---------------------------------------
  3032. *isequipped(<id>{,<id>{,..}})
  3033. This function will return 1 if the invoking character has all of the item
  3034. IDs given equipped (if item/card IDs are passed, then it checks if the items/cards are
  3035. inserted into slots in the equipment they are currently wearing). Theoretically
  3036. there is no limit to the number of items that may be tested for at the same time.
  3037. If even one of the items given is not equipped, 0 will be returned.
  3038. // (Poring,Santa Poring,Poporing,Marin)
  3039. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  3040. // (Poring)
  3041. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  3042. The function was meant for item scripts to support the cards released by Gravity
  3043. in February 2005, but it will work just fine in normal NPC scripts.
  3044. ---------------------------------------
  3045. *isequippedcnt(<id>{,<id>{,..}})
  3046. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  3047. the amount of item/card equipped that were found on the invoking character from the given list.
  3048. Example:
  3049. if (isequippedcnt(4001,4005,4033,4196) == 5)
  3050. mes "Finally got 5 cards from poring monsters type?";
  3051. ---------------------------------------
  3052. *checkequipedcard(<item id>)
  3053. This function will return 1 if the item/card specified by its item ID number is
  3054. inserted into any equipment they have in their inventory, currently equipped or
  3055. not.
  3056. ---------------------------------------
  3057. //
  3058. 3,1.- End of item-related commands
  3059. //
  3060. ---------------------------------------
  3061. ==============================
  3062. |4.- Player-related commands.|
  3063. ==============================
  3064. ---------------------------------------
  3065. *attachrid(<account ID>{,force})
  3066. *detachrid;
  3067. These commands allow the manipulation of the script's currently attached player.
  3068. While 'attachrid' allows attaching of a different player by using its account id
  3069. for the parameter RID, 'detachrid' makes the following commands run as if the
  3070. script was never invoked by a player.
  3071. The command returns false if the player cannot be attached (if the account is offline
  3072. or does not exist), and true upon success.
  3073. By default the command is executed with force, which causes to attach the player
  3074. even if he is currently attached to another script. Since this is not always the
  3075. desired behavior you can also specify false to the command and it will only return
  3076. true if the player is online and was not attached to another script.
  3077. ---------------------------------------
  3078. *addrid(<type>{,<flag>{,<parameters>}});
  3079. This command will attach other RIDs to the current script without detaching the
  3080. invoking RID. It returns 1 if successful and 0 upon failure.
  3081. <type> determines what RIDs are attached:
  3082. 0: All players in the server.
  3083. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  3084. 2: Party members of a specified party ID.
  3085. [ Parameters: <party id> ]
  3086. 3: Guild members of a specified guild ID.
  3087. [ Parameters: <guild id> ]
  3088. 4: All players in a specified area of the map of the invoking player (or NPC).
  3089. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  3090. 5: All players in the map.
  3091. [ Parameters: "<map name>" ]
  3092. Account ID: If type is Account ID, attach the specified account ID.
  3093. <flag> can prevent certain players from being attached:
  3094. 0: Players are always attached. (default)
  3095. 1: Players currently running another script will not be attached.
  3096. ---------------------------------------
  3097. *rid2name(<rid>)
  3098. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  3099. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  3100. Note: rid2name may not produce correct character names since rid = account id.
  3101. It will return the current online character of the account only.
  3102. ---------------------------------------
  3103. *message "<character name>","<message>";
  3104. That command will send a message to the chat window of the character specified
  3105. by name. The text will also appear above the head of that character. It will not
  3106. be seen by anyone else.
  3107. ---------------------------------------
  3108. *dispbottom "<message>"{,<color>{,<char_id>}};
  3109. This command will send the given message with color into the invoking character's chat
  3110. window. The color format is in RGB (0xRRGGBB). The color is
  3111. by default green
  3112. ---------------------------------------
  3113. *showscript "<message>"{,<GID>, <flag>};
  3114. Makes attached player or GID says a message like shouting a skill name, the message
  3115. will be seen to everyone around but not in chat window.
  3116. flag: Specify target
  3117. AREA - Message is sent to players in the vicinity of the source (default).
  3118. SELF - Message is sent only to player attached.
  3119. ---------------------------------------
  3120. *warp "<map name>",<x>,<y>{,<char id>};
  3121. This command will take the invoking character or <char id>, if specified, to the specified map, and if
  3122. wanted, specified coordinates too, but these can be random.
  3123. warp "place",50,55;
  3124. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  3125. coordinates land on an unwalkable map square, it will send the warped character
  3126. to a random place. Same will happen if they are both zero:
  3127. warp "place",0,0;
  3128. Notice that while warping people to coordinates 0,0 will normally get them into
  3129. a random place, it's not certain to always be so. Darned if I know where this is
  3130. actually coded, it might be that this happens because square 0,0 is unwalkable
  3131. on all official maps. If you're using custom maps, beware.
  3132. There are also three special 'map names' you can use.
  3133. "Random" will warp the player randomly on the current map.
  3134. "Save" and "SavePoint" will warp the player back to their save point.
  3135. ---------------------------------------
  3136. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  3137. This command is similar to 'warp', however, it will not refer to the invoking
  3138. character, but instead, all characters within a specified area, defined by the
  3139. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  3140. including the activating character, if they are outside the area.
  3141. areawarp "place",10,10,120,120,"place2",150,150;
  3142. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  3143. shape, on the map called "place", will be affected, and warped to "place2" X 150
  3144. Y 150
  3145. areawarp "place",10,10,120,120,"place2",0,0;
  3146. By using ,0,0; as the destination coordinates it will take all the characters in
  3147. the affected area to a random set of co-ordinates on "place2".
  3148. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  3149. By using the optional x4 and y4 parameters, the destination coordinates will be a
  3150. random place within the defined x3/y3-x4/y4 square.
  3151. Like 'warp', areawarp will also explicitly warp characters randomly into the
  3152. current map if you give the 'to map name' as "Random".
  3153. See also 'warp'.
  3154. ---------------------------------------
  3155. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>",<range x>,<range y>};
  3156. Warps a party to specified map and coordinate given the party ID, which you can get with
  3157. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  3158. You can use the following "map names" for special warping behavior:
  3159. Random: All party members are randomly warped in their current map (as if they
  3160. all used a fly wing)
  3161. SavePointAll: All party members are warped to their respective save point.
  3162. SavePoint: All party members are warped to the save point of the currently
  3163. attached player (will fail if there's no player attached).
  3164. Leader: All party members are warped to the leader's position. The leader must
  3165. be online and in the current map-server for this to work.
  3166. RandomAll: All party members are warped to the same random position in their current map
  3167. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  3168. The <range x> and <range y> optional values allow for a randomization with the
  3169. player's warp point. The values will randomly add or subtract from the given <x>
  3170. and <y> coordinates.
  3171. Example:
  3172. mes "[Party Warper]";
  3173. mes "Here you go!";
  3174. close2;
  3175. .@party_id = getcharid(1);
  3176. warpparty "prontera",150,100,.@party_id;
  3177. close;
  3178. ---------------------------------------
  3179. *warpguild "<map name>",<x>,<y>,<guild_id>;
  3180. Warps a guild to specified map and coordinate given the guild id, which you can get with
  3181. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  3182. You can use the following "map names" for special warping behavior:
  3183. Random: All guild members are randomly warped in their current map (as if they
  3184. all used a fly wing)
  3185. SavePointAll: All guild members are warped to their respective save point.
  3186. SavePoint: All guild members are warped to the save point of the currently
  3187. attached player (will fail if there's no player attached).
  3188. Example:
  3189. warpguild "prontera",x,y,Guild_ID;
  3190. ---------------------------------------
  3191. *warppartner("<map name>",<x>,<y>);
  3192. This function will find the invoking character's marriage partner, if any, and
  3193. warp them to the map and coordinates given. It will return 1 upon success and
  3194. 0 if the partner is not online, the character is not married, or if there's no
  3195. invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
  3196. ---------------------------------------
  3197. *savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  3198. *save "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  3199. These commands save where the invoking character will return to upon clicking
  3200. "Return to Save Point", after death and in some other cases. The two versions are
  3201. equivalent. They ignore any and all mapflags, and can make a character respawn where
  3202. no teleportation is otherwise possible.
  3203. The <range x> and <range y> optional values allow for a randomization with the
  3204. player's save point. The values will randomly add or subtract from the given <x>
  3205. and <y> coordinates.
  3206. savepoint "place",350,75;
  3207. savepoint "place",350,75,2,2; // Randomly save the character between 348,73 and 352,77
  3208. ---------------------------------------
  3209. *heal <hp>,<sp>{,<char_id>};
  3210. This command will heal a set amount of HP and/or SP on the invoking character.
  3211. heal 30000,0; // This will heal 30,000 HP
  3212. heal 0,30000; // This will heal 30,000 SP
  3213. heal 300,300; // This will heal 300 HP and 300 SP
  3214. This command just alters the hit points and spell points of the invoking
  3215. character and produces no other output whatsoever.
  3216. ---------------------------------------
  3217. *healap <ap>{,<char_id>};
  3218. This command will heal a set amount of AP on the invoking character.
  3219. healap 10; // This will give 10 AP
  3220. healap -10; // This will remove 10 AP
  3221. This command just alters the activity points of the invoking
  3222. character and produces no other output whatsoever.
  3223. ---------------------------------------
  3224. *itemheal <hp>,<sp>{,<char_id>};
  3225. This command heals relative amounts of HP and/or SP on the invoking character.
  3226. Unlike heal, this command is intended for use in item scripts. It applies
  3227. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  3228. When used inside an NPC script, certain bonuses are omitted.
  3229. The command also applies a SP/VIT-related bonus:
  3230. heal = heal * [(100 + STATUS*2) / 100]
  3231. Example:
  3232. // If the player has 50 vit and no bonuses, this will heal
  3233. // anything from 200 to 300 HP and 5 SP
  3234. itemheal rand(100,150),5;
  3235. ---------------------------------------
  3236. *percentheal <hp>,<sp>{,<char_id>};
  3237. This command will heal the invoking character. It heals the character, but not
  3238. by a set value - it adds percent of their maximum HP/SP.
  3239. percentheal 100,0; // This will heal 100% HP
  3240. percentheal 0,100; // This will heal 100% SP
  3241. percentheal 50,50; // This will heal 50% HP and 50% SP
  3242. So the amount that this will heal will depend on the total amount of HP or SP
  3243. you have maximum. Like 'heal', this will not call up any animations or effects.
  3244. ---------------------------------------
  3245. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  3246. This command will revive and fully restore the HP/SP of the selected characters.
  3247. It returns 1 upon successful use.
  3248. <type> is the target, and determines the <option> parameter:
  3249. 0: Player -> Character ID number
  3250. 1: Party -> Party ID number
  3251. 2: Guild -> Guild ID number
  3252. 3: Map -> Map name (a string)
  3253. 4: All -> None (takes <revive_flag> as option)
  3254. If no option is specified, the invoking player's character ID, party ID, guild ID,
  3255. or map will be used.
  3256. <revive_flag> determines the action:
  3257. 1: Revive and heal all players (default)
  3258. 2: Heal living players only
  3259. 4: Revive dead players only
  3260. <map name> can optionally be used to define a single map to execute the command on
  3261. for types 1 (party) and 2 (guild).
  3262. Examples:
  3263. // Only revive characters in invoking party on map "morocc"
  3264. recovery 1,getcharid(1),4,"morocc";
  3265. // Fully heal (don't revive) all members of invoking character's guild
  3266. recovery 2,getcharid(2),2;
  3267. // Revive and fully heal everyone in map "prontera"
  3268. recovery 3,"prontera";
  3269. // Only revive all dead characters on server
  3270. recovery 4,4;
  3271. ---------------------------------------
  3272. *jobchange <job number>{,<upper flag>,<char_id>};
  3273. This command will change the job class of the invoking character.
  3274. jobchange 1; // This would change your player into a Swordman
  3275. jobchange 4002; // This would change your player into a Swordman High
  3276. This command does work with numbers, but you can also use job names. The full
  3277. list of job names and the numbers they correspond to can be found in
  3278. 'src/map/script_constants.hpp'.
  3279. // This would change your player into a Swordman
  3280. jobchange Job_Swordman;
  3281. // This would change your player into a Swordman High
  3282. jobchange Job_Swordman_High;
  3283. 'upper flag' can alternatively be used to specify the type of job one changes
  3284. to. For example, jobchange Job_Swordman,1; will change the character to a high
  3285. swordsman. The upper values are:
  3286. -1 (or when omitted): preserves the current job type.
  3287. 0: Normal/standard classes
  3288. 1: High/Advanced classes
  3289. 2: Baby classes
  3290. This command will also set a permanent character-based variable
  3291. 'jobchange_level' which will contain the job level at the time right before
  3292. changing jobs, which can be checked for later in scripts.
  3293. ---------------------------------------
  3294. *jobname(<job number>)
  3295. This command retrieves the name of the given job using the map_msg entries 550->655.
  3296. mes "[Kid]";
  3297. mes "I never thought I'd met a " + jobname(Class) + " here of all places.";
  3298. close;
  3299. ---------------------------------------
  3300. *eaclass({<job number>,<char_id>})
  3301. This commands returns the "eA job-number" corresponding to the given class, and
  3302. uses the invoking player's class if none is given. The eA job-number is also a
  3303. class number system, but it's one that comes with constants which make it easy
  3304. to convert among classes. The command will return -1 if you pass it a job number
  3305. which doesn't have an eA job-number equivalent.
  3306. .@eac = eaclass();
  3307. if ((.@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  3308. mes "Your base job is Swordman.";
  3309. if (.@eac&EAJL_UPPER)
  3310. mes "You are a rebirth job.";
  3311. if ((.@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  3312. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  3313. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  3314. ---------------------------------------
  3315. *roclass(<job number>{,<gender>})
  3316. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3317. corresponding RO class number. A gender is required because both Bard and Dancers
  3318. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3319. gender if none is given (if no player is attached, male will be used by default).
  3320. The command will return -1 if there is no valid class to represent the specified
  3321. job (for example, if you try to get the baby version of a Taekwon class).
  3322. .@eac = eaclass();
  3323. //Check if class is already rebirth
  3324. if (.@eac&EAJL_UPPER) {
  3325. mes "You look strong.";
  3326. close;
  3327. }
  3328. .@eac = roclass(.@eac|EAJL_UPPER);
  3329. //Check if class has a rebirth version
  3330. if (.@eac != -1) {
  3331. mes "Bet you can't wait to become a " + jobname(.@eac) + "!";
  3332. close;
  3333. }
  3334. ---------------------------------------
  3335. *changebase <job ID number>{,<account ID>};
  3336. This command will change a character's appearance to that of the specified job
  3337. class. Nothing but appearance will change.
  3338. The command will run for the invoking character unless an account ID is given.
  3339. changebase Job_Novice; // Changes player to Novice sprite.
  3340. changebase Class; // Changes player back to default sprite.
  3341. ---------------------------------------
  3342. *classchange(<view id>{,"<NPC name>","<flag>"});
  3343. This command is very ancient, its origins are clouded in mystery.
  3344. It will send a 'display id change' packet to everyone in the immediate area of
  3345. the NPC object, which will supposedly make the NPC look like a different sprite,
  3346. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3347. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3348. and most importantly, will not work at all since this command was broken with
  3349. the introduction of advanced classes. The code is written with the assumption
  3350. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3351. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3352. ID numbers on the other end of the number pool where monster sprites float.
  3353. As a result it is currently impossible to call this command with a valid view
  3354. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3355. run will actually just crash the client.
  3356. It could be a real gem if it can be gotten to actually do what it's supposed to
  3357. do, but this will only happen in a later SVN revision.
  3358. Empty <NPC name> means attached NPC.
  3359. Target for <flag>:
  3360. - bc_area : Sprite is sent to players in the vicinity of the source (default value).
  3361. - bc_self : Sprite is sent only to player attached.
  3362. ---------------------------------------
  3363. *changesex({<char_id>});
  3364. This command will change the gender for the attached character's account. If it
  3365. was male, it will become female, if it was female, it will become male. The
  3366. change will be written to the character server, the player will receive the
  3367. message: "Need disconnection to perform change-sex request..." and the player
  3368. will be immediately kicked to the login screen. When they log back in, they will
  3369. be the opposite sex.
  3370. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3371. they will also have their skills reset upon 'changesex'.
  3372. ---------------------------------------
  3373. *changecharsex({<char_id>});
  3374. This command will change the gender of the attached character. If it
  3375. was male, it will become female, if it was female, it will become male. The
  3376. change will be written to the character server, the player will receive the
  3377. message: "Need disconnection to perform change-sex request..." and the player
  3378. will be immediately kicked to the login screen. When they log back in, they will
  3379. be the opposite sex.
  3380. If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
  3381. the character will also have their skills reset upon 'changecharsex'.
  3382. ---------------------------------------
  3383. *getexp <base_exp>,<job_exp>{,<char_id>};
  3384. This command will give the invoking character a specified number of base and job
  3385. experience points. Used for a quest reward. Negative values won't work.
  3386. The EXP values are adjustted by 'quest_exp_rate' config value, VIP bonus, Guild
  3387. Tax and EXP boost items such Battle Manual, Bubble Gum, or items that have
  3388. SC_EXPBOOST or SC_ITEMBOOST.
  3389. getexp 10000,5000;
  3390. ---------------------------------------
  3391. *getexp2 <base_exp>,<job_exp>{,<char_id>};
  3392. This command is safety version of 'set' command for BaseExp and JobExp. If using
  3393. 'set' while the BaseExp or JobExp value is more than 2,147,483,647 (INT_MAX) will
  3394. causing overflow error.
  3395. Unlike 'getexp', this command ignores the adjustment factors!
  3396. ---------------------------------------
  3397. *getbaseexp_ratio(<percent>{,<base_level>{,char_id});
  3398. Returns the amount of base experience representing the given <percent> of the
  3399. required base experience at <base_level>. If no base level is specified the base
  3400. level of the attached character will be used.
  3401. ---------------------------------------
  3402. *getjobexp_ratio(<percent>{,<job_level>{,char_id});
  3403. Returns the amount of job experience representing the given <percent> of the
  3404. required job experience at <job_level>. If no job level is specified the job
  3405. level of the attached character will be used.
  3406. ---------------------------------------
  3407. *setlook <look type>,<look value>{,<char_id>};
  3408. *changelook <look type>,<look value>{,<char_id>};
  3409. 'setlook' will alter the look data for the invoking character. It is used
  3410. mainly for changing the palette used on hair and clothes: you specify which look
  3411. type you want to change, then the palette you want to use. Make sure you specify
  3412. a palette number that exists/is usable by the client you use.
  3413. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3414. // This will change your hair color, so that it uses palette 8, what ever your
  3415. // palette 8 is, your hair will use that color
  3416. setlook LOOK_HAIR_COLOR,8;
  3417. // This will change your clothes color, so they are using palette 1, whatever
  3418. // your palette 1 is, your clothes will then use that set of colors.
  3419. setlook LOOK_CLOTHES_COLOR,1;
  3420. Here are the possible look types:
  3421. LOOK_BASE - Base sprite
  3422. LOOK_HAIR - Hairstyle
  3423. LOOK_WEAPON - Weapon
  3424. LOOK_HEAD_BOTTOM - Head bottom
  3425. LOOK_HEAD_TOP - Head top
  3426. LOOK_HEAD_MID - Head mid
  3427. LOOK_HAIR_COLOR - Hair color
  3428. LOOK_CLOTHES_COLOR - Clothes color
  3429. LOOK_SHIELD - Shield
  3430. LOOK_SHOES - Shoes
  3431. LOOK_BODY2 - Body style
  3432. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3433. with this value. It still wants it from the server though, so it is kept, but
  3434. normally doesn't do a thing.
  3435. Only the look data for hairstyle, hair color and clothes color are saved to the
  3436. char server's database and will persist. Body style will also persist if 'save_body_style'
  3437. configuration is enabled in '/conf/battle/client.conf'. The rest freely change as the character
  3438. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3439. should not expect to set them. In fact, messing with them is generally
  3440. hazardous, do it at your own risk, it is not tested what will this actually do -
  3441. it won't cause database corruption and probably won't cause a server crash, but
  3442. it's easy to crash the client with just about anything unusual.
  3443. However, it might be an easy way to quickly check for empty view IDs for
  3444. sprites, which is essential for making custom headgear.
  3445. Since a lot of people have different palettes for hair and clothes, it's
  3446. impossible to tell you what all the color numbers are. If you want a serious
  3447. example, there is a Stylist script inside the default rAthena installation that
  3448. you can look at: 'npc/custom/stylist.txt'
  3449. ---------------------------------------
  3450. *pushpc <direction>,<cells>;
  3451. This command will push the currently attached player to given direction by given
  3452. amount of square cells. Direction is the same as used when declaring NPCs, and
  3453. can be specified by using one of the DIR_* constants (src/map/script_constants.hpp).
  3454. The knock-back is not restricted by items or map flags, only obstacles are taken
  3455. into account. If there is not enough space to perform the push (e.g. due to a
  3456. wall), the character is pushed only up to the obstacle.
  3457. // pushes the character 5 cells in 3 o'clock direction from its
  3458. // current position.
  3459. pushpc DIR_EAST, 5;
  3460. ---------------------------------------
  3461. *recalculatestat;
  3462. This command will force a stat recalculation for the attached player.
  3463. ---------------------------------------
  3464. *needed_status_point(<type>,<val>{,<char id>});
  3465. Returns the number of stat points needed to change the specified stat <type> by <val>.
  3466. If <val> is negative, returns the number of stat points that would be needed to
  3467. raise the specified stat from (current value - <val>) to current value.
  3468. ---------------------------------------
  3469. *jobcanentermap("<mapname>"{,<JobID>});
  3470. Return true if player (decided by job) can enter the map, false otherwise.
  3471. For optional 'JobID', see constant of Job_*, or use player's Class, BaseJob,
  3472. and BaseClass. If no player is attached, this param must have a value.
  3473. See also db/[pre-]re/job_noenter_map.txt
  3474. ---------------------------------------
  3475. *get_revision()
  3476. This command will return the SVN revision number that the server is currently
  3477. running on.
  3478. if (get_revision() >= 15000)
  3479. mes "Welcome to rAthena!";
  3480. ---------------------------------------
  3481. *get_githash()
  3482. This command will return the Git Hash that the server is currently running on.
  3483. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3484. ---------------------------------------
  3485. \\
  3486. 4,1.- Item-related commands
  3487. \\
  3488. ---------------------------------------
  3489. *getitem <item id>,<amount>{,<account ID>};
  3490. *getitem "<item name>",<amount>{,<account ID>};
  3491. This command will give an amount of specified items to the invoking character.
  3492. If an optional account ID is specified, and the target character is currently
  3493. online, items will be created in their inventory instead. If they are not
  3494. online, nothing will happen.
  3495. In the first and most commonly used version of this command, items are
  3496. referred to by their database ID number found inside 'db/item_db.yml'.
  3497. getitem 502,10 // The person will receive 10 apples
  3498. getitem 617,1 // The person will receive 1 Old Violet Box
  3499. This transaction is logged if the log script generated transactions option is
  3500. enabled.
  3501. You may also create an item by its name in the 'english name' field in the
  3502. item database:
  3503. getitem "RED_POTION",10;
  3504. Which will do what you'd expect. If it can't find that name in the database,
  3505. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3506. This is used in pretty much all NPC scripts that have to do with items and
  3507. quite a few item scripts. For more examples check just about any official script.
  3508. ---------------------------------------
  3509. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3510. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3511. *getitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3512. *getitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3513. *getitem4 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3514. *getitem4 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3515. This command will give an amount of specified items to the invoking character.
  3516. If an optional account ID is specified, and the target character is currently
  3517. online, items will be created in their inventory instead. If they are not
  3518. online, nothing will happen. It works essentially the same as 'getitem' but is
  3519. a lot more flexible.
  3520. Those parameters that are different from 'getitem' are:
  3521. identify - Whether you want the item to be identified (1) or not (0).
  3522. refine - For how many pluses will it be refined.
  3523. It will not let you refine an item higher than the max refine.
  3524. attribute - Whether the item is broken (1) or not (0).
  3525. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3526. the specific card slot.
  3527. Card1-card4 values are also used to store name information for named items, as
  3528. well as the elemental property of weapons and armor. You can create a named item
  3529. in this manner, however, if you just need a named piece of standard equipment,
  3530. it is much easier to the 'getnameditem' function instead.
  3531. You will need to keep these values if you want to destroy and then perfectly
  3532. recreate a named item, for this see 'getinventorylist'.
  3533. If you still want to try creating a named item with this command because
  3534. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3535. this. Careful, minor magic ahead.
  3536. // First, let's get an ID of a character who's name will be on the item.
  3537. // Only an existing character's name may be there.
  3538. // Let's assume our character is 'Adam' and find his ID.
  3539. .@charid = getcharid(0,"Adam");
  3540. // Now we split the character ID number into two portions with a binary
  3541. // shift operation. If you don't understand what this does, just copy it.
  3542. .@card3 = .@charid & 65535;
  3543. .@card4 = .@charid >> 16;
  3544. // If you're inscribing non-equipment, .@card1 must be 254.
  3545. // Arrows are also not equipment.
  3546. .@card1 = 254;
  3547. // For named equipment, card2 means the Star Crumbs and elemental
  3548. // crystals used to make this equipment. For everything else, it's 0.
  3549. .@card2 = 0;
  3550. // Now, let's give the character who invoked the script some
  3551. // Adam's Apples:
  3552. getitem2 512,1,1,0,0,.@card1,.@card2,.@card3,.@card4;
  3553. This wasn't tested with all possible items, so I can't give any promises,
  3554. experiment first before relying on it.
  3555. To create equipment, continue this example it like this:
  3556. // We've already have card3 and card4 loaded with correct
  3557. // values so we'll just set up card1 and card2 with data
  3558. // for an Ice Stiletto.
  3559. // If you're inscribing equipment, .@card1 must be 255.
  3560. .@card1 = 255;
  3561. // That's the number of star crumbs in a weapon.
  3562. .@sc = 2;
  3563. // That's the number of elemental property of the weapon.
  3564. .@ele = 1;
  3565. // And that's the wacky formula that makes them into
  3566. // a single number.
  3567. .@card2 = .@ele+((.@sc*5)<<8);
  3568. // That will make us an Adam's +2 VVS Ice Stiletto:
  3569. getitem2 1216,1,1,2,0,.@card1,.@card2,.@card3,.@card4;
  3570. Experiment with the number of star crumbs - I'm not certain just how much will
  3571. work most and what it depends on. The valid element numbers are:
  3572. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3573. You can, apparently, even create duplicates of the same pet egg with this
  3574. command, creating a pet which is the same, but simultaneously exists in two
  3575. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3576. this really cause.
  3577. 'getitem3' is advance version of 'getitem2' that also use Item Random Option as additional values.
  3578. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3579. <RandomValueArray> : Array variable of item random option's value.
  3580. <RandomParamArray> : Array variable of item random option's param.
  3581. 'getitem4' is advance version of 'getitem3' that also use the grade as additional values.
  3582. Valid grades are:
  3583. ENCHANTGRADE_NONE - No grade
  3584. ENCHANTGRADE_D - Grade D
  3585. ENCHANTGRADE_C - Grade C
  3586. ENCHANTGRADE_B - Grade B
  3587. ENCHANTGRADE_A - Grade A
  3588. Example to get Crimson Weapon with Ghost property:
  3589. // +9 Crimson Dagger [2]
  3590. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3591. setarray .@OptVal[0],0;
  3592. setarray .@OptParam[0],0;
  3593. getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3594. ---------------------------------------
  3595. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3596. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3597. This command behaves identically to 'getitem', but the items created will be
  3598. bound to the target character as specified by the bound type. All items created
  3599. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3600. some cases cannot be traded or stored.
  3601. Valid bound types are:
  3602. Bound_Account : Account Bound item
  3603. Bound_Guild : Guild Bound item
  3604. Bound_Party : Party Bound item
  3605. Bound_Char : Character Bound item
  3606. ---------------------------------------
  3607. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3608. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3609. *getitembound3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3610. *getitembound3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3611. *getitembound4 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3612. *getitembound4 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3613. This command behaves identically to 'getitem2', but the items created will be
  3614. bound to the target character as specified by the bound type. All items created
  3615. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3616. some cases cannot be traded or stored.
  3617. For a list of bound types see 'getitembound'.
  3618. 'getitembound3' is advance version of 'getitembound2' that also use Item Random Option as additional values.
  3619. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3620. <RandomValueArray> : Array variable of item random option's value.
  3621. <RandomParamArray> : Array variable of item random option's param.
  3622. 'getitembound4' is advance version of 'getitembound3' that also use the grade as additional values.
  3623. Valid grades are:
  3624. ENCHANTGRADE_NONE - No grade
  3625. ENCHANTGRADE_D - Grade D
  3626. ENCHANTGRADE_C - Grade C
  3627. ENCHANTGRADE_B - Grade B
  3628. ENCHANTGRADE_A - Grade A
  3629. Example to get Crimson Weapon with Ghost property:
  3630. // +9 Crimson Dagger [2]
  3631. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3632. setarray .@OptVal[0],0;
  3633. setarray .@OptParam[0],0;
  3634. getitembound3 28705,1,1,9,0,0,0,0,0,BOUND_CHAR,.@OptID,.@OptVal,.@OptParam;
  3635. ---------------------------------------
  3636. *getnameditem <item id>,<character name|character ID>;
  3637. *getnameditem "<item name>",<character name|character ID>;
  3638. Create an item signed with the given character's name.
  3639. The command returns 1 when the item is created successfully, or 0 if it fails.
  3640. Failure occurs when:
  3641. - There is no player attached.
  3642. - Item name or ID is not valid.
  3643. - The given character ID/name is offline.
  3644. Example:
  3645. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3646. getnameditem "Apple","Aaron";
  3647. //Self-explanatory (I hope).
  3648. if (getnameitem("Apple","Aaron")) {
  3649. mes "You now have a Aaron's Apple!";
  3650. }
  3651. ---------------------------------------
  3652. *rentitem <item id>,<time>{,<account_id>};
  3653. *rentitem "<item name>",<time>{,<account_id>};
  3654. Creates a rental item in the attached character's inventory. The item will expire
  3655. in <time> seconds and be automatically deleted. When receiving a rental item,
  3656. the character will receive a message in their chat window. The character will
  3657. also receive warning messages in their chat window before the item disappears.
  3658. When rentals expire it will call the UnEquipScript of the item. This can be used
  3659. for special cases such as removing a status change or resetting a variable or state
  3660. of the player.
  3661. This command can not be used to rent stackable items. Rental items cannot be
  3662. dropped, traded, or placed in guild storage. (i.e. trade mask 67)
  3663. Note: 'delitem' in an NPC script can still remove rental items.
  3664. Note: 'countitem' will not count any item with a rental timer. Use 'rentalcountitem' instead.
  3665. ---------------------------------------
  3666. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3667. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3668. *rentitem3 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3669. *rentitem3 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3670. *rentitem4 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3671. *rentitem4 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3672. Creates a rental item in the attached character's inventory. The item will expire
  3673. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3674. See 'getitem2' for an explanation of the expanded parameters.
  3675. 'rentitem3' is advance version of 'rentitem2' that also use Item Random Option as additional values.
  3676. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3677. <RandomValueArray> : Array variable of item random option's value.
  3678. <RandomParamArray> : Array variable of item random option's param.
  3679. 'rentitem4' is advance version of 'rentitem3' that also use the grade as additional values.
  3680. Valid grades are:
  3681. ENCHANTGRADE_NONE - No grade
  3682. ENCHANTGRADE_D - Grade D
  3683. ENCHANTGRADE_C - Grade C
  3684. ENCHANTGRADE_B - Grade B
  3685. ENCHANTGRADE_A - Grade A
  3686. Example to get Crimson Weapon with Ghost property:
  3687. // +9 Crimson Dagger [2]
  3688. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3689. setarray .@OptVal[0],0;
  3690. setarray .@OptParam[0],0;
  3691. rentitem3 28705,(24*60*60),1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3692. ---------------------------------------
  3693. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
  3694. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
  3695. This command will create an item on the specified cell of a map.
  3696. As with any dropped items, the items created with this command will disappear after
  3697. a period of time. Using an amount greater than 1 will create a single stack of the
  3698. given amount, not multiple stacks of 1.
  3699. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3700. Apples if the name isn't found.
  3701. If the map name is given as "this", the map the invoking character is on will be used.
  3702. If <canShowEffect> flag is set to true, it will show a pillar effect on the ground when dropped, depending on the item database's DropEffect flag.
  3703. ---------------------------------------
  3704. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
  3705. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
  3706. *makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3707. *makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3708. *makeitem4 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3709. *makeitem4 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3710. This command will create an item on the specified cell of a map. See 'makeitem' for
  3711. further details.
  3712. See 'getitem2' for an explanation of the expanded parameters.
  3713. 'makeitem3' is advance version of 'makeitem2' that also use Item Random Option as additional values.
  3714. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3715. <RandomValueArray> : Array variable of item random option's value.
  3716. <RandomParamArray> : Array variable of item random option's param.
  3717. 'makeitem4' is advance version of 'makeitem3' that also use the grade as additional values.
  3718. Valid grades are:
  3719. ENCHANTGRADE_NONE - No grade
  3720. ENCHANTGRADE_D - Grade D
  3721. ENCHANTGRADE_C - Grade C
  3722. ENCHANTGRADE_B - Grade B
  3723. ENCHANTGRADE_A - Grade A
  3724. Example to get Crimson Weapon with Ghost property:
  3725. // 0.5% chance to get +0 Valkyrie Shield [1]
  3726. // with Neutral Resistance +10% and 5% damage reduction from Demi-Human or Player
  3727. // when Valkyrie Randgris killed
  3728. OnNPCKillEvent:
  3729. if (killedrid == 1751 && rand(0,10000) > 9950) { // Valkyrie Randgris
  3730. getmapxy(.@map$,.@x,.@y,BL_PC);
  3731. setarray .@OptID[0],RDMOPT_ATTR_TOLERACE_NOTHING,RDMOPT_RACE_TOLERACE_HUMAN;
  3732. setarray .@OptVal[0],10,5;
  3733. setarray .@OptParam[0],0;
  3734. makeitem3 2115,1,.@map$,.@x,.@y,0,0,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3735. }
  3736. end;
  3737. ---------------------------------------
  3738. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3739. *cleanmap "<map name>";
  3740. These commands will clear all items lying on the ground on the specified map, either
  3741. within the x1/y1-x2/y2 rectangle or across the entire map.
  3742. ---------------------------------------
  3743. *searchitem <array name>,"<item name>";
  3744. This command will fill the given array with the ID of items whose name matches
  3745. the given one. It returns the number of items found. For performance reasons,
  3746. the results array is limited to 10 items.
  3747. mes "What item are you looking for?";
  3748. input .@name$;
  3749. .@qty = searchitem(.@matches[0],.@name$);
  3750. mes "I found " + .@qty + " items:";
  3751. for (.@i = 0; .@i < .@qty; .@i++)
  3752. // Display name (eg: "Apple[0]")
  3753. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3754. ---------------------------------------
  3755. *delitem <item id>,<amount>{,<account ID>};
  3756. *delitem "<item name>",<amount>{,<account ID>};
  3757. This command will remove a specified amount of items from the invoking/target character.
  3758. Like all the item commands, it uses the item ID found inside 'db/item_db.yml'.
  3759. delitem 502,10; // The person will lose 10 apples
  3760. delitem 617,1; // The person will lose 1 Old Violet Box
  3761. It is always a good idea to check if the player actually has the items before you delete them.
  3762. If you try to delete more items that the player has, the player will lose the ones he/she has
  3763. and the script will terminate with an error.
  3764. Like 'getitem', this command will also accept an 'english name' field from the
  3765. database. If the name is not found, nothing will be deleted.
  3766. ---------------------------------------
  3767. *cartdelitem <item id>,<amount>{,<account ID>};
  3768. *cartdelitem "<item name>",<amount>{,<account ID>};
  3769. *storagedelitem <item id>,<amount>{,<account ID>};
  3770. *storagedelitem "<item name>",<amount>{,<account ID>};
  3771. *guildstoragedelitem <item id>,<amount>{,<account ID>};
  3772. *guildstoragedelitem "<item name>",<amount>{,<account ID>};
  3773. This command behaves identically to 'delitem', but deletes items from the player's
  3774. cart, storage, or guild storage.
  3775. If no cart is mounted, 'cartdelitem' will return -1.
  3776. If player is not in a guild or storage is open, 'guildstoragedelitem' will return -1.
  3777. ---------------------------------------
  3778. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3779. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3780. *delitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3781. *delitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3782. *delitem4 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3783. *delitem4 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3784. This command will remove a specified amount of items from the invoking/target character.
  3785. See 'getitem2' for an explanation of the expanded parameters.
  3786. 'delitem3' is advance version of 'delitem2' that also use Item Random Option as criteria.
  3787. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3788. <RandomValueArray> : Array variable of item random option's value.
  3789. <RandomParamArray> : Array variable of item random option's param.
  3790. 'delitem4' is advance version of 'delitem3' that also use the grade as criteria.
  3791. ---------------------------------------
  3792. *delitemidx <index>{,<amount>{,<char id>}}
  3793. This command will remove an item at the given inventory index.
  3794. If <amount> is not specified, this will remove all of the items at the specified index.
  3795. The only way to get the inventory index is by using 'getinventorylist()'. After deleting
  3796. an item at the given index, that index can remain empty until the player relogs, requiring
  3797. 'getinventorylist()' to be called again. If an item is deleted with an invalid index, the
  3798. script will terminate with an error.
  3799. This command returns true on success and false if the item at the given index could not be deleted or if
  3800. not enough items were available at the given index.
  3801. Example:
  3802. // This will remove all Red Potions from player's inventory
  3803. getinventorylist();
  3804. for (.@i = 0; .@i < @inventorylist_count; ++.@i)
  3805. if (@inventorylist_id[.@i] == 501)
  3806. delitemidx @inventorylist_idx[.@i];
  3807. ---------------------------------------
  3808. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3809. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3810. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3811. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3812. *guildstoragedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3813. *guildstoragedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3814. This command behaves identically to 'delitem2', but deletes items from the player's
  3815. cart, storage, or guild storage.
  3816. If no cart is mounted, 'cartdelitem2' will return -1.
  3817. If player is not in a guild or storage is open, 'guildstoragedelitem2' will return -1.
  3818. ---------------------------------------
  3819. *countitem(<item id>{,<accountID>})
  3820. *countitem("<item name>"{,<accountID>})
  3821. This function will return the number of items for the specified item ID that the
  3822. invoking character has in the inventory.
  3823. mes "[Item Checker]";
  3824. mes "Hmmm, it seems you have " + countitem(502) + " apples";
  3825. close;
  3826. Like 'getitem', this function will also accept an 'english name' from the
  3827. database as an argument.
  3828. If you want to state the number at the end of a sentence, you can do it by
  3829. adding up strings:
  3830. mes "[Item Checker]";
  3831. mes "Hmmm, the total number of apples you are holding is " + countitem("APPLE");
  3832. close;
  3833. ---------------------------------------
  3834. *cartcountitem(<item id>{,<accountID>})
  3835. *cartcountitem("<item name>"{,<accountID>})
  3836. *storagecountitem(<item id>{,<accountID>})
  3837. *storagecountitem("<item name>"{,<accountID>})
  3838. *guildstoragecountitem(<nameID>{,<accountID>})
  3839. *guildstoragecountitem("<item name>"{,<accountID>})
  3840. This command behaves identically to 'countitem', but counts items from the player's
  3841. cart, storage, or guild storage.
  3842. If no cart is mounted, 'cartcountitem' will return -1.
  3843. If player is not in a guild or storage is open, 'guildstoragecountitem' will return -1.
  3844. ---------------------------------------
  3845. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3846. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3847. *countitem3(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3848. *countitem3("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3849. *countitem4(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3850. *countitem4("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3851. Expanded version of 'countitem' function, used for created/carded/forged items.
  3852. This function will return the number of items for the specified item ID and
  3853. other parameters that the invoking character has in the inventory.
  3854. See 'getitem2' for an explanation of the expanded parameters.
  3855. 'countitem3' is advance version of 'countitem2' that also use Item Random Option as criteria.
  3856. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3857. <RandomValueArray> : Array variable of item random option's value.
  3858. <RandomParamArray> : Array variable of item random option's param.
  3859. 'countitem4' is advance version of 'countitem3' that also use the grade as criteria.
  3860. ---------------------------------------
  3861. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3862. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3863. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3864. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3865. *guildstoragecountitem2(<nameID>,<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3866. *guildstoragecountitem2("<item name>",<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3867. This command behaves identically to 'countitem2', but counts items from the player's
  3868. cart, storage, or guild storage.
  3869. If no cart is mounted, 'cartcountitem2' will return -1.
  3870. If player is not in a guild or storage is open, 'guildstoragecountitem2' will return -1.
  3871. ---------------------------------------
  3872. *rentalcountitem(<item id>{,<accountID>})
  3873. *rentalcountitem("<item name>"{,<accountID>})
  3874. This function will return the number of rental items for the specified item ID that the
  3875. invoking character has in the inventory.
  3876. ---------------------------------------
  3877. *rentalcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3878. *rentalcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3879. *rentalcountitem3(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3880. *rentalcountitem3("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3881. *rentalcountitem4(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3882. *rentalcountitem4("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3883. Expanded version of 'rentalcountitem' function, used for created/carded/forged items.
  3884. This function will return the number of rental items for the specified item ID and
  3885. other parameters that the invoking character has in the inventory.
  3886. See 'getitem2' for an explanation of the expanded parameters.
  3887. 'rentalcountitem3' is advance version of 'rentalcountitem2' that also use Item Random Option as criteria.
  3888. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3889. <RandomValueArray> : Array variable of item random option's value.
  3890. <RandomParamArray> : Array variable of item random option's param.
  3891. 'rentalcountitem4' is advance version of 'rentalcountitem3' that also use the grade as criteria.
  3892. ---------------------------------------
  3893. *countbound({<bound type>{,<char_id>}})
  3894. This function will return the number of different bounded items in the character's
  3895. inventory, and sets the arrays @bound_items[] and @bound_amount[] containing all item IDs of the
  3896. counted items and their respective amount. If a bound type is specified, only those items will be counted.
  3897. For a list of bound types see 'getitembound'.
  3898. Example:
  3899. .@total_type = countbound();
  3900. mes "You currently have " + .@total_type + " different type of bounded items.";
  3901. next;
  3902. mes "The list of bounded items include:";
  3903. for(.@i = 0; .@i < .@total_type; .@i++)
  3904. mes "x" + @bound_amount[.@i] + " " + getitemname(@bound_items[.@i]);
  3905. close;
  3906. ---------------------------------------
  3907. *groupranditem <group id>{,<sub_group>};
  3908. Returns the item_id of a random item picked from the group specified. The
  3909. different groups and their group number are specified in 'db/(pre-)re/item_group_db.yml'.
  3910. When used in conjunction with other functions, you can get a random item. For
  3911. example, for a random pet lure:
  3912. getitem groupranditem(IG_Taming),1;
  3913. 'sub_group' is used to get the available random items of item group from specified random
  3914. group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
  3915. More info, see doc/item_group.txt.
  3916. ---------------------------------------
  3917. *getrandgroupitem <group_id>{,<quantity>{,<sub_group>{,<identify>{,<char_id>}}}};
  3918. Similar to the above example, this command allows players to obtain the specified
  3919. quantity of a random item from the group "<group id>". The different groups and
  3920. their group number are specified in db/(pre-)re/item_group_db.yml
  3921. If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
  3922. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
  3923. 'must' item group).
  3924. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
  3925. as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
  3926. if 'identify' is defined with value 1.
  3927. More info, see doc/item_group.txt.
  3928. ---------------------------------------
  3929. *getgroupitem <group_id>{,<identify>{,<char_id>}};
  3930. Gives item(s) to the attached player based on item group contents.
  3931. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3932. item group & sub_group.
  3933. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
  3934. as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
  3935. if 'identify' is defined with value 1.
  3936. More info, see doc/item_group.txt.
  3937. ---------------------------------------
  3938. *enable_items;
  3939. *disable_items;
  3940. These commands toggle the ability to change equipment while interacting with
  3941. an NPC. To avoid possible exploits, the commands affect the particular script
  3942. instance only. Note that if a different script also calls enable_items, it
  3943. will override the last call (so you may want to call this command at the start
  3944. of your script without assuming it is still in effect).
  3945. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3946. ---------------------------------------
  3947. *itemskill <skill id>,<skill level>{,<keep requirement>};
  3948. *itemskill "<skill name>",<skill level>{,<keep requirement>};
  3949. This command is meant for item scripts to replicate single-use skills in usable
  3950. items. It will not work properly if there is a visible dialog window or menu or if the item is not type 'Delayconsume'.
  3951. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3952. target cursor is shown.
  3953. If <keep requirement> parameter is set to true, the skill's requirements will be checked.
  3954. By default, the requirements for item skills are not checked, and therefore the default value is false.
  3955. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual skill has been used from skill tree.
  3956. - Id: 605
  3957. AegisName: Anodyne
  3958. Name: Anodyne
  3959. Type: Delayconsume
  3960. Buy: 2000
  3961. Weight: 100
  3962. Flags:
  3963. BuyingStore: true
  3964. Script: |
  3965. itemskill "SM_ENDURE",1;
  3966. // When Sienna_Execrate_Scroll_1_5 is used, it will cast Sienna Execrate Level 5 and consume 2 Red_Gemstones.
  3967. - Id: 23194
  3968. AegisName: Sienna_Execrate_Scroll_1_5
  3969. Name: Level 5 Sienna Execrate
  3970. Type: Delayconsume
  3971. Buy: 10
  3972. Weight: 10
  3973. Script: |
  3974. itemskill "WL_SIENNAEXECRATE",5,true;
  3975. ---------------------------------------
  3976. *consumeitem <item id>{,<char_id>};
  3977. *consumeitem "<item name>"{,<char_id>};
  3978. This command will run the item script of the specified item on the invoking
  3979. character. The character does not need to possess the item, and the item will
  3980. not be deleted. While this command is intended for usable items, it will run
  3981. for any item type.
  3982. This command does not currently work with the 'itemskill' script command.
  3983. ---------------------------------------
  3984. *produce <item level>;
  3985. This command will open a crafting window on the client connected to the invoking
  3986. character. The 'item level' is a number which determines what kind of a crafting
  3987. window will pop-up.
  3988. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3989. what can actually be produced. The window will not be empty only if the invoking
  3990. character can actually produce the items of that type and has the appropriate raw
  3991. materials in their inventory.
  3992. The success rate to produce the item is the same as the success rate of the skill
  3993. associated with the item level. If there is no skill id, the success rate will be 50%.
  3994. Valid item levels are:
  3995. 1 - Level 1 Weapons
  3996. 2 - Level 2 Weapons
  3997. 3 - Level 3 Weapons
  3998. 21 - Blacksmith's Stones and Metals
  3999. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  4000. 23 - Elemental Converters
  4001. ---------------------------------------
  4002. *cooking <dish level>;
  4003. This command will open a produce window on the client connected to the invoking
  4004. character. The 'dish level' is the number which determines what kind of dish
  4005. level you can produce. You can see the full list of dishes that can be produced in
  4006. 'db/produce_db.txt'.
  4007. The window will be shown empty if the invoking character does not have enough of
  4008. the required incredients to cook a dish.
  4009. Valid dish levels are:
  4010. 11 - Level 1 Dish
  4011. 12 - Level 2 Dish
  4012. 13 - Level 3 Dish
  4013. 14 - Level 4 Dish
  4014. 15 - Level 5 Dish
  4015. 16 - Level 6 Dish
  4016. 17 - Level 7 Dish
  4017. 18 - Level 8 Dish
  4018. 19 - Level 9 Dish
  4019. 20 - Level 10 Dish
  4020. Although it's required to set a dish level, it doesn't matter if you set it to 1
  4021. and you want to cook a level 10 dish, as long as you got the required incredients
  4022. to cook the dish the command works.
  4023. ---------------------------------------
  4024. *makerune <% success bonus>{,<char_id>};
  4025. This command will open a rune crafting window on the client connected to the
  4026. invoking character. Since this command is officially used in rune ores, a bonus
  4027. success rate must be specified (which adds to the base formula).
  4028. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  4029. The window will not be empty only if the invoking character can actually produce
  4030. a rune and has the appropriate raw materials in their inventory.
  4031. ---------------------------------------
  4032. *successremovecards <equipment slot>;
  4033. This command will remove all cards of the cards slots defined in db/item_db.yml
  4034. from the item found in the specified equipment slot of the invoking character,
  4035. create new card items and give them to the character.
  4036. If any cards were removed in this manner, it will also show a success effect.
  4037. ---------------------------------------
  4038. *failedremovecards <equipment slot>,<type>;
  4039. This command will remove all cards from the item found in the specified
  4040. equipment slot of the invoking character. 'type' determines what happens to the
  4041. item and the cards:
  4042. 0 - will destroy both the item and the cards.
  4043. 1 - will keep the item, but destroy the cards.
  4044. 2 - will keep the cards, but destroy the item.
  4045. Whatever the type is, it will also show a failure effect on screen.
  4046. ---------------------------------------
  4047. *repair <broken item number>{,<char_id>};
  4048. This command repairs a broken piece of equipment, using the same list of broken
  4049. items as available through 'getbrokenid'.
  4050. ---------------------------------------
  4051. *repairall {<char_id>};
  4052. This command repairs all broken equipment in the attached player's inventory.
  4053. A repair effect will be shown if any items are repaired, else the command will
  4054. end silently.
  4055. ---------------------------------------
  4056. *successrefitem <equipment slot>{,<count>{,<char_id>}};
  4057. This command will refine an item in the specified equipment slot of the invoking
  4058. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  4059. This command will also display a 'refine success' effect on the character and put
  4060. appropriate messages into their chat window. It will also give the character fame
  4061. points if a weapon reached +10 this way, even though these will only take effect for
  4062. blacksmith who will later forge a weapon.
  4063. ---------------------------------------
  4064. *failedrefitem <equipment slot>{,<char_id>};
  4065. This command will fail to refine an item in the specified equipment slot of the
  4066. invoking character. The item will be destroyed. This will also display a 'refine
  4067. failure' effect on the character and put appropriate messages into their chat
  4068. window.
  4069. ---------------------------------------
  4070. *downrefitem <equipment slot>{,<count>{,<char_id>}};
  4071. This command will downgrade an item in the specified equipment slot of the invoking
  4072. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  4073. This command will also display a 'refine failure' effect on the character and put
  4074. appropriate messages into their chat window.
  4075. ---------------------------------------
  4076. *unequip <equipment slot>{,<char_id>};
  4077. This command will unequip whatever is currently equipped in the invoking
  4078. character's specified equipment slot. For a full list of possible equipment
  4079. slots see 'getequipid'.
  4080. If an item occupies several equipment slots, it will get unequipped from all of
  4081. them.
  4082. ---------------------------------------
  4083. *delequip <equipment slot>{,<char_id>};
  4084. This command will destroy whatever is currently equipped in the invoking
  4085. character's specified equipment slot. For a full list of possible equipment
  4086. slots see 'getequipid'.
  4087. This command will return 1 if an item was deleted and 0 otherwise.
  4088. ---------------------------------------
  4089. *breakequip <equipment slot>{,<char_id>};
  4090. This command will break and unequip whatever is currently equipped in the
  4091. invoking character's specified equipment slot. For a full list of possible
  4092. equipment slots see 'getequipid'.
  4093. This command will return 1 if an item was broken and 0 otherwise.
  4094. ---------------------------------------
  4095. *clearitem {<char_id>};
  4096. This command will destroy all items the invoking character has in their
  4097. inventory (including equipped items). It will not affect anything else, like
  4098. storage or cart.
  4099. ---------------------------------------
  4100. *equip <item id>{,<char_id>};
  4101. *autoequip <item id>,<option>;
  4102. These commands are to equip a equipment on the attached character.
  4103. The equip function will equip the item ID given when the player has
  4104. this item in his/her inventory, while the autoequip function will
  4105. equip the given item ID when this is looted. The option parameter of
  4106. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  4107. Examples:
  4108. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  4109. equip 1104;
  4110. //The invoked character will now automatically equip a falchion when it's looted.
  4111. autoequip 1104,1;
  4112. //The invoked character will no longer automatically equip a falchion.
  4113. autoequip 1104,0;
  4114. ---------------------------------------
  4115. *buyingstore <slots>;
  4116. Invokes buying store preparation window like the skill 'Open Buying Store',
  4117. without the item requirement. Amount of slots is limited by the server to
  4118. a maximum of 5 slots by default.
  4119. Example:
  4120. // Gives the player opportunity to buy 4 different kinds of items.
  4121. buyingstore 4;
  4122. ---------------------------------------
  4123. *searchstores <uses>,<effect>;
  4124. Invokes the store search window, which allows to search for both vending
  4125. and buying stores. Parameter uses indicates, how many searches can be
  4126. started, before the window has to be reopened. Effect value affects,
  4127. what happens, when a result item is double-clicked and can be one of the
  4128. following:
  4129. 0 = Shows the store's position on the mini-map and highlights the
  4130. shop sign with yellow color, when the store is on same map
  4131. as the invoking player.
  4132. 1 = Directly opens the shop, regardless of distance.
  4133. Example:
  4134. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  4135. searchstores 10,1;
  4136. ---------------------------------------
  4137. *enable_command;
  4138. *disable_command;
  4139. These commands toggle the ability to use atcommand while interacting with an NPC.
  4140. The default setting, 'atcommand_disable_npc', is defined in 'conf/battle/gm.conf'.
  4141. ---------------------------------------
  4142. //
  4143. 4,1.- End of item-related commands
  4144. //
  4145. ---------------------------------------
  4146. *openstorage;
  4147. This will open character's Kafra storage window on the client connected to the
  4148. invoking character. It can be used from any kind of NPC or item script, not just
  4149. limited to Kafra Staff.
  4150. The storage window opens regardless of whether there are open NPC dialogs or
  4151. not, but it is preferred to close the dialog before displaying the storage
  4152. window, to avoid any disruption when both windows overlap.
  4153. mes "Close this window to open your storage.";
  4154. close2;
  4155. openstorage;
  4156. end;
  4157. ---------------------------------------
  4158. *openstorage2 <storage_id>,<mode>{,<account_id>};
  4159. Just like the 'openstorage' command, except this command can open additional storages
  4160. by the specified <storage_id>. For <storage_id>, please read the conf/inter_server.yml
  4161. for storage groups.
  4162. Values for <mode> are:
  4163. STOR_MODE_NONE : Player only can read the storage entries.
  4164. STOR_MODE_GET : Player can get items from the storage.
  4165. STOR_MODE_PUT : Player can put items in the storage.
  4166. Example:
  4167. if (vip_status(VIP_STATUS_ACTIVE)) {
  4168. mes "I will open your Premium storage.";
  4169. mes "Thank you for using our service.";
  4170. close2;
  4171. openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
  4172. } else {
  4173. mes "Sorry, your Premium status is expired.";
  4174. mes "Storage will be opened but you can't put any item into it.";
  4175. close2;
  4176. openstorage2 1,STOR_MODE_GET;
  4177. }
  4178. end;
  4179. ---------------------------------------
  4180. *openmail({<char_id>});
  4181. This will open a character's Mail window on the client connected to the
  4182. invoking character.
  4183. This command is not supported for PACKETVER 20150513 or newer.
  4184. mes "Close this window to open your mail inbox.";
  4185. close2;
  4186. openmail;
  4187. end;
  4188. ---------------------------------------
  4189. *mail <destination id>,"<sender name>","<title>","<body>"{,<zeny>{,<item id array>,<item amount array>{,refine{,bound{,<item card0 array>{,<item card1 array>{,<item card2 array>{,<item card3 array>
  4190. {,<random option id0 array>, <random option value0 array>, <random option paramter0 array>{,<random option id1 array>, <random option value1 array>, <random option paramter1 array>
  4191. {,<random option id2 array>, <random option value2 array>, <random option paramter2 array>{,<random option id3 array>, <random option value3 array>, <random option paramter3 array>
  4192. {,<random option id4 array>, <random option value4 array>, <random option paramter4 array>}}}}}}}}};
  4193. This command will send mail to the <destination id> which is a character ID.
  4194. A <sender name> can be specified but does not have to be from the direct creator
  4195. of the mail and is limited to NAME_LENGTH (24) characters. Mail <title> is limited
  4196. to MAIL_TITLE_LENGTH (40) characters. Mail <body> is limited to MAIL_BODY_LENGTH
  4197. (200) characters for PACKETVER < 20150513 or 500 characters for later clients.
  4198. Optional <zeny> and item data can be added to the mail as well. PACKETVER < 20150513
  4199. is limited to 1 item while later clients are limited to MAIL_MAX_ITEM (5).
  4200. The <item id array>, <item amount array>, <item card0 array>, <item card1 array>,
  4201. <item card2 array>, and <item card3 array> should all be integer arrays.
  4202. For random options there can be 5 arrays in pairs of 3 (ids, values, parameters) right after the cards.
  4203. All of these arrays shall be integer arrays as well.
  4204. Example of sending mail with zeny:
  4205. .@charid = getcharid(0);
  4206. .@sender$ = "Poring";
  4207. .@title$ = "Welcome";
  4208. .@body$ = "Hi! I'm a simple Poring from the Prontera fields! Welcome to Ragnarok!";
  4209. .@zeny = 5000;
  4210. mail .@charid, .@sender$, .@title$, .@body$, .@zeny;
  4211. Example of sending mail with items:
  4212. .@charid = getcharid(0);
  4213. .@sender$ = "Angeling";
  4214. .@title$ = "Welcome";
  4215. .@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
  4216. .@zeny = 0;
  4217. setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
  4218. setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
  4219. setarray .@mailrefine[0], 0, 0, 3, 10; // +3 Hat, +10 Dagger
  4220. setarray .@mailbound[0], 0, 0, Bound_Account, Bound_Char; // Account bounded Hat, Char bounded Dagger
  4221. setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
  4222. setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4223. setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4224. mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailrefine, .@mailbound, .@mailcard0, .@mailcard1, .@mailcard2;
  4225. Example of sending mail with items and random options:
  4226. .@charid = getcharid(0);
  4227. .@sender$ = "Angeling";
  4228. .@title$ = "Welcome";
  4229. .@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
  4230. .@zeny = 0;
  4231. setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
  4232. setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
  4233. setarray .@mailrefine[0], 0, 0, 3, 10; // +3 Hat, +10 Dagger
  4234. setarray .@mailbound[0], 0, 0, Bound_Account, Bound_Char; // Account bounded Hat, Char bounded Dagger
  4235. setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
  4236. setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4237. setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4238. setarray .@mailcard3[0], 0, 0, 0, 0; // Empty last slot
  4239. setarray .@mailrndopt_id0[0], 0, 0, 0, RDMOPT_VAR_MAXHPAMOUNT; // Enchant the Dagger with increased HP option
  4240. setarray .@mailrndopt_val0[0], 0, 0, 0, 1000; // Enchant the Dagger with increased HP option by 1000 points
  4241. setarray .@mailrndopt_prm0[0], 0, 0, 0, 0; // Enchant the Dagger with increased HP option - does not need any parameter
  4242. mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailrefine, .@mailbound, .@mailcard0, .@mailcard1, .@mailcard2, .@mailcard3, .@mailrndopt_id0, .@mailrndopt_val0, .@mailrndopt_prm0;
  4243. ---------------------------------------
  4244. *openauction({<char_id>});
  4245. This will open the Auction window on the client connected to the invoking character.
  4246. mes "Close this window to open the Auction window.";
  4247. close2;
  4248. openauction;
  4249. end;
  4250. ---------------------------------------
  4251. \\
  4252. 4,2.- Guild-related commands
  4253. \\
  4254. ---------------------------------------
  4255. *guildopenstorage()
  4256. This function works the same as 'openstorage' but will open a guild storage
  4257. window instead for the guild storage of the guild the invoking character belongs
  4258. to.
  4259. Return values:
  4260. GSTORAGE_OPEN - Successfully opened.
  4261. GSTORAGE_STORAGE_ALREADY_OPEN - Player storage is already open.
  4262. GSTORAGE_ALREADY_OPEN - Guild storage is already open.
  4263. GSTORAGE_NO_GUILD - Player is not in a guild.
  4264. GSTORAGE_NO_STORAGE - Guild hasn't invested in the Guild Storage Expansion skill (only if OFFICIAL_GUILD_STORAGE is enabled).
  4265. GSTORAGE_NO_PERMISSION - Player doesn't have permission to use the guild storage.
  4266. ---------------------------------------
  4267. *guildopenstorage_log({<char id>})
  4268. Opens the guild storage log window for the attached character or the given character id.
  4269. Possible return values:
  4270. GUILDSTORAGE_LOG_FINAL_SUCCESS Window was opened successfully.
  4271. GUILDSTORAGE_LOG_EMPTY Window was not opened, because no entries exist.
  4272. GUILDSTORAGE_LOG_FAILED Some database error occurred.
  4273. ---------------------------------------
  4274. *guild_has_permission(<permission>{,<char id>})
  4275. Checks if the attached player or the player with the given character id has the given permission(s).
  4276. Permission can be a bitmask and allows to use multiple values at the same time.
  4277. Returns true if the player has all of the given permissions or false if the player does at least
  4278. miss one of the given permissions or is not in a guild at all.
  4279. Available permissions are:
  4280. GUILD_PERM_INVITE If a player is allowed to invite other players.
  4281. GUILD_PERM_EXPEL If a player is allowed to expel other guild members.
  4282. GUILD_PERM_STORAGE If a player is allowed to access the guild storage.
  4283. GUILD_PERM_ALL A combination of all permissions above.
  4284. ---------------------------------------
  4285. *guildchangegm(<guild id>,<new master's name>)
  4286. This function will change the Guild Master of a guild. The ID is the guild's
  4287. id, and the new guild master's name must be passed.
  4288. Returns 1 on success, 0 otherwise.
  4289. ---------------------------------------
  4290. *guildgetexp <amount>;
  4291. This will give the specified amount of guild experience points to the guild the
  4292. invoking character belongs to. It will silently fail if they do not belong to
  4293. any guild.
  4294. ---------------------------------------
  4295. *guildskill <skill id>,<level>
  4296. *guildskill "<skill name>",<level>
  4297. This command will bump up the specified guild skill by the specified number of
  4298. levels. This refers to the invoking character and will only work if the invoking
  4299. character is a member of a guild AND its guild master, otherwise no failure
  4300. message will be given and no error will occur, but nothing will happen - same
  4301. about the guild skill trying to exceed the possible maximum. The full list of
  4302. guild skills is available in 'db/(pre-)re/skill_db.yml', these are all the GD_ skills at
  4303. the end.
  4304. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  4305. // 10000). Notice that if you try to add two levels of Approval, or add
  4306. // Approval when the guild already has it, it will only have one level of
  4307. // Approval afterwards.
  4308. guildskill 10000,1,0;
  4309. You might want to make a quest for getting a certain guild skill, make it hard
  4310. enough that all the guild needs to help or something. Doing this for the Glory
  4311. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  4312. a fun quest.
  4313. ---------------------------------------
  4314. //
  4315. 4,2 End of guild-related commands.
  4316. //
  4317. ---------------------------------------
  4318. *resetlvl <action type>{,<char_id>};
  4319. This is a character reset command, meant mostly for rebirth script supporting
  4320. Advanced jobs, which will reset the invoking character's stats and level
  4321. depending on the action type given. Valid action types are:
  4322. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  4323. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  4324. If the new job is 'Novice High', give 100 status points, give First Aid and
  4325. Play Dead skills.
  4326. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  4327. Skills and attribute values are not altered.
  4328. 3 - Base level 1, base exp 0. Nothing else is changed.
  4329. 4 - Job level 1, job exp 0. Nothing else is changed.
  4330. In all cases everything the character has on will be unequipped.
  4331. Even though it doesn't return a value, it is used as a function in the official
  4332. rebirth scripts. Ask AppleGirl why.
  4333. ---------------------------------------
  4334. *resetstatus({<char_id>});
  4335. This is a character reset command, which will reset the stats on the invoking
  4336. character and give back all the stat points used to raise them previously.
  4337. Nothing will happen to any other numbers about the character.
  4338. Used in reset NPC's (duh!)
  4339. ---------------------------------------
  4340. *resetskill({<char_id>});
  4341. This command takes off all the skill points on the invoking character, so they
  4342. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  4343. to spend again. Nothing else will change but the skills. Quest skills will also
  4344. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  4345. the 'quest_skill_learn' option is set in there, the points in the quest skills
  4346. will also count towards the total.
  4347. Used in reset NPC's (duh!)
  4348. ---------------------------------------
  4349. *resetfeel({<char_id>});
  4350. This command will reset the Star Gladiator's designated maps on the invoking character.
  4351. Only works on Star Gladiator and Star Emperor classes.
  4352. ---------------------------------------
  4353. *resethate({<char_id>});
  4354. This command will reset the Star Gladiator's designated monsters on the invoking character.
  4355. Only works on Star Gladiator and Star Emperor classes.
  4356. ---------------------------------------
  4357. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  4358. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  4359. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  4360. *sc_end <effect type>{,<GID>};
  4361. *sc_end_class {<char_id>{,<job_id>}};
  4362. These commands will bestow a status effect on a character.
  4363. The <effect type> determines which status is invoked. This can be either a number
  4364. or constant, with the common statuses (mostly negative) found in 'src/map/script_constants.hpp'
  4365. with the 'SC_' prefix. A full list is located in 'src/map/status.hpp', though
  4366. they are not currently documented.
  4367. The duration of the status is given in <ticks>, or milleseconds.
  4368. Use INFINITE_TICK for infinite duration.
  4369. Certain status changes take an additional parameter <value 1>, which typically
  4370. modifies player stats by the given number or percentage. This differs for each
  4371. status, and is sometimes zero.
  4372. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  4373. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  4374. be defined for the rate to work.
  4375. Optional value <flag> is how the status change start will be handled (a bitmask).
  4376. SCSTART_NOAVOID : Status change cannot be avoided.
  4377. SCSTART_NOTICKDEF : Tick cannot be reduced by stats (default).
  4378. SCSTART_LOADED : sc_data loaded, so no value will be altered.
  4379. SCSTART_NORATEDEF : Rate cannot be reduced.
  4380. SCSTART_NOICON : Status icon won't be sent to client
  4381. If a <GID> is given, the status change will be invoked on the specified character
  4382. instead of the one attached to the script. This can only be defined after setting
  4383. a rate and flag.
  4384. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  4385. for effects that require them. The meaning of the extra values vary depending on the
  4386. effect type. For more infos, read status_change.txt containing a list of all Status Changes
  4387. and theirs val1, val2, val3, and val4 usage in source.
  4388. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  4389. perform a complete removal of all statuses (although permanent ones will re-apply).
  4390. 'sc_end_class' works like 'sc_end' but will remove all status effects from any learned
  4391. skill on the invoking character. If <job_id> is provided it will end the effect for that job.
  4392. Examples:
  4393. // This will poison the invoking character for 10 minutes at 50% chance.
  4394. sc_start SC_POISON,600000,0,5000;
  4395. // This will bestow the effect of Level 10 Blessing.
  4396. sc_start SC_BLESSING,240000,10;
  4397. // Adjust element resistance by percentage. Sample with Resist_Fire item script:
  4398. // val1: Water resistance
  4399. // val2: Earth resistance
  4400. // val3: Fire resistance
  4401. // val4: Wind resistance
  4402. sc_start4 SC_ARMOR_ELEMENT,1200000,-15,0,20,0;
  4403. // This will end the Freezing status for the invoking character.
  4404. sc_end SC_FREEZE;
  4405. // This will end the effect of any learned skill for the invoking character.
  4406. sc_end_class;
  4407. // This will end the effect of any learned skill for the character with the <char_id> 150000.
  4408. // val1: <char_id>
  4409. sc_end_class(150000);
  4410. // This will end the effect of any Arch Bishop skill for the invoking character.
  4411. // val1: <char_id>
  4412. // val2: <job_id> of Arch Bishop
  4413. sc_end_class(getcharid(0),Job_Arch_Bishop);
  4414. Note: to use SC_NOCHAT you should alter Manner
  4415. set Manner, -5; // Will mute a user for 5 minutes
  4416. set Manner, 0; // Will unmute a user
  4417. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  4418. ---------------------------------------
  4419. *getstatus(<effect type>{,<type>{,<char_id>}})
  4420. Retrieve information about a specific status effect when called. Depending on <type>
  4421. specified the function will return different information.
  4422. Possible <type> values:
  4423. - 0 or undefined: whether the status is active
  4424. - 1: the val1 of the status
  4425. - 2: the val2 of the status
  4426. - 3: the val3 of the status
  4427. - 4: the val4 of the status
  4428. - 5: the amount of time in milliseconds that the status has remaining
  4429. If <type> is not defined or is set to 0, then the script function will either
  4430. return 1 if the status is active, or 0 if the status is not active. If the status
  4431. is not active when any of the <type> fields are provided, this script function
  4432. will always return 0.
  4433. ---------------------------------------
  4434. *skilleffect <skill id>,<number>;
  4435. *skilleffect "<skill name>",<number>;
  4436. This command displays visual and aural effects of given skill on currently
  4437. attached character. The number parameter is for skill whose visual effect
  4438. involves displaying of a number (healing or damaging). Note, that this command
  4439. will not actually use the skill, it is intended for scripts, which simulate
  4440. skill usage by the NPC, such as buffs, by setting appropriate status and
  4441. displaying the skill's effect.
  4442. mes "Be blessed!";
  4443. // Heal of 2000 HP
  4444. heal 2000,0;
  4445. skilleffect 28,2000;
  4446. // Blessing Level 10
  4447. sc_start SC_BLESSING,240000,10;
  4448. skilleffect 34,0;
  4449. // Increase AGI Level 5
  4450. sc_start SC_INCREASEAGI,140000,5;
  4451. skilleffect 29,0;
  4452. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  4453. Increase AGI Lv 5, and display appropriate effects.
  4454. ---------------------------------------
  4455. *npcskilleffect <skill id>,<number>,<x>,<y>;
  4456. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  4457. This command behaves identically to 'skilleffect', however, ground type skill
  4458. effects will be centered at the map coordinates given on the same map as the
  4459. attached character and all other skill types will be centered on the attached
  4460. character.
  4461. ---------------------------------------
  4462. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  4463. This command will display special effect with the given number, centered on the
  4464. specified NPCs coordinates, if any. For a full list of special effect numbers
  4465. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  4466. some client releases. (Notably, rain is absent from any client executables
  4467. released after April 2005.)
  4468. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  4469. specified does not exist, the command will do nothing. When specifying an NPC,
  4470. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  4471. will retain the default behavior of the command.
  4472. // this will make the NPC "John Doe#1"
  4473. // show the effect "EF_HIT1" specified by
  4474. // Jane Doe. I wonder what John did...
  4475. mes "[Jane Doe]";
  4476. mes "Well, I never!";
  4477. specialeffect EF_HIT1,AREA,"John Doe#1";
  4478. close;
  4479. ---------------------------------------
  4480. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  4481. This command behaves identically to 'specialeffect', but the effect will be
  4482. centered on the invoking character's sprite.
  4483. <Player name> parameter will display <effect number> on another Player than the
  4484. one currently attached to the script. Like with specialeffect, when specifying
  4485. a player, <send_target> must be supplied, specifying AREA will retain the default
  4486. behavior of the command.
  4487. ---------------------------------------
  4488. *removespecialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  4489. Work for 2018-10-02+
  4490. This command behaves parameter same as 'specialeffect', but use for remove effect with <effect number>
  4491. from invoking NPC.
  4492. ---------------------------------------
  4493. *removespecialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  4494. Work for 2018-10-02+
  4495. This command behaves parameter same as 'specialeffect2', but use for remove effect with <effect number>
  4496. from invoking character.
  4497. ---------------------------------------
  4498. *statusup <stat>{,<char_id>};
  4499. This command will change a specified stat of the invoking character up by one
  4500. permanently. Stats are to be given as number, but you can use these constants to
  4501. replace them:
  4502. bStr - Strength
  4503. bVit - Vitality
  4504. bInt - Intelligence
  4505. bAgi - Agility
  4506. bDex - Dexterity
  4507. bLuk - Luck
  4508. ---------------------------------------
  4509. *statusup2 <stat>,<amount>{,<char_id>};
  4510. This command will change a specified stat of the invoking character by the
  4511. specified amount permanently. The amount can be negative. See 'statusup'.
  4512. // This will decrease a character's Vit forever.
  4513. statusup2 bVit,-1;
  4514. ---------------------------------------
  4515. *traitstatusup <stat>{,<char_id>};
  4516. This command will change a specified trait stat of the invoking character up by one
  4517. permanently. Trait stats are to be given as number, but you can use these constants to
  4518. replace them:
  4519. bPow - Power
  4520. bSta - Stamina
  4521. bWis - Wisdom
  4522. bSpl - Spell
  4523. bCon - Concentration
  4524. bCrt - Creative
  4525. ---------------------------------------
  4526. *traitstatusup2 <stat>,<amount>{,<char_id>};
  4527. This command will change a specified trait stat of the invoking character by the
  4528. specified amount permanently. The amount can be negative. See 'statusup'.
  4529. // This will decrease a character's Sta forever.
  4530. traitstatusup2 bSta,-1;
  4531. ---------------------------------------
  4532. *bonus <bonus type>,<val1>;
  4533. *bonus2 <bonus type>,<val1>,<val2>;
  4534. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  4535. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  4536. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  4537. These commands are meant to be used in item scripts. They will probably work
  4538. outside item scripts, but the bonus will not persist for long. They, as
  4539. expected, refer only to an invoking character.
  4540. You can find the full list of possible bonuses and which command to use for each
  4541. kind in 'doc/item_bonus.txt'.
  4542. ---------------------------------------
  4543. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4544. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4545. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  4546. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  4547. These commands are meant to be used in item scripts only! See 'petautobonus' for pet usage.
  4548. What these commands do is 'attach' a script to the player which will get
  4549. executed on attack (or when attacked in the case of autobonus2).
  4550. Rate is the trigger rate of the script (1000 = 100%).
  4551. Duration is the time in milliseconds that the bonus will last for since the script has triggered.
  4552. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  4553. The optional argument 'flag' is used to classify the type of attack where the script
  4554. can trigger (it shares the same flags as the bAutoSpell bonus script):
  4555. Range criteria:
  4556. BF_SHORT: Trigger on melee attack
  4557. BF_LONG: Trigger on ranged attack
  4558. Default: BF_SHORT+BF_LONG
  4559. Attack type criteria:
  4560. BF_WEAPON: Trigger on weapon skills
  4561. BF_MAGIC: Trigger on magic skills
  4562. BF_MISC: Trigger on misc skills
  4563. Default: BF_WEAPON
  4564. Skill criteria:
  4565. BF_NORMAL: Trigger on normal attacks
  4566. BF_SKILL: Trigger on skills
  4567. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  4568. otherwise BF_SKILL+BF_NORMAL is used.
  4569. The difference between the optional argument 'other script' and the 'bonus script' is that,
  4570. the former one triggers only when attacking(or attacked) and the latter one runs on
  4571. status calculation as well, which makes sure, within the duration, the "bonus" that get
  4572. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  4573. "bonus" command only. And we usually use 'other script' to show visual effects.
  4574. In all cases, when the script triggers, the attached player will be the one
  4575. who holds the bonus. There is currently no way of knowing within this script
  4576. who was the other character (the attacker in autobonus2, or the target in
  4577. autobonus and autobonus3).
  4578. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  4579. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  4580. //effect when the bonus is active.
  4581. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  4582. ---------------------------------------
  4583. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  4584. This command will attach a script to a player for a given duration, in seconds.
  4585. After that time, the script will automatically expire. The same bonus cannot be
  4586. stacked. By default, this bonus will be stored on `bonus_script` table when player
  4587. logs out.
  4588. Flags (bitmask):
  4589. 1 : Remove when dead.
  4590. 2 : Removable by Dispell.
  4591. 4 : Removable by Clearance.
  4592. 8 : Remove when player logs out.
  4593. 16 : Removeable by Banishing Buster.
  4594. 32 : Removable by Refresh.
  4595. 64 : Removable by Lux Anima.
  4596. 128 : Remove when Madogear is activated or deactivated.
  4597. 256 : Remove when receive damage.
  4598. 512 : Script is permanent, cannot be cleared by bonus_script_clear.
  4599. 1024: Force to replace duplicated script by expanding the duration.
  4600. 2048: Force to add duplicated script. This flag cannot be stacked with 1024,
  4601. if both are defined, 1024 will be checked first and ignore this flag.
  4602. Types:
  4603. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  4604. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  4605. 1: Buff
  4606. 2: Debuff
  4607. Status_icon: See "Status Icon" section in 'src/map/script_constants.hpp'. Default is SI_BLANK (-1).
  4608. Example:
  4609. - Id: 512
  4610. AegisName: Apple
  4611. Name: Apple
  4612. Type: Healing
  4613. Buy: 15
  4614. Weight: 20
  4615. Flags:
  4616. BuyingStore: true
  4617. Script: |
  4618. bonus_script "{ bonus bStr,5; }",60;
  4619. ---------------------------------------
  4620. *bonus_script_clear {<flag>,{<char_id>}};
  4621. Removes attached bonus_script from player. If no 'char_id' given, it will removes
  4622. from the invoker.
  4623. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  4624. it just removes non-permanent script.
  4625. ---------------------------------------
  4626. *plagiarizeskill <skill_id>,<level>;
  4627. Enable the player to plagiarize specific skills that are copyable.
  4628. Return 1 on success, 0 otherwise.
  4629. ---------------------------------------
  4630. *plagiarizeskillreset <flag>;
  4631. Remove a plagiarized skill from the player.
  4632. Return 1 on success, 0 otherwise.
  4633. Flag constants:
  4634. 1 - Use for Plagiarism Skill
  4635. 2 - Use for Reproduce Skill
  4636. ---------------------------------------
  4637. *skill <skill id>,<level>{,<flag>};
  4638. *skill "<skill name>",<level>{,<flag>};
  4639. *addtoskill <skill id>,<level>{,<flag>};
  4640. *addtoskill "<skill name>",<level>{,<flag>};
  4641. These commands will give the invoking character a specified skill. This is also
  4642. used for item scripts.
  4643. Level is obvious. Skill id is the ID number of the skill in question as per
  4644. 'db/(pre-)re/skill_db.yml'. It is not known for certain whether this can be used to give
  4645. a character a monster's skill, but you're welcome to try with the numbers given
  4646. in 'db/(pre-)re/mob_skill_db.txt'.
  4647. Flag is 0 if the skill is given permanently (will get written with the character
  4648. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  4649. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  4650. 'skill' and to 2 in 'addtoskill'.
  4651. Flag 2 means that the level parameter is to be interpreted as a stackable
  4652. additional bonus to the skill level. If the character did not have that skill
  4653. previously, they will now at 0+the level given.
  4654. Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
  4655. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  4656. Flag constants:
  4657. 0 - SKILL_PERM
  4658. 1 - SKILL_TEMP
  4659. 2 - SKILL_TEMPLEVEL
  4660. 3 - SKILL_PERM_GRANT
  4661. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  4662. // level 1.
  4663. skill 152,1,0;
  4664. ---------------------------------------
  4665. *nude {<char_id>};
  4666. This command will unequip anything equipped on the invoking character.
  4667. It is not required to do this when changing jobs since 'jobchange' will unequip
  4668. everything not equippable by the new job class anyway.
  4669. ---------------------------------------
  4670. *sit {"<character name>"};
  4671. *stand {"<character name>"};
  4672. These commands will make a character sit or stand.
  4673. If no character is specified, the command will run for the invoking character.
  4674. Additionnally Sitting constant is true when the character is sitting, false otherwise.
  4675. ---------------------------------------
  4676. *disguise <Monster ID>{,<char_id>};
  4677. *undisguise {<char_id>};
  4678. This command disguises the current player with a monster sprite.
  4679. The disguise lasts until 'undisguise' is issued or the player logs out.
  4680. Example:
  4681. disguise 1002; // Disguise character as a Poring.
  4682. next;
  4683. undisguise; // Return to normal character sprite.
  4684. ---------------------------------------
  4685. *transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4686. *transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4687. *active_transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4688. *active_transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4689. This command will turn a player into a monster for a given duration and can grant
  4690. a SC attribute effect while transformed. Note that players cannot be transformed
  4691. during War of Emperium or if already disguised.
  4692. Can only be removed when you die or the duration ends.
  4693. 'transform' and 'active_transform' can stack on each other but using 'transform' or
  4694. 'active_transform' twice will not stack (it will cancel the previous bonus for the new).
  4695. 'active_transform' will take priority over transform for its duration.
  4696. ---------------------------------------
  4697. \\
  4698. 4,3 Marriage-related commands
  4699. \\
  4700. ---------------------------------------
  4701. *marriage("<spouse name>");
  4702. This function will marry two characters, the invoking character and the one
  4703. referred to by name given, together, setting them up as each other's marriage
  4704. partner. No second function call has to be issued (in current SVN at least) to
  4705. make sure the marriage works both ways. The function returns 1 upon success, or
  4706. 0 if the marriage could not be completed, either because the other character
  4707. wasn't found or because one of the two characters is already married.
  4708. This will do nothing else for the marriage except setting up the spouse ID for
  4709. both of these characters. No rings will be given and no effects will be shown.
  4710. ---------------------------------------
  4711. *wedding;
  4712. This command will call up wedding effects - the music and confetti - centered on
  4713. the invoking character. Example can be found in the wedding script.
  4714. ---------------------------------------
  4715. *divorce({<char_id>})
  4716. This function will "un-marry" the invoking character from whoever they were
  4717. married to. Both will no longer be each other's marriage partner, (at least in
  4718. current SVN, which prevents the cases of multi-spouse problems). It will return
  4719. 1 upon success or 0 if the character was not married at all.
  4720. This function will also destroy both wedding rings and send a message to both
  4721. players, telling them they are now divorced.
  4722. ---------------------------------------
  4723. *adopt("<parent_name>","<baby_name>");
  4724. *adopt(<parent_id>,<baby_id>);
  4725. This function will send the client adoption request to the specified baby
  4726. character. The parent value can be either parent. Both parents and the baby
  4727. need to be online in order for adoption to work.
  4728. Return values:
  4729. ADOPT_ALLOWED - Sent message to Baby to accept or deny.
  4730. ADOPT_ALREADY_ADOPTED - Character is already adopted.
  4731. ADOPT_MARRIED_AND_PARTY - Parents need to be married and in a party with the baby.
  4732. ADOPT_EQUIP_RINGS - Parents need wedding rings equipped.
  4733. ADOPT_NOT_NOVICE - Baby is not a Novice.
  4734. ADOPT_CHARACTER_NOT_FOUND - A parent or Baby was not found.
  4735. ADOPT_MORE_CHILDREN - You cannot adopt more than 1 child. (client message)
  4736. ADOPT_LEVEL_70 - Parents need to be at least level 70 in order to adopt someone. (client message)
  4737. ADOPT_MARRIED - You cannot adopt a married person. (client message)
  4738. ---------------------------------------
  4739. //
  4740. 4,3.- End of marriage-related commands
  4741. //
  4742. ---------------------------------------
  4743. *pcfollow <id>,<target id>;
  4744. *pcstopfollow <id>;
  4745. Makes a character follow or stop following someone. This command does the same
  4746. as the @follow command. The main difference is that @follow can use character
  4747. names, and this commands needs the account ID for the target.
  4748. Examples:
  4749. // This will make Aaron follow Bullah, when both of these characters are online.
  4750. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4751. // Makes Aaron stop following whoever he is following.
  4752. pcstopfollow getCharID(3,"Aaron");
  4753. ---------------------------------------
  4754. *pcblockmove <id>,<option>;
  4755. *unitblockmove <id>,<option>;
  4756. Prevents the given GID from moving when the option is 1, and enables the ID to
  4757. move again when the option is 0. This command will run for the attached unit
  4758. if the given GID is zero.
  4759. Examples:
  4760. // Prevents the current char from moving away.
  4761. pcblockmove getcharid(3),1;
  4762. // Enables the current char to move again.
  4763. pcblockmove getcharid(3),0;
  4764. ---------------------------------------
  4765. *pcblockskill <id>,<option>;
  4766. *unitblockskill <id>,<option>;
  4767. Prevents the given GID from casting skills when the option is 1, and enables
  4768. the ID to cast skills again when the option is 0. This command will run for
  4769. the attached unit if the given GID is zero.
  4770. Examples:
  4771. // Prevents the current char from casting skills.
  4772. pcblockskill getcharid(3),1;
  4773. // Enables the current char to cast skills again.
  4774. pcblockskill getcharid(3),0;
  4775. ---------------------------------------
  4776. *setpcblock <type>,<state>{,<account ID>};
  4777. *getpcblock {<account ID>};
  4778. 'setpcblock' command prevents/allows the player from doing the given <type> of action according
  4779. to the <state> during the player session (note: @reloadscript removes all <type> except PCBLOCK_IMMUNE).
  4780. The <type> values are bit-masks, multiples of <type> can be added to change the player action.
  4781. The action is blocked when the <state> is true, while false allows the action again.
  4782. 'getpcblock' command return the bit-mask value of the currently
  4783. enabled block flags.
  4784. Available <type>:
  4785. PCBLOCK_MOVE Prevent the player from moving.
  4786. PCBLOCK_ATTACK Prevent the player from attacking.
  4787. PCBLOCK_SKILL Prevent the player from using skills/itemskills.
  4788. PCBLOCK_USEITEM Prevent the player from using usable items.
  4789. PCBLOCK_CHAT Prevent the player from sending global/guild/party/whisper messages.
  4790. PCBLOCK_IMMUNE Prevent the player from being hit by monsters.
  4791. PCBLOCK_SITSTAND Prevent the player from sitting/standing.
  4792. PCBLOCK_COMMANDS Prevent the player from using atcommands/charcommands.
  4793. PCBLOCK_NPCCLICK Prevent the player from clicking/touching any NPC/shop/warp.
  4794. PCBLOCK_EMOTION Prevent the player from using emotions.
  4795. PCBLOCK_NPC Simulate NPC interaction. Useful for NPC with no mes window. Sum of PCBLOCK_MOVE|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_NPCCLICK.
  4796. PCBLOCK_ALL Sum of all the flags.
  4797. Examples:
  4798. // Make the attached player invulnerable to monster (same as @monsterignore)
  4799. setpcblock PCBLOCK_IMMUNE, true;
  4800. // Prevents the attached player from attacking and using skills
  4801. setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL, true;
  4802. // Re-enables attack, skills and item use
  4803. setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM, false;
  4804. // getpcblock related checks
  4805. if (getpcblock() & PCBLOCK_IMMUNE)
  4806. mes "You are invulnerable!";
  4807. if (getpcblock() & (PCBLOCK_MOVE|PCBLOCK_SITSTAND))
  4808. mes "You can't walk or sit.";
  4809. if ((getpcblock() & (PCBLOCK_ATTACK|PCBLOCK_SKILL)) == 0)
  4810. mes "You can attack and use skills.";
  4811. if (getpcblock() & PCBLOCK_CHAT)
  4812. mes "You can't chat.";
  4813. ---------------------------------------
  4814. ==================================
  4815. |5.- Mob / NPC -related commands.|
  4816. ==================================
  4817. ---------------------------------------
  4818. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4819. *monster "<map name>",<x>,<y>,"<name to show>","<mob name>",<amount>{,"<event label>",<size>,<ai>};
  4820. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4821. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>","<mob name>",<amount>{,"<event label>",<size>,<ai>};
  4822. This command will spawn <amount> monsters with <mob id> or <mob name> on the specified
  4823. coordinates on the specified map. If the script is invoked by a character, a special
  4824. <map name>, "this", will be recognized to mean the name of the map the invoking character
  4825. is located at. This command works fine in item scripts.
  4826. The same command arguments mean the same things as described above in the
  4827. beginning of this document when talking about permanent monster spawns. Monsters
  4828. spawned in this manner will not respawn upon being killed.
  4829. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4830. be picked from the entire database according to the rules configured in the
  4831. server for dead branches. This will work for all other kinds of non-permanent
  4832. monster spawns.
  4833. The only very special thing about this command is an event label, which is an
  4834. optional parameter. This label is written like '<NPC object name>::<label name>'
  4835. and upon the monster being killed, it will execute the script inside of the
  4836. specified NPC object starting from the label given. The RID of the player
  4837. attached at this execution will be the RID of the killing character.
  4838. The variable 'killedrid' is set to the Class (mob ID) of the monster killed.
  4839. The variable 'killedgid' is set to the ID (unique mob game ID) of the monster killed.
  4840. <size> can be:
  4841. Size_Small (0) (default)
  4842. Size_Medium (1)
  4843. Size_Large (2)
  4844. <ai> can be:
  4845. AI_NONE (0) (default)
  4846. AI_ATTACK (1) (attack/friendly)
  4847. AI_SPHERE (2) (Alchemist skill)
  4848. AI_FLORA (3) (Alchemist skill)
  4849. AI_ZANZOU (4) (Kagerou/Oboro skill)
  4850. AI_LEGION (5) (Sera skill)
  4851. AI_FAW (6) (Mechanic skill)
  4852. AI_WAVEMODE (7) Normal monsters will ignore attack from AI_WAVEMODE monsters
  4853. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4854. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4855. The 'areamonster' command works much like the 'monster' command and is not
  4856. significantly different, but spawns the monsters within a square defined by
  4857. x1/y1-x2/y2.
  4858. Returned value is an array with the game ID of the spawned monster(s) depending
  4859. on the amount spawned. Array is stored in $@mobid[].
  4860. Simple monster killing script:
  4861. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4862. mes "[Summon Man]";
  4863. mes "Want to start the Poring hunt?";
  4864. next;
  4865. if (select("Yes.:No.") == 2) {
  4866. mes "[Summon Man]";
  4867. mes "Come back later.";
  4868. close;
  4869. }
  4870. // Summon 10 Porings.
  4871. // Using coordinates 0,0 will spawn them in a random location.
  4872. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4873. mes "[Summon Man]";
  4874. mes "Now go and kill all the Porings I summoned.";
  4875. close;
  4876. OnPoringKilled:
  4877. $PoringKilled++;
  4878. if ($PoringKilled >= 10) {
  4879. announce "Summon Man: Well done. All the Porings are dead!",3;
  4880. $PoringKilled = 0;
  4881. }
  4882. end;
  4883. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4884. ---------------------------------------
  4885. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4886. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4887. *areamobuseskill "<map name>",<x>,<y>,<range>,"<mob name>",<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4888. *areamobuseskill "<map name>",<x>,<y>,<range>,"<mob name>","<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4889. This command will make all monsters of the specified <mob id> or <mob name> in the specified
  4890. area use the specified skill. <map name>, <x>, and <y> define the center of the area,
  4891. which extending <range> cells in each direction (ex: a range of 3 would create
  4892. a 7x7 square). The skill can be specified by <skill id> or <skill name>. <cast time> is in
  4893. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4894. <target type> can be:
  4895. 0 = self
  4896. 1 = the mob's current target
  4897. 2 = the mob's master
  4898. 3 = random target
  4899. Example:
  4900. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4901. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4902. // make the plant cast level 10 Cold Bolt on a random target
  4903. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,ET_KEK,3;
  4904. ---------------------------------------
  4905. *killmonster "<map name>","<event label>"{,<type>};
  4906. This command will kill all monsters that were spawned with 'monster' or
  4907. 'addmonster' and have a specified event label attached to them. Commonly used to
  4908. get rid of remaining quest monsters once the quest is complete.
  4909. If the label is given as "All", all monsters which have their respawn times set
  4910. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4911. command, and all monsters summoned with GM commands, but no other ones - that
  4912. is, all non-permanent monsters) on the specified map will be killed regardless
  4913. of the event label value.
  4914. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4915. will make the command fire "OnMyMobDead" events from any monsters that do die
  4916. as a result of this command.
  4917. ---------------------------------------
  4918. *killmonsterall "<map name>"{,<type>};
  4919. This command will kill all monsters on a specified map name, regardless of how
  4920. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4921. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4922. trigger when there is no player, killmonsterall has also been modified to support this.
  4923. Using this the normal/old way means labels don't trigger when a player didn't
  4924. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4925. forced to use the new method. However, if you wish to use the new label type with this
  4926. command, simply use 1 for type. Any other number won't be recognized.
  4927. ---------------------------------------
  4928. *strmobinfo(<type>,<monster id>);
  4929. This function will return information about a monster record in the database, as
  4930. per 'db/(pre-)re/mob_db.yml'. Type is the kind of information returned. Valid types are:
  4931. It will return 0 if there is no such monster (or the type value is invalid),
  4932. or an empty string if you requested the monster's name.
  4933. 1 - 'english name' field in the database, a string.
  4934. 2 - 'japanese name' field in the database, a string.
  4935. All other returned values are numbers:
  4936. 3 - Level.
  4937. 4 - Maximum HP.
  4938. 5 - Maximum SP.
  4939. 6 - Experience reward.
  4940. 7 - Job experience reward.
  4941. ---------------------------------------
  4942. *mobcount("<map name>","<event label>")
  4943. This function will count all the monsters on the specified map that have a given
  4944. event label and return the number or 0 if it can't find any. Naturally, only
  4945. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4946. event label.
  4947. If you pass this function an empty string for the event label, it will return
  4948. the total count of monster without event label, including permanently spawning monsters.
  4949. With the dynamic mobs system enabled, where mobs are not kept
  4950. in memory for maps with no actual people playing on them, this will return a 0
  4951. for any such map.
  4952. If the event label is given as "all", all monsters will be counted, regardless of
  4953. having any event label attached.
  4954. If the map name is given as "this", the map the invoking character is on will
  4955. be used. If the map is not found, or the invoker is not a character while the map
  4956. is "this", it will return -1.
  4957. ---------------------------------------
  4958. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4959. This command creates a monster which is a copy of another player. The first
  4960. four arguments serve the same purpose as in the monster script command, The
  4961. <char id> is the character id of the player to clone (player must be online).
  4962. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4963. must be a character id of another online player.
  4964. The mode can be specified to determine the behavior of the clone. Its
  4965. values are the same as the ones used for the mode field in the mob_db. The
  4966. default mode is aggressive, assists, can move, can attack.
  4967. Flag can be either zero or one currently. If zero, the clone is a normal
  4968. monster that'll target players, if one, it is considered a summoned monster,
  4969. and as such, it'll target other monsters. Defaults to zero.
  4970. The duration specifies how long the clone will live before it is auto-removed.
  4971. Specified in seconds, defaults to no limit (zero).
  4972. Returned value is the monster ID of the spawned clone. If command fails,
  4973. returned value is zero.
  4974. ---------------------------------------
  4975. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4976. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4977. with other commands, this one will set up the monster to fight to protect the
  4978. invoking character. Monster name and mob id obey the same rules as the one given
  4979. at the beginning of this document for permanent monster spawns with the
  4980. exceptions mentioned when describing 'monster' command.
  4981. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4982. invoking character.
  4983. Timeout is the time in milliseconds the summon lives, and is set default
  4984. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4985. and it is not possible to create a spawn that lasts forever.
  4986. If an event label is given, upon the monster being killed, the event label will
  4987. run as if by 'donpcevent'.
  4988. Returned value is the game ID of the spawned monster.
  4989. // Will summon a dead branch-style monster to fight for the character.
  4990. summon "--ja--",-1;
  4991. ---------------------------------------
  4992. *addmonsterdrop <monster id>,<item id>,<rate>,{<steal protected>,{<random option group id>}};
  4993. *addmonsterdrop "<monster name>",<item id>,<rate>,{<steal protected>,{<random option group id>}};
  4994. *delmonsterdrop <monster id>,<item id>;
  4995. *delmonsterdrop "<monster name>",<item id>;
  4996. These commands will temporarily add or delete a monster drop, which will be reset
  4997. when the mob database reloads or the server shuts down. They return true upon success, false otherwise.
  4998. If the monster already drops the specified item, its drop rate will be updated with
  4999. the given rate (100 = 1%).
  5000. If <steal protected> is true the item will be protected from TF_STEAL (default false).
  5001. <random option group id> binds the item with the given random option group Id (default 0).
  5002. The Id must be valid, like defined in db/[pre-]re/item_randomopt_group.yml
  5003. Examples:
  5004. // Makes Owl Baron drop Honey at an 80% rate.
  5005. addmonsterdrop 1295,518,8000;
  5006. // Makes Owl Baron drop Knife_ at an 80% rate, protected from TF_STEAL and with random option group Id 5.
  5007. addmonsterdrop 1295,1202,8000,true,5;
  5008. // Deletes Executioner's Mitten from Rybio.
  5009. delmonsterdrop 1201,7017;
  5010. ---------------------------------------
  5011. *mob_setidleevent <GID>,<event>;
  5012. This command will attach an event label to the monster with the given <GID> which will execute
  5013. when the <GID> is idle.
  5014. Example:
  5015. monster "prontera",0,0,"Quest Poring",1002,1;
  5016. mob_setidleevent $@mobid[0], "NPC NAME::OnIdle";
  5017. end;
  5018. OnIdle:
  5019. mobchat getattachedrid(),0,0x00FF00,"I'm IDLE!";
  5020. end;
  5021. ---------------------------------------
  5022. *disablenpc {"<NPC object name>"};
  5023. *enablenpc {"<NPC object name>"};
  5024. These two commands will disable and enable, respectively, an NPC object
  5025. specified by name. The disabled NPC will disappear from sight and will no longer
  5026. be triggerable in the normal way. It is not clear whether it will still be
  5027. accessible through 'donpcevent' and other triggering commands, but it probably
  5028. will be. You can disable even warp NPCs if you know their object names, which is
  5029. an easy way to make a map only accessible through walking half the time. Then
  5030. you 'enablenpc' them back.
  5031. You can also use these commands to create the illusion of an NPC switching
  5032. between several locations, which is often better than actually moving the NPC -
  5033. create one NPC object with a visible and a hidden part to their name, make a few
  5034. copies, and then disable all except one.
  5035. ---------------------------------------
  5036. *hideonnpc {"<NPC object name>"};
  5037. *hideoffnpc {"<NPC object name>"};
  5038. These commands will make the NPC object specified display as hidden/visible,
  5039. even though not actually disabled per se. Hidden as in thief Hide skill, but
  5040. unfortunately, not detectable by Ruwach or Sight.
  5041. As they are now, these commands are pointless, it is suggested to use
  5042. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  5043. sprite location and other accompanying data from memory when it is not used.
  5044. However, you can use these for some quest ideas (such as cloaking NPCs talking
  5045. while hidden then revealing.... you can wonder around =P
  5046. ---------------------------------------
  5047. *unloadnpc "<NPC object name>";
  5048. This command will fully unload a NPC object and all of it's duplicates.
  5049. ---------------------------------------
  5050. *duplicate "<NPC name>","<map>",<x>,<y>{,"<Duplicate NPC name>"{,<sprite>{,<dir>{,<xs>{,<xy>}}}}};
  5051. This command will duplicate the NPC with the given <NPC name> on <map> at <x>/<y>.
  5052. If <Duplicate NPC name>, <sprite>, <dir>, <xs> or <ys> is not provided the value of the original NPC will be used.
  5053. The Unique name of the new duplicated NPC is returned on success. An empty string is returned on failure.
  5054. NOTE:
  5055. Duplicates will always have the same NPC variables as the original NPC.
  5056. Editing a NPC variable in a duplicate or the original NPC will change it for the others.
  5057. ---------------------------------------
  5058. *cloakonnpc {"<NPC object name>"{,<character ID>}};
  5059. *cloakoffnpc {"<NPC object name>"{,<character ID>}};
  5060. These commands will make the NPC object specified display as cloaked/uncloaked,
  5061. even though not actually disabled.
  5062. The player can interact with a NPC cloaked (via NPC click, monster event..)
  5063. but the NPC trigger area is disabled.
  5064. If <character ID> is given then the NPC will only display to the specified
  5065. player until he/she leaves the map, logs out, or the npc option is changed.
  5066. If no <character ID> is specified it will display to the area.
  5067. ---------------------------------------
  5068. *cloakonnpcself {"<NPC object name>"};
  5069. *cloakoffnpcself {"<NPC object name>"};
  5070. Same command as above, but an attached player is required. The NPC will only display to the attached player.
  5071. ---------------------------------------
  5072. *isnpccloaked {"<NPC object name>"{,<character ID>}};
  5073. Returns true if the NPC has been cloaked to the attached player or given
  5074. <character ID>, false otherwise. This works in association with cloakonnpc
  5075. when it is targetting a specific character.
  5076. ---------------------------------------
  5077. *doevent "<NPC object name>::<event label>";
  5078. This command will start a new execution thread in a specified NPC object at the
  5079. specified label. The execution of the script running this command will not stop,
  5080. and the event called by the 'doevent' command will not run until the invoking
  5081. script has terminated. No parameters may be passed with a doevent call.
  5082. The script of the NPC object invoked in this manner will run as if it's been
  5083. invoked by the RID that was active in the script that issued a 'doevent'. As
  5084. such, the command will not work if an RID is not attached.
  5085. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  5086. mes "This is what you will see when you click me";
  5087. close;
  5088. OnLabel:
  5089. mes "This is what you will see if the doevent is activated";
  5090. close;
  5091. }
  5092. ....
  5093. doevent "NPC::OnLabel";
  5094. ---------------------------------------
  5095. *donpcevent "<NPC object name>::<event label>";
  5096. This command invokes the event label code within an another NPC or NPCs. It
  5097. starts a separate instance of execution, and the invoking NPC will resume
  5098. execution its immediately.
  5099. If the supplied event label has the form "NpcName::OnLabel", then only given
  5100. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  5101. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  5102. label will be invoked, one after another. In both cases the invoked script
  5103. will run without an attached RID, whether or not the invoking script was
  5104. attached to a player. The event label name is required to start with "On".
  5105. This command can be used to make other NPCs act, as if they were responding to
  5106. the invoking NPC's actions, such as using an emotion or talking.
  5107. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  5108. mes "NPC2 copies my actions!";
  5109. close2;
  5110. donpcevent "NPC2::OnEmote";
  5111. end;
  5112. OnEmote:
  5113. emotion rand(1,30);
  5114. end;
  5115. }
  5116. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  5117. mes "NPC1 copies my actions!";
  5118. close2;
  5119. donpcevent "NPC1::OnEmote";
  5120. end;
  5121. OnEmote:
  5122. emotion rand(1,30);
  5123. end;
  5124. }
  5125. Whichever of the both NPCs is talked to, both will show a random emotion at the
  5126. same time.
  5127. As of r16564, command now returns 1 or 0 on success and failure.
  5128. A debug message also shows on the console when no events are triggered.
  5129. ---------------------------------------
  5130. *cmdothernpc "<npc name>","<command>";
  5131. This is simply "donpcevent <npc name>::OnCommand<command>".
  5132. It is an approximation of official server script language's 'cmdothernpc'.
  5133. Returns true if the command was executed on the other NPC successfully, false if not.
  5134. ---------------------------------------
  5135. *npctalk "<message>"{,"<NPC name>",<flag>{,<color>}};
  5136. This command will display a message as if the NPC object running it was a player
  5137. talking - that is, above their head and in the chat window.
  5138. The display name of the NPC won't get appended in front of the message.
  5139. If the <NPC name> option is given and not empty, then that NPC will display the message,
  5140. else the attached NPC will display the message,
  5141. the color format is in RGB (0xRRGGBB). The color is White by default.
  5142. Target for <flag>:
  5143. - bc_all : Broadcast message is sent server-wide (only in the chat window).
  5144. - bc_map : Message is sent to everyone in the same map as the source of the npc.
  5145. - bc_area : Message is sent to players in the vicinity of the source (default value).
  5146. - bc_self : Message is sent only to player attached.
  5147. // This will make everyone in the area see the NPC greet the character
  5148. // who just invoked it.
  5149. npctalk "Hello " + strcharinfo(0) + ", how are you?";
  5150. ---------------------------------------
  5151. *chatmes "<message>"{,"<NPC name>"};
  5152. This command will display a message in the waitingroom (chat) of the NPC.
  5153. If the <NPC name> option is given, then that NPC will display the message, else
  5154. the attached NPC will display the message.
  5155. If the NPC is not in a waitingroom, nothing happens.
  5156. // Everyone in the waitingroom will see this message:
  5157. chatmes "Waiting 5 minutes until the next match will start";
  5158. ---------------------------------------
  5159. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  5160. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  5161. *setnpcdisplay("<npc name>", "<display name>")
  5162. *setnpcdisplay("<npc name>", <class id>)
  5163. Changes the display name and/or display class of the target NPC.
  5164. Returns 0 is successful, 1 if the NPC does not exist.
  5165. Size is 0 = normal 1 = small 2 = big.
  5166. ---------------------------------------
  5167. \\
  5168. 5,1.- Time-related commands
  5169. \\
  5170. ---------------------------------------
  5171. *addtimer <ticks>,"NPC::OnLabel";
  5172. *deltimer "NPC::OnLabel";
  5173. *addtimercount <ticks>,"NPC::OnLabel";
  5174. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  5175. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  5176. number of ticks. For all three cases, the event label given is the identifier of
  5177. that timer. The timer runs on the character object that is attached to the script,
  5178. and can have multiple instances. When the label is run, it is run as if the player that
  5179. the timer runs on has clicked the NPC.
  5180. When this timer runs out, a new execution thread will start in the specified NPC
  5181. object at the specified label.
  5182. The ticks are given in 1/1000ths of a second.
  5183. One more thing. These timers are stored as part of player data. If the player
  5184. logs out, all of these get immediately deleted, without executing the script.
  5185. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  5186. Example:
  5187. <NPC Header> {
  5188. dispbottom "Starting a 5 second timer...";
  5189. addtimer 5000, strnpcinfo(3) + "::On5secs";
  5190. end;
  5191. On5secs:
  5192. dispbottom "5 seconds have passed!";
  5193. end;
  5194. }
  5195. ---------------------------------------
  5196. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  5197. { "<NPC name>" | <Attach Flag> };
  5198. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  5199. { "<NPC name>" | <Detach Flag> };
  5200. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  5201. { "<NPC name>" | <Attach Flag> };
  5202. *setnpctimer <tick>{,"<NPC name>"};
  5203. *getnpctimer(<type of information>{,"<NPC name>"})
  5204. *attachnpctimer {"<character name>"};
  5205. *detachnpctimer {"<NPC name>"};
  5206. This set of commands and functions will create and manage an NPC-based timer.
  5207. The NPC name may be omitted, in which case the calling NPC is used as target.
  5208. Contrary to addtimer/deltimer commands which let you have many different timers
  5209. referencing different labels in the same NPC, each with their own countdown,
  5210. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  5211. and let you know how many were triggered already and how many still remain.
  5212. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  5213. creating this timer, the execution will not stop, but will happily continue
  5214. onward. The timer will then invoke new execution threads at labels
  5215. "OnTimer<time>:" in the NPC object it is attached to.
  5216. To create the timer, use the 'initnpctimer', which will start it running.
  5217. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  5218. 'startnpctimer' will let the paused timer continue.
  5219. By default timers do not have a RID attached, which lets them continue even
  5220. if the player that started them logs off. To attach a RID to a timer, you can
  5221. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  5222. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  5223. stopnpctimer lets you detach any RID after stopping the timer, and by using
  5224. 'detachnpctimer' you can detach a RID at any time.
  5225. Normally there is only a single timer per NPC, but as an exception, as long as
  5226. you attach a player to the timer, you can have multiple timers running at once,
  5227. because these will get stored on the players instead of the NPC.
  5228. NOTE: You need to attach the RID before the timer _before_ you start it to
  5229. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  5230. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  5231. event label of that NPC will be triggered, so you can do the appropriate
  5232. cleanup (the player is still attached when this event is triggered).
  5233. The 'setnpctimer' command will explicitly set the timer to a given tick.
  5234. 'getnpctimer' provides timer information. Its parameter defines what type:
  5235. 0 - Will return the current tick count of the timer.
  5236. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  5237. specified NPC waiting for execution.
  5238. 2 - Will return the number of times the timer has triggered and will trigger
  5239. an "OnTimer<tick>:" label in the specified NPC.
  5240. Example 1:
  5241. <NPC Header> {
  5242. // We need to use attachnpctimer because the mes command below needs RID attach
  5243. attachnpctimer;
  5244. initnpctimer;
  5245. npctalk "I cant talk right now, give me 10 seconds";
  5246. end;
  5247. OnTimer5000:
  5248. npctalk "Ok 5 seconds more";
  5249. end;
  5250. OnTimer6000:
  5251. npctalk "4";
  5252. end;
  5253. OnTimer7000:
  5254. npctalk "3";
  5255. end;
  5256. OnTimer8000:
  5257. npctalk "2";
  5258. end;
  5259. OnTimer9000:
  5260. npctalk "1";
  5261. end;
  5262. OnTimer10000:
  5263. stopnpctimer;
  5264. mes "[Man]";
  5265. mes "Ok we can talk now";
  5266. detachnpctimer;
  5267. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  5268. }
  5269. Example 2:
  5270. OnTimer15000:
  5271. npctalk "Another 15 seconds have passed.";
  5272. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  5273. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  5274. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  5275. initnpctimer;
  5276. end;
  5277. // This OnInit label will run when the script is loaded, so that the timer
  5278. // is initialized immediately as the server starts. It is dropped back to 0
  5279. // every time the NPC says something, so it will cycle continuously.
  5280. OnInit:
  5281. initnpctimer;
  5282. end;
  5283. Example 3:
  5284. mes "[Man]";
  5285. mes "I have been waiting " + (getnpctimer(0)/1000) + " seconds for you.";
  5286. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  5287. close;
  5288. Example 4:
  5289. mes "[Man]";
  5290. mes "Ok, I will let you have 30 more seconds...";
  5291. close2;
  5292. setnpctimer (getnpctimer(0)-30000);
  5293. // Notice the 'close2'. If there were a 'next' there the timer would be
  5294. // changed only after the player pressed the 'next' button.
  5295. end;
  5296. ---------------------------------------
  5297. *sleep {<milliseconds>};
  5298. *sleep2 {<milliseconds>};
  5299. *awake "<NPC name>";
  5300. These commands are used to control the pause of a NPC.
  5301. sleep and sleep2 will pause the script for the given amount of milliseconds.
  5302. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  5303. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  5304. basically do the same, but the main difference is that sleep will not keep the rid,
  5305. while sleep2 does. Also sleep2 will stop the script if there is no unit attached.
  5306. Examples:
  5307. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  5308. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  5309. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  5310. ---------------------------------------
  5311. *progressbar "<color>",<seconds>;
  5312. This command works almost like sleep2, but displays a progress bar
  5313. above the head of the currently attached character (like cast bar).
  5314. Once the given amount of seconds passes, the script resumes. If the
  5315. character moves while the progress bar progresses, it is aborted and
  5316. the script ends. The color format is in RGB (RRGGBB). The color is
  5317. currently ignored by the client and appears always green.
  5318. NOTE:
  5319. Ragexe clients are known to randomly crash if a message window is still open.
  5320. If possible make sure to close all message windows before triggering the progressbar command.
  5321. ---------------------------------------
  5322. *progressbar_npc "<color>",<seconds>{,<"NPC Name">};
  5323. This command works like progressbar, but displays a progress bar
  5324. above the head of the currently attached (or given) NPC. Once the
  5325. given amount of seconds passes, the script resumes. The color format
  5326. is in RGB (RRGGBB). The color is currently ignored by the client and
  5327. appears always green.
  5328. ---------------------------------------
  5329. //
  5330. 5,1.- End of time-related commands
  5331. //
  5332. ---------------------------------------
  5333. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>{,<char_id>}}}}}};
  5334. This command will broadcast a message to all or most players, similar to
  5335. @kami/@kamib GM commands.
  5336. announce "This will be shown to everyone at all in yellow.",0;
  5337. The region the broadcast is heard in (target), source of the broadcast
  5338. and the color the message will come up as is determined by the flags.
  5339. The flag values are coded as constants in 'src/map/script_constants.hpp' to make them easier to use.
  5340. Target flags:
  5341. - bc_all: Broadcast message is sent server-wide (default).
  5342. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  5343. - bc_area: Message is sent to players in the vicinity of the source.
  5344. - bc_self: Message is sent only to current player , if the source flag is bc_pc it also can
  5345. be used to send the Message to the character id if it's provided.
  5346. You cannot use more than one target flag.
  5347. Source flags:
  5348. - bc_pc: Broadcast source is the attached player or the character id if it's provided (default).
  5349. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  5350. (useful when a player is not attached or the message should be sent to those
  5351. nearby the NPC).
  5352. You cannot use more than one source flag.
  5353. Special flags:
  5354. - bc_yellow: Broadcast will be displayed in yellow color (default).
  5355. - bc_blue: Broadcast will be displayed in blue color.
  5356. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  5357. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  5358. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  5359. If any of the optional parameters is used, special flag is ignored.
  5360. Optional parameters may not work well (or at all) depending on a game client used.
  5361. The color parameter is a single number which can be in hexadecimal notation.
  5362. For example:
  5363. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  5364. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  5365. In official scripts only two font-weights (types) are used:
  5366. - normal (FW_NORMAL = 400, default),
  5367. - bold (FW_BOLD = 700).
  5368. Default font size is 12.
  5369. Using this for private messages to players is probably not that good an idea,
  5370. but it can be used instead in NPCs to "preview" an announce.
  5371. // This will be a private message to the player using the NPC that made the
  5372. // announcement
  5373. announce "This is my message just for you",bc_blue|bc_self;
  5374. // This will be shown on everyones screen that is in sight of the NPC.
  5375. announce "This is my message just for you people here",bc_npc|bc_area;
  5376. // This will be a private message to the player with character id 150000
  5377. announce "This is my message just for char id 150000",bc_self,0xFFF618,FW_NORMAL,12,0,0,150000;
  5378. ---------------------------------------
  5379. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  5380. This command will work like 'announce' but will only broadcast to characters
  5381. currently residing on the specified map. The flag and optional parameters
  5382. parameters are the same as in 'announce', but target and source flags are ignored.
  5383. ---------------------------------------
  5384. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  5385. This command works like 'announce' but will only broadcast to characters
  5386. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  5387. optional parameters are the same as in 'announce', but target and source flags are ignored.
  5388. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  5389. ---------------------------------------
  5390. *callshop "<name>"{,<option>};
  5391. These are a series of commands used to create dynamic shops.
  5392. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  5393. The options are:
  5394. 0 = The normal window (buy, sell and cancel) (default)
  5395. 1 = The buy window
  5396. 2 = The sell window
  5397. Note: The <option> parameter only works on the 'shop' type NPC.
  5398. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  5399. (as long as an npcshop* command is executed from that NPC, see note below). These
  5400. labels, if used, will replace how the shop handles the buying and selling of items,
  5401. allowing for the creation of dynamic shops.
  5402. The label "OnBuyItem" sets the following arrays:
  5403. @bought_nameid - item ID bought
  5404. @bought_quantity - amount bought
  5405. The label "OnSellItem" sets the following arrays:
  5406. @sold_nameid - item ID sold
  5407. @sold_quantity - amount sold
  5408. @sold_refine - refine count
  5409. @sold_attribute - if the item is broken (1) or not (0)
  5410. @sold_identify - if the item is identified (1) or not (0)
  5411. @sold_enchantgrade - enchantgrade
  5412. @sold_card1 - card slot 1
  5413. @sold_card2 - card slot 2
  5414. @sold_card3 - card slot 3
  5415. @sold_card4 - card slot 4
  5416. @sold_option_id1 - random option ID 1
  5417. @sold_option_val1 - random option value 1
  5418. @sold_option_param1 - random option param 1
  5419. @sold_option_id2 - random option ID 2
  5420. @sold_option_val2 - random option value 2
  5421. @sold_option_param2 - random option param 2
  5422. @sold_option_id3 - random option ID 3
  5423. @sold_option_val3 - random option value 3
  5424. @sold_option_param3 - random option param 3
  5425. @sold_option_id4 - random option ID 4
  5426. @sold_option_val4 - random option value 4
  5427. @sold_option_param4 - random option param 4
  5428. @sold_option_id5 - random option ID 5
  5429. @sold_option_val5 - random option value 5
  5430. @sold_option_param5 - random option param 5
  5431. Note: These labels will only be triggered if an npcshop* command is executed because these
  5432. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  5433. are triggered in the NPC whose master_nd is given in the shop.
  5434. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  5435. ---------------------------------------
  5436. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  5437. *npcshopitem "<name>",<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,...}}};
  5438. This command lets you override the contents of an existing NPC shop or cashshop. The
  5439. current sell list will be wiped, and only the items specified with the price
  5440. specified will be for sale.
  5441. The function returns 1 if shop was updated successfully, or 0 if not found.
  5442. NOTES:
  5443. - That you cannot use -1 to specify default selling price!
  5444. - If the attached shop type is a market shop, notice that there is an extra parameter after price, <stock>. Make sure to not add duplicate items! For unlimited stock use -1.
  5445. ---------------------------------------
  5446. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  5447. *npcshopadditem "<name>",<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,...}}};
  5448. This command will add more items at the end of the selling list for the
  5449. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  5450. appear twice on the sell list.
  5451. The function returns 1 if shop was updated successfully, or 0 if not found.
  5452. NOTES:
  5453. - That you cannot use -1 to specify default selling price!
  5454. - If attached shop type is market shop, need an extra param after price, it's <stock>
  5455. and make sure don't add duplication item! For unlimited stock use -1.
  5456. ---------------------------------------
  5457. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  5458. This command will remove items from the specified NPC shop or cashshop.
  5459. If the item to remove exists more than once on the shop, all instances will be
  5460. removed.
  5461. Note that the function returns 1 even if no items were removed. The return
  5462. value is only to confirm that the shop was indeed found.
  5463. ---------------------------------------
  5464. *npcshopattach "<name>"{,<flag>};
  5465. This command will attach the current script to the given NPC shop.
  5466. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  5467. of your script will be executed whenever a player buys/sells from the shop.
  5468. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  5469. and @sold_quantity[] will be filled up with the items and quantities
  5470. bought/sold.
  5471. The optional parameter specifies whether to attach ("1") or detach ("0") from
  5472. the shop (the default is to attach). Note that detaching will detach any NPC
  5473. attached to the shop, even if it's from another script, while attaching will
  5474. override any other script that may be already attached.
  5475. The function returns 0 if the shop was not found, 1 otherwise.
  5476. NOTES:
  5477. - If attached shop type is market shop, will be default to call the 'buy' window.
  5478. ---------------------------------------
  5479. *npcshopupdate "<name>",<item_id>,<price>{,<stock>}
  5480. Update an entry from a shop. If the price is 0 it won't be changed. May also be used for
  5481. marketshop to update the stock quantity. For unlimited stock, use -1.
  5482. For other shop types, the stock value has no effect.
  5483. ---------------------------------------
  5484. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  5485. This command will create a chat room, owned by the NPC object running this
  5486. script and displayed above the NPC sprite.
  5487. The maximum length of a chat room name is 60 letters.
  5488. The limit is the maximum number of people allowed to enter the chat room.
  5489. The attached NPC is included in this count. If the optional event and trigger
  5490. parameters are given, the event label ("<NPC object name>::<label name>")
  5491. will be invoked as if with a 'doevent' upon the number of people in the chat
  5492. room reaching the given triggering amount.
  5493. // The NPC will just show a box above its head that says "Hello World", clicking
  5494. // it will do nothing, since the limit is zero.
  5495. waitingroom "Hello World",0;
  5496. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  5497. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  5498. // the player will be able to wait until 7 players accumulate. Once this happens,
  5499. // it will cause the NPC "Bouncer" run the label "OnStart".
  5500. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  5501. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  5502. // and will have 8 waiting slots. Clicking this will allow a player who has
  5503. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  5504. // able to wait until 7 players accumulate. Once this happens, it will cause
  5505. // the NPC "Bouncer" run the label "OnStart".
  5506. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  5507. Creating a waiting room does not stop the execution of the script and it will
  5508. continue to the next line.
  5509. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  5510. of waiting rooms.
  5511. ---------------------------------------
  5512. *delwaitingroom {"<NPC object name"};
  5513. This command will delete a waiting room. If no parameter is given, it will
  5514. delete a waiting room attached to the NPC object running this command, if it is,
  5515. it will delete a waiting room owned by another NPC object. This is the only way
  5516. to get rid of a waiting room, nothing else will cause it to disappear.
  5517. It's not clear what happens to a waiting room if the NPC is disabled with
  5518. 'disablenpc', by the way.
  5519. ---------------------------------------
  5520. *enablewaitingroomevent {"<NPC object name>"};
  5521. *disablewaitingroomevent {"<NPC object name>"};
  5522. *enablearena;
  5523. *disablearena;
  5524. This will enable and disable triggering the waiting room event (see
  5525. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  5526. for a specified NPC object. The chat room will not disappear when triggering is
  5527. disabled and enabled in this manner and players will not be kicked out of it.
  5528. Enabling a chat room event will also cause it to immediately check whether the
  5529. number of users in it exceeded the trigger amount and trigger the event
  5530. accordingly.
  5531. Normally, whenever a waiting room was created to make sure that only one
  5532. character is, for example, trying to pass a job quest trial, and no other
  5533. characters are present in the room to mess up the script.
  5534. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  5535. These are supposedly left here for compatibility with official server scripts,
  5536. but no rAthena script uses these at the moment.
  5537. ---------------------------------------
  5538. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  5539. This function will return information about the waiting room state for the
  5540. attached waiting room or for a waiting room attached to the specified NPC if
  5541. any.
  5542. The valid information types are:
  5543. 0 - Number of users currently chatting.
  5544. 1 - Maximum number of users allowed.
  5545. 2 - Will return 1 if the waiting room has a trigger set.
  5546. 0 otherwise.
  5547. 3 - Will return 1 if the waiting room is currently disabled.
  5548. 0 otherwise.
  5549. 4 - The Title of the waiting room (string)
  5550. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  5551. set a password on a waiting room right now.
  5552. 16 - Event name of the waiting room (string)
  5553. 32 - Whether or not the waiting room is full.
  5554. 33 - Whether the amount of users in the waiting room is higher than the trigger
  5555. number.
  5556. ---------------------------------------
  5557. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  5558. This command will warp the amount of characters equal to the trigger number of
  5559. the waiting room chat attached to the NPC object running this command to the
  5560. specified map and coordinates, kicking them out of the chat. Those waiting the
  5561. longest will get warped first. It can also do a random warp on the same map
  5562. ("Random" instead of map name) and warp to the save point ("SavePoint").
  5563. The list of characters to warp is taken from the list of the chat room members.
  5564. Those not in the chat room will not be considered even if they are talking to
  5565. the NPC in question. If the number of people is given, exactly this much people
  5566. will be warped.
  5567. This command can also keep track of who just got warped. It does this by setting
  5568. special variables:
  5569. $@warpwaitingpc[] is an array containing the account_id numbers of the
  5570. characters who were just warped.
  5571. $@warpwaitingpcnum contains the number of the character it just warped.
  5572. See also 'getpartymember' for advice on what to do with those variables.
  5573. The obvious way of using this effectively would be to set up a waiting room for
  5574. two characters to be warped onto a random PVP map for a one-on-one duel, for
  5575. example.
  5576. ---------------------------------------
  5577. *waitingroomkick "<NPC object name>" , "<character name>";
  5578. This command kicks the given character from the waiting room attached to the given NPC.
  5579. ---------------------------------------
  5580. *getwaitingroomusers "<NPC object name>";
  5581. This command get all the characters in the waiting room of the given NPC and stores
  5582. their gids in the array .@waitingroom_users[]. Also, stores the number of characters
  5583. in the variable .@waitingroom_usercount.
  5584. ---------------------------------------
  5585. *kickwaitingroomall {"<NPC object name>"};
  5586. This command kicks everybody out of a specified waiting room chat.
  5587. ---------------------------------------
  5588. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  5589. This command sets the 'nosave' flag for the specified map and also gives an
  5590. alternate respawn-upon-relogin point.
  5591. It does not make a map impossible to make a save point on as you would normally
  5592. think, 'savepoint' will still work. It will, however, make the specified map
  5593. kick the reconnecting players off to the alternate map given to the coordinates
  5594. specified.
  5595. ---------------------------------------
  5596. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  5597. This command marks a specified map with the given map flag, which will alter the
  5598. behavior of the map. A full list of mapflags is located in 'src/map/script_constants.hpp' with
  5599. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  5600. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  5601. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  5602. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  5603. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  5604. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  5605. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  5606. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  5607. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  5608. The optional parameter <zone> is used to set the zone for 'restricted' mapflags,
  5609. GM level bypass for 'nocommand', base/job experience for 'bexp'/'jexp', and
  5610. flag for 'battleground'.
  5611. For 'skill_damage' mapflag:
  5612. - Setting the flag here will adjust the global (all skills) damage on the map.
  5613. - <zone> is the -100 to 100000 damage adjustment value of the skills.
  5614. - See 'getmapflag' for the different <type> values.
  5615. For 'skill_duration' mapflag:
  5616. - <zone> is the skill ID to adjust.
  5617. - <type> is the percentage of adjustment from 0 to 100000.
  5618. ---------------------------------------
  5619. *removemapflag "<map name>",<flag>{,<zone>};
  5620. This command removes a mapflag from a specified map.
  5621. See 'setmapflag' for a list of mapflags.
  5622. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  5623. ---------------------------------------
  5624. *getmapflag("<map name>",<flag>{,<type>})
  5625. This command checks the status of a given mapflag and returns the mapflag's state.
  5626. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  5627. For MF_RESTRICTED, the zone value of the map is returned.
  5628. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  5629. SKILLDMG_MAX: if mapflag is set (default)
  5630. SKILLDMG_PC: damage against players
  5631. SKILLDMG_MOB: damage against mobs
  5632. SKILLDMG_BOSS: damage against bosses
  5633. SKILLDMG_OTHER: damage against other
  5634. SKILLDMG_CASTER: caster type
  5635. ---------------------------------------
  5636. *setbattleflag "<battle flag>",<value>{,<reload>};
  5637. *getbattleflag("<battle flag>")
  5638. Sets or gets the value of the given battle flag.
  5639. Battle flags are the flags found in the battle / *.conf files and is also used in Lupus' variable rates script.
  5640. If the reload value is given then the server will attempt to reload monster data
  5641. to properly apply the new rates. This applies to EXP/Drop type configs. The server
  5642. will only attempt to reload specific configs.
  5643. Examples:
  5644. // Will set the base experience rate to 20x (2000%) - Monster data will continue to use previous rates at server start
  5645. setBattleFlag "base_exp_rate",2000;
  5646. // Will set the base experience rate to 20x (2000%) - Monster data will be reloaded to new value
  5647. setBattleFlag "base_exp_rate",2000,true;
  5648. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  5649. mes getBattleFlag("base_exp_rate");
  5650. ---------------------------------------
  5651. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  5652. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  5653. The source coordinates specify the portal's location on the map of the invoking NPC.
  5654. The target map and coordinates determine the destination of the portal.
  5655. Examples:
  5656. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  5657. warpportal 150,150,"prontera",150,180;
  5658. ---------------------------------------
  5659. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  5660. This command will collect all characters located on the From map and warp them
  5661. wholesale to the same point on the To map, or randomly distribute them there if
  5662. the coordinates are zero. "Random" is understood as a special To map name and
  5663. will mean randomly shuffling everyone on the same map.
  5664. Optionally, a type and ID can be specified. Available types are:
  5665. 0 - Everyone
  5666. 1 - Guild
  5667. 2 - Party
  5668. Example:
  5669. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  5670. mapwarp "prontera","alberta",150,150,1,63;
  5671. ---------------------------------------
  5672. \\
  5673. 5,2.- Guild-related commands
  5674. \\
  5675. ---------------------------------------
  5676. *maprespawnguildid "<map name>",<guild id>,<flag>;
  5677. This command goes through the specified map and for each player and monster
  5678. found there does stuff.
  5679. Flag is a bit-mask (add up numbers to get effects you want)
  5680. 1 - warp all guild members to their save points.
  5681. 2 - warp all non-guild members (including guildless players) to their save points.
  5682. 4 - remove all monsters which are not guardian or Emperium.
  5683. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  5684. kick all characters out', which is what the official scripts do upon castle
  5685. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  5686. For examples, check the WoE scripts in the distribution.
  5687. ---------------------------------------
  5688. *agitstart;
  5689. *agitend;
  5690. *agitstart2;
  5691. *agitend2;
  5692. *agitstart3;
  5693. *agitend3;
  5694. These commands will start and end War of Emperium FE, War of Emperium SE,
  5695. or War of Emperium TE.
  5696. This is a bit more complex than it sounds, since the commands themselves won't
  5697. actually do anything interesting, except causing all 'OnAgitStart:' and
  5698. 'OnAgitEnd:', 'OnAgitStart2:' and 'OnAgitEnd2:', or 'OnAgitStart3:' and
  5699. 'OnAgitEnd3:' in the case of latter two commands, events to run everywhere,
  5700. respectively. They are used as simple triggers to run a lot of complex scripts
  5701. all across the server, and they, in turn, are triggered by clock with an
  5702. 'OnClock<time>:' time-triggering label.
  5703. ---------------------------------------
  5704. *gvgon "<map name>";
  5705. *gvgoff "<map name>";
  5706. These commands will turn GVG mode for the specified maps on and off, setting up
  5707. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  5708. even though WoE itself may or may not actually be in effect.
  5709. ---------------------------------------
  5710. *gvgon3 "<map name>";
  5711. *gvgoff3 "<map name>";
  5712. Theses commands behave identically to gvgon/gvgoff, but apply GVG_TE mapflag.
  5713. ---------------------------------------
  5714. *flagemblem <guild id>;
  5715. This command only works when run by the NPC objects which have sprite id 722,
  5716. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  5717. will be seen by anyone. If it is invoked in that manner, the emblem of the
  5718. specified guild will appear on the flag, though, if any players are watching it
  5719. at this moment, they will not see the emblem change until they move out of sight
  5720. of the flag and return.
  5721. This is commonly used in official guildwar scripts with a function call which
  5722. returns a guild id:
  5723. // This will change the emblem on the flag to that of the guild that owns
  5724. // "guildcastle"
  5725. flagemblem GetCastleData("guildcastle",1);
  5726. ---------------------------------------
  5727. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  5728. This command is roughly equivalent to 'monster', but is meant to be used with
  5729. castle guardian monsters and will only work with them. It will set the guardian
  5730. characteristics up according to the castle's investment values and otherwise
  5731. set the things up that only castle guardians need.
  5732. Since trunk r12524:
  5733. Returns the id of the mob or 0 if an error occurred.
  5734. When 'guardian index' isn't supplied it produces a temporary guardian.
  5735. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  5736. ---------------------------------------
  5737. *guardianinfo("<map name>", <guardian number>, <type>);
  5738. This function will return various info about the specified guardian, or -1
  5739. if it fails for some reason. It is primarily used in the castle manager NPC.
  5740. Map name and guardian number (value between 0 and 7) define the target.
  5741. Type indicates what information to return:
  5742. 0 - visibility (whether the guardian is installed or not)
  5743. 1 - max. hp
  5744. 2 - current hp
  5745. ---------------------------------------
  5746. *getguildalliance(<guild id1>, <guild id2>);
  5747. This command will return the relation between 2 guilds.
  5748. NOTE: This should be used in collaboration with 'requestguildinfo' as the
  5749. map-server needs to request for information from the char-server.
  5750. Return values:
  5751. -2 - Guild ID1 does not exist
  5752. -1 - Guild ID2 does not exist
  5753. 0 - Both guilds have no relation OR guild ID aren't given
  5754. 1 - Both guilds are allies
  5755. 2 - Both guilds are antagonists
  5756. ---------------------------------------
  5757. //
  5758. 5,2.- End of guild-related commands
  5759. //
  5760. ---------------------------------------
  5761. *npcspeed <speed value>;
  5762. *npcwalkto <x>,<y>;
  5763. *npcstop;
  5764. These commands will make the NPC object in question move around the map. As they
  5765. currently are, they are a bit buggy and are not useful for much more than making
  5766. an NPC move randomly around the map.
  5767. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  5768. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  5769. possible (instant motion). 100 is the default character walking speed.
  5770. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  5771. on the same map it is currently on. The script proceeds immediately after the
  5772. NPC begins moving.
  5773. 'npcstop' will stop the motion.
  5774. While in transit, the NPC will be clickable, but invoking it will cause it to
  5775. stop moving, which will make its coordinates different from what the client
  5776. computed based on the speed and motion coordinates. The effect is rather
  5777. unnerving.
  5778. Only a few NPC sprites have walking animations, and those that do, do not get
  5779. the animation invoked when moving the NPC, due to the problem in the NPC walking
  5780. code, which looks a bit silly. You might have better success by defining a job-
  5781. sprite based sprite id in 'db/mob_avail.yml' with this.
  5782. ---------------------------------------
  5783. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  5784. This command looks like the NPCWalkToxy function,but is a little different.
  5785. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  5786. sometimes gives problems if the path isn't a straight line without objects),
  5787. this command just moves the NPC. It basically warps out and in on the current
  5788. and given spot. Direction can be used to change the NPC's facing direction.
  5789. Example:
  5790. // This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
  5791. moveNPC "Bugga",100,20;
  5792. ---------------------------------------
  5793. =====================
  5794. |6.- Other commands.|
  5795. =====================
  5796. ---------------------------------------
  5797. *debugmes "<message>";
  5798. This command will send a debug message to the server console (map-server window). It
  5799. will not be displayed anywhere else.
  5800. // Displays "NAME has clicked me!" in the map-server window.
  5801. debugmes strcharinfo(0) + " has clicked me!";
  5802. ---------------------------------------
  5803. *errormes "<message>";
  5804. This command will send an error message to the server console (map-server window). It
  5805. will not be displayed anywhere else.
  5806. // Displays "NAME has clicked me!" in the map-server window.
  5807. errormes strcharinfo(0) + " has clicked me!";
  5808. ---------------------------------------
  5809. *logmes "<message>";
  5810. This command will write the message given to the map server NPC log file, as
  5811. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  5812. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  5813. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  5814. same log file.
  5815. If logs are not enabled, nothing will happen.
  5816. ---------------------------------------
  5817. *globalmes "<message>"{,"<NPC name>"};
  5818. This command will send a message to the chat window of all currently connected
  5819. characters.
  5820. If NPC name is specified, the message will be sent as if the sender would be
  5821. the NPC with the said name.
  5822. The display name of the NPC won't get appended in front of the message.
  5823. ---------------------------------------
  5824. *rand(<number>{,<number>});
  5825. This function returns a number ...
  5826. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  5827. (if you specify two) ... randomly positioned between the two numbers you specify.
  5828. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  5829. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  5830. rand(2,5) would result in 2,3,4 or 5
  5831. ---------------------------------------
  5832. *viewpoint <action>,<x>,<y>,<point number>,<color>{,<Char ID>};
  5833. This command will mark places on the mini map in the client connected to the
  5834. invoking character. It uses the normal X and Y coordinates from the main map.
  5835. The colors of the marks are defined using a hexadecimal number, same as the ones
  5836. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  5837. (They look like 0x<six numbers>.)
  5838. Action is what you want to do with a point, 1 will set it, while 2 will clear
  5839. it. 0 will also set it, but automatically removes the point after 15 seconds.
  5840. Point number is the number of the point - you can have several. If more than
  5841. one point is drawn at the same coordinates, they will cycle, which can be used
  5842. to create flashing marks.
  5843. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  5844. // and will be red.
  5845. viewpoint 1,30,40,1,0xFF0000;
  5846. This will create three points:
  5847. viewpoint 1,30,40,1,0xFF0000;
  5848. viewpoint 1,35,45,2,0xFF0000;
  5849. viewpoint 1,40,50,3,0xFF0000;
  5850. And this is how you remove them:
  5851. viewpoint 2,30,40,1,0xFF0000;
  5852. viewpoint 2,35,45,2,0xFF0000;
  5853. viewpoint 2,40,50,3,0xFF0000;
  5854. The client determines what it does with the points entirely, the server keeps no
  5855. memory of where the points are set whatsoever.
  5856. ---------------------------------------
  5857. *viewpointmap "<map name>",<action>,<x>,<y>,<point number>,<color>;
  5858. This command will mark places on the mini map in the client for all players currently
  5859. on the defined map. It uses the normal X and Y coordinates from the main map.
  5860. The colors of the marks are defined using a hexadecimal number, same as the ones
  5861. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  5862. (They look like 0x<six numbers>.)
  5863. Action is what you want to do with a point, 1 will set it, while 2 will clear
  5864. it. 0 will also set it, but automatically removes the point after 15 seconds.
  5865. Point number is the number of the point - you can have several. If more than
  5866. one point is drawn at the same coordinates, they will cycle, which can be used
  5867. to create flashing marks.
  5868. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  5869. // and will be red for all players currently on the map Prontera.
  5870. viewpointmap "prontera",1,30,40,1,0xFF0000;
  5871. This will create three points:
  5872. .@map$ = "prontera";
  5873. viewpointmap .@map$,1,30,40,1,0xFF0000;
  5874. viewpointmap .@map$,1,35,45,2,0xFF0000;
  5875. viewpointmap .@map$,1,40,50,3,0xFF0000;
  5876. And this is how you remove them:
  5877. .@map$ = "prontera";
  5878. viewpointmap .@map$,2,30,40,1,0xFF0000;
  5879. viewpointmap .@map$,2,35,45,2,0xFF0000;
  5880. viewpointmap .@map$,2,40,50,3,0xFF0000;
  5881. The client determines what it does with the points entirely, the server keeps no
  5882. memory of where the points are set whatsoever.
  5883. ---------------------------------------
  5884. *cutin "<filename>",<position>;
  5885. This command will display a picture, usually an NPC illustration, also called
  5886. cutin, for the currently attached client. The position parameter determines the
  5887. placement of the illustration and takes following values:
  5888. 0 bottom left corner
  5889. 1 bottom middle
  5890. 2 bottom right corner
  5891. 3 middle of screen in a movable window with an empty title bar
  5892. 4 middle of screen without the window header, but still movable
  5893. 255 clear all displayed cutins
  5894. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  5895. and data folder, and is required to be a bitmap. The file extension .bmp can be
  5896. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  5897. placed on the size of the illustrations by the client, although loading of large
  5898. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  5899. Typically the size is about 320x480. New illustrations can be added by just
  5900. putting the new file into the location above.
  5901. The client is able to display only one cutin at the same time and each new one
  5902. will cause the old one to disappear. To delete the currently displayed
  5903. illustration without displaying a new one, an empty file name and position 255
  5904. must be used.
  5905. // Displays the Comodo Kafra illustration in lower right corner.
  5906. cutin "kafra_07",2;
  5907. // Typical way to end a script, which displayed an illustration during a
  5908. // dialog with a player.
  5909. mes "See you.";
  5910. close2;
  5911. cutin "",255;
  5912. end;
  5913. ---------------------------------------
  5914. *emotion <emotion number>{,<target>};
  5915. This command makes an object display an emotion sprite above their own as
  5916. if they were doing that emotion. For a full list of emotion numbers,
  5917. see 'src/map/script_constants.hpp' under 'ET_'. The not so obvious ones are 'ET_QUESTION'
  5918. (a question mark) and 'ET_SURPRISE' (the exclamation mark).
  5919. The optional target parameter specifies who will get the emotion on top of
  5920. their head. Use the target Game ID (GID).
  5921. ---------------------------------------
  5922. *misceffect <effect number>;
  5923. This command, if run from an NPC object that has a sprite, will call up a
  5924. specified effect number, centered on the NPC sprite. If the running code does
  5925. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  5926. all (an item script) the effect will be centered on the character who's RID got
  5927. attached to the script, if any. For usable item scripts, this command will
  5928. create an effect centered on the player using the item.
  5929. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  5930. those that actually work may differ greatly between client versions.
  5931. ---------------------------------------
  5932. *soundeffect "<effect filename>",<type>;
  5933. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  5934. These two commands will play a sound effect to either the invoking character
  5935. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  5936. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  5937. object at all (an item script) the sound will be centered on the character who's
  5938. RID got attached to the script, if any. If it does, it will be centered on that
  5939. object. (an NPC sprite)
  5940. Effect filename is the filename in a GRF. It must have the .wav extension.
  5941. It's not quite certain what the 'type' actually does, it is sent to the client
  5942. directly. It probably determines which directory to play the effect from.
  5943. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  5944. but where the other numbers will read from is unclear.
  5945. The sound files themselves must be in the PCM format, and file names should also
  5946. have a maximum length of 23 characters including the .wav extension:
  5947. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  5948. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  5949. You can add your own effects this way, naturally.
  5950. ---------------------------------------
  5951. *playBGM "<BGM filename>";
  5952. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  5953. These two commands will play a Background Music to either the invoking character
  5954. only ('playBGM') or multiple characters ('playBGMall').
  5955. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  5956. It's not required to specify the extension inside the script.
  5957. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  5958. is omitted as well the BGM will be played for the entire server.
  5959. You can add your own BGMs this way, naturally.
  5960. ---------------------------------------
  5961. *pvpon "<map name>";
  5962. *pvpoff "<map name>";
  5963. These commands will turn PVP mode for the specified maps on and off. Beside
  5964. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5965. timer and ranking as will @pvpon GM command do.
  5966. ---------------------------------------
  5967. *atcommand "<command>";
  5968. This command will run the given command line exactly as if it was typed in from
  5969. the keyboard by the player connected to the invoking character, and that
  5970. character belonged to an account which had GM level 99.
  5971. // This will ask the invoker for a character name and then use the '@nuke'
  5972. // GM command on them, killing them mercilessly.
  5973. input .@player$;
  5974. atcommand "@nuke " + .@player$;
  5975. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5976. original atcommand, not the script-bound atcommand.
  5977. ---------------------------------------
  5978. *charcommand "<command>";
  5979. This command will run the given command line exactly as if it was typed in from
  5980. the keyboard from a character that belonged to an account which had GM level 99.
  5981. The commands can also run without an attached rid.
  5982. // This would do the same as above, but now
  5983. // it doesn't need a player attached by default.
  5984. charcommand "#option 0 0 0 Roy";
  5985. ---------------------------------------
  5986. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5987. This command will bind a NPC event label to an atcommand. Upon execution of the
  5988. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5989. one binding. If you rebind, it will override the original binding.
  5990. Note: The default level for atcommand is 0 while the default level for charcommand is 100.
  5991. The following variables are set upon execution:
  5992. .@atcmd_command$ = The name of the @command used.
  5993. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5994. .@atcmd_numparameters = The number of parameters defined.
  5995. Example:
  5996. When a user types the command "@test", an angel effect will be shown.
  5997. - script atcmd_example -1,{
  5998. OnInit:
  5999. bindatcmd "test",strnpcinfo(3) + "::OnAtcommand";
  6000. end;
  6001. OnAtcommand:
  6002. specialeffect2 EF_ANGEL2;
  6003. end;
  6004. }
  6005. ---------------------------------------
  6006. *unbindatcmd "<command>";
  6007. This command will unbind a NPC event label from an atcommand.
  6008. ---------------------------------------
  6009. *useatcmd "<command>";
  6010. This command will execute a script-bound atcommand for the attached RID. If the
  6011. supplied command is not bound to any script, this command will act like 'atcommand'
  6012. and attempt to execute a source-defined command.
  6013. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  6014. in this way.
  6015. ---------------------------------------
  6016. *camerainfo <range>,<rotation>,<latitude>{,<char id>};
  6017. This command will update the client's camera information with the given values where
  6018. the client can be the attached character or the player given by the char id parameter.
  6019. Note: This requires 2016-05-25aRagexeRE or newer.
  6020. The values given will be divided by 100 and transmitted as floating-point number.
  6021. range The zoomfactor of the camera.
  6022. Default: 230000 (230.0) when fully zoomed in
  6023. Maximum: 400000 (400.0) when fully zoomed out
  6024. rotation The rotation of the camera.
  6025. Default: 0 (0.0) when no rotation is applied
  6026. Maximum: 360000 (360.0°) when fully rotated
  6027. latitude The angle of the camera.
  6028. Default: -50000 (-50.0)
  6029. Maximum: -75000 (-75.0)
  6030. ---------------------------------------
  6031. *refineui({<char id>})
  6032. Opens the refine UI for the attached player or the given character id.
  6033. This feature requires 2016-10-12aRagexeRE or newer.
  6034. ---------------------------------------
  6035. *openstylist({<char id>})
  6036. Opens the stylist UI for the attached player or the given character id.
  6037. This feature requires packet version 2015-11-04 or newer.
  6038. ---------------------------------------
  6039. *laphine_synthesis({<item id>})
  6040. *laphine_synthesis({<"item name">})
  6041. Opens the laphine synthesis UI for <item ID> or <item name> for the attached player.
  6042. If run from within an item script <item ID> or <item name> is optional.
  6043. This feature requires packet version 2016-06-01 or newer.
  6044. ---------------------------------------
  6045. *laphine_upgrade()
  6046. Opens the laphine upgrade UI for the attached player.
  6047. This feature requires packet version 2017-07-26 or newer.
  6048. This function is intended for use in item scripts.
  6049. ---------------------------------------
  6050. *openbank({<char id>})
  6051. Opens the Bank UI for the attached player or the given character ID.
  6052. This command requires packet version 2015-12-02 or newer.
  6053. ---------------------------------------
  6054. *enchantgradeui {<char id>};
  6055. Opens the enchantgrade UI for the attached character or the player given by the char ID parameter.
  6056. This command requires packet version 2020-07-24 or newer.
  6057. ---------------------------------------
  6058. *set_reputation_points(<type>,<points>{,<char id>})
  6059. Sets the reputation points via <points> for reputation group <type> for the attached player or the given character ID.
  6060. <type> is the client side index as stored in the Id field of the reputation.yml database files.
  6061. ---------------------------------------
  6062. *get_reputation_points(<type>{,<char id>})
  6063. Gets the reputation points for reputation group <type> for the attached player or the given character ID.
  6064. <type> is the client side index as stored in the Id field of the reputation.yml database files.
  6065. ---------------------------------------
  6066. *item_reform({<item id>{,<char id>}})
  6067. *item_reform({<"item name">{,<char id>}})
  6068. Opens the item reform UI for <item ID> or <item name> for the attached player or the given character ID.
  6069. If run from within an item script <item ID> or <item name> is optional.
  6070. This feature requires packet version 2021-11-03 or newer.
  6071. ---------------------------------------
  6072. *item_enchant(<client side LUA index>{,<char ID>});
  6073. Opens the enchant UI for the attached character or the player given by the <char ID> parameter.
  6074. If the player exceeds 70% weight the client will not open the enchant UI and will trigger an
  6075. error message instead.
  6076. This command requires packet version 2021-11-03 or newer.
  6077. ---------------------------------------
  6078. \\
  6079. 6,1.- Unit-related commands
  6080. \\
  6081. ---------------------------------------
  6082. *unitwalk <GID>,<x>,<y>{,"<event label>"};
  6083. *unitwalkto <GID>,<Target GID>{,"<event label>"};
  6084. This command will tell a <GID> to walk to a position, defined either as a set of
  6085. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  6086. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  6087. unit's current map. While there is no way to move across an entire map with 1 command
  6088. use, this could be used in a loop to move long distances.
  6089. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
  6090. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  6091. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  6092. target ID will result in an error.
  6093. An optional Event Label can be passed as well which will execute when the <GID> has reached
  6094. the given coordinates or <Target GID>.
  6095. Examples:
  6096. // Makes player walk to the coordinates (150,150).
  6097. unitwalk getcharid(3),150,150;
  6098. // Performs a conditional check with the command and reports success or failure to the player.
  6099. if (unitwalk(getcharid(3),150,150))
  6100. dispbottom "Walking you there...";
  6101. else
  6102. dispbottom "That's too far away, man.";
  6103. // Makes player walk to another character named "WalkToMe".
  6104. unitwalkto getcharid(3),getcharid(3,"WalkToMe");
  6105. ---------------------------------------
  6106. *unitattack <GID>,<Target ID>{,<action type>};
  6107. *unitattack <GID>,"<Target Name>"{,<action type>};
  6108. This command will make a <GID> attack the specified target. It returns true upon
  6109. success and false for all failures.
  6110. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  6111. continuous attack instead of a single attack.
  6112. Note:
  6113. Using unitattack with <GID> 0 means that it will use the currently attached unit.
  6114. For players any attack requests will fail, because talking to an NPC prevents attacking a monster.
  6115. Therefore you need to detach the player from the NPC before using this command.
  6116. ---------------------------------------
  6117. *unitkill <GID>;
  6118. This command will kill a <GID>.
  6119. ---------------------------------------
  6120. *unitwarp <GID>,"<map name>",<x>,<y>;
  6121. This command will warp a <GID> to the specified map and coordinates.
  6122. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  6123. used with "OnTouch" to warp monsters:
  6124. OnTouch:
  6125. unitwarp 0,"this",-1,-1;
  6126. ---------------------------------------
  6127. *unitstopattack <GID>;
  6128. This command will make a <GID> stop attacking.
  6129. ---------------------------------------
  6130. *unitstopwalk <GID>{,<flag>};
  6131. This command will make a <GID> stop moving.
  6132. Note: If this is called from OnTouch, then the walktimer attached to the unit is
  6133. removed from OnTouch which causes this command to not stop the unit from walking.
  6134. Suggest to use 'unitblockmove' to forcefully stop the unit with OnTouch.
  6135. The <flag> value affects how the unit is stopped. The following flags are bitwise
  6136. values (can be combined using the pipe operator):
  6137. USW_NONE = Unit will keep walking to their original destination.
  6138. USW_FIXPOS = Issue a fixpos packet afterwards.
  6139. USW_MOVE_ONCE = Force the unit to move one cell if it hasn't yet.
  6140. USW_MOVE_FULL_CELL = Enable moving to the next cell when unit was already half-way there (may cause on-touch/place side-effects, such as a scripted map change).
  6141. USW_FORCE_STOP = Force stop moving.
  6142. This command will also remove the state tracking used for 'unitwalk' and 'unitwalkto'.
  6143. ---------------------------------------
  6144. *unittalk <GID>,"<text>"{,flag};
  6145. This command will make a <GID> say a message. The display name of the <GID> won't get appended in front of the message.
  6146. flag: Specify target
  6147. bc_area - Message is sent to players in the vicinity of the source (default).
  6148. bc_self - Message is sent only to player attached.
  6149. ---------------------------------------
  6150. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>,<casttime>,<cancel>,<Line_ID>};
  6151. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>,<casttime>,<cancel>,<Line_ID>};
  6152. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>{,<casttime>,<cancel>,<Line_ID>};
  6153. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>{,<casttime>,<cancel>,<Line_ID>};
  6154. This is the replacement of the older commands, these use the same values for
  6155. GID as the other unit* commands (See 'GID').
  6156. Skill ID is the ID of the skill, skill level is the level of the skill.
  6157. Cast time is the amount of seconds to add or remove from the skill. Use a positive value to
  6158. add and negative value to subtract. Using 0 or no value will use the default skill cast time.
  6159. For the position, the x and y are given in the UnitSkillUsePos.
  6160. <cancel> defines if the cast can be interrupted when hit (true/false).
  6161. CastCancel from skill_db.yml is the default value of <cancel>.
  6162. If <Line_ID> is defined (positive number, default 0) the monster will say the message from 'Line_ID'
  6163. in mob_chat_db.yml when casting the skill.
  6164. ---------------------------------------
  6165. *unitexists <GID>;
  6166. Checks if the given Game ID exists. Returns false if the object doesn't exist, or true if
  6167. it does.
  6168. ---------------------------------------
  6169. *getunittype <GID>;
  6170. Returns the type of object from the given Game ID. Returns -1 if the given GID does not
  6171. exist.
  6172. Return values:
  6173. BL_PC - Character object
  6174. BL_MOB - Monster object
  6175. BL_PET - Pet object
  6176. BL_HOM - Homunculus object
  6177. BL_MER - Mercenary object
  6178. BL_NPC - NPC object
  6179. BL_ELEM - Elemental object
  6180. ---------------------------------------
  6181. *getunitname <GID>;
  6182. Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
  6183. Mercenary and Elemental don't support custom names.
  6184. Returns "Unknown" if unit is not found.
  6185. ---------------------------------------
  6186. *setunitname <GID>,"<new name>";
  6187. Changes the name of the given unit to the new name given. Supported types are monster,
  6188. homunculus, and pet. To change an NPC's name, see 'setnpcdisplay'. Mercenary and
  6189. Elemental don't support custom names.
  6190. Changing a homunculus or pet name will be permanent.
  6191. Returns "Unknown" if unit is not found.
  6192. ---------------------------------------
  6193. *setunittitle <GID>,<title>;
  6194. Apply a <title> to the given <GID>.
  6195. Note: This only works on non-player types. It also will only work on mobs if battle_config.show_mob_info is not enabled.
  6196. ---------------------------------------
  6197. *getunittitle <GID>;
  6198. Returns the title of the given <GID>.
  6199. ---------------------------------------
  6200. *getunitdata <GID>,<arrayname>;
  6201. *setunitdata <GID>,<parameter>,<new value>;
  6202. This is used to get and set special data related to the unit.
  6203. With getunitdata, the array given will be filled with the current data. In setunitdata
  6204. the indexes in the array would be used to set that data on the unit.
  6205. Both getunitdata and setunitdata will return -1 if the given GID does not exist.
  6206. Note: When adjusting a unit's stat (STR, AGI, etc) the unit's respective statuses are
  6207. recalculated (HIT, FLEE, etc) automatically. Keep in mind that some stats don't
  6208. affect a unit's status and will have to directly be modified.
  6209. Parameters (indexes) for monsters are:
  6210. UMOB_SIZE
  6211. UMOB_LEVEL
  6212. UMOB_HP
  6213. UMOB_MAXHP
  6214. UMOB_MASTERAID
  6215. UMOB_MAPID
  6216. UMOB_X
  6217. UMOB_Y
  6218. UMOB_SPEED
  6219. UMOB_MODE
  6220. UMOB_AI
  6221. UMOB_SCOPTION
  6222. UMOB_SEX
  6223. UMOB_CLASS
  6224. UMOB_HAIRSTYLE
  6225. UMOB_HAIRCOLOR
  6226. UMOB_HEADBOTTOM
  6227. UMOB_HEADMIDDLE
  6228. UMOB_HEADTOP
  6229. UMOB_CLOTHCOLOR
  6230. UMOB_SHIELD
  6231. UMOB_WEAPON
  6232. UMOB_LOOKDIR
  6233. UMOB_CANMOVETICK
  6234. UMOB_STR
  6235. UMOB_AGI
  6236. UMOB_VIT
  6237. UMOB_INT
  6238. UMOB_DEX
  6239. UMOB_LUK
  6240. UMOB_SLAVECPYMSTRMD
  6241. UMOB_DMGIMMUNE
  6242. UMOB_ATKRANGE
  6243. UMOB_ATKMIN
  6244. UMOB_ATKMAX
  6245. UMOB_MATKMIN
  6246. UMOB_MATKMAX
  6247. UMOB_DEF
  6248. UMOB_MDEF
  6249. UMOB_HIT
  6250. UMOB_FLEE
  6251. UMOB_PDODGE
  6252. UMOB_CRIT
  6253. UMOB_RACE
  6254. UMOB_ELETYPE
  6255. UMOB_ELELEVEL
  6256. UMOB_AMOTION
  6257. UMOB_ADELAY
  6258. UMOB_DMOTION
  6259. UMOB_TARGETID
  6260. UMOB_ROBE
  6261. UMOB_BODY2
  6262. UMOB_GROUP_ID
  6263. UMOB_IGNORE_CELL_STACK_LIMIT
  6264. UMOB_RES
  6265. UMOB_MRES
  6266. -----
  6267. Parameter (indexes) for homunculi are:
  6268. UHOM_SIZE
  6269. UHOM_LEVEL
  6270. UHOM_HP
  6271. UHOM_MAXHP
  6272. UHOM_SP
  6273. UHOM_MAXSP
  6274. UHOM_MASTERCID
  6275. UHOM_MAPID
  6276. UHOM_X
  6277. UHOM_Y
  6278. UHOM_HUNGER
  6279. UHOM_INTIMACY
  6280. UHOM_SPEED
  6281. UHOM_LOOKDIR
  6282. UHOM_CANMOVETICK
  6283. UHOM_STR
  6284. UHOM_AGI
  6285. UHOM_VIT
  6286. UHOM_INT
  6287. UHOM_DEX
  6288. UHOM_LUK
  6289. UHOM_DMGIMMUNE
  6290. UHOM_ATKRANGE
  6291. UHOM_ATKMIN
  6292. UHOM_ATKMAX
  6293. UHOM_MATKMIN
  6294. UHOM_MATKMAX
  6295. UHOM_DEF
  6296. UHOM_MDEF
  6297. UHOM_HIT
  6298. UHOM_FLEE
  6299. UHOM_PDODGE
  6300. UHOM_CRIT
  6301. UHOM_RACE
  6302. UHOM_ELETYPE
  6303. UHOM_ELELEVEL
  6304. UHOM_AMOTION
  6305. UHOM_ADELAY
  6306. UHOM_DMOTION
  6307. UHOM_TARGETID
  6308. UHOM_GROUP_ID
  6309. -----
  6310. Parameter (indexes) for pets are:
  6311. UPET_SIZE
  6312. UPET_LEVEL
  6313. UPET_HP
  6314. UPET_MAXHP
  6315. UPET_MASTERAID
  6316. UPET_MAPID
  6317. UPET_X
  6318. UPET_Y
  6319. UPET_HUNGER
  6320. UPET_INTIMACY
  6321. UPET_SPEED
  6322. UPET_LOOKDIR
  6323. UPET_CANMOVETICK
  6324. UPET_STR
  6325. UPET_AGI
  6326. UPET_VIT
  6327. UPET_INT
  6328. UPET_DEX
  6329. UPET_LUK
  6330. UPET_DMGIMMUNE
  6331. UPET_ATKRANGE
  6332. UPET_ATKMIN
  6333. UPET_ATKMAX
  6334. UPET_MATKMIN
  6335. UPET_MATKMAX
  6336. UPET_DEF
  6337. UPET_MDEF
  6338. UPET_HIT
  6339. UPET_FLEE
  6340. UPET_PDODGE
  6341. UPET_CRIT
  6342. UPET_RACE
  6343. UPET_ELETYPE
  6344. UPET_ELELEVEL
  6345. UPET_AMOTION
  6346. UPET_ADELAY
  6347. UPET_DMOTION
  6348. UPET_GROUP_ID
  6349. -----
  6350. Parameter (indexes) for mercenaries are:
  6351. UMER_SIZE
  6352. UMER_HP
  6353. UMER_MAXHP
  6354. UMER_MASTERCID
  6355. UMER_MAPID
  6356. UMER_X
  6357. UMER_Y
  6358. UMER_KILLCOUNT
  6359. UMER_LIFETIME
  6360. UMER_SPEED
  6361. UMER_LOOKDIR
  6362. UMER_CANMOVETICK
  6363. UMER_STR
  6364. UMER_AGI
  6365. UMER_VIT
  6366. UMER_INT
  6367. UMER_DEX
  6368. UMER_LUK
  6369. UMER_DMGIMMUNE
  6370. UMER_ATKRANGE
  6371. UMER_ATKMIN
  6372. UMER_ATKMAX
  6373. UMER_MATKMIN
  6374. UMER_MATKMAX
  6375. UMER_DEF
  6376. UMER_MDEF
  6377. UMER_HIT
  6378. UMER_FLEE
  6379. UMER_PDODGE
  6380. UMER_CRIT
  6381. UMER_RACE
  6382. UMER_ELETYPE
  6383. UMER_ELELEVEL
  6384. UMER_AMOTION
  6385. UMER_ADELAY
  6386. UMER_DMOTION
  6387. UMER_TARGETID
  6388. UMER_GROUP_ID
  6389. -----
  6390. Parameter (indexes) for elementals are:
  6391. UELE_SIZE
  6392. UELE_HP
  6393. UELE_MAXHP
  6394. UELE_SP
  6395. UELE_MAXSP
  6396. UELE_MASTERCID
  6397. UELE_MAPID
  6398. UELE_X
  6399. UELE_Y
  6400. UELE_LIFETIME
  6401. UELE_MODE
  6402. UELE_SPEED
  6403. UELE_LOOKDIR
  6404. UELE_CANMOVETICK
  6405. UELE_STR
  6406. UELE_AGI
  6407. UELE_VIT
  6408. UELE_INT
  6409. UELE_DEX
  6410. UELE_LUK
  6411. UELE_DMGIMMUNE
  6412. UELE_ATKRANGE
  6413. UELE_ATKMIN
  6414. UELE_ATKMAX
  6415. UELE_MATKMIN
  6416. UELE_MATKMAX
  6417. UELE_DEF
  6418. UELE_MDEF
  6419. UELE_HIT
  6420. UELE_FLEE
  6421. UELE_PDODGE
  6422. UELE_CRIT
  6423. UELE_RACE
  6424. UELE_ELETYPE
  6425. UELE_ELELEVEL
  6426. UELE_AMOTION
  6427. UELE_ADELAY
  6428. UELE_DMOTION
  6429. UELE_TARGETID
  6430. UELE_GROUP_ID
  6431. -----
  6432. Parameter (indexes) for NPCs are:
  6433. UNPC_LEVEL
  6434. UNPC_HP
  6435. UNPC_MAXHP
  6436. UNPC_MAPID
  6437. UNPC_X
  6438. UNPC_Y
  6439. UNPC_LOOKDIR
  6440. UNPC_STR
  6441. UNPC_AGI
  6442. UNPC_VIT
  6443. UNPC_INT
  6444. UNPC_DEX
  6445. UNPC_LUK
  6446. UNPC_PLUSALLSTAT
  6447. UNPC_DMGIMMUNE
  6448. UNPC_ATKRANGE
  6449. UNPC_ATKMIN
  6450. UNPC_ATKMAX
  6451. UNPC_MATKMIN
  6452. UNPC_MATKMAX
  6453. UNPC_DEF
  6454. UNPC_MDEF
  6455. UNPC_HIT
  6456. UNPC_FLEE
  6457. UNPC_PDODGE
  6458. UNPC_CRIT
  6459. UNPC_RACE
  6460. UNPC_ELETYPE
  6461. UNPC_ELELEVEL
  6462. UNPC_AMOTION
  6463. UNPC_ADELAY
  6464. UNPC_DMOTION
  6465. UNPC_SEX
  6466. UNPC_CLASS
  6467. UNPC_HAIRSTYLE
  6468. UNPC_HAIRCOLOR
  6469. UNPC_HEADBOTTOM
  6470. UNPC_HEADMIDDLE
  6471. UNPC_HEADTOP
  6472. UNPC_CLOTHCOLOR
  6473. UNPC_SHIELD
  6474. UNPC_WEAPON
  6475. UNPC_ROBE
  6476. UNPC_BODY2
  6477. UNPC_DEADSIT
  6478. UNPC_GROUP_ID
  6479. *Notes:
  6480. - *_SIZE: small (0); medium (1); large (2)
  6481. - *_MAPID: this refers to the map_data index (from src/map/map.cpp), not the mapindex_db index (from src/common/mapindex.cpp)
  6482. -- For 'setunitdata', map name can also be passed in as a valid value instead of map ID
  6483. - *_SPEED: 20 - 1000
  6484. - *_MODE: see doc/mob_db_mode_list.txt
  6485. - *_LOOKDIR: north (0), northwest (1), west (2), etc
  6486. - *_CANMOVETICK: seconds * 1000 the unit will be unable to move
  6487. - *_DMGIMMUNE: unit will be immune to damage (1), or will receive damage (0)
  6488. - *_HUNGER: 0 - 100
  6489. - *_INTIMACY: 0 - 1000
  6490. - *_LIFETIME: seconds * 1000 the unit will be 'alive' for
  6491. - *_AMOTION: see doc/mob_db.txt
  6492. - *_ADELAY: see doc/mob_db.txt
  6493. - *_DMOTION: see doc/mob_db.txt
  6494. - *_BODY2: enable (1) the alternate display, or disable (0)
  6495. - *_TARGETID: when set to 0 the unit will release the target and stop attacking
  6496. - UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
  6497. - UMOB_SCOPTION: see the 'Variables' section at the top of this document
  6498. - UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0)
  6499. - UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreases all stats by given amount
  6500. - UNPC_DEADSIT: stand (0), dead (1), sit (2)
  6501. Example:
  6502. // Spawn some Porings and save the Game ID.
  6503. // - Keep in mind, when the 'monster' script command is used,
  6504. // - all the spawned monster GID's are stored in an array
  6505. // - called $@mobid[].
  6506. monster "prontera",149,190,"Poring",1002,10;
  6507. .GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!
  6508. // Save the strong Poring's mob data in the .@por_arr[] variable. (.@por_arr[1] being level, .@por_arr[13] being class, etc.)
  6509. // With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
  6510. getunitdata .GID,.@por_arr;
  6511. // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
  6512. setunitdata .GID,UMOB_MAXHP,1000;
  6513. ---------------------------------------
  6514. *geteleminfo <type>{,<char_id>};
  6515. Get info of elemental of attached player or player by char_id.
  6516. Other info can be obtained by 'getunitdata' command.
  6517. Valid types are:
  6518. 0: Elemental ID
  6519. 1: Elemental Game ID
  6520. ---------------------------------------
  6521. \\
  6522. 6,1.- End of unit-related commands
  6523. \\
  6524. ---------------------------------------
  6525. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  6526. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  6527. This command causes the attached NPC object to cast a skill on the attached
  6528. player. The skill will have no cast time or cooldown. The player must be
  6529. within the default skill range or the command will fail silently.
  6530. The "stat point" parameter temporarily sets all NPC stats to the given value,
  6531. and "NPC level" is the temporary level of the NPC (used in some skills).
  6532. Neither value can be greater than the max level defined in config, and will
  6533. not work properly if the NPC has a mob sprite.
  6534. Before using skills, NPCs must have basic stats applied to them depending on the
  6535. skill being used: UNPC_ATKMIN, UNPC_ATKMAX, UNPC_MATKMIN, UNPC_MATKMAX, UNPC_STR,
  6536. UNPC_AGI, UNPC_VIT, UNPC_INT, UNPC_DEX, UNPC_LUK.
  6537. See 'setunitdata' for more information on usage.
  6538. // Casts Level 10 Heal on the attached player, calculated with
  6539. // all stats 99 and base level 60.
  6540. npcskill "AL_HEAL",10,99,60;
  6541. ---------------------------------------
  6542. *day;
  6543. *night;
  6544. These two commands will switch the entire server between day and night mode
  6545. respectively. If your server is set to cycle between day and night by
  6546. configuration, it will eventually return to that cycle.
  6547. Example:
  6548. - script DayNight -1,{
  6549. OnClock0600:
  6550. day;
  6551. end;
  6552. OnInit:
  6553. // setting correct mode upon server start-up
  6554. if (gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
  6555. OnClock1800:
  6556. night;
  6557. end;
  6558. }
  6559. This script allows to emulate the day/night cycle as the server does, but also
  6560. allows triggering additional effects upon change, like announces, gifts, etc.
  6561. The day/night cycle set by configuration should be disabled when this script is used.
  6562. ---------------------------------------
  6563. *defpattern <set number>,"<regular expression pattern>","<event label>";
  6564. *activatepset <set number>;
  6565. *deactivatepset <set number>;
  6566. *deletepset <set number>;
  6567. This set of commands is only available if the server is compiled with regular
  6568. expressions library enabled. Default compilation and most binary distributions
  6569. aren't, which is probably bad, since these, while complex to use, are quite
  6570. fascinating.
  6571. They will make the NPC object listen for text spoken publicly by players and
  6572. match it against regular expression patterns, then trigger labels associated
  6573. with these regular expression patterns.
  6574. Patterns are organized into sets, which are referred to by a set number. You can
  6575. have multiple sets patterns, and multiple patterns may be active at once.
  6576. Numbers for pattern sets start at 1.
  6577. 'defpattern' will associate a given regular expression pattern with an event
  6578. label. This event will be triggered whenever something a player says is matched
  6579. by this regular expression pattern, if the pattern is currently active.
  6580. 'activatepset' will make the pattern set specified active. An active pattern
  6581. will enable triggering labels defined with 'defpattern', which will not happen
  6582. by default.
  6583. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  6584. set number in this case will deactivate all pattern sets defined.
  6585. 'deletepset' will delete a pattern set from memory, so you can create a new
  6586. pattern set in its place.
  6587. Using regular expressions is high wizardry. But with this high wizardry comes
  6588. unparalleled power of text manipulation. For an explanation of what a regular
  6589. expression pattern is, see a few web pages:
  6590. http://www.regular-expressions.info/
  6591. http://www.weitz.de/regex-coach/
  6592. For an example of this in use, see doc/sample/npc_test_pcre.txt
  6593. With this you could, for example, automatically punish players for asking for
  6594. Zeny in public places, or alternatively, automatically give them Zeny instead if
  6595. they want it so much.
  6596. ---------------------------------------
  6597. *pow(<number>,<power>)
  6598. Returns the result of the calculation.
  6599. Example:
  6600. .@i = pow(2,3); // .@i will be 8
  6601. ---------------------------------------
  6602. *sqrt(<number>)
  6603. Returns the square-root of a number.
  6604. Example:
  6605. .@i = sqrt(25); // .@i will be 5
  6606. ---------------------------------------
  6607. *distance(<x0>,<y0>,<x1>,<y1>)
  6608. Returns distance between 2 points.
  6609. Example:
  6610. .@i = distance(100,200,101,202);
  6611. ---------------------------------------
  6612. *min(<number or array>{,<number or array>,...})
  6613. *minimum(<number or array>{,<number or array>,...})
  6614. *max(<number or array>{,<number or array>,...})
  6615. *maximum(<number or array>{,<number or array>,...})
  6616. Returns the smallest (or biggest) from the set of given parameters.
  6617. These parameters have to be either numbers or number arrays.
  6618. Example:
  6619. .@minimum = min( 1, -6, -2, 8, 2 ); // .@minimum will be equal to -6
  6620. .@maximum = max( 0, 5, 10, 4 ); // .@maximum will be equal to 10
  6621. .@level = min( BaseLevel, 70 ); // .@level will be the character's base level, capped to 70
  6622. setarray .@testarray, 4, 5, 12, 6, 7, 3, 8, 9, 10;
  6623. .@minimum = min( .@testarray ); // .@minimum will be equal to 3
  6624. .@maximum = max( .@testarray ); // .@maximum will be equal to 12
  6625. .@minimum = min( -6, 1, 2, 3, .@testarray ); // .@minimum will be equal to -6
  6626. .@maximum = max( -6, 1, 2, 3, .@testarray ); // .@maximum will be equal to 12
  6627. ---------------------------------------
  6628. *cap_value(<number>, <min>, <max>)
  6629. Returns the number but capped between <min> and <max>.
  6630. Example:
  6631. // capped between 0 ~ 100
  6632. .@value = cap_value(10, 0, 100); // .@value will be equal to 10
  6633. .@value = cap_value(1000, 0, 100); // .@value will be equal to 100
  6634. .@value = cap_value(-10, 3, 100); // .@value will be equal to 3
  6635. ---------------------------------------
  6636. *round(<number>,<precision>);
  6637. *ceil(<number>,<precision>);
  6638. *floor(<number>,<precision>);
  6639. Returns <number> rounded to multiple of <precision>.
  6640. `round` function will round the <number> up if its division with <precision> yield a remainder
  6641. with a value equals to or more than half of <precision>. Otherwise, it rounds the <number> down.
  6642. `ceil` always round the <number> up.
  6643. `floor` always round the <number> down.
  6644. ---------------------------------------
  6645. *md5("<string>")
  6646. Returns the md5 checksum of a number or string.
  6647. Example:
  6648. mes md5(12345);
  6649. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  6650. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  6651. ---------------------------------------
  6652. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  6653. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  6654. Executes an SQL query. A 'select' query can fill array variables with up to 2 billion rows of
  6655. values, and will return the number of rows (i.e. array size) or -1 on failure.
  6656. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  6657. Example:
  6658. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  6659. mes "Hall Of Fame: TOP5";
  6660. mes "1." + .@name$[0] + "(" + .@fame[0] + ")"; // largest fame value.
  6661. mes "2." + .@name$[1] + "(" + .@fame[1] + ")";
  6662. mes "3." + .@name$[2] + "(" + .@fame[2] + ")";
  6663. mes "4." + .@name$[3] + "(" + .@fame[3] + ")";
  6664. mes "5." + .@name$[4] + "(" + .@fame[4] + ")";
  6665. ---------------------------------------
  6666. *escape_sql(<value>)
  6667. Converts the value to a string and escapes special characters so that it is safe to
  6668. use in query_sql(). Returns the escaped form of the given value.
  6669. Example:
  6670. .@name$ = "John's Laptop";
  6671. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  6672. ---------------------------------------
  6673. *setiteminfo(<item id>,<type>,<value>)
  6674. *setiteminfo(<aegis item name>,<type>,<value>)
  6675. This function will set some value of an item.
  6676. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  6677. Valid types are:
  6678. ITEMINFO_BUY (0) - Buy Price
  6679. ITEMINFO_SELL (1) - Sell Price
  6680. ITEMINFO_TYPE (2) - Type
  6681. ITEMINFO_MAXCHANCE (3) - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  6682. if = 0, then monsters don't drop it at all (rare or a quest item)
  6683. if = 10000, then this item is sold in NPC shops only
  6684. ITEMINFO_GENDER (4) - Gender
  6685. ITEMINFO_LOCATIONS (5) - Location(s)
  6686. ITEMINFO_WEIGHT (6) - Weight
  6687. ITEMINFO_ATTACK (7) - ATK
  6688. ITEMINFO_DEFENSE (8) - DEF
  6689. ITEMINFO_RANGE (9) - Range
  6690. ITEMINFO_SLOT (10) - Slot
  6691. ITEMINFO_VIEW (11) - View
  6692. ITEMINFO_EQUIPLEVELMIN (12) - equipment LV
  6693. ITEMINFO_WEAPONLEVEL (13) - weapon LV
  6694. ITEMINFO_ALIASNAME (14) - AliasName
  6695. ITEMINFO_EQUIPLEVELMAX (15) - equipment LV Max
  6696. ITEMINFO_MAGICATTACK (16) - matk if RENEWAL is defined
  6697. ITEMINFO_ARMORLEVEL (19) - armor LV
  6698. Example:
  6699. setiteminfo 7049,ITEMINFO_WEIGHT,9990; // Stone now weighs 999.0
  6700. ---------------------------------------
  6701. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  6702. Set a new script bonus to the Item. Very useful for game events.
  6703. You can remove an item's itemscript by leaving the itemscript argument empty.
  6704. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  6705. Type can optionally be used indicates which script to set (default is 0):
  6706. 0 - Script
  6707. 1 - EquipScript
  6708. 2 - UnEquipScript
  6709. Example:
  6710. setitemscript 2637,"{ if (isequipped(2236) == 0)end; if (getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  6711. setitemscript 2637,"";
  6712. ---------------------------------------
  6713. *atoi("<string>")
  6714. *axtoi("<string>")
  6715. *strtol("<string>", base)
  6716. These commands are used to convert strings to numbers. 'atoi' will interpret
  6717. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  6718. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  6719. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  6720. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  6721. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  6722. 32 bit int range (INT_MIN ~ INT_MAX).
  6723. Examples:
  6724. .@var = atoi("11"); // Sets .@var to 11
  6725. .@var = axtoi("FF"); // Sets .@var to 255
  6726. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  6727. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  6728. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  6729. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  6730. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  6731. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  6732. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  6733. ---------------------------------------
  6734. *compare("<string>","<substring>")
  6735. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  6736. This command is not case sensitive.
  6737. Examples:
  6738. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  6739. if (compare("Bloody Murderer","Blood"))
  6740. dothis;
  6741. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  6742. if (compare("Blood Butterfly","Bloody"))
  6743. dothat;
  6744. ---------------------------------------
  6745. *strcmp("<string>","<string>")
  6746. This command compares two strings are returns a value:
  6747. 1: string 1 > string 2
  6748. 0: strings are equal
  6749. -1: string 1 < string 2
  6750. ---------------------------------------
  6751. *getstrlen("<string>")
  6752. This function will return the length of the string given as an argument. It is
  6753. useful to check if anything input by the player exceeds name length limits and
  6754. other length limits and asking them to try to input something else.
  6755. ---------------------------------------
  6756. *charisalpha("<string>",<position>)
  6757. This function will return 1 if the character number Position in the given string
  6758. is a letter, 0 if it isn't a letter but a digit or a space.
  6759. The first letter is position 0.
  6760. ---------------------------------------
  6761. *charat(<string>,<index>)
  6762. Returns char at specified index. If index is out of range, returns empty string.
  6763. The first letter of a string is index 0.
  6764. Example:
  6765. charat("This is a string", 10); //returns "s"
  6766. ---------------------------------------
  6767. *setchar(<string>,<char>,<index>)
  6768. Returns the original string with the char at the specified index set to the
  6769. specified char. If index out of range, the original string will be returned.
  6770. Only the 1st char in the <char> parameter will be used.
  6771. Example:
  6772. setchar("Cat", "B", 0); //returns "Bat"
  6773. ---------------------------------------
  6774. *insertchar(<string>,<char>,<index>)
  6775. Returns the original string with the specified char inserted at the specified
  6776. index. If index is out of range, the char will be inserted on the end of the
  6777. string that it is closest. Only the 1st char in the <char> parameter will be used.
  6778. Example:
  6779. insertchar("laughter", "s", 0); //returns "slaughter"
  6780. ---------------------------------------
  6781. *delchar(<string>,<index>)
  6782. Returns the original string with the char at the specified index removed.
  6783. If index is out of range, original string will be returned.
  6784. Example:
  6785. delchar("Diet", 3); //returns "Die"
  6786. ---------------------------------------
  6787. *strtoupper(<string>)
  6788. *strtolower(<string>)
  6789. Returns the specified string in its uppercase/lowercase form.
  6790. All non-alpha characters will be preserved.
  6791. Example:
  6792. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  6793. ---------------------------------------
  6794. *charisupper(<string>,<index>)
  6795. *charislower(<string>,<index>)
  6796. Returns 1 if character at specified index of specified string is
  6797. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  6798. Example:
  6799. charisupper("rAthena", 1); //returns 1
  6800. ---------------------------------------
  6801. *substr(<string>,<start_index>,<end_index>)
  6802. Returns the sub-string of the specified string inclusively between the set
  6803. indexes. If indexes are out of range, or the start index is after the end
  6804. index, an empty string will be returned.
  6805. Example:
  6806. substr("foobar", 3, 5); //returns "bar"
  6807. ---------------------------------------
  6808. *explode(<dest_array>,<string>,<delimiter>)
  6809. Breaks a string up into substrings based on the specified delimiter. Substrings
  6810. will be stored within the specified string array. Only the 1st char of the
  6811. delimiter parameter will be used. If an empty string is passed as a delimiter,
  6812. the string will be placed in the array in its original form.
  6813. Example:
  6814. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  6815. //.@my_array$ contents will be...
  6816. //.@my_array$[0]: "Explode"
  6817. //.@my_array$[1]: "Test"
  6818. //.@my_array$[2]: "1965"
  6819. //.@my_array$[3]: "red"
  6820. //.@my_array$[4]: "PIE"
  6821. ---------------------------------------
  6822. *implode(<string_array>{,<glue>})
  6823. Combines all substrings within the specified string array into a single string.
  6824. If the glue parameter is specified, it will be inserted inbetween each substring.
  6825. Example:
  6826. setarray .@my_array$[0], "This", "is", "a", "test";
  6827. implode(.@my_array$, " "); //returns "This is a test"
  6828. ---------------------------------------
  6829. *sprintf(<format>[,param[,param[,...]]])
  6830. C style sprintf. The resulting string is returned same as in PHP. All C format
  6831. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  6832. The number of params is only limited by rA's script engine.
  6833. Example:
  6834. .@format$ = "The %s contains %d monkeys";
  6835. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  6836. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  6837. ---------------------------------------
  6838. *sscanf(<string>,<format>[,param[,param[,...]]])
  6839. C style sscanf. All C format specifiers are supported.
  6840. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  6841. by rA's script engine.
  6842. Example:
  6843. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  6844. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  6845. ---------------------------------------
  6846. *strpos(<haystack>,<needle>{,<offset>})
  6847. PHP style strpos. Finds a substring (needle) within a string (haystack).
  6848. The offset parameter indicates the index of the string to start searching.
  6849. Returns index of substring on successful search, else -1.
  6850. Comparison is case sensitive.
  6851. Example:
  6852. strpos("foobar", "bar", 0); //returns 3
  6853. strpos("foobarfoo", "foo", 0); //returns 0
  6854. strpos("foobarfoo", "foo", 1); //returns 6
  6855. ---------------------------------------
  6856. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  6857. Replaces all instances of a search string in the input with the specified
  6858. replacement string. By default is case sensitive unless <usecase> is set
  6859. to 0. If specified it will only replace as many instances as specified
  6860. in the count parameter.
  6861. Example:
  6862. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  6863. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  6864. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  6865. ---------------------------------------
  6866. *countstr(<input>, <search>{, <usecase>})
  6867. Counts all instances of a search string in the input. By default is case
  6868. sensitive unless <usecase> is set to 0.
  6869. Example:
  6870. countstr("test test test Test", "test"); //returns 3
  6871. countstr("cake Cake", "Cake", 0); //returns 2
  6872. ---------------------------------------
  6873. *preg_match(<regular expression pattern>,<string>{,<offset>})
  6874. Searches a string for a match to the regular expression provided. The
  6875. offset parameter indicates the index of the string to start searching.
  6876. Returns offsets to captured substrings, or 0 if no match is found.
  6877. This command is only available if the server is compiled with the regular
  6878. expressions library enabled.
  6879. ---------------------------------------
  6880. *setfont <font>;
  6881. This command sets the current RO client interface font to one of the
  6882. fonts stored in data\*.eot by using an ID of the font. When the ID
  6883. of the currently used font is used, default interface font is used
  6884. again.
  6885. 0 - Default
  6886. 1 - RixLoveangel
  6887. 2 - RixSquirrel
  6888. 3 - NHCgogo
  6889. 4 - RixDiary
  6890. 5 - RixMiniHeart
  6891. 6 - RixFreshman
  6892. 7 - RixKid
  6893. 8 - RixMagic
  6894. 9 - RixJJangu
  6895. ---------------------------------------
  6896. *showdigit <value>{,<type>};
  6897. Displays given numeric 'value' in large digital clock font on top of
  6898. the screen. The optional parameter 'type' specifies visual aspects
  6899. of the "clock" and can be one of the following values:
  6900. 0 - Displays the value for 5 seconds (default).
  6901. 1 - Incremental counter (1 tick/second).
  6902. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  6903. but overflows.
  6904. 3 - Decremental counter (2 ticks/second). Two digits only, stops
  6905. at zero.
  6906. Except for type 3 the value is interpreted as seconds and formatted
  6907. as time in days, hours, minutes and seconds. Note, that the official
  6908. script command does not have the optional parameter.
  6909. // displays 23:59:59 for 5 seconds
  6910. showdigit 86399;
  6911. // counter that starts at 60 and runs for 30 seconds
  6912. showdigit 60,3;
  6913. ---------------------------------------
  6914. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  6915. Each map cell has several 'flags' that specify the properties of that cell.
  6916. These include terrain properties (walkability, shootability, presence of water),
  6917. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  6918. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  6919. This command lets you alter these flags for all map cells in the specified
  6920. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  6921. The 'type' defines which flag to modify. Possible options see 'src/map/script_constants.hpp'.
  6922. Example:
  6923. setcell "arena",0,0,300,300,cell_basilica,1;
  6924. setcell "arena",140,140,160,160,cell_basilica,0;
  6925. setcell "arena",135,135,165,165,cell_walkable,0;
  6926. setcell "arena",140,140,160,160,cell_walkable,1;
  6927. This will add a makeshift ring into the center of the map. The ring will be
  6928. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  6929. the rest of the map will be marked as 'basilica', preventing observers from
  6930. casting any offensive skills or fighting among themselves. Note that the wall
  6931. will not be shown nor known client-side, which may cause movement problems.
  6932. Another example:
  6933. OnBarricadeDeploy:
  6934. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  6935. end;
  6936. OnBarricadeBreak:
  6937. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  6938. end;
  6939. This could be a part of the WoE:SE script, where attackers are not allowed
  6940. to proceed until all barricades are destroyed. This script would place and
  6941. remove a nonwalkable row of cells after the barricade mobs.
  6942. ---------------------------------------
  6943. *checkcell ("<map name>",<x>,<y>,<type>);
  6944. This command will return 1 or 0, depending on whether the specified cell has
  6945. the 'type' flag set or not. There are various types to check, all mimicking
  6946. the server's cell_chk enumeration. The types can be found in 'src/map/script_constants.hpp'.
  6947. The meaning of the individual types can be confusing, so here's an overview:
  6948. - cell_chkwall/water/cliff
  6949. these check directly for the 'terrain component' of the specified cell
  6950. - cell_chkpass/reach/nopass/noreach
  6951. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  6952. - cell_chknpc/basilica/landprotector/novending/nochat
  6953. these check for specific dynamic flags (their name indicates what they do)
  6954. Example:
  6955. mes "Pick a destination map.";
  6956. input .@map$;
  6957. mes "Alright, now give me the coordinates.";
  6958. input .@x;
  6959. input .@y;
  6960. if ( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  6961. mes "Can't warp you there, sorry!";
  6962. close;
  6963. } else {
  6964. mes "Ok, get ready...";
  6965. close2;
  6966. warp .@map$, .@x, .@y;
  6967. end;
  6968. }
  6969. ---------------------------------------
  6970. *getfreecell "<map name>",<rX>,<rY>{,<x>,<y>,<rangeX>,<rangeY>,<flag>};
  6971. Finds a free cell on the given map and stores the reference to the found cell
  6972. in <rX> and <rY>. Passing <x> and <y> with <rangeX> and <rangeY> allows for
  6973. searching within a specified area on the given map. The <flag> is a bitmask
  6974. and has the following possible values:
  6975. - 1 = Random cell on the map or from <x>,<y> range. (default)
  6976. - 2 = The target should be able to walk to the target tile.
  6977. - 4 = There shouldn't be any players around the target tile (use the no_spawn_on_player setting).
  6978. Examples:
  6979. getfreecell("prontera",.@x,.@y); // Find a random empty cell in Prontera and store it within .@x and .@y
  6980. getfreecell("prontera",.@x,.@y,150,150,5,5); // Find a random empty cell on 150,150 (with a range of 5x5) in Prontera and store it within .@x and .@y
  6981. ---------------------------------------
  6982. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  6983. *delwall "<name>";
  6984. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  6985. line of the given size in the given direction. The difference with setcell is
  6986. this one update client part too to avoid the glitch problem. Directions are the
  6987. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  6988. ---------------------------------------
  6989. *checkwall "<name>";
  6990. This command will return true if the wall with the given name exists, false otherwise.
  6991. ---------------------------------------
  6992. *readbook <book id>,<page>;
  6993. This command will open a book item at the specified page.
  6994. ---------------------------------------
  6995. *open_roulette( {char_id} )
  6996. Opens the roulette window for the currently attached character or the character
  6997. with the given character id.
  6998. ---------------------------------------
  6999. *naviregisterwarp("<Name of Link>", "<dest_map>", <dest_x>, <dest_y>)
  7000. Only useful when using the map-server-generator. Registers an extra warp from this
  7001. npc to the destination map/x/y for the generated client files.
  7002. ---------------------------------------
  7003. *navihide
  7004. Only useful when using the map-server-generator. Hides this npc and all links from
  7005. this npc in the navigation generation.
  7006. ---------------------------------------
  7007. ========================
  7008. |7.- Instance commands.|
  7009. ========================
  7010. ---------------------------------------
  7011. *instance_create("<instance name>"{,<instance mode>{,<owner id>}});
  7012. Creates an instance for the <owner id> of <mode>. The instance name, along with
  7013. all other instance data, is read from 'db/(pre-)re/instance_db.yml'. Upon success,
  7014. the command generates a unique instance ID, duplicates all listed maps and NPCs,
  7015. sets the alive time, and triggers the "OnInstanceInit" label in all NPCs inside
  7016. the instance.
  7017. Instance Mode options:
  7018. IM_NONE: Attached to no one.
  7019. IM_CHAR: Attached to a single character.
  7020. IM_PARTY: Attached to a party (default instance mode).
  7021. IM_GUILD: Attached to a guild.
  7022. IM_CLAN: Attached to a clan.
  7023. The command returns the instance ID upon success, and these values upon failure:
  7024. -1: Invalid type.
  7025. -2: Character/Party/Guild/Clan not found.
  7026. -3: Instance already exists.
  7027. -4: No free instances (MAX_INSTANCE exceeded).
  7028. ---------------------------------------
  7029. *instance_destroy {<instance id>};
  7030. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  7031. the script is attached to is used. If that fails, the script will come to a halt.
  7032. This will also trigger the "OnInstanceDestroy" label in all NPCs inside the instance.
  7033. ---------------------------------------
  7034. *instance_enter("<instance name>",{<x>,<y>,<char_id>,<instance id>});
  7035. Warps the attached player to the specified <instance id>. If no ID is specified,
  7036. the IM_PARTY instance the invoking player is attached to is used.
  7037. The map and coordinates are located in 'db/(pre-)re/instance_db.yml'.
  7038. The command returns IE_OK upon success, and these values upon failure:
  7039. IE_NOMEMBER: Party/Guild/Clan not found (for party/guild/clan modes).
  7040. IE_NOINSTANCE: Character/Party/Guild/Clan does not have an instance.
  7041. IE_OTHER: Other errors (invalid instance name, instance doesn't match with character/party/guild/clan).
  7042. Put -1 for x and y if want to warp player with default entrance coordinates.
  7043. ---------------------------------------
  7044. *instance_npcname("<npc name>"{,<instance id>})
  7045. Returns the unique name of the instanced script. If no ID is specified,
  7046. the instance the script is attached to is used. If that fails, the script
  7047. will come to a halt.
  7048. ---------------------------------------
  7049. *instance_mapname("<map name>"{,<instance id>})
  7050. Returns the unique name of the instanced map. If no instance ID is specified,
  7051. the instance the script is attached to is used. If that fails, the command
  7052. returns an empty string instead.
  7053. ---------------------------------------
  7054. *instance_id({<instance mode>})
  7055. Returns the unique instance ID of the given mode. By default it returns the
  7056. attached script instance. If <instance mode> is provided then the instance
  7057. of the currently attached player is used. If that fails, the function will return 0.
  7058. Instance Mode options:
  7059. IM_CHAR: Attached to character.
  7060. IM_PARTY: Attached to character's party.
  7061. IM_GUILD: Attached to character's guild.
  7062. IM_CLAN: Attached to character's clan.
  7063. ---------------------------------------
  7064. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  7065. Warps all players in the <instance id> to <map name> to the given coordinates.
  7066. If no ID is specified, the IM_PARTY instance the invoking player is attached
  7067. to is used. If that fails, the script will come to a halt.
  7068. ---------------------------------------
  7069. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  7070. Broadcasts a message to all players in the <instance id> currently residing on
  7071. an instance map. If 0 is specified for <instance id>, the instance the script
  7072. is attached to is used.
  7073. For details on the other parameters, see 'announce'.
  7074. ---------------------------------------
  7075. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  7076. This function checks if a party meets certain requirements, returning 1 if all
  7077. conditions are met and 0 otherwise. It will only check online characters.
  7078. amount - number of online party members (default is 1).
  7079. min - minimum level of all characters in the party (default is 1).
  7080. max - maximum level of all characters in the party (default is max level in conf).
  7081. Example:
  7082. if (instance_check_party(getcharid(1),2,2,149)) {
  7083. mes "Your party meets the Memorial Dungeon requirements.",
  7084. mes "All online members are between levels 1-150 and at least two are online.";
  7085. close;
  7086. } else {
  7087. mes "Sorry, your party does not meet requirements.";
  7088. close;
  7089. }
  7090. ---------------------------------------
  7091. *instance_check_guild(<guild id>{,<amount>{,<min>{,<max>}}})
  7092. This function checks if a guild meets certain requirements, returning 1 if all
  7093. conditions are met and 0 otherwise. It will only check online characters.
  7094. amount - number of online guild members (default is 1).
  7095. min - minimum level of all characters in the guild (default is 1).
  7096. max - maximum level of all characters in the guild (default is max level in conf).
  7097. Example:
  7098. if (instance_check_guild(getcharid(2),2,2,149)) {
  7099. mes "Your guild meets the Memorial Dungeon requirements.",
  7100. mes "All online members are between levels 1-150 and at least two are online.";
  7101. close;
  7102. } else {
  7103. mes "Sorry, your guild does not meet requirements.";
  7104. close;
  7105. }
  7106. ---------------------------------------
  7107. *instance_check_clan(<clan id>{,<amount>{,<min>{,<max>}}})
  7108. This function checks if a clan meets certain requirements, returning 1 if all
  7109. conditions are met and 0 otherwise. It will only check online characters.
  7110. amount - number of online clan members (default is 1).
  7111. min - minimum level of all characters in the clan (default is 1).
  7112. max - maximum level of all characters in the clan (default is max level in conf).
  7113. Example:
  7114. if (instance_check_clan(getcharid(5),2,2,149)) {
  7115. mes "Your clan meets the Memorial Dungeon requirements.",
  7116. mes "All online members are between levels 1-150 and at least two are online.";
  7117. close;
  7118. } else {
  7119. mes "Sorry, your clan does not meet requirements.";
  7120. close;
  7121. }
  7122. ---------------------------------------
  7123. *instance_info("<instance name>",<info type>{,<instance_db map index>});
  7124. Returns the specified <info type> of the given <instance name> from the instance database.
  7125. If the <instance name> is unknown or an invalid <info type> is supplied -1 will be returned.
  7126. Valid info types:
  7127. IIT_ID: Instance database ID as integer.
  7128. IIT_TIME_LIMIT: Instance database total life time as integer.
  7129. IIT_IDLE_TIMEOUT: Instance database timeout time as integer.
  7130. IIT_ENTER_MAP: Instance database enter map as string.
  7131. IIT_ENTER_X: Instance database enter X location as integer.
  7132. IIT_ENTER_Y: Instance database enter Y location as integer.
  7133. IIT_MAPCOUNT: Instance database total maps as integer.
  7134. IIT_MAP: Instance database map name from the given <instance_db map index> as string.
  7135. If the index is invalid an empty string will be returned.
  7136. Example:
  7137. .@name$ = "Endless Tower";
  7138. mes .@name$ + " will be destroyed if no one is in the instance for " + instance_info(.@name$,IIT_IDLETIMEOUT) + " seconds.";
  7139. // Endless Tower will be destroyed if no one is in the instance for 300 seconds.
  7140. ---------------------------------------
  7141. *instance_live_info(<info type>{,<instance id>});
  7142. Returns the specified <info type> of instance attached to the npc or, if
  7143. an instance ID is specified, of that instance.
  7144. Valid <info type>:
  7145. ILI_NAME - Instance Name
  7146. Return the name of the instance or "" if that fails.
  7147. ILI_MODE - Instance Mode
  7148. Return IM_NONE, IM_CHAR, IM_PARTY, IM_GUILD, IM_CLAN or -1 if that fails.
  7149. ILI_OWNER - Owner ID
  7150. Return an ID according to the instance mode of the instance attached/specified or -1 if that fails.
  7151. When the instance mode is IM_NONE, ILI_OWNER will return the npc ID that created the instance,
  7152. IM_CHAR - the owner char ID
  7153. IM_PARTY - the party ID
  7154. IM_GUILD - the guild ID
  7155. IM_CLAN - the clan ID
  7156. Examples:
  7157. // Return the instance name of the instance attached to the npc.
  7158. .@instance_name$ = instance_live_info(ILI_NAME);
  7159. // Return the guild owner ID of the given instance ID.
  7160. .@owner = instance_live_info(ILI_OWNER, instance_id(IM_GUILD));
  7161. ---------------------------------------
  7162. *instance_list(<"map name">{,<instance mode>});
  7163. Creates the array '.@instance_list' with possible instance IDs for the given <map name> and optional <mode>.
  7164. Return '.@instance_list' array size.
  7165. Instance mode options: IM_NONE, IM_CHAR, IM_PARTY, IM_GUILD, or IM_CLAN
  7166. If the instance mode is not provided then it will return all the instance IDs for that map.
  7167. Examples:
  7168. // This example assumes that there are several instances on the map of Prontera.
  7169. .@size = instance_list("prontera");
  7170. for ( .@i = 0; .@i < .@size; ++.@i )
  7171. mes instance_mapname("prontera", .@instance_list[.@i]);
  7172. //the output would be a list of all prontera copies that are active in the server.
  7173. ---------------------------------------
  7174. *getinstancevar(<variable>,<instance id>);
  7175. Returns a reference to an instance variable (' prefix) of the specific instance ID.
  7176. This can only be used to get ' variables.
  7177. Examples:
  7178. // This will set the .@s variable to the value of 'var variable of the specific instance ID.
  7179. set .@s, getinstancevar('var, instance_id(IM_PARTY));
  7180. // This will set the 'var variable of the specific instance ID to 1.
  7181. set getinstancevar('var, instance_id(IM_GUILD)), 1;
  7182. ---------------------------------------
  7183. *setinstancevar(<variable>,<value>,<instance id>);
  7184. This command will set an instance variable to the value that the expression results in.
  7185. See 'set' command for more information.
  7186. Returns the variable reference.
  7187. Examples:
  7188. // This will set the 'var variable of the specific instance ID to 9.
  7189. setinstancevar('var, 9, instance_id(IM_GUILD));
  7190. ---------------------------------------
  7191. =========================
  7192. |8.- Quest Log commands.|
  7193. =========================
  7194. ---------------------------------------
  7195. *questinfo <Icon>{,<Map Mark Color>{,"<condition>"}};
  7196. This command should only be used in OnInit/OnInstanceInit labels.
  7197. Show an emotion on top of a NPC, and optionally, a colored mark in the mini-map like "viewpoint" or "viewpointmap".
  7198. When a user is doing some action, each NPC is checked for questinfo that has been set on the map.
  7199. If questinfo is present, it will check if the player fulfill the condition.
  7200. If he/she does or no condition has been set, the bubble will appear.
  7201. Available <Icon>:
  7202. No Icon : QTYPE_NONE
  7203. ! Quest Icon : QTYPE_QUEST
  7204. ? Quest Icon : QTYPE_QUEST2
  7205. ! Job Icon : QTYPE_JOB
  7206. ? Job Icon : QTYPE_JOB2
  7207. ! Event Icon : QTYPE_EVENT
  7208. ? Event Icon : QTYPE_EVENT2
  7209. Warg : QTYPE_WARG (Only for packetver < 20170315)
  7210. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410 and < 20170315)
  7211. Click Me : QTYPE_CLICKME (Only for packetver >= 20170315)
  7212. Daily Quest : QTYPE_DAILYQUEST (Only for packetver >= 20170315)
  7213. ! Event Icon : QTYPE_EVENT3 (Only for packetver >= 20170315)
  7214. Job Quest : QTYPE_JOBQUEST (Only for packetver >= 20170315)
  7215. Jumping Poring : QTYPE_JUMPING_PORING (Only for packetver >= 20170315)
  7216. <Map Mark Color>, when used, creates a mark in the user's mini map on the position of the NPC,
  7217. the available color values are:
  7218. QMARK_NONE - No Marker (default)
  7219. QMARK_YELLOW - Yellow Marker
  7220. QMARK_GREEN - Green Marker
  7221. QMARK_PURPLE - Purple Marker
  7222. <condition> can be any expression similarly to the <condition> in the 'if' command.
  7223. List of the player's actions to trigger the questinfo condition:
  7224. - Item added to/removed from player inventory
  7225. - Base/Job level change
  7226. - Job change
  7227. - Quest given/erased/completed
  7228. - Quest objective updated (character killed a monster quest target)
  7229. - Warp
  7230. Example:
  7231. izlude,100,100,4 script Test 844,{
  7232. mes "[Test]";
  7233. mes "Hello World.";
  7234. close;
  7235. OnInit:
  7236. // Display an icon if the player has completed the given hunting quest and his/her variable 'unknown_var' is above 0
  7237. questinfo QTYPE_QUEST, QMARK_YELLOW, "checkquest(1001,HUNTING) == 2 && unknown_var > 0";
  7238. //.. or display an icon if the player didn't start the given quest and he/she has one red potion in inventory
  7239. questinfo QTYPE_QUEST, QMARK_YELLOW, "!isbegin_quest(1001) && countitem(501) == 1";
  7240. end;
  7241. }
  7242. ---------------------------------------
  7243. *questinfo_refresh {<char_id>};
  7244. This command refreshes each quest bubble that has been set on the map according
  7245. to the questinfo condition for the attached/given player.
  7246. ---------------------------------------
  7247. *setquest <ID>{,<char_id>};
  7248. Place quest of <ID> in the users quest log, the state of which is "active".
  7249. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  7250. ---------------------------------------
  7251. *completequest <ID>{,<char_id>};
  7252. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  7253. ---------------------------------------
  7254. *erasequest <ID>{,<char_id>};
  7255. Remove the quest of the given <ID> from the user's quest log.
  7256. ---------------------------------------
  7257. *changequest <ID>,<ID2>{,<char_id>};
  7258. Remove quest of the given <ID> from the user's quest log.
  7259. Add quest of the <ID2> to the the quest log, and the state is "active".
  7260. ---------------------------------------
  7261. *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}})
  7262. If no additional argument supplied, return the state of the quest:
  7263. -1 = Quest not started (not in quest log)
  7264. 0 = Quest has been given, but the state is "inactive"
  7265. 1 = Quest has been given, and the state is "active"
  7266. 2 = Quest completed
  7267. If parameter "PLAYTIME" is supplied:
  7268. -1 = Quest not started (not in quest log)
  7269. 0 = the time limit has not yet been reached
  7270. 1 = the time limit has not been reached but the quest is marked as complete
  7271. 2 = the time limit has been reached
  7272. If parameter "HUNTING" is supplied:
  7273. -1 = Quest not started (not in quest log)
  7274. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  7275. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  7276. 2 = you've killed all of the target monsters
  7277. ---------------------------------------
  7278. *isbegin_quest(<ID>{,<char_id>})
  7279. Return the state of the quest:
  7280. 0 = Quest not started (not in quest log)
  7281. 1 = Quest has been given (state is either "inactive" or "active")
  7282. 2 = Quest completed
  7283. ---------------------------------------
  7284. *showevent <icon>{,<mark color>{,<char_id>}}
  7285. Show an emotion on top of a NPC, and optionally,
  7286. a colored mark in the mini-map like "viewpoint" or "viewpointmap".
  7287. This is used to indicate that a NPC has a quest or an event to
  7288. a certain player.
  7289. Available Icons:
  7290. Remove Icon : QTYPE_NONE
  7291. ! Quest Icon : QTYPE_QUEST
  7292. ? Quest Icon : QTYPE_QUEST2
  7293. ! Job Icon : QTYPE_JOB
  7294. ? Job Icon : QTYPE_JOB2
  7295. ! Event Icon : QTYPE_EVENT
  7296. ? Event Icon : QTYPE_EVENT2
  7297. Warg : QTYPE_WARG
  7298. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  7299. Mark Color:
  7300. QMARK_NONE - No Marker (default)
  7301. QMARK_YELLOW - Yellow Marker
  7302. QMARK_GREEN - Green Marker
  7303. QMARK_PURPLE - Purple Marker
  7304. ---------------------------------------
  7305. *open_quest_ui {<quest ID>,{<char ID>}};
  7306. Opens the quest UI for the attached player or the given character ID.
  7307. Use 0 as the quest ID to open the main quest UI. If the quest ID is not 0 then the quest UI is opened to the given quest. If the quest data is not populated in the client LUB then a message will be displayed saying the quest doesn't exist.
  7308. This command requires packet version 2015-12-02 or newer.
  7309. ---------------------------------------
  7310. ============================
  7311. |9.- Battleground commands.|
  7312. ============================
  7313. ---------------------------------------
  7314. *waitingroom2bg_single(<battle group>,{"<map name>",<x>,<y>{,"<npc name>"}});
  7315. Adds the first waiting player from the chat room of the given NPC to an existing battleground group.
  7316. The player will also be warped to the default spawn point of the battle group or to the specified coordinates
  7317. <x> and <y> on the given <map>.
  7318. Note: The map need the mapflag MF_BATTLEGROUND otherwise the player is removed from the Battleground team.
  7319. ---------------------------------------
  7320. *waitingroom2bg("<map name>",<x>,<y>,{"<On Quit Event>","<On Death Event>"{,"<NPC Name>"}});
  7321. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  7322. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  7323. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  7324. If "-" is supplied for <map name> then the player will not automatically respawn after the 1 second delay.
  7325. This allows for better manipulation of <On Death Event>. The player will have to be warped to desired location
  7326. at the end of <On Death Event>.
  7327. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  7328. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  7329. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  7330. Example:
  7331. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  7332. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  7333. end;
  7334. ---------------------------------------
  7335. *bg_create("<map name>",<x>,<y>{,"<On Quit Event>","<On Death Event>"});
  7336. Creates an instance of battleground battle group that can be used with other battleground commands.
  7337. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  7338. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  7339. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  7340. If "-" is supplied for <map name> then the player will not automatically respawn after the 1 second delay.
  7341. This allows for better manipulation of <On Death Event>. The player will have to be warped to desired location
  7342. at the end of <On Death Event>.
  7343. Returns battle group ID on success. Returns 0 on failure.
  7344. ---------------------------------------
  7345. *bg_join(<battle group>,{"<map name>",{<x>,<y>{,<char id>}});
  7346. Adds an attached player or <char id> if specified to an existing battleground group. The player will also be warped
  7347. to the default spawn point of the battle group or to the specified coordinates <x> and <y> on the given <map>.
  7348. Note: The map need the mapflag MF_BATTLEGROUND otherwise the player is removed from the Battleground team.
  7349. Returns true on success. Returns false on failure.
  7350. ---------------------------------------
  7351. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  7352. Updates the respawn point of the given Battle Group to x,y on the same map. <Battle Group ID> can be retrieved
  7353. using getcharid(4).
  7354. Example:
  7355. bg_team_setxy getcharid(4),56,212;
  7356. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  7357. end;
  7358. ---------------------------------------
  7359. *bg_reserve("<battleground_map_name>"{,<ended>});
  7360. Reserves a Battleground map for the Battleground UI System. When a map is booked it prevents another similar
  7361. queue from being created and will allow players to join an active Battlegrounds event.
  7362. If <ended> is true, then the Battleground is marked as over to prevent new players from joining. This state is meant
  7363. for the period where players can get their Badges.
  7364. ---------------------------------------
  7365. *bg_unbook("<battleground_map_name>");
  7366. Removes a Battleground map for the Battleground UI System. When a map is unbooked it allows a queue to be created.
  7367. ---------------------------------------
  7368. *bg_desert({<char_id>});
  7369. Same as 'bg_leave' but slaps the player with a deserter status so they can't enter another queue for the time
  7370. defined in battleground_db (10 minutes by default).
  7371. With the Battleground Queue System, it will also warp the player to their previous position when they joined or
  7372. to their save point if the map had MF_NOSAVE.
  7373. ---------------------------------------
  7374. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  7375. Similar to the 'warp' command.
  7376. Places all members of <Battle Group> at the specified map and coordinates.
  7377. Example:
  7378. //place the battle group one for Tierra Gorge at starting position.
  7379. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  7380. end;
  7381. ---------------------------------------
  7382. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  7383. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  7384. Similar to the 'monster' command.
  7385. Spawns a monster with allegiance to the given Battle Group.
  7386. Does not allow for the summoning of multiple monsters.
  7387. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  7388. Example:
  7389. // It can be used in two different ways.
  7390. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  7391. end;
  7392. // Alternatively, you can set an ID for the monster using "set".
  7393. // This becomes useful when used with the command below.
  7394. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  7395. end;
  7396. ---------------------------------------
  7397. *bg_monster_set_team <GID>,<Battle Group>;
  7398. This command will change the allegiance if a monster in a battle ground.
  7399. GID can be set when spawning the monster via the 'bg_monster' command.
  7400. Example:
  7401. end;
  7402. OnEnable:
  7403. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  7404. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  7405. initnpctimer;
  7406. end;
  7407. OnTimer1000:
  7408. stopnpctimer;
  7409. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  7410. bg_monster_set_team $@Guardian, $@BG_1;
  7411. end;
  7412. ---------------------------------------
  7413. *bg_leave {<char_id>};
  7414. Removes attached player from their Battle Group.
  7415. With the Battleground Queue System, it will also warp the player to their previous position when they joined or
  7416. to their save point if the map had MF_NOSAVE.
  7417. ---------------------------------------
  7418. *bg_destroy <Batte Group>;
  7419. Destroys the Battle Group created for that battle ground.
  7420. ---------------------------------------
  7421. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  7422. Restores a percentage of the maximum HP/SP of players within a defined area.
  7423. This is primarily used in battleground scripts, but is not limited to them.
  7424. Example:
  7425. areapercentheal "bat_a01",52,208,61,217,100,100;
  7426. end;
  7427. ---------------------------------------
  7428. *bg_get_data(<Battle Group>,<type>);
  7429. Retrieves data related to given Battle Group. Type can be one of the following:
  7430. 0 - Amount of players currently belonging to the group.
  7431. 1 - Store GID of players in <Battle Group> in a temporary global array $@arenamembers,
  7432. stores and also returns the amount of players currently belonging to the group in $@arenamemberscount.
  7433. ---------------------------------------
  7434. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  7435. Retrieves the amount of players belonging to the given Battle Group on the given
  7436. map within the specified rectangular area.
  7437. ---------------------------------------
  7438. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  7439. This command will force the update of the displayed scoreboard.
  7440. It is only usable when the map is defined as a Type 2 Battleground:
  7441. mapflag <map name> battleground 2
  7442. ---------------------------------------
  7443. *bg_info("<battleground name>", <type>);
  7444. Retrieves data related to given <battleground name> from the database. Requires feature.bgqueue
  7445. to be enabled. <Type> can be one of the following:
  7446. BG_INFO_ID: Battleground ID.
  7447. BG_INFO_REQUIRED_PLAYERS: Required players to start a battleground (per side).
  7448. BG_INFO_MAX_PLAYERS: Maximum players allowed in a battleground.
  7449. BG_INFO_MIN_LEVEL: Minimum level allowed to join a battleground.
  7450. BG_INFO_MAX_LEVEL: Maximum level allowed to join a battleground.
  7451. BG_INFO_MAPS: Number of maps in a battleground. Stores an array of map names in @bgmaps[] and a count in @bgmapscount.
  7452. BG_INFO_DESERTER_TIME: Amount of time in seconds a player is marked deserter.
  7453. ---------------------------------------
  7454. ====================
  7455. |10.- Pet commands.|
  7456. ====================
  7457. ---------------------------------------
  7458. *bpet;
  7459. *birthpet;
  7460. This command opens up a pet hatching window on the client connected to the
  7461. invoking character. It is used in item script for the pet incubators and will
  7462. let the player hatch an owned egg. If the character has no eggs, it will just
  7463. open up an empty incubator window.
  7464. This is still usable outside item scripts.
  7465. ---------------------------------------
  7466. *pet <pet id>;
  7467. *catchpet <pet id>;
  7468. This command is used in all the item scripts for taming items. Running this
  7469. command will make the pet catching cursor appear on the client connected to the
  7470. invoking character, usable on the monsters with the specified pet ID number. It
  7471. will still work outside an item script.
  7472. If the <pet id> is PET_CATCH_UNIVERSAL the item will attempt to catch the targeted
  7473. monster as long as it is in the pet database and does not have the MD_STATUS_IMMUNE
  7474. monster mode.
  7475. If the <pet id> is PET_CATCH_UNIVERSAL_ITEM the item will attempt to catch the targeted
  7476. monster as long as it is in the pet database and the targeted monster requires the lure
  7477. item used.
  7478. See 'doc/mob_db_mode_list.txt' for more information about monster modes.
  7479. A full list of pet IDs can be found inside 'db/(pre-)re/pet_db.yml'.
  7480. ---------------------------------------
  7481. *makepet <pet id>;
  7482. This command will create a pet egg and put it in the invoking character's
  7483. inventory. The kind of pet is specified by pet ID numbers listed in
  7484. 'db/(pre-)re/pet_db.yml'. The egg is created exactly as if the character just successfully
  7485. caught a pet in the normal way.
  7486. // This will make you a poring:
  7487. makepet 1002;
  7488. Notice that you absolutely have to create pet eggs with this command. If you try
  7489. to give a pet egg with 'getitem', pet data will not be created by the char
  7490. server and the egg will disappear when anyone tries to hatch it.
  7491. ---------------------------------------
  7492. *getpetinfo(<type>{,<char_id>})
  7493. This function will return pet information for the pet the invoking character
  7494. currently has active. Valid types are:
  7495. PETINFO_ID - Pet ID
  7496. PETINFO_CLASS - Pet class number as per 'db/(pre-)re/pet_db.yml' - will tell you what kind of a pet it is.
  7497. PETINFO_NAME - Pet name. Will return "null" if there's no pet.
  7498. PETINFO_INTIMATE - Pet friendly level (intimacy score). 1000 is full loyalty.
  7499. PETINFO_HUNGRY - Pet hungry level. 100 is full hunger.
  7500. PETINFO_RENAMED - Pet rename flag. 0 means this pet has not been named yet.
  7501. PETINFO_LEVEL - Pet level
  7502. PETINFO_BLOCKID - Pet Game ID
  7503. PETINFO_EGGID - Pet egg item ID
  7504. PETINFO_FOODID - Pet food item ID
  7505. PETINFO_INTIMATE can be used with the following constants for checking values:
  7506. PET_INTIMATE_NONE = 0
  7507. PET_INTIMATE_AWKWARD = 1 ~ 99
  7508. PET_INTIMATE_SHY = 100 ~ 249
  7509. PET_INTIMATE_NEUTRAL = 250 ~ 749
  7510. PET_INTIMATE_CORDIAL = 750 ~ 909
  7511. PET_INTIMATE_LOYAL = 910 ~ 1000
  7512. PETINFO_HUNGRY can be used with the following constants for checking values:
  7513. PET_HUNGRY_NONE = 0
  7514. PET_HUNGRY_VERY_HUNGRY = 1 ~ 10
  7515. PET_HUNGRY_HUNGRY = 11 ~ 25
  7516. PET_HUNGRY_NEUTRAL = 26 ~ 75
  7517. PET_HUNGRY_SATISFIED = 76 ~ 90
  7518. PET_HUNGRY_STUFFED = 91 ~ 100
  7519. Example:
  7520. mes "[Vet]";
  7521. mes "Your pet + " getpetinfo(PETINFO_NAME);
  7522. if (getpetinfo(PETINFO_INTIMATE) < PET_INTIMATE_LOYAL)
  7523. mes "has some growing to do on you!";
  7524. else
  7525. mes "seems to love you very much!";
  7526. close;
  7527. ---------------------------------------
  7528. =============================
  7529. |10.1.- The Pet AI commands.|
  7530. =============================
  7531. ---------------------------------------
  7532. These commands will only work if the invoking character has a pet, and are meant
  7533. to be executed from pet scripts. They will modify the pet AI decision-making for
  7534. the current pet of the invoking character, and will NOT have any independent
  7535. effect by themselves, which is why only one of them each may be in effect at any
  7536. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  7537. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport'.
  7538. All commands with delays and durations will only make the behavior active for
  7539. the specified duration of seconds, with a delay of the specified number of
  7540. seconds between activations. Rates are a chance of the effect occurring and are
  7541. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  7542. at the maximum possible.
  7543. The behavior modified with the below mentioned commands will only be exhibited if
  7544. the pet is loyal and appropriate configuration options are set in
  7545. 'battle_athena.conf'.
  7546. Pet scripts in the database normally run whenever a pet of that type hatches
  7547. from the egg. Other commands usable in item scripts (see 'bonus') will also
  7548. happily run from pet scripts. Apparently, the pet-specific commands will also
  7549. work in NPC scripts and modify the behavior of the current pet up until the pet
  7550. is hatched again. (Which will also occur when the character is logged in again
  7551. with the pet still out of the egg.) It is not certain for how long the effect of
  7552. such command running from an NPC script will eventually persist, but apparently,
  7553. it is possible to usefully employ them in usable item scripts to create pet
  7554. buffing items.
  7555. Nobody tried this before, so you're essentially on your own here.
  7556. ---------------------------------------
  7557. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  7558. This command will make the pet give a bonus to the owner's stat in certain
  7559. duration in seconds and will be repeated for certain delay in seconds.
  7560. For a full bonus list, see 'doc/item_bonus.txt'
  7561. NOTE: Currently ONLY supported for bonuses that used by 'bonus' script.
  7562. ---------------------------------------
  7563. *petrecovery <status type>,<delay>;
  7564. This command will make the pet cure a specified status condition. The curing
  7565. actions will occur once every Delay seconds. For a full list of status
  7566. conditions that can be cured, see the list of 'SC_' status condition constants
  7567. in 'src/map/script_constants.hpp'.
  7568. ---------------------------------------
  7569. *petloot <max items>;
  7570. This command will turn on pet looting, with a maximum number of items to loot
  7571. specified. Pet will store items and return them when the maximum is reached or
  7572. when pet performance is activated.
  7573. ---------------------------------------
  7574. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  7575. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  7576. This will make the pet use a specified support skill on the owner whenever the
  7577. HP and SP are below the given percent values, with a specified delay time
  7578. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.yml'.
  7579. It's not quite certain who's stats will be used for the skills cast, the
  7580. character's or the pets. Probably, Skotlex can answer that question.
  7581. ---------------------------------------
  7582. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  7583. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  7584. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  7585. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  7586. These two commands will make the pet cast an attack skill on the enemy the pet's
  7587. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  7588. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  7589. inflicted and the specified number of attacks.
  7590. Value of 'rate' is between 1 and 100. 100 = 100%
  7591. ---------------------------------------
  7592. *petautobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  7593. *petautobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  7594. *petautobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  7595. *petautobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  7596. See 'autobonus' for more details.
  7597. ---------------------------------------
  7598. ===========================
  7599. |11.- Homunculus commands.|
  7600. ===========================
  7601. ---------------------------------------
  7602. *homevolution;
  7603. This command will try to evolve the current player's homunculus.
  7604. If it doesn't work, the /swt emotion is shown.
  7605. To evolve a homunculus, the invoking player must have a homunculus,
  7606. the homunculus must not be the last evolution and
  7607. the homunculus must have above 91000 intimacy with its owner.
  7608. ---------------------------------------
  7609. *morphembryo;
  7610. This command will try to put the invoking player's Homunculus in an
  7611. uncallable state, required for mutation into a Homunculus S. The player
  7612. will also receive a Strange Embryo (ID 6415) in their inventory if
  7613. successful, which is deleted upon mutation.
  7614. The command will fail if the invoking player does not have an evolved
  7615. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  7616. Returns 1 upon success and 0 for all failures.
  7617. ---------------------------------------
  7618. *hommutate {<ID>};
  7619. This command will try to mutate the invoking player's Homunculus into
  7620. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  7621. The command will fail if the invoking player does not have an evolved
  7622. Homunculus at level 99 or above, if it is not in the embryo state
  7623. (from the 'morphembryo' command), or if the invoking player does not
  7624. possess a Strange Embryo. The /swt emotion is shown upon failure.
  7625. If the optional parameter <ID> is set, the invoking player's Homunculus
  7626. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  7627. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  7628. Returns 1 upon success and 0 for all failures.
  7629. ---------------------------------------
  7630. *checkhomcall()
  7631. This function checks if the attached player's Homunculus is active,
  7632. and will return the following values:
  7633. -1: The player has no Homunculus.
  7634. 0: The player's Homunculus is active.
  7635. 1: The player's Homunculus is vaporized.
  7636. 2: The player's Homunculus is in morph state.
  7637. ---------------------------------------
  7638. *gethominfo(<type>{,<char_id>})
  7639. This function will return Homunculus information for the Homunculus of the
  7640. invoking character, regardless of its vaporize state. It returns zero or
  7641. "null" if the player does not own a Homunculus.
  7642. Valid types are:
  7643. 0 - Homunculus ID
  7644. 1 - Homunculus Class
  7645. 2 - Homunculus Name
  7646. 3 - Homunculus friendly level (intimacy score). 100000 is full loyalty.
  7647. 4 - Homunculus hungry level. 100 is completely full.
  7648. 5 - Homunculus rename flag. 0 means this homunculus has not been named yet.
  7649. 6 - Homunculus level
  7650. 7 - Homunculus Game ID
  7651. ---------------------------------------
  7652. *homshuffle;
  7653. This will recalculate the homunculus stats according to its level, of the
  7654. current invoking character.
  7655. ---------------------------------------
  7656. *addhomintimacy <amount>{,<char_id>};
  7657. Increase or decrease a homunculus' intimacy value by the given <amount>. 100000 is full loyalty.
  7658. ---------------------------------------
  7659. ==========================
  7660. |12.- Mercenary commands.|
  7661. ==========================
  7662. ---------------------------------------
  7663. *mercenary_create <class>,<contract time>;
  7664. This command summons a mercenary for a given time (in milliseconds). For a
  7665. list of all available classes, see 'db/mercenary_db.txt'.
  7666. This command is typically used in item scripts of mercenary scrolls.
  7667. ---------------------------------------
  7668. *mercenary_delete {<char id>{,<reply>}};
  7669. This command removes the mercenary from a player.
  7670. The parameter 'reply' can be one of the following values:
  7671. 0 - Mercenary soldier's duty hour is over, faith increased by 1. (default)
  7672. 1 - Your mercenary soldier has been killed, faith decreased by 1.
  7673. 2 - Your mercenary soldier has been fired.
  7674. 3 - Your mercenary soldier has ran away.
  7675. ---------------------------------------
  7676. *mercenary_heal <hp>,<sp>;
  7677. This command works like 'heal', but affects the mercenary of the
  7678. currently attached character.
  7679. ---------------------------------------
  7680. *mercenary_sc_start <type>,<tick>,<val1>;
  7681. This command works like 'sc_start', but affects the mercenary of the
  7682. currently attached character.
  7683. ---------------------------------------
  7684. *mercenary_get_calls(<guild>);
  7685. *mercenary_set_calls <guild>,<value>;
  7686. Sets or gets the mercenary calls value for given guild for currently
  7687. attached character. Guild can be one or the following constants:
  7688. ARCH_MERC_GUILD
  7689. SPEAR_MERC_GUILD
  7690. SWORD_MERC_GUILD
  7691. ---------------------------------------
  7692. *mercenary_get_faith(<guild>);
  7693. *mercenary_set_faith <guild>,<value>;
  7694. Sets or gets the mercenary faith value for given guild for currently
  7695. attached character. Guild can be one or the following constants:
  7696. ARCH_MERC_GUILD
  7697. SPEAR_MERC_GUILD
  7698. SWORD_MERC_GUILD
  7699. ---------------------------------------
  7700. *getmercinfo(<type>{,<char id>});
  7701. Retrieves information about mercenary of the currently attached
  7702. character. If char id is given, the information of that character is
  7703. retrieved instead. Type specifies what information to retrieve and
  7704. can be one of the following:
  7705. 0 - Mercenary ID
  7706. 1 - Mercenary Class
  7707. 2 - Mercenary Name
  7708. 3 - Mercenary faith value for this mercenary's guild, if any
  7709. 4 - Mercenary calls value for this mercenary's guild, if any
  7710. 5 - Mercenary kill count
  7711. 6 - Mercenary remaining life time in msec
  7712. 7 - Mercenary level
  7713. 8 - Mercenary Game ID
  7714. If the character does not have a mercenary, the command returns ""
  7715. for name and 0 for all other types.
  7716. ---------------------------------------
  7717. ======================
  7718. |13.- Party commands.|
  7719. ======================
  7720. ---------------------------------------
  7721. *getpartyname(<party id>)
  7722. This function will return the name of a party that has the specified ID number.
  7723. If there is no such party ID, "null" will be returned.
  7724. Lets say the ID of a party was saved as a global variable:
  7725. // This would return the name of the party from the ID stored in a variable
  7726. mes "You're in the '" + getpartyname($@var) + "' party, I know!";
  7727. ---------------------------------------
  7728. *getpartymember <party id>{,<type>{,<array_variable>}};
  7729. This command will find all members of a specified party and returns their names
  7730. (or character id or account id depending on the value of "type") into an array
  7731. of temporary global variables. There's actually quite a few commands like this
  7732. which will fill a special variable with data upon execution and not do anything
  7733. else.
  7734. Upon executing this,
  7735. $@partymembername$[] is a global temporary string array which contains all the
  7736. names of these party members
  7737. (only set when type is 0 or not specified)
  7738. $@partymembercid[] is a global temporary number array which contains the
  7739. character id of these party members.
  7740. (only set when type is 1)
  7741. $@partymemberaid[] is a global temporary number array which contains the
  7742. account id of these party members.
  7743. (only set when type is 2)
  7744. $@partymembercount is the number of party members that were found.
  7745. The party members will (apparently) be found regardless of whether they are
  7746. online or offline. Note that the names come in no particular order.
  7747. Be sure to use $@partymembercount to go through this array, and not
  7748. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  7749. someone with 7 party members invokes this script, the array would have 7
  7750. elements. But if another person calls up the NPC, and he has a party of 5, the
  7751. server will not clear the array for you, overwriting the values instead. So in
  7752. addition to returning the 5 member names, the 6th and 7th elements from the last
  7753. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  7754. the new guy's party. $@partymembercount will always contain the correct number,
  7755. (5) unlike 'getarraysize()' which will return 7 in this case.
  7756. If 'array_variable' is set, the result will be stored to that variable instead
  7757. using global variable.
  7758. Example 1: list party member names
  7759. // get the party member names
  7760. getpartymember getcharid(1),0;
  7761. // It's a good idea to copy the global temporary $@partymember*****
  7762. // variables to your own scope variables because if you have pauses in this
  7763. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  7764. // another player could click this NPC, trigger 'getpartymember', and
  7765. // overwrite the $@partymember***** variables.
  7766. .@count = $@partymembercount;
  7767. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  7768. // list the party member names
  7769. for (.@i = 0; .@i < .@count; .@i++)
  7770. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  7771. close;
  7772. Example 2: check party count (with a 'next' pause), before warping to event
  7773. .register_num = 5; // How many party members are required?
  7774. // get the charID and accountID of character's party members
  7775. getpartymember getcharid(1), 1;
  7776. getpartymember getcharid(1), 2;
  7777. if ( $@partymembercount != .register_num ) {
  7778. mes "Please form a party of " + .register_num + " to continue";
  7779. close;
  7780. }
  7781. // loop through both and use 'isloggedin' to count online party members
  7782. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  7783. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  7784. .@count_online++;
  7785. // We search accountID & charID because a single party can have multiple
  7786. // characters from the same account. Without searching through the charID,
  7787. // if a player has 2 characters from the same account inside the party but
  7788. // only 1 char online, it would count their online char twice.
  7789. if ( .@count_online != .register_num ) {
  7790. mes "All your party members must be online to continue";
  7791. close;
  7792. }
  7793. // copy the array to prevent players cheating the system
  7794. copyarray .@partymembercid, $@partymembercid, .register_num;
  7795. mes "Are you ready ?";
  7796. next; // careful here
  7797. select("Yes");
  7798. // When a script hits a next, menu, sleep or input that pauses the script,
  7799. // players can invite or /leave and make changes in their party. To prevent
  7800. // this, we call getpartymember again and compare with the original values.
  7801. getpartymember getcharid(1), 1;
  7802. if ( $@partymembercount != .register_num ) {
  7803. mes "You've made changes to your party !";
  7804. close;
  7805. }
  7806. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  7807. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  7808. mes "You've made changes to your party !";
  7809. close;
  7810. }
  7811. }
  7812. // Finally, it's safe to start the event!
  7813. warpparty "event_map", 0,0, getcharid(1);
  7814. ---------------------------------------
  7815. *getpartyleader(<party id>{,<type>})
  7816. This function returns some information about the given party-id's leader.
  7817. When type is omitted, the default information retrieved is the leader's name.
  7818. Possible types are:
  7819. 1: Leader account id
  7820. 2: Leader character id
  7821. 3: Leader's class
  7822. 4: Leader's current map name
  7823. 5: Leader's current level as stored on the party structure (may not be
  7824. current level if leader leveled up recently).
  7825. If retrieval fails (leader not found or party does not exist), this function
  7826. returns "null" instead of the character name, and -1 for the other types.
  7827. ---------------------------------------
  7828. *is_party_leader({<party ID>})
  7829. This command will return true if the player attached to the script is the leader
  7830. of his/her party, or, if a party ID is specified, of that party.
  7831. ---------------------------------------
  7832. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  7833. Organizes a party with the attached or specified character as leader. If
  7834. successful, the command returns 1 and sets the global temporary variable
  7835. "$@party_create_id" to the ID of the party created.
  7836. Additionally, item sharing options can be provided:
  7837. - Item Share: 0-Each Take (default), 1-Party Share
  7838. - Item Share Type: 0-Each Take (default), 1-Even Share
  7839. These values are returned upon failure:
  7840. 0: Unknown error.
  7841. -1: Player not found.
  7842. -2: Player already has a party.
  7843. -3: Party name exists.
  7844. ---------------------------------------
  7845. *party_destroy(<party id>);
  7846. Disbands a party. The command returns 1 upon success and 0 upon failure.
  7847. ---------------------------------------
  7848. *party_addmember(<party id>,<character id>);
  7849. Adds a player to an existing party.
  7850. The command returns 1 upon success, and these values upon failure:
  7851. 0: Unknown error.
  7852. -1: Player not found.
  7853. -2: Player already has a party.
  7854. -3: Party not found.
  7855. -4: Party is full.
  7856. -5: Another character from the same account is already in the party.
  7857. ---------------------------------------
  7858. *party_delmember({<character id>,<party id>});
  7859. Removes a player from his/her party. If no player is specified, the command
  7860. will run for the invoking player. If that player is the only party member
  7861. remaining, the party will be disbanded.
  7862. The command returns 1 upon success, and these values upon failure:
  7863. 0: Unknown error.
  7864. -1: Player not found.
  7865. -2: Party not found.
  7866. -3: Player is not in the party.
  7867. ---------------------------------------
  7868. *party_changeleader(<party id>,<character id>);
  7869. Transfers leadership of a party to the specified character.
  7870. The command returns 1 upon success, and these values upon failure:
  7871. 0: Unknown error.
  7872. -1: Party not found.
  7873. -2: Player not found.
  7874. -3: Player is not in the party.
  7875. -4: Player is already party leader.
  7876. ---------------------------------------
  7877. *party_changeoption(<party id>,<option>,<flag>);
  7878. Changes a party option.
  7879. Valid options are:
  7880. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  7881. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  7882. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  7883. The command returns 1 upon success, and these values upon failure:
  7884. 0: Invalid option.
  7885. -1: Party not found.
  7886. ---------------------------------------
  7887. *opendressroom(<flag>{,<char_id>});
  7888. This will open the Dress Room window on the client connected to the invoking character.
  7889. mes "Close this window to open the Dress Room window.";
  7890. close2;
  7891. opendressroom(1);
  7892. end;
  7893. Valid flag are:
  7894. 1 - Open the Dress Room window
  7895. ---------------------------------------
  7896. *navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
  7897. Generates a navigation for attached or specified character. Requires client
  7898. 2011-10-10aRagEXE or newer.
  7899. The flag specifies how the client will calculate the specific route.
  7900. Valid flags are:
  7901. NAV_NONE - No services
  7902. NAV_AIRSHIP_ONLY - Airship only
  7903. NAV_SCROLL_ONLY - Scroll only
  7904. NAV_AIRSHIP_AND_SCROLL - Airship and Scroll
  7905. NAV_KAFRA_ONLY - Kafra only
  7906. NAV_KAFRA_AND_AIRSHIP - Kafra and Airship
  7907. NAV_KAFRA_AND_SCROLL - Kafra and Scroll
  7908. NAV_ALL - All services
  7909. When flag is not specified, the default value is NAV_KAFRA_AND_AIRSHIP.
  7910. The hide_window specifies whether to display (0) or hide (1) the navigation window.
  7911. By default the window is hidden.
  7912. You can specify the monster_id in combination with a mapname to make the
  7913. navigation system tell you, that you have reached the desired mob.
  7914. Note:
  7915. The client requires custom monster spawns be in the navigation file
  7916. for using the embedded client Navigation feature to work properly. In this
  7917. instance sending the player to the map where the monster spawns is a simpler
  7918. solution rather than sending the map and the monster_id.
  7919. ---------------------------------------
  7920. *hateffect(<Hat Effect ID>,<State>);
  7921. This will set a Hat Effect onto the player. The state field allows you to
  7922. enable (true) or disable (false) the effect on the player.
  7923. The Hat Effect constants can be found in 'src/map/script_constants.hpp' starting
  7924. with HAT_EF_*.
  7925. Requires client 2015-05-13aRagEXE or newer.
  7926. ---------------------------------------
  7927. *getrandomoptinfo(<type>);
  7928. Returns value of an attribute of current random option.
  7929. Valid attributes are:
  7930. ROA_ID - ID of current option
  7931. ROA_VALUE - Value field of current option
  7932. ROA_PARAM - Param field of current option
  7933. This script command is intended for using in random option scripts.
  7934. ---------------------------------------
  7935. *getequiprandomoption(<equipment index>,<index>,<type>{,<char id>});
  7936. Returns value of an attribute of a random option on an equipped item.
  7937. See 'getequipid' for a full list of valid equipment slots.
  7938. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  7939. For valid attribute types, see `getrandomoptinfo` command reference.
  7940. ---------------------------------------
  7941. *setrandomoption(<equipment slot>,<index>,<id>,<value>,<param>{,<char id>});
  7942. Sets <index+1>th random option for equipment equipped at <equipment slot>
  7943. to <id>, <value> and <param>.
  7944. See 'getequipid' for a full list of valid equipment slots.
  7945. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  7946. ID - ID of random option. See db/item_randomopt_db.yml for constants.
  7947. Value - Value of random option
  7948. Param - Parameter of random option
  7949. ---------------------------------------
  7950. *randomoptgroup <random option group ID>;
  7951. This command fills the following arrays with the results of a random option group.
  7952. The random option group IDs are specified in 'db/(pre-)re/item_randomopt_group.yml'.
  7953. Arrays - from index 0 to MAX_ITEM_RDM_OPT-1 :
  7954. .@opt_id[] - array of random option ID.
  7955. .@opt_value[] - array of value.
  7956. .@opt_param[] - array of param.
  7957. Example:
  7958. // Fill the arrays using the random option group ID 5 (group used for Crimson weapons).
  7959. randomoptgroup(5);
  7960. // Create a +9 Crimson Dagger [2] with the Group 5 applied
  7961. getitem3 28705,1,1,9,0,0,0,0,0,.@opt_id,.@opt_value,.@opt_param;
  7962. ---------------------------------------
  7963. *clan_join(<clan id>{,<char id>});
  7964. The attached player joins the clan with the <clan id>. On a successful join,
  7965. true is returned, else false if the join failed.
  7966. If <char id> is specified, the specified player is used rather than the attached one.
  7967. ---------------------------------------
  7968. *clan_leave({<char id>});
  7969. The attached player will leave their clan. On a successful leave, true is returned,
  7970. else false if the leave failed.
  7971. If <char id> is specified, the specified player is used rather than the attached one.
  7972. ---------------------------------------
  7973. ========================
  7974. |14.- Channel commands.|
  7975. ========================
  7976. ---------------------------------------
  7977. *channel_create "<chname>","<alias>"{,"<password>"{<option>{,<delay>{,<color>{,<char_id>}}}}};
  7978. Creates a public channel with <chname> as the channel name. To protect the
  7979. channel, use <password> or write "null" to create it without a password.
  7980. Channel name must start with '#' and cannot be the same as the map or ally
  7981. channel names.
  7982. <alias> will be used to change the channel name when the channel message
  7983. is displayed.
  7984. <option> values are:
  7985. CHAN_OPT_BASE - Default option including CHAN_OPT_ANNOUNCE_SELF|CHAN_OPT_MSG_DELAY|CHAN_OPT_CAN_CHAT|CHAN_OPT_CAN_LEAVE
  7986. CHAN_OPT_ANNOUNCE_SELF - Show info for player itself if player has joined/leaves the channel
  7987. CHAN_OPT_ANNOUNCE_JOIN - Display message when player is joining the channel
  7988. CHAN_OPT_ANNOUNCE_LEAVE - Display message when player is leaving the channel
  7989. CHAN_OPT_MSG_DELAY - Enable chat delay for the channel
  7990. CHAN_OPT_COLOR_OVERRIDE - Player's unique font color will override channel's color
  7991. CHAN_OPT_CAN_CHAT - Player can chat in the channel
  7992. CHAN_OPT_CAN_LEAVE - Player can leave the channel
  7993. CHAN_OPT_AUTOJOIN - Players will auto join the channel at login
  7994. The <delay> is the minimum chat delay in millisecond for a single player before
  7995. the player can chat again in the same channel.
  7996. Use <color> hex code to set the color for this channel, if not defined, default
  7997. channel color will be used.
  7998. If <char_id> is defined, the channel will be a private channel and the player
  7999. will be the the channel owner.
  8000. Returns 1 on success.
  8001. /**
  8002. * This example will shows the message on this channel as
  8003. * [rAthena] Admin : Hello world!
  8004. * instead of
  8005. * #rathena Admin : Hello world!
  8006. **/
  8007. channel_create("#rathena","[rAthena]");
  8008. channel_create("#vip","[VIP]","vipmemberonly");
  8009. ---------------------------------------
  8010. *channel_setopt "<chname>",<option>,<value>;
  8011. Set option for the channel. Use 1 in <value> to set it, or 0 to unset.
  8012. The <option> values are the same as the 'channel_create' options.
  8013. For CHAN_OPT_MSG_DELAY, the delay in millisecond must be sent or use 0
  8014. to remove the delay at <value>.
  8015. Returns 1 on success.
  8016. // Example to set delay
  8017. channel_setopt("#global",CHAN_OPT_MSG_DELAY,5000);
  8018. Only for public and private channel.
  8019. ---------------------------------------
  8020. *channel_getopt "<chname>",<option>;
  8021. Get option value for the channel. The <option> values are the same as the
  8022. 'channel_create' options. Returns true or false except for CHAN_OPT_MSG_DELAY
  8023. which returns an integer.
  8024. // Example to get the delay
  8025. .delay = channel_getopt("#global",CHAN_OPT_MSG_DELAY);
  8026. Only for public and private channel.
  8027. ---------------------------------------
  8028. *channel_setcolor "<chname>",<color>;
  8029. To change channel color.
  8030. <color> uses hex RGB values.
  8031. Returns 1 on success.
  8032. ---------------------------------------
  8033. *channel_setpass "<chname>","<password>";
  8034. To set, unset, or change password of a channel.
  8035. Use "null" to remove the password.
  8036. Returns 1 on success.
  8037. Only for public and private channel.
  8038. ---------------------------------------
  8039. *channel_setgroup "<chname>",<group_id>{,...,<group_id>};
  8040. *channel_setgroup2 "<chname>",<array_of_groups>;
  8041. Set group restriction for a channel. Only player with matching <group_id>
  8042. are allowed to to join the channel.
  8043. By using 0 in the first group channel, the group restriction will be
  8044. removed from the channel config.
  8045. 'channel_setgroup2' receives input for group list as an array.
  8046. Returns 0 on failure, and 1 (or n groups count) on success.
  8047. // Example 1: Remove groups
  8048. channel_setgroup("#event",0);
  8049. // Example 2: Multiple values
  8050. channel_setgroup("#vip",2,5);
  8051. // Example 3: Using array
  8052. setarray .@staffs[0],2,3,4,10,99;
  8053. channel_setgroup("#staff",.@staffs);
  8054. Only for public and private channel.
  8055. ---------------------------------------
  8056. *channel_chat "<chname>","<message>"{,<color>};
  8057. Sends message to the channel.
  8058. Returns 1 on success.
  8059. // Example if channel doesn't have alias
  8060. channel_chat(#rathena,"Hello World!"); // #rathena Hello World!
  8061. // Example if channel has alias
  8062. channel_chat(#rathena,"Hello World!"); // [rAthena] Hello World!
  8063. ---------------------------------------
  8064. *channel_ban "<chname>",<char_id>;
  8065. Ban player from a public or private channel.
  8066. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be banned.
  8067. Returns 1 on success.
  8068. ---------------------------------------
  8069. *channel_unban "<chname>",<char_id>;
  8070. Unban player from a public or private channel.
  8071. Returns 1 on success.
  8072. ---------------------------------------
  8073. *channel_kick "<chname>",<char_id>;
  8074. *channel_kick "<chname>","<char_name>";
  8075. Kick player from a public or private channel.
  8076. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be kicked.
  8077. Returns 1 on success.
  8078. ---------------------------------------
  8079. *channel_delete "<chname>";
  8080. Delete an existing public or private channel. Cannot delete ally or
  8081. local map channel.
  8082. Returns 0 on success.
  8083. ---------------------------------------
  8084. ============================
  8085. |15.- Achievement commands.|
  8086. ============================
  8087. ---------------------------------------
  8088. *achievementadd(<achievement id>{,<char id>})
  8089. This function will add an achievement to the player's log for the attached
  8090. player or the supplied <char id>. The objective requirements are not ignored
  8091. when using this function.
  8092. Returns true on success and false on failure.
  8093. ---------------------------------------
  8094. *achievementremove(<achievement id>{,<char id>})
  8095. This function will remove an achievement from the player's log for the attached
  8096. player or the supplied <char id>.
  8097. Returns true on success and false on failure.
  8098. ---------------------------------------
  8099. *achievementinfo(<achievement id>,<type>{,<char id>})
  8100. This function will return the specified <type> value for an achievement of the
  8101. attached player or the supplied <char id>. If the player doesn't have the
  8102. achievement active (no progress has been made): if the achievement doesn't
  8103. exist -1 will be returned, or -2 will be returned on any other error such as
  8104. an invalid <type>.
  8105. Valid types:
  8106. - ACHIEVEINFO_COUNT1
  8107. - ACHIEVEINFO_COUNT2
  8108. - ACHIEVEINFO_COUNT3
  8109. - ACHIEVEINFO_COUNT4
  8110. - ACHIEVEINFO_COUNT5
  8111. - ACHIEVEINFO_COUNT6
  8112. - ACHIEVEINFO_COUNT7
  8113. - ACHIEVEINFO_COUNT8
  8114. - ACHIEVEINFO_COUNT9
  8115. - ACHIEVEINFO_COUNT10
  8116. - ACHIEVEINFO_COMPLETE
  8117. - ACHIEVEINFO_COMPLETEDATE
  8118. - ACHIEVEINFO_GOTREWARD
  8119. - ACHIEVEINFO_LEVEL (<achievement id> is useless for this)
  8120. - ACHIEVEINFO_SCORE (<achievement id> is useless for this)
  8121. ---------------------------------------
  8122. *achievementcomplete(<achievement id>{,<char id>})
  8123. This function will complete an achievement for the attached player or the supplied
  8124. <char id>. The objective requirements are ignored when using this function.
  8125. Returns true on success and false on failure.
  8126. ---------------------------------------
  8127. *achievementexists(<achievement id>{,<char id>});
  8128. This function will return if the achievement exists on the player or the supplied
  8129. <char id> and is completed.
  8130. Returns true on success and false on failure.
  8131. ---------------------------------------
  8132. *achievementupdate(<achievement id>,<type>,<value>{,<char id>})
  8133. This function will update an achievement's value for an achievement of the attached
  8134. player or the supplied <char id>. If the player does not have the achievement active
  8135. (no progress has been made) it will be added to the player's log first before updating
  8136. the <type> value.
  8137. Returns true on success and false on failure.
  8138. See 'achievementinfo' for valid <type> values.
  8139. - ACHIEVEINFO_COMPLETE, ACHIEVEINFO_COMPLETEDATE, and ACHIEVEINFO_GOTREWARD require the
  8140. specific value returned from 'gettimetick(2)'.
  8141. - Excludes ACHIEVEINFO_LEVEL and ACHIEVEINFO_SCORE.
  8142. ---------------------------------------
  8143. *addfame(<amount>,{,<char id>})
  8144. Increases the fame of the attached player or the supplied <char id> by the <amount> given.
  8145. Note: Only works with classes that use the ranking system.
  8146. ---------------------------------------
  8147. *getfame({<char id>})
  8148. Gets the fame points of the attached player or the supplied <char id>.
  8149. Note: Only works with classes that use the ranking system.
  8150. ---------------------------------------
  8151. *getfamerank({<char id>})
  8152. Returns fame rank (start from 1 to MAX_FAME_LIST), else 0.
  8153. Note: Only works with classes that use the ranking system.
  8154. ---------------------------------------