script_commands.txt 362 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104
  1. //===== rAthena Documentation================================
  2. //= rAthena Script Commands
  3. //===== By:==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated:========================================
  6. //= 20171011
  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.txt' 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. <mob size> can be:
  127. Size_Small (0)
  128. Size_Medium (1)
  129. Size_Large (2)
  130. <mob ai> can be:
  131. AI_NONE (0) (default)
  132. AI_ATTACK (1) (attack/friendly)
  133. AI_SPHERE (2) (Alchemist skill)
  134. AI_FLORA (3) (Alchemist skill)
  135. AI_ZANZOU (4) (Kagerou/Oboro skill)
  136. AI_LEGION (5) (Sera skill)
  137. AI_FAW (6) (Mechanic skill)
  138. Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able
  139. to be detected on the map with the SC_BOSSMAPINFO status (used by Convex Mirror).
  140. ** NPC names
  141. /!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
  142. NPC names are kinda special and are formatted this way:
  143. <Display name>{::<Unique name>}
  144. All NPCs need to have a unique name that is used for identification purposes.
  145. When you have to identify a NPC by its name, you should use <Unique name>.
  146. If <Unique name> is not provided, use <Display name> instead.
  147. The client has a special feature when displaying names:
  148. if the display name contains a '#' character, it hides that part of the name.
  149. ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
  150. <Display name> must be at most 24 characters in length.
  151. <Unique name> must be at most 24 characters in length.
  152. ** Define a warp point
  153. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  154. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp2%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  155. This will define a warp NPC that will warp a player between maps, and while most
  156. arguments of that are obvious, some deserve special mention.
  157. SpanX and SpanY will make the warp sensitive to a character who didn't step
  158. directly on it, but walked into a zone which is centered on the warp from
  159. coordinates and is SpanX in each direction across the X axis and SpanY in each
  160. direction across the Y axis.
  161. Warp NPC objects also have a name, because you can use it to refer to them later
  162. with 'enablenpc'/'disablenpc'
  163. Facing of a warp object is irrelevant, it is not used in the code and all
  164. current scripts have a zero in there.
  165. Unlike 'warp', 'warp2' will also be triggered by hidden player.
  166. ** Define an NPC object.
  167. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  168. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  169. This will place an NPC object on a specified map at the specified location, and
  170. is a top-level command you will use the most in your custom scripting. The NPCs
  171. are triggered by clicking on them, and/or by walking in their trigger area, if
  172. defined, see that below.
  173. Facing is a direction the NPC sprite will face in. Not all NPC sprites have
  174. different images depending on the direction you look from, so for some facing
  175. will be meaningless. Facings are counted counterclockwise in increments of 45
  176. degrees, where 0 means facing towards the top of the map. (So to turn the sprite
  177. towards the bottom of the map, you use facing 4, and to make it look southeast
  178. it's facing 5.)
  179. Sprite ID is the sprite number or constant used to display this particular NPC.
  180. You may also use a monster's ID instead to display a monster sprite for this NPC.
  181. It is possible to use a job sprite as well, but you must first define it as a
  182. monster sprite in 'mob_avail.txt', a full description on how to do this is not
  183. in the scope of this manual.
  184. A '-1' Sprite ID will make the NPC invisible (and unclickable).
  185. A '111' Sprite ID will make an NPC which does not have a sprite, but is still
  186. clickable, which is useful if you want to make a clickable object of the 3D
  187. terrain.
  188. TriggerX and triggerY, if given, will define an area, centered on NPC and
  189. spanning triggerX cells in every direction across X and triggerY in every
  190. direction across Y. Walking into that area will trigger the NPC. If no
  191. 'OnTouch:' special label is present in the NPC code, the execution will start
  192. from the beginning of the script, otherwise, it will start from the 'OnTouch:'
  193. label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
  194. used in this case.
  195. The code part is the script code that will execute whenever the NPC is
  196. triggered. It may contain commands and function calls, descriptions of which
  197. compose most of this document. It has to be in curly brackets, unlike elsewhere
  198. where we use curly brackets, these do NOT signify an optional parameter.
  199. ** Define a 'floating' NPC object.
  200. -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  201. This will define an NPC object not triggerable by normal means. This would
  202. normally mean it's pointless since it can't do anything, but there are
  203. exceptions, mostly related to running scripts at specified time, which is what
  204. these floating NPC objects are for. More on that below.
  205. ** Define a shop/cashshop/itemshop/pointshop NPC.
  206. -%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  207. <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  208. -%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  209. <map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  210. -%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  211. <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  212. -%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  213. <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  214. <map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<quantity>{,<itemid>:<price>:<quantity>...}
  215. This will define a shop NPC, which, when triggered (which can only be done by
  216. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  217. NPCs and you can't change the prices otherwise than by editing the script
  218. itself.
  219. The Item ID is the number of item in the 'item_db.txt' database. If Price is set
  220. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  221. price you gave will be used for this item, which is how you create differing
  222. prices for items in different shops.
  223. There are other types of shops available:
  224. cashshop - use "cashshop" in place of "shop" to use the Cash Shop interface, allowing
  225. you to buy items with special points that are stored as account variables
  226. called #CASHPOINTS and #KAFRAPOINTS. This type of shop will not allow you to sell
  227. items at it, only make purchases. The layout used to define sale items still count, and
  228. "<price>" refers to how many points will be spent purchasing the them.
  229. "itemshop" and "pointshop" use the Shop interface, allowing you to buy items with a specific
  230. item or special points from a variable. 'pointshop' only supports permanent character variables,
  231. temporary character variables, permanent local account variables or permanent global account
  232. variables. These variables must be of integer type, not string. 'discount' flag is an
  233. optional value which makes the price at that shop become affected by discount skill.
  234. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  235. warp/warp2: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  236. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  237. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  238. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  239. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  240. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  241. Warp duplicates inherit the target location.
  242. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  243. NPC duplicates inherit the script code.
  244. The rest (name, location, facing, sprite ID, span/trigger area)
  245. is obtained from the definition of the duplicate (not inherited).
  246. ** Define a function object
  247. function%TAB%script%TAB%<function name>%TAB%{<code>}
  248. This will define a function object, callable with the 'callfunc' command (see
  249. below). This object will load on every map server separately, so you can get at
  250. it from anywhere. It's not possible to call the code in this object by
  251. anything other than the 'callfunc' script command.
  252. The code part is the script code that will execute whenever the function is
  253. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  254. we use curly brackets, these do NOT signify an optional parameter.
  255. Once an object is defined which has a 'code' field to its definition, it
  256. contains script commands which can actually be triggered and executed.
  257. ~ RID? GID? ~
  258. What a RID is and why do you need to know
  259. -----------------------------------------
  260. Most scripting commands and functions will want to request data about a
  261. character, store variables referenced to that character, send stuff to the
  262. client connected to that specific character. Whenever a script is invoked by a
  263. character, it is passed a so-called RID - this is the account ID number of a
  264. character that caused the code to execute by clicking on it, walking into its
  265. OnTouch zone, or otherwise.
  266. If you are only writing common NPCs, you don't need to bother with it. However,
  267. if you use functions, if you use timers, if you use clock-based script
  268. activation, you need to be aware of all cases when a script execution can be
  269. triggered without a RID attached. This will make a lot of commands and functions
  270. unusable, since they want data from a specific character, want to send stuff to
  271. a specific client, want to store variables specific to that character, and they
  272. would not know what character to work on if there's no RID.
  273. Unless you use 'attachrid' to explicitly attach a character to the script first.
  274. Whenever we say 'invoking character', we mean 'the character who's RID is
  275. attached to the running script. The script function "playerattached" can be
  276. used to check which is the currently attached player to the script (it will
  277. return 0 if the there is no player attached or the attached player no longer
  278. is logged on to the map-server).
  279. But what about GID?
  280. -------------------
  281. GID stands for the Game ID of something, this can either be the GID obtained
  282. through mobspawn (mob control commands) or the account ID of a character.
  283. Another way would be to right click on a mob, NPC or char as GM sprited char
  284. to view the GID.
  285. See also 'getpetinfo', 'getmercinfo', 'gethominfo', and 'geteleminfo'.
  286. This is mostly used for the new version of skill and the mob control commands
  287. implemented.
  288. Item and pet scripts
  289. --------------------
  290. Each item in the item database has three special fields - Script , OnEquip_Script
  291. and OnUnequip_Script. The first is script code run every time a character equips the item,
  292. with the RID of the equipping character. Every time they unequip an item, all
  293. temporary bonuses given by the script commands are cleared, and all the scripts
  294. are executed once again to rebuild them. This also happens in several other
  295. situations (like upon login) but the full list is currently unknown.
  296. OnEquip_Script is a piece of script code run whenever the item is used by a character
  297. by double-clicking on it. OnUnequip_Script runs whenever the
  298. equipment is unequip by a character
  299. Not all script commands work properly in the item scripts. Where commands and
  300. functions are known to be meant specifically for use in item scripts, they are
  301. described as such.
  302. Every pet in the pet database has a PetScript field, which determines pet
  303. behavior. It is invoked wherever a pet of the specified type is spawned.
  304. (hatched from an egg, or loaded from the char server when a character who had
  305. that pet following them connects) This may occur in some other situations as
  306. well. Don't expect anything other than commands definitely marked as usable in
  307. pet scripts to work in there reliably.
  308. Numbers
  309. -------
  310. Beside the common decimal numbers, which are nothing special whatsoever (though
  311. do not expect to use fractions, since ALL numbers are integer in this language),
  312. the script engine also handles hexadecimal numbers, which are otherwise
  313. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  314. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  315. to 'mes 0x10' it will print '16'.
  316. Number values can't exceed the limits of an integer variable: Any number
  317. greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  318. be capped to those values and will cause a warning to be reported.
  319. Variables
  320. ---------
  321. The meat of every programming language is variables - places where you store
  322. data.
  323. In the rAthena scripting language, variable names are not case sensitive.
  324. Variables are divided into and uniquely identified by the combination of:
  325. prefix - determines the scope and extent (or lifetime) of the variable
  326. name - an identifier consisting of '_' and alphanumeric characters
  327. postfix - determines the type of the variable: integer or string
  328. Scope can be:
  329. global - global to all servers
  330. local - local to the server
  331. account - attached to the account of the character identified by RID
  332. character - attached to the character identified by RID
  333. npc - attached to the NPC
  334. scope - attached to the scope of the instance
  335. Extent can be:
  336. permanent - They still exist when the server resets.
  337. temporary - They cease to exist when the server resets.
  338. Prefix: scope and extent
  339. nothing - A permanent variable attached to the character, the default variable
  340. type. They are stored by char-server in the `char_reg_num` and
  341. `char_reg_str`.
  342. "@" - A temporary variable attached to the character.
  343. SVN versions before 2094 revision and RC5 version will also treat
  344. 'l' as a temporary variable prefix, so beware of having variable
  345. names starting with 'l' if you want full backward compatibility.
  346. "$" - A global permanent variable.
  347. They are stored by map-server in database table `mapreg`.
  348. "$@" - A global temporary variable.
  349. This is important for scripts which are called with no RID
  350. attached, that is, not triggered by a specific character object.
  351. "." - A NPC variable.
  352. They exist in the NPC and disappear when the server restarts or the
  353. NPC is reloaded. Can be accessed from inside the NPC or by calling
  354. 'getvariableofnpc'. Function objects can also have .variables which
  355. are accessible from inside the function, however 'getvariableofnpc'
  356. does NOT work on function objects.
  357. ".@" - A scope variable.
  358. They are unique to the instance and scope. Each instance has its
  359. own scope that ends when the script ends. Calling a function with
  360. callsub/callfunc starts a new scope, returning from the function
  361. ends it. When a scope ends, its variables are converted to values
  362. ('return .@var;' returns a value, not a reference).
  363. "'" - An instance variable.
  364. These are used with the instancing system and are unique to each
  365. instance type.
  366. "#" - A permanent local account variable.
  367. They are stored by char-server in the `acc_reg_num` table and
  368. `acc_reg_str`.
  369. "##" - A permanent global account variable stored by the login server.
  370. They are stored in the `global_acc_reg_num` table and
  371. `global_acc_reg_str`.
  372. The only difference you will note from normal # variables is when
  373. you have multiple char-servers connected to the same login server.
  374. The # variables are unique to each char-server, while the ## variables
  375. are shared by all these char-servers.
  376. Postfix: integer or string
  377. nothing - integer variable, can store positive and negative numbers, but only
  378. whole numbers (so don't expect to do any fractional math)
  379. '$' - string variable, can store text
  380. Examples:
  381. name - permanent character integer variable
  382. name$ - permanent character string variable
  383. @name - temporary character integer variable
  384. @name$ - temporary character string variable
  385. $name - permanent global integer variable
  386. $name$ - permanent global string variable
  387. $@name - temporary global integer variable
  388. $@name$ - temporary global string variable
  389. .name - NPC integer variable
  390. .name$ - NPC string variable
  391. .@name - scope integer variable
  392. .@name$ - scope string variable
  393. 'name - instance integer variable
  394. 'name$ - instance string variable
  395. #name - permanent local account integer variable
  396. #name$ - permanent local account string variable
  397. ##name - permanent global account integer variable
  398. ##name$ - permanent global account string variable
  399. If a variable was never set, it is considered to equal zero for integer
  400. variables or an empty string ("", nothing between the quotes) for string
  401. variables. Once you set it to that, the variable is as good as forgotten
  402. forever, and no trace remains of it even if it was stored with character or
  403. account data.
  404. Some variables are special, that is, they are already defined for you by the
  405. scripting engine. You can see the full list in 'src/map/script_constants.h', which
  406. is a file you should read, since it also allows you to replace lots of numbered
  407. arguments for many commands with easier to read text. The special variables most
  408. commonly used are all permanent character-based variables:
  409. Zeny - Amount of Zeny.
  410. Hp - Current amount of hit points.
  411. MaxHp - Maximum amount of hit points.
  412. Sp - Current spell points.
  413. MaxSp - Maximum amount of spell points.
  414. StatusPoint - Amount of status points remaining.
  415. SkillPoint - Amount of skill points remaining.
  416. BaseLevel - Character's base level.
  417. JobLevel - Character's job level.
  418. BaseExp - Amount of base experience points.
  419. JobExp - Amount of job experience points.
  420. NextBaseExp - Amount of base experience points needed to reach the next level.
  421. NextJobExp - Amount of job experience points needed to reach the next level.
  422. Weight - Amount of weight the character currently carries.
  423. MaxWeight - Maximum weight the character can carry.
  424. Sex - 0 if female, 1 if male.
  425. Class - Character's job.
  426. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  427. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  428. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  429. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  430. reached a 1-1 class, it will return Job_Novice.
  431. BaseJob - The character's 'normal' job, regardless of Upper value.
  432. For example, this will return Job_Acolyte for Acolyte,
  433. Baby Acolyte, and High Acolyte.
  434. Karma - The character's karma. Karma system is not fully functional, but
  435. this doesn't mean this doesn't work at all. Not tested.
  436. Manner - The character's manner rating. Becomes negative if the player
  437. utters words forbidden through the use of 'manner.txt' client-side
  438. file.
  439. While these behave as variables, do not always expect to just set them - it is
  440. not certain whether this will work for all of them. Whenever there is a command
  441. or a function to set something, it's usually preferable to use that instead. The
  442. notable exception is Zeny, which you can and often will address directly -
  443. setting it will make the character own this number of Zeny.
  444. If you try to set Zeny to a negative number, the script will be terminated with an error.
  445. Some source-end constants can also be accessed in scripts. This list is located in
  446. 'src/map/script_constants.h', which contains constants such as server defines and status options:
  447. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  448. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  449. VIP_SCRIPT, MIN_STORAGE
  450. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  451. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  452. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  453. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  454. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  455. Assigning variables
  456. --------- ---------
  457. Variables can be accessed and modified much like in other programming languages.
  458. @x = 100;
  459. @x = @y = 100;
  460. Support for modifying variable values using 'set' is still supported (and required
  461. to exist for this new method to work) so previous scripts will continue to work.
  462. When assigning values, all operator methods are supported which exist in the below
  463. 'Operators' section. For instance:
  464. @x += 100;
  465. @x -= 100;
  466. @x *= 2;
  467. @x /= 2;
  468. @x %= 5;
  469. @x >>= 2;
  470. @x <<= 2;
  471. Will all work. For more information on available operators, see the Operators section
  472. described below. All operators listed there may be placed in-front of the '=' sign
  473. when modifying variables to perform the action as required.
  474. Note:
  475. !! Currently the scripting engine does not support directly copying array variables.
  476. !! In order to copy arrays between variables the use of 'copyarray' function is still
  477. !! required.
  478. Strings
  479. -------
  480. To include symbol '"' in a string you should use prefix '\"'
  481. Arrays
  482. ------
  483. Arrays (in rAthena at least) are essentially a set of variables going under the
  484. same name. You can tell between the specific variables of an array with an
  485. 'array index', a number of a variable in that array:
  486. <variable name>[<array index>]
  487. All variable types can be used as arrays.
  488. Variables stored in this way, inside an array, are also called 'array elements'.
  489. Arrays are specifically useful for storing a set of similar data (like several
  490. item IDs for example) and then looping through it. You can address any array
  491. variable as if it was a normal variable:
  492. set @arrayofnumbers[0],1;
  493. You can also do things like using a variable (or an expression, or even a
  494. value from another array) to get at an array value:
  495. set @x,100;
  496. set @arrayofnumbers[@x],10;
  497. This will make @arrayofnumbers[100] equal to 10.
  498. Index numbering always starts with 0 and arrays can hold over 2 billion
  499. variables. As such, the (guaranteed) allowed values for indices are in the
  500. range 0 ~ 2147483647.
  501. And array indexes probably can't be negative. Nobody tested what happens when
  502. you try to get a negatively numbered variable from an array, but it's not going
  503. to be pretty.
  504. Arrays can naturally store strings:
  505. @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
  506. the '$', normally denoting a string variable, before the square brackets that
  507. denotes an array index.
  508. Variable References
  509. -------------------
  510. //##TODO
  511. Operators
  512. ---------
  513. Operators are things you can do to variables and numbers. They are either the
  514. common mathematical operations or conditional operators
  515. + - will add two numbers. If you try to add two strings, the result will be a
  516. string glued together at the +. You can add a number to a string, and the
  517. result will be a string. No other math operators work with strings.
  518. - - will subtract two numbers.
  519. * - will multiply two numbers.
  520. / - will divide two numbers. Note that this is an integer division, i.e.
  521. 7/2 is not equal 3.5, it's equal 3.
  522. % - will give you the remainder of the division. 7%2 is equal to 1.
  523. There are also conditional operators. This has to do with the conditional
  524. command 'if' and they are meant to return either 1 if the condition is satisfied
  525. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  526. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  527. zero will also be True.)
  528. You can compare numbers to each other and you compare strings to each other, but
  529. you can not compare numbers to strings.
  530. == - Is true if both sides are equal. For strings, it means they are the same.
  531. >= - True if the first value is equal to, or greater than, the second value.
  532. <= - True if the first value is equal to, or less than, the second value
  533. > - True if the first value greater than the second value
  534. < - True if the first value is less than the second value
  535. != - True if the first value IS NOT equal to the second one
  536. Examples:
  537. 1 == 1 is True.
  538. 1<2 is True while 1>2 is False.
  539. @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  540. Only ' == ' and '!=' have been tested for comparing strings. Since there's no way
  541. to code a seriously complex data structure in this language, trying to sort
  542. strings by alphabet would be pointless anyway.
  543. Comparisons can be stacked in the same condition:
  544. && - Is True if and only if BOTH sides are true.
  545. ('1 == 1 && 2 == 2' is true. '2 == 1 && 1 == 1' is false.)
  546. || - Is True if either side of this expression is True.
  547. 1 == 1 && 2 == 2 is True.
  548. 1 == 1 && 2 == 1 is False.
  549. 1 == 1 || 2 == 1 is True.
  550. Logical bitwise operators work only on numbers, and they are the following:
  551. << - Left shift.
  552. >> - Right shift.
  553. Left shift moves the binary 1(s) of a number n positions to the left,
  554. which is the same as multiplying by 2, n times.
  555. In the other hand, Right shift moves the binary 1(s) of a number n positions
  556. to the right, which is the same as dividing by 2, n times.
  557. Example:
  558. set b,2;
  559. set a, b << 3;
  560. mes a;
  561. set a, a >> 2;
  562. mes a;
  563. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  564. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  565. & - And.
  566. | - Or.
  567. The bitwise operator AND (&) is used to test two values against each other,
  568. and results in setting bits which are active in both arguments. This can
  569. be used for a few things, but in rAthena this operator is usually used to
  570. create bit-masks in scripts.
  571. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  572. of one of the numbers is 1. This way a variable can hold several values we can check,
  573. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  574. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  575. that a player can have.
  576. A bit-mask basically is (ab)using the variables bits to set various options in
  577. one variable. With the current limit if variables it is possible to store 32
  578. different options in one variable (by using the bits on position 0 to 31).
  579. Example(s):
  580. - Basic example of the & operator, bit example:
  581. 10 & 2 = 2
  582. Why? :
  583. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  584. 2 = 2^1 (2), so in bits (same size) it would be 0010
  585. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  586. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  587. 0010, which is 2.
  588. - Basic example of creating and using a bit-mask:
  589. set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  590. if (@options & 1) mes "Option 1 is activated";
  591. if (@options & 2) mes "Option 2 is activated";
  592. if (@options & 4) mes "Option 3 is activated";
  593. if (@options & 8) mes "Option 4 is activated";
  594. if (@options & 16) mes "Options 5 is activated";
  595. This would return the messages about option 2, 3 and 5 being shown (since we've set
  596. the 2,4 and 16 bit to 1).
  597. ^ - Xor.
  598. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  599. numbers have the same value in the said position. On the other hand, it
  600. sets to 1 if they have different values in the said binary position.
  601. This is another way of setting and unsetting bits in bit-masks.
  602. Example:
  603. - First let's set the quests that are currently in progress:
  604. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  605. - After playing for a bit, the player starts another quest:
  606. if (inProgress&2 == 0) {
  607. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  608. set inProgress,inProgress^2;
  609. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  610. close;
  611. }
  612. - After spending some time reading info on Xor's, the player finally completes quest 1:
  613. if (inProgress&1 && isComplete) {
  614. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  615. set inProgress,inProgress^1;
  616. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  617. close;
  618. }
  619. Unary operators with only with a single number, which follows the operator, and
  620. are following:
  621. - - Negation.
  622. The sign of the number will be reversed. If the number was positive, it will
  623. become negative and vice versa.
  624. Example:
  625. set .@myvar,10;
  626. mes "Negative 10 is " + (-.@myvar);
  627. ! - Logical Not.
  628. Reverses the boolean result of an expression. True will become false and
  629. false will become true.
  630. Example:
  631. if (!callfunc("F_dosomething"))
  632. {
  633. mes "Doing something failed.";
  634. close;
  635. }
  636. ~ - Bitwise Not.
  637. Reverses each bit in a number, also known as one's complement. Cleared bits
  638. are set, and set bits are cleared.
  639. Example:
  640. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  641. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  642. Ternary operators take three expressions (numbers, strings or boolean), and are
  643. following:
  644. ?: - Conditional operator
  645. Very useful e.g. to replace
  646. if (Sex) mes "..."; else mes "...";
  647. clauses with simple
  648. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  649. or to replace any other simple if-else clauses. It might be worth
  650. mentioning that ?: has low priority and has to be enclosed with
  651. parenthesis in most (if not all) cases.
  652. Labels
  653. ------
  654. Within executable script code, some lines can be labels:
  655. <label name>:
  656. Labels are points of reference in your script, which can be used to route
  657. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  658. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  659. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  660. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  661. under 22 characters could be wise. It may only contain alphanumeric characters
  662. and underscore. In addition to labels you name yourself, there are also some
  663. special labels which the script engine will start execution from if a special
  664. event happens:
  665. OnClock<hour><minute>:
  666. OnMinute<minute>:
  667. OnHour<hour>:
  668. On<weekday><hour><minute>:
  669. OnDay<month><day>:
  670. This will execute when the server clock hits the specified date or time. Hours
  671. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  672. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  673. Remember the zero.
  674. OnInit:
  675. OnInterIfInit:
  676. OnInterIfInitOnce:
  677. OnInit will execute every time the scripts loading is complete, including when
  678. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  679. the map server connects to a char server, OnInterIfInitOnce will only execute
  680. once and will not execute if the map server reconnects to the char server later.
  681. OnAgitStart:
  682. OnAgitEnd:
  683. OnAgitInit:
  684. OnAgitStart2:
  685. OnAgitEnd2:
  686. OnAgitInit2:
  687. OnAgitStart3:
  688. OnAgitEnd3:
  689. OnAgitInit3:
  690. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  691. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  692. will do likewise for the end of WoE.
  693. OnAgitInit will run when data for all castles and all guilds that hold a castle
  694. is received by map-server from the char-server after initial connect.
  695. No RID will be attached while any of the above mentioned labels are triggered, so
  696. no character or account-based variables will be accessible, until you attach a
  697. RID with 'attachrid' (see below).
  698. The above also applies to, the last three labels, the only difference is that
  699. these labels are used exclusively for WoE SE, and are called independently.
  700. OnInstanceInit:
  701. This label will be executed when an instance is created and initialized through
  702. the 'instance_create' command. It will run again if @reloadscript is used while
  703. an instance is in progress.
  704. OnInstanceDestroy:
  705. This label will be executed when an instance is destroyed by a timeout, exceeding
  706. the keepalive time or through the 'instance_destroy' command. It will be called
  707. exactly before the instance will be destroyed and all other NPCs of the instance
  708. will still be available at this point of time.
  709. OnTouch:
  710. This label will be executed if a trigger area is defined for the NPC object it's
  711. in. If it isn't present, the execution will start from the beginning of the NPC
  712. code. The RID of the triggering character object will be attached.
  713. OnTouch_:
  714. Similar to OnTouch, but will only run one instance. Another character is
  715. chosen once the triggering character leaves the area.
  716. OnTouchNPC:
  717. Similar to OnTouch, but will only trigger for monsters. For this case, by using
  718. 'getattachedrid' will returns GID (ID that returned when use 'monster').
  719. OnPCLoginEvent:
  720. OnPCLogoutEvent:
  721. OnPCBaseLvUpEvent:
  722. OnPCJobLvUpEvent:
  723. It's pretty obvious when these four special labels will be invoked.
  724. OnPCDieEvent:
  725. This special label triggers when a player dies. The variable 'killerrid' is
  726. set to the ID of the killer.
  727. OnPCKillEvent:
  728. This special label triggers when a player kills another player. The variable
  729. 'killedrid' is set to the ID of the player killed.
  730. OnNPCKillEvent:
  731. This special label triggers when a player kills a monster without label. The variable
  732. 'killedrid' is set to the Class (mob ID) of the monster killed.
  733. OnPCLoadMapEvent:
  734. This special label triggers when a player steps in a map marked with the
  735. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  736. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  737. every time a player would change maps. Imagine the server load with 1,000 players
  738. (oh the pain...)
  739. OnPCStatCalcEvent:
  740. This special label triggers when a player's stats are recalculated, such as when
  741. changing stats, equipment, or maps, as well as when logging in, leveling up, and
  742. mounting a job mount. This can be used to grant additional item bonuses to certain
  743. player groups, for instance.
  744. OnWhisperGlobal:
  745. This special label triggers when a player whispers the NPC, and will run with the
  746. player's RID attached. It can accept up to ten parameters, which will be stored
  747. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  748. See 'doc/whisper_sys.txt' for further documentation.
  749. Only the special labels which are not associated with any script command are
  750. listed here. There are other kinds of labels which may be triggered in a similar
  751. manner, but they are described with their associated commands.
  752. On<label name>:
  753. These special labels are used with Mob scripts mostly, and script commands
  754. that requires you to point/link a command to a mob or another NPC, giving a label
  755. name to start from. The label name can be any of your liking, but must be
  756. started with "On".
  757. Example:
  758. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  759. amatsu,13,152,4 script Master 767,{
  760. mes "Hi there";
  761. close;
  762. OnThisMobDeath:
  763. announce "Hey, " + strcharinfo(0) + " just killed a Poringz0rd!",bc_blue|bc_all;
  764. end;
  765. }
  766. Each time you kill one, that announce will appear in blue to everyone.
  767. "Global" labels
  768. There's a catch with labels and doevent. If you call a label (using doevent)
  769. and called label is in NPC that has trigger area, that label must end with
  770. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  771. usually happens since otherwise there would be no point calling the label with
  772. doevent, because OnTouch would do the job). For further reference look for
  773. npc_event in npc.c.
  774. Scripting commands and functions
  775. --------------------------------
  776. The commands and functions are listed here in no particular order. There's a
  777. difference between commands and functions - commands leave no 'return value'
  778. which might be used in a conditional statement, as a command argument, or stored
  779. in a variable. Calling commands as if they were functions will sometimes work,
  780. but is not advised, as this can lead to some hard to track errors. Calling
  781. functions as if they were commands will mess up the stack, so 'return' command
  782. will not return correctly after this happens in a particular script.
  783. All commands must end with a ';'.
  784. -------------------------
  785. From here on, we will have the commands sorted as follow:
  786. 1.- Basic commands.
  787. 2.- Information-retrieving commands.
  788. 3.- Checking commands.
  789. 4.- Player-related commands.
  790. 5.- Mob / NPC -related commands.
  791. 6.- Other commands.
  792. 7.- Instance commands.
  793. 8.- Quest Log commands.
  794. 9.- Battleground commands.
  795. 10.- Pet commands.
  796. 10.1.- The Pet AI commands.
  797. 11.- Homunculus commands.
  798. 12.- Mercenary commands.
  799. 13.- Party commands.
  800. 14.- Channel commands.
  801. 15.- Achievement commands.
  802. =====================
  803. |1.- Basic commands.|
  804. =====================
  805. ---------------------------------------
  806. *mes "<string>"{,"<string>"{,...}};
  807. This command will display a box on the screen for the invoking character, if no
  808. such box is displayed already, and will print the string specified into that
  809. box. There is normally no 'close' or 'next' button on this box, unless you
  810. create one with 'close' or 'next', and while it's open the player can't do much
  811. else, so it's important to create a button later. If the string is empty, it
  812. will show up as an empty line.
  813. mes "Text that will appear in the box";
  814. Colors
  815. ------
  816. Inside the string you may put color codes, which will alter the color of the
  817. text printed after them. The color codes are all '^<R><G><B>' and contain three
  818. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  819. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  820. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  821. whenever the client is drawing windows on screen, so printing text in that color
  822. will have kind of a weird effect. Once you've set a text's color to something,
  823. you have to set it back to black unless you want all the rest of the text be in
  824. that color:
  825. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  826. Notice that the text coloring is handled purely by the client. If you use non-
  827. English characters, the color codes might get screwed if they stick to letters
  828. with no intervening space. Separating them with spaces from the letters on
  829. either side solves the problem.
  830. Multiple Lines
  831. --------------
  832. To display multiple lines of message while only using a single 'mes' command,
  833. use the script command in the following format:
  834. mes "Line 1", "Line 2", "Line 3";
  835. This will display 3 different lines while only consuming a single line in
  836. the relevant script file.
  837. Navigation
  838. ----------
  839. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  840. using HTML-like labels:
  841. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  842. The "flag" parameter can be:
  843. 0: Do not open Navigation Window (default).
  844. 1: Open Navigation Window.
  845. The example below will make the [Tool Shop] text clickable and begin navigation
  846. to alberta (98,154) when clicked.
  847. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  848. See also 'navigateto', which can be used for certain NPC events.
  849. Items
  850. -----
  851. You can refer to items by using HTML-like links to certain items:
  852. <ITEMLINK>Display Name<INFO>Item ID</INFO></ITEMLINK>
  853. Where <Display Name> is the name that will be displayed for your link and
  854. <Item ID> being the ID of the item you want to link to when clicked.
  855. In 2015 the tag name was changed to <ITEM> resulting in the following syntax:
  856. <ITEM>Display Name<INFO>Item ID</INFO></ITEM>
  857. The following sample will open a preview window for Red Potion:
  858. mes "Did you ever consume a <ITEMLINK>Red Potion<INFO>501</INFO></ITEMLINK>?";
  859. // Or in 2015:
  860. mes "Did you ever consume a <ITEM>Red Potion<INFO>501</INFO></ITEM>?";
  861. NOTE: Be aware that item links are rendered incorrectly in 2015+ clients at the moment.
  862. URLs
  863. ----
  864. Similarly, you can create links to websites that launch in a new window:
  865. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  866. ---------------------------------------
  867. *next;
  868. This command will display a 'next' button in the message window for the
  869. invoking character. Clicking on it will cause the window to clear and display
  870. a new one. Used to segment NPC-talking, next is often used in combination with
  871. 'mes' and 'close'.
  872. If no window is currently on screen, one will be created, but once the invoking
  873. character clicks on it, a warning is thrown on the server console and the script
  874. will terminate.
  875. mes "[Woman]";
  876. mes "This would appear on the page";
  877. next;
  878. // This is needed since it is a new page and the top will now be blank
  879. mes "[Woman]";
  880. mes "This would appear on the 2nd page";
  881. ---------------------------------------
  882. *clear;
  883. This command will clear the dialog text and continue the script without player interaction.
  884. Example:
  885. mes "This is how the 'clear' script command works.";
  886. sleep2 3000;
  887. clear; // This will clear the dialog and continue to the next one.
  888. mes "I will show you again.";
  889. sleep2 3000;
  890. clear;
  891. mes "Bye!";
  892. close;
  893. ---------------------------------------
  894. *close;
  895. This command will create a 'close' button in the message window for the invoking
  896. character. If no window is currently on screen, the script execution will end. This is one
  897. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  898. script execution will end, and the message box will disappear.
  899. mes "[Woman]";
  900. mes "I am finished talking to you. Click the close button.";
  901. close;
  902. mes "This command will not run at all, since the script has ended.";
  903. ---------------------------------------
  904. *close2;
  905. This command will create a 'close' button in the message window for the invoking
  906. character. WARNING: If no window is currently on screen, the script execution will halt
  907. indefinitely! See 'close'. There is one important difference, though - even though
  908. the message box will have closed, the script execution will not stop, and commands after
  909. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  910. make it stop in some other manner.
  911. mes "[Woman]";
  912. mes "I will warp you now.";
  913. close2;
  914. warp "place",50,50;
  915. end;
  916. Don't expect things to run smoothly if you don't make your scripts 'end'.
  917. ---------------------------------------
  918. *end;
  919. This command will stop the execution for this particular script. The two
  920. versions are perfectly equivalent. It is the normal way to end a script which
  921. does not use 'mes'.
  922. if (BaseLevel <= 10)
  923. npctalk "Look at that you are still a n00b";
  924. else if (BaseLevel <= 20)
  925. npctalk "Look at that you are getting better, but still a n00b";
  926. else if (BaseLevel <= 30)
  927. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  928. else if (BaseLevel <= 40)
  929. npctalk "Look at that you are almost 2nd profession";
  930. end;
  931. Without the use of 'end' it would travel through the labels until the end of the
  932. script. If you were lvl 10 or less, you would see all the speech lines, the use
  933. of 'end' stops this, and ends the script.
  934. ---------------------------------------
  935. *set <variable>,<expression>{,<char_id>};
  936. *set(<variable>,<expression>{,<char id>})
  937. This command will set a variable to the value that the expression results in.
  938. Variables may either be set through this command or directly, much like any
  939. other programming language (refer to the "Assigning variables" section).
  940. This is the most basic script command and is used a lot whenever you try to do
  941. anything more advanced than just printing text into a message box.
  942. set @x,100;
  943. will make @x equal 100.
  944. set @x,1+5/8+9;
  945. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  946. integer in this language) and make @x equal it.
  947. Returns the variable reference (since trunk r12870).
  948. ---------------------------------------
  949. *setd "<variable name>",<value>{,<char_id>};
  950. Works almost identically as set, except the variable name is identified as a string
  951. and can thus be constructed dynamically.
  952. This command is equivalent to:
  953. set getd("variable name"),<value>;
  954. Examples:
  955. setd ".@var$", "Poporing";
  956. mes .@var$; // Displays "Poporing".
  957. setd ".@" + .@var$ + "123$", "Poporing is cool";
  958. mes .@Poporing123$; // Displays "Poporing is cool".
  959. NOTE:
  960. 'char_id' only works for non-server variables.
  961. Player with Character ID 'char_id' must be online.
  962. ---------------------------------------
  963. *getd("<variable name>")
  964. Returns a reference to a variable, the name can be constructed dynamically.
  965. Refer to 'setd' for usage.
  966. This can also be used to set an array dynamically:
  967. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  968. Examples:
  969. set getd("$varRefence"), 1;
  970. set @i, getd("$" + "pikachu");
  971. ---------------------------------------
  972. *getvariableofnpc(<variable>,"<npc name>")
  973. Returns a reference to a NPC variable (. prefix) from the target NPC.
  974. This can only be used to get . variables.
  975. Examples:
  976. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  977. getvariableofnpc(.var,"TargetNPC");
  978. //This will set the .v variable to the value of the TargetNPC's .var variable.
  979. set .v, getvariableofnpc(.var,"TargetNPC");
  980. //This will set the .var variable of TargetNPC to 1.
  981. set getvariableofnpc(.var,"TargetNPC"), 1;
  982. Note: even though function objects can have .variables,
  983. getvariableofnpc will not work on them.
  984. ---------------------------------------
  985. *getvar <variable>,<char_id>;
  986. Get variable value from the specified player. Only player/account variables
  987. are allowed to be used (temporary character variable "@", permanent
  988. character "", permanent local account "#", and permanent global account "##").
  989. ---------------------------------------
  990. *goto <label>;
  991. This command will make the script jump to a label, usually used in conjunction
  992. with other command, such as "if", but often used on its own.
  993. ...
  994. goto Label;
  995. mes "This will not be seen";
  996. end;
  997. Label:
  998. mes "This will be seen";
  999. end;
  1000. This command should be avoided and only used if there is no other option.
  1001. ---------------------------------------
  1002. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  1003. This command will create a selectable menu for the invoking character. Only one
  1004. menu can be on screen at the same time.
  1005. Depending on what the player picks from the menu, the script execution will
  1006. continue from the corresponding label. (it's string-label pairs, not label-
  1007. string)
  1008. Options can be grouped together, separated by the character ':'.
  1009. menu "A:B",L_Wrong,"C",L_Right;
  1010. It also sets a special temporary character variable @menu, which contains the
  1011. number of option the player picked. (Numbering of options starts at 1.)
  1012. This number is consistent with empty options and grouped options.
  1013. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  1014. L_Wrong:
  1015. // If they click "A" or "B" they will end up here
  1016. // @menu == 1 if "A"
  1017. // @menu == 2 will never happen because the option is empty
  1018. // @menu == 3 if "B"
  1019. L_Impossible:
  1020. // Empty options are not displayed and therefore can't be selected
  1021. // this label will never be reached from the menu command
  1022. L_Right:
  1023. // If they click "C" they will end up here
  1024. // @menu == 5
  1025. If a label is '-', the script execution will continue right after the menu
  1026. command if that option is selected, this can be used to save you time, and
  1027. optimize big scripts.
  1028. menu "A::B:",-,"C",L_Right;
  1029. // If they click "A" or "B" they will end up here
  1030. // @menu == 1 if "A"
  1031. // @menu == 3 if "B"
  1032. L_Right:
  1033. // If they click "C" they will end up here
  1034. // @menu == 5
  1035. Both these examples will perform the exact same task.
  1036. If you give an empty string as a menu item, the item will not display. This
  1037. can effectively be used to script dynamic menus by using empty string for
  1038. entries that should be unavailable at that time.
  1039. You can do it by using arrays, but watch carefully - this trick isn't high
  1040. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1041. until you understand how it works.
  1042. Create a temporary array of strings to contain your menu items, and populate it
  1043. with the strings that should go into the menu at this execution, making sure not
  1044. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1045. this:
  1046. setarray @possiblemenuitems$[0],<list of potential menu items>;
  1047. @j = 0; // That's the menu lines counter.
  1048. // We loop through the list of possible menu items.
  1049. // @i is our loop counter.
  1050. for( @i = 0; @i < getarraysize(@possiblemenuitems$); @i++ )
  1051. {
  1052. // That 'condition' is whatever condition that determines whether
  1053. // a menu item number @i actually goes into the menu or not.
  1054. if (<condition>)
  1055. {
  1056. // We record the option into the list of options actually available.
  1057. @menulist$[@j] = @possiblemenuitems$[@i];
  1058. // We just copied the string, we do need its number for later
  1059. // though, so we record it as well.
  1060. @menureference[@j] = @i;
  1061. // Since we've just added a menu item into the list, we increment
  1062. // the menu lines counter.
  1063. @j++;
  1064. }
  1065. // We go on to the next possible menu item.
  1066. }
  1067. This will create you an array @menulist$ which contains the text of all items
  1068. that should actually go into the menu based on your condition, and an array
  1069. @menureference, which contains their numbers in the list of possible menu items.
  1070. (Remember, arrays start with 0.) There's less of them than the possible menu
  1071. items you've defined, but the menu command can handle the empty lines - only if
  1072. they are last in the list, and if it's made this way, they are. Now comes a
  1073. dirty trick:
  1074. // X is whatever the most menu items you expect to handle.
  1075. menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
  1076. This calls up a menu of all your items. Since you didn't copy some of the
  1077. possible menu items into the list, its end is empty and so no menu items will
  1078. show up past the end. But this menu call doesn't jump anywhere, it just
  1079. continues execution right after the menu command. (And it's a good thing it
  1080. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1081. know which ones to define if you don't know beforehand which options will end up
  1082. where in your menu?)
  1083. But how do you figure out which option the user picked? Enter the @menu.
  1084. @menu contains the number of option that the user selected from the list,
  1085. starting with 1 for the first option. You know now which option the user picked
  1086. and which number in your real list of possible menu items it translated to:
  1087. mes "You selected " + @possiblemenuitems$[@menureference[@menu-1]] + "!";
  1088. @menu is the number of option the user picked.
  1089. @menu-1 is the array index for the list of actually used menu items that we
  1090. made.
  1091. @menureference[@menu-1] is the number of the item in the array of possible menu
  1092. items that we've saved just for this purpose.
  1093. And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
  1094. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1095. You can set up a bunch of 'if (@menureference[@menu-1] == X) goto Y' statements to
  1096. route your execution based on the line selected and still generate a different
  1097. menu every time, which is handy when you want to, for example, make users select
  1098. items in any specific order before proceeding, or make a randomly shuffled menu.
  1099. Kafra code bundled with the standard distribution uses a similar array-based
  1100. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1101. probably since that wasn't documented anywhere.
  1102. See also 'select', which is probably better in this particular case. Instead of
  1103. menu, you could use 'select' like this:
  1104. @dummy = select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
  1105. For the purposes of the technique described above these two statements are
  1106. perfectly equivalent.
  1107. ---------------------------------------
  1108. *select("<option>"{,"<option>",...})
  1109. *prompt("<option>"{,"<option>",...})
  1110. This function is a handy replacement for 'menu' for some specific cases where
  1111. you don't want a complex label structure - like, for example, asking simple yes-
  1112. no questions. It will return the number of menu option picked, starting with 1.
  1113. Like 'menu', it will also set the variable @menu to contain the option the user
  1114. picked.
  1115. if (select("Yes:No" ) == 1)
  1116. mes "You said yes, I know.";
  1117. And like 'menu', the selected option is consistent with grouped options
  1118. and empty options.
  1119. 'prompt' works almost the same as select, except that when a character clicks
  1120. the Cancel button, this function will return 255 instead.
  1121. ---------------------------------------
  1122. *input(<variable>{,<min>{,<max>}})
  1123. This command will make an input box pop up on the client connected to the
  1124. invoking character, to allow entering of a number or a string. This has many
  1125. uses, one example would be a guessing game, also making use of the 'rand'
  1126. function:
  1127. mes "[Woman]";
  1128. mes "Try and guess the number I am thinking of.";
  1129. mes "The number will be between 1 and 10.";
  1130. next;
  1131. .@number = rand(1,10);
  1132. input .@guess;
  1133. if (.@guess == .@number) {
  1134. mes "[Woman]";
  1135. mes "Well done, that was the number I was thinking of!";
  1136. close;
  1137. } else {
  1138. mes "[Woman]";
  1139. mes "Sorry, that wasn't the number I was thinking of.";
  1140. close;
  1141. }
  1142. If you give the input command a string variable to put the input in, it will
  1143. allow the player to enter text. Otherwise, only numbers will be allowed.
  1144. mes "[Woman]";
  1145. mes "Please say HELLO";
  1146. next;
  1147. input .@var$;
  1148. if (.@var$ == "HELLO") {
  1149. mes "[Woman]";
  1150. mes "Well done, you typed it correctly.";
  1151. close;
  1152. } else {
  1153. mes "[Woman]";
  1154. mes "Sorry, you got it wrong.";
  1155. close;
  1156. }
  1157. Normally you may not input a negative number with this command.
  1158. This is done to prevent exploits in badly written scripts, which would
  1159. let people, for example, put negative amounts of Zeny into a bank script and
  1160. receive free Zeny as a result.
  1161. Since trunk r12192 the command has two optional arguments and a return value.
  1162. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1163. 'input_max_value' in script_athena.conf.
  1164. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1165. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1166. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1167. shorter than 'min' and 0 otherwise.
  1168. ---------------------------------------
  1169. *callfunc "<function>"{,<argument>,...<argument>};
  1170. *callfunc("<function>"{,<argument>,...<argument>})
  1171. This command lets you call up a function NPC. A function NPC can be called from
  1172. any script on any map server. Using the 'return' command it will come back to
  1173. the place that called it.
  1174. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1175. mes "[Woman]"
  1176. mes "Let's see if you win...";
  1177. callfunc "funcNPC";
  1178. mes "Well done, you have won!";
  1179. close;
  1180. }
  1181. function%TAB%script%TAB%funcNPC%TAB%{
  1182. .@win = rand(2);
  1183. if (.@win == 0)
  1184. return;
  1185. mes "Sorry, you lost.";
  1186. close;
  1187. }
  1188. You can pass arguments to your function - values telling it what exactly to do -
  1189. which will be available there with getarg() (see 'getarg')
  1190. Notice that returning is not mandatory, you can end execution right there.
  1191. If you want to return a real value from inside your function NPC, it is better
  1192. to write it in the function form, which will also work and will make the script
  1193. generally cleaner:
  1194. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1195. mes "[Man]"
  1196. mes "Gimme a number!";
  1197. next;
  1198. input @number;
  1199. if (callfunc("OddFunc",@number)) mes "It's Odd!";
  1200. close;
  1201. }
  1202. function%TAB%script%TAB%OddFunc%TAB%{
  1203. if (getarg(0)%2 == 0)
  1204. return 0;// it's even
  1205. return 1;// it's odd
  1206. }
  1207. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1208. may be called directly without the use of the 'callfunc' script command.
  1209. function<tab>script<tab>SayHello<tab>{
  1210. mes "Hello " + getarg(0);
  1211. return 0;
  1212. }
  1213. place,50,50,6<tab>script<tab>Man<tab>115,{
  1214. mes "[Man]";
  1215. SayHello strcharinfo(0);
  1216. close;
  1217. }
  1218. Note:
  1219. !! A user-defined function must be declared /before/ a script attempts to
  1220. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1221. !! (or loaded in a separate file first) before attempting to call them directly.
  1222. ---------------------------------------
  1223. *callsub <label>{,<argument>,...<argument>};
  1224. *callsub(<label>{,<argument>,...<argument>})
  1225. This command will go to a specified label within the current script (do NOT use
  1226. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1227. arguments given, if any, which can be recovered there with 'getarg'. When done
  1228. there, you should use the 'return' command to go back to the point from where
  1229. this label was called. This is used when there is a specific thing the script
  1230. will do over and over, this lets you use the same bit of code as many times as
  1231. you like, to save space and time, without creating extra NPC objects which are
  1232. needed with 'callfunc'. A label is not callable in this manner from another
  1233. script.
  1234. Example 1: callsub for checking (if checks pass, return to script)
  1235. callsub S_CheckFull, "guild_vs2",50;
  1236. switch( rand(4) ) {
  1237. case 0: warp "guild_vs2",9,50; end;
  1238. case 1: warp "guild_vs2",49,90; end;
  1239. case 2: warp "guild_vs2",90,50; end;
  1240. case 3: warp "guild_vs2",49,9; end;
  1241. }
  1242. ...
  1243. S_CheckFull:
  1244. if (getmapusers(getarg(0)) >= getarg(1)) {
  1245. mes "I'm sorry, this arena is full. Please try again later.";
  1246. close;
  1247. }
  1248. return;
  1249. Example 2: callsub used repeatedly, with different arguments
  1250. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1251. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
  1252. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1253. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1254. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1255. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1256. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1257. // etc
  1258. }
  1259. ...
  1260. S_DunWarp:
  1261. // getarg(0) = "map name"
  1262. // getarg(1) = x
  1263. // getarg(2) = y
  1264. if (Zeny >= 100) {
  1265. Zeny -= 100;
  1266. warp getarg(0),getarg(1),getarg(2);
  1267. } else {
  1268. mes "Dungeon warp costs 100 Zeny.";
  1269. }
  1270. close;
  1271. ---------------------------------------
  1272. *getarg(<index>{,<default_value>})
  1273. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1274. call you can specify variables that will make that call different from another
  1275. one. This function will return an argument the function or subroutine was
  1276. called with, and is the normal way to get them.
  1277. This is another thing that can let you use the same code more than once.
  1278. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1279. If no such argument was given, a zero is returned.
  1280. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1281. mes "[Woman]";
  1282. mes "Let's see if you win...";
  1283. callfunc "funcNPC",2;
  1284. mes "Well done, you have won!";
  1285. close;
  1286. }
  1287. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1288. mes "[Woman]";
  1289. mes "Let's see if you win...";
  1290. callfunc "funcNPC",5;
  1291. mes "Well done, you have won!";
  1292. close;
  1293. }
  1294. function%TAB%script%TAB%funcNPC%TAB%{
  1295. .@win = rand(getarg(0));
  1296. if (.@win == 0) return;
  1297. mes "Sorry, you lost.";
  1298. close;
  1299. |
  1300. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1301. stated as 2, so when the random number is generated by the 'rand' function, it
  1302. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1303. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1304. "woman2" less likely to say the player won.
  1305. You can pass multiple arguments in a function call:
  1306. callfunc "funcNPC",5,4,3;
  1307. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1308. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1309. If the target argument exists, it is returned.
  1310. Otherwise, if <default_value> is present it is returned instead,
  1311. if not the script terminates immediately.
  1312. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1313. ---------------------------------------
  1314. *getargcount()
  1315. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1316. call you can specify arguments. This function will return the number of arguments
  1317. provided.
  1318. Example:
  1319. callfunc "funcNPC",5,4,3;
  1320. ...
  1321. function%TAB%script%TAB%funcNPC%TAB%{
  1322. .@count = getargcount(); // 3
  1323. ...
  1324. }
  1325. ---------------------------------------
  1326. *return {<value>};
  1327. This command causes the script execution to leave previously called function
  1328. with callfunc or script with callsub and return to the location, where the call
  1329. originated from. Optionally a return value can be supplied, when the call was
  1330. done using the function form.
  1331. Using this command outside of functions or scripts referenced by callsub will
  1332. result in error and termination of the script.
  1333. callfunc "<your function>";// when nothing is returned
  1334. set <variable>,callfunc("<your function>");// when a value is being returned
  1335. ---------------------------------------
  1336. *function <function name>;
  1337. *<function name>{(<argument>,...<argument>)};
  1338. *function <function name> {
  1339. <code>
  1340. }
  1341. This works like callfunc, and is used for cleaner and faster scripting. The function
  1342. must be defined and used within a script, and works like a label with arguments.
  1343. Note that the name may only contain alphanumeric characters and underscore.
  1344. Usage:
  1345. 1. Declare the function.
  1346. function <function name>;
  1347. 2. Call the function anywhere within the script.
  1348. It can also return a value when used with parentheses.
  1349. <function name>;
  1350. 3. Define the function within the script.
  1351. <function name> {<code>}
  1352. Example:
  1353. prontera,154,189,4 script Item Seller 767,{
  1354. /* Function declaration */
  1355. function SF_Selling;
  1356. if (Zeny > 50) {
  1357. mes "Welcome!";
  1358. /* Function call */
  1359. SF_Selling;
  1360. }
  1361. else mes "You need 50z, sorry!";
  1362. close;
  1363. /* Function definition */
  1364. function SF_Selling {
  1365. mes "Would you like to buy a phracon for 50z?";
  1366. next;
  1367. if (select("Yes","No, thanks") == 1) {
  1368. Zeny -= Zeny;
  1369. getitem 1010,1;
  1370. mes "Thank you!";
  1371. }
  1372. return;
  1373. }
  1374. }
  1375. Example with parameters and return value:
  1376. prontera,150,150,0 script TestNPC 123,{
  1377. /* Function declaration */
  1378. function MyAdd;
  1379. mes "Enter two numbers.";
  1380. next;
  1381. input .@a;
  1382. input .@b;
  1383. /* Function call */
  1384. mes .@a + " + " + .@b + " = " + MyAdd(.@a,.@b);
  1385. close;
  1386. /* Function definition */
  1387. function MyAdd {
  1388. return getarg(0)+getarg(1);
  1389. }
  1390. }
  1391. ---------------------------------------
  1392. *is_function("<function name>")
  1393. This command checks whether a function exists.
  1394. It returns 1 if function is found, or 0 if it isn't.
  1395. Example:
  1396. function script try {
  1397. dothat;
  1398. }
  1399. - script test -1,{
  1400. .@try = is_function("try"); // 1
  1401. .@not = is_function("not"); // 0
  1402. }
  1403. ---------------------------------------
  1404. *if (<condition>) <statement>;
  1405. This is the basic conditional statement command, and just about the only one
  1406. available in this scripting language.
  1407. The condition can be any expression. All expressions resulting in a non-zero
  1408. value will be considered True, including negative values. All expressions
  1409. resulting in a zero are false.
  1410. If the expression results in True, the statement will be executed. If it isn't
  1411. true, nothing happens and we move on to the next line of the script.
  1412. if (1) mes "This will always print.";
  1413. if (0) mes "And this will never print.";
  1414. if (5) mes "This will also always print.";
  1415. if (-1) mes "Funny as it is, this will also print just fine.";
  1416. For more information on conditional operators see the operators section above.
  1417. Anything that is returned by a function can be used in a condition check without
  1418. bothering to store it in a specific variable:
  1419. if (strcharinfo(0) == "Daniel Jackson") mes "It is true, you are Daniel!";
  1420. More examples of using the 'if' command in the real world:
  1421. Example 1:
  1422. .@answer = 1;
  1423. input .@input;
  1424. if (.@input == .@answer)
  1425. close;
  1426. mes "Sorry, your answer is incorrect.";
  1427. close;
  1428. Example 2:
  1429. .@answer = 1;
  1430. input .@input;
  1431. if (.@input != .@answer)
  1432. mes "Sorry, your answer is incorrect.";
  1433. close;
  1434. Notice that examples 1 and 2 have the same effect.
  1435. Example 3:
  1436. @count++;
  1437. mes "[Forgetful Man]";
  1438. if (@count == 1) mes "This is the first time you have talked to me.";
  1439. if (@count == 2) mes "This is the second time you have talked to me.";
  1440. if (@count == 3) mes "This is the third time you have talked to me.";
  1441. if (@count == 4) {
  1442. mes "This is the fourth time you have talked to me.";
  1443. mes "I think I am getting amnesia, I have forgotten about you...";
  1444. @count = 0;
  1445. }
  1446. close;
  1447. Example 4:
  1448. mes "[Quest Person]";
  1449. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in item_db
  1450. mes "Can you please bring me an apple?";
  1451. close;
  1452. }
  1453. mes "Oh, you brought an Apple!";
  1454. mes "I didn't want it, I just wanted to see one.";
  1455. close;
  1456. Example 5:
  1457. mes "[Person Checker]";
  1458. if ($@name$ == "") { // global variable not yet set
  1459. mes "Please tell me someones name";
  1460. next;
  1461. input $@name$;
  1462. $@name2$ = strcharinfo(0);
  1463. mes "[Person Checker]";
  1464. mes "Thank you.";
  1465. close;
  1466. }
  1467. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1468. mes "You are the person that " + $@name2$ + " just mentioned.";
  1469. mes "Nice to meet you!";
  1470. // reset the global variables
  1471. $@name$ = "";
  1472. $@name2$ = "";
  1473. close;
  1474. }
  1475. mes "You are not the person that " + $name2$ + " mentioned.";
  1476. close;
  1477. See 'strcharinfo' for an explanation of what this function does.
  1478. Example 6: Using complex conditions.
  1479. mes "[Multiple Checks]";
  1480. if (@queststarted == 1 && countitem(512) >= 5) {
  1481. mes "Well done, you have started the quest and brought me 5 Apples.";
  1482. @queststarted = 0;
  1483. delitem 512,5;
  1484. close;
  1485. }
  1486. mes "Please bring me 5 apples.";
  1487. @queststarted = 1;
  1488. close;
  1489. The script engine also supports nested 'if' statements:
  1490. if (<condition>)
  1491. dothis;
  1492. else
  1493. dothat;
  1494. If the condition isn't met, it'll do the action following the 'else'.
  1495. We can also group several actions depending on a condition:
  1496. if (<condition>) {
  1497. dothis1;
  1498. dothis2;
  1499. } else {
  1500. dothat1;
  1501. dothat2;
  1502. dothat3;
  1503. }
  1504. Remember that if you plan to do several actions upon the condition being false, and
  1505. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1506. the output of the condition, unless of course, you stop the execution of the script if the
  1507. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1508. Also, you can have multiple conditions nested or chained.
  1509. if (<condition 1>)
  1510. dothis;
  1511. else if (<condition 2>) {
  1512. dothat;
  1513. end;
  1514. } else
  1515. dothis;
  1516. ---------------------------------------
  1517. *jump_zero (<condition>),<label>;
  1518. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1519. If the condition is false (equal to zero) this command will immediately jump to
  1520. the specified label like in 'goto'. While 'if' is more generally useful, for
  1521. some cases this could be an optimization.
  1522. The main reason for this command is that other control statements, like
  1523. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1524. with this command when a script is parsed.
  1525. ---------------------------------------
  1526. *switch (expression);
  1527. The switch statement is similar to a series of if statements on the same expression.
  1528. In many occasions, you may want to compare the same variable (or expression)
  1529. with many different values, and execute a different piece of code depending
  1530. on which value it equals to. This is exactly what the switch statement is for.
  1531. It is important to understand how the switch statement is executed in order
  1532. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1533. In the beginning, no code is executed. Only when a case statement is found
  1534. with a value that matches the value of the switch expression the case statement(s)
  1535. will to executed. The parser continues to execute the statements until the end
  1536. of the switch block, or the first time it sees a break statement. If you don't
  1537. write a break statement at the end of a case's statement list, the parser will
  1538. go on executing the statements of the following case (fall-through).
  1539. Example 1:
  1540. switch(select("Yes:No")) {
  1541. case 1:
  1542. mes "You said yes!";
  1543. break;
  1544. case 2:
  1545. mes "Aww, why?";
  1546. break;
  1547. }
  1548. close;
  1549. The example above would work like a menu and would go to the first case if
  1550. the user selects option, otherwise, would go to the second one.
  1551. Example 2:
  1552. switch(getgroupid()) {
  1553. case 1:
  1554. mes "Wow, you're super!";
  1555. break;
  1556. case 2:
  1557. mes "A helping hand!";
  1558. break;
  1559. case 3:
  1560. mes "10001010010011";
  1561. break;
  1562. case 4:
  1563. mes "Yes, milord?";
  1564. break;
  1565. default:
  1566. mes "Hello there!";
  1567. break;
  1568. }
  1569. The example above would print a message depending on the player's groupid.
  1570. If there is no statement declared for the corresponding groupid, the script
  1571. would use the 'default' statement that applies to rest of possible values,
  1572. similar to 'else' in the if-else statement.
  1573. ---------------------------------------
  1574. *while (<condition>) <statement>;
  1575. This is probably the simplest and most frequently used loop structure. The 'while'
  1576. statement can be interpreted as "while <condition> is true, perform <statement>".
  1577. It is a pretest loop, meaning the conditional expression is tested before any of the
  1578. statements in the body of the loop are performed. If the condition evaluates to
  1579. false, the statement(s) in the body of the loop is/are never executed. If the
  1580. condition evaluates to true, the statement(s) are executed, then control transfers
  1581. back to the conditional expression, which is reevaluated and the cycle continues.
  1582. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1583. Example 1:
  1584. while (switch(select("Yes:No") == 2 ))
  1585. mes "You picked no.";
  1586. close;
  1587. Example 2: multiple statements
  1588. while (switch(select("Yes:No") == 2 )) {
  1589. mes "Why did you pick no?";
  1590. mes "You should pick yes instead!";
  1591. }
  1592. close;
  1593. Example 3: counter-controlled loop
  1594. .@i = 1;
  1595. while (.@i <= 5) {
  1596. mes "This line will print 5 times.";
  1597. .@i += 1;
  1598. }
  1599. close;
  1600. Example 4: sentinel-controlled loop
  1601. mes "Input 0 to stop";
  1602. input .@num;
  1603. while (.@num != 0) {
  1604. mes "You entered " + .@num;
  1605. input .@num;
  1606. }
  1607. close;
  1608. ---------------------------------------
  1609. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1610. Another pretest looping structure is the 'for' statement. It is considered a
  1611. specialized form of the 'while' statement, and is usually associated with counter-
  1612. controlled loops. Here are the steps of the 'for' statement: the initialize
  1613. statement is executed first and only once. The condition test is performed.
  1614. When the condition evaluates to false, the rest of the for statement is skipped.
  1615. When the condition evaluates to true, the body of the loop is executed, then the
  1616. update statement is executed (this usually involves incrementing a variable).
  1617. Then the condition is reevaluated and the cycle continues.
  1618. Example 1:
  1619. for( .@i = 1; .@i <= 5; .@i++ )
  1620. mes "This line will print 5 times.";
  1621. Example 2:
  1622. mes "This will print the numbers 1 - 5.";
  1623. for( .@i = 1; .@i <= 5; .@i++ )
  1624. mes "Number: " + .@i;
  1625. ---------------------------------------
  1626. *do { <statement>; } while (<condition>);
  1627. The 'do...while' is the only post-test loop structure available in this script
  1628. language. With a post-test, the statements are executed once before the condition
  1629. is tested. When the condition is true, the statement(s) are repeated. When the
  1630. condition is false, control is transferred to the statement following the
  1631. 'do...while' loop expression.
  1632. Example 1: sentinel-controlled loop
  1633. mes "This menu will keep appearing until you pick Cancel";
  1634. do {
  1635. .@menu = select("One:Two:Three:Cancel");
  1636. } while (.@menu != 4);
  1637. Example 2: counter-controlled loop
  1638. mes "This will countdown from 10 to 1.";
  1639. .@i = 10;
  1640. do {
  1641. mes .@i;
  1642. .@i -= 1;
  1643. } while (.@i > 0);
  1644. ---------------------------------------
  1645. *freeloop({<toggle>})
  1646. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1647. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1648. warn you if an infinite loop is detected.
  1649. The command will return the state of freeloop for the attached script, even if no
  1650. argument is provided.
  1651. Example:
  1652. freeloop(1); // enable script to loop freely
  1653. // be careful with what you do here
  1654. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1655. dothis;
  1656. // will sleep the script for 1ms when detect an infinity loop to
  1657. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1658. }
  1659. freeloop(0); // disable freeloop
  1660. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1661. dothis;
  1662. // throw an infinity loop error
  1663. }
  1664. ---------------------------------------
  1665. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1666. This command will allow you to quickly fill up an array in one go. Check the
  1667. Kafra scripts in the distribution to see this used a lot.
  1668. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1669. First value is the index of the first element of the array to alter. For
  1670. example:
  1671. setarray @array[0],200,200,200;
  1672. setarray @array[1],300,150;
  1673. will produce:
  1674. @array[0]=200
  1675. @array[1]=300
  1676. @array[2]=150
  1677. ---------------------------------------
  1678. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1679. This command will change many array values at the same time to the same value.
  1680. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1681. // This will make all 6 values 0
  1682. cleararray @array[0],0,6;
  1683. // This will make array element 0 change to 245
  1684. cleararray @array[0],245,1;
  1685. // This will make elements 1 and 2 change to 345
  1686. cleararray @array[1],345,2;
  1687. See 'setarray'.
  1688. ---------------------------------------
  1689. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1690. This command lets you quickly shuffle a lot of data between arrays, which is in
  1691. some cases invaluable.
  1692. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1693. // So we have made @array[]
  1694. copyarray @array2[0],@array[2],2;
  1695. // Now, @array2[0] will be equal to @array[2] (300) and
  1696. // @array2[1] will be equal to @array[3].
  1697. So using the examples above:
  1698. @array[0] = 100
  1699. @array[1] = 200
  1700. @array[2] = 300
  1701. @array[3] = 400
  1702. @array[4] = 500
  1703. @array[5] = 600
  1704. New Array:
  1705. @array2[0] = 300
  1706. @array2[1] = 400
  1707. @array2[2] = 0
  1708. @array2[3] = 0
  1709. Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
  1710. 0.
  1711. ---------------------------------------
  1712. *deletearray <array name>[<first value>],<how much to delete>;
  1713. This command will delete a specified number of array elements totally from an
  1714. array, shifting all the elements beyond this towards the beginning.
  1715. // This will delete array element 0, and move all the other array elements
  1716. // up one place.
  1717. deletearray @array[0],1
  1718. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1719. // place, and move the other elements ups, so there are no gaps.
  1720. deletearray @array[1],3
  1721. ---------------------------------------
  1722. *inarray <array name>,<value>;
  1723. This command returns the index of the first matching value found in the array.
  1724. It will return -1 if the value is not found.
  1725. setarray .@array[0], 100, 200, 300, 400, 500, 600, 100;
  1726. inarray(.@array[0], 200);
  1727. //return 1 because 200 is in index 1
  1728. //another way to say it that .@array[1] == 200
  1729. .@index = inarray(.@array[0], 600);
  1730. //.@index is now 5 because .@array[5] == 600
  1731. inarray(.@array[0], 100);
  1732. //while index 6 is also 100, the command will return the first instance it finds
  1733. //return 0 because .@array[0] == 100
  1734. inarray(.@array[0], 800);
  1735. //return -1 because 800 is not an element of the array .@array
  1736. For more details, see the sample in 'doc/sample/inarray.txt'.
  1737. ---------------------------------------
  1738. *countinarray <array name>{[<start index>]},<array name>{[<start index>]};
  1739. This command will check for matches between the array values and return the number of matches.
  1740. While being optional, if [<start index>] is supplied, the search will begin from the given index value.
  1741. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1742. .@variable = 100;
  1743. if(countinarray(.@array[0], .@variable))
  1744. mes "The number 100 was found in the array @array";
  1745. countinarray(.@array[0], .@variable);
  1746. //return 1 because the number 100 is an element of the array .@array
  1747. setarray .@array2[0],100,500;
  1748. countinarray(.@array[0], .@array2[0]);
  1749. //return 2 because the numbers 100 and 500 are elements of the array .@array
  1750. setarray .@array3[0],100,700;
  1751. countinarray(.@array[0], .@array3[0]);
  1752. //return 1 because the number 100 is an element of the array .@array
  1753. //but the number 700 is not an element of the array .@array
  1754. //also you can change the position between the arrays in the command
  1755. if(countinarray(.@array[0], .@array3[0]) == countinarray(.@array3[0], .@array[0]))
  1756. //This is true
  1757. For more details, see the sample in 'doc/sample/inarray.txt'.
  1758. ---------------------------------------
  1759. ======================================
  1760. |2.- Information-retrieving commands.|
  1761. ======================================
  1762. ---------------------------------------
  1763. *strcharinfo(<type>{,<char_id>})
  1764. This function will return either the name, party name or guild name for the
  1765. invoking character. Whatever it returns is determined by type.
  1766. 0 - Character's name.
  1767. 1 - The name of the party they're in if any.
  1768. 2 - The name of the guild they're in if any.
  1769. 3 - The name of the map the character is in.
  1770. If a character is not a member of any party or guild, an empty string will be
  1771. returned when requesting that information.
  1772. ---------------------------------------
  1773. *strnpcinfo(<type>)
  1774. This function will return the various parts of the name of the calling NPC.
  1775. Whatever it returns is determined by type.
  1776. 0 - The NPC's display name (visible#hidden)
  1777. 1 - The visible part of the NPC's display name
  1778. 2 - The hidden part of the NPC's display name
  1779. 3 - The NPC's unique name (::name)
  1780. 4 - The name of the map the NPC is in.
  1781. ---------------------------------------
  1782. *getarraysize(<array name>)
  1783. This function returns highest index of the array that is filled.
  1784. Notice that zeros and empty strings at the end of this array are not
  1785. counted towards this number.
  1786. For example:
  1787. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1788. set @arraysize,getarraysize(@array);
  1789. This will make @arraysize == 6. But if you try this:
  1790. setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
  1791. set @arraysize,getarraysize(@array);
  1792. @arraysize will still equal 6, even though you've set 7 values.
  1793. ---------------------------------------
  1794. *getelementofarray(<array name>,<index>)
  1795. This command retrieves the value of the element of given array at given index.
  1796. This is equivalent to using:
  1797. <array name>[<index>]
  1798. The reason for this is, that this short form is internally converted into a call
  1799. to getelementofarray, when the script is loaded.
  1800. Also useful when passing arrays to functions or accessing another npc's arrays:
  1801. getelementofarray(getarg(0),<index>)
  1802. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1803. ---------------------------------------
  1804. *readparam(<parameter number>{,"<character name>"})
  1805. *readparam(<parameter number>{,<char_id>})
  1806. This function will return the specified stat of the invoking character, or, if a
  1807. character name or character id is specified, of that player. The stat can either
  1808. be a number or parameter name, defined in 'src/map/script_constants.h'.
  1809. Some example parameters:
  1810. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1811. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1812. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
  1813. All of these also behave as variables, but don't expect to be able to just 'set'
  1814. them - some will not work for various internal reasons.
  1815. Example 1:
  1816. // Returns how many status points you haven't spent yet.
  1817. mes "Unused status points: " + readparam(9);
  1818. Using this particular information as a function call is not required. Typing this
  1819. will return the same result:
  1820. mes "Unused status points: " + StatusPoint;
  1821. Example 2:
  1822. You can also use this command to get stat values.
  1823. if (readparam(bVit) > 77)
  1824. mes "Only people with over 77 Vit are reading this!";
  1825. ---------------------------------------
  1826. *getcharid(<type>{,"<character name>"})
  1827. This function will return a unique ID number of the invoking character, or, if a
  1828. character name is specified, of that player.
  1829. Type is the kind of associated ID number required:
  1830. 0 - Character ID
  1831. 1 - Party ID
  1832. 2 - Guild ID
  1833. 3 - Account ID
  1834. 4 - Battle Ground ID
  1835. 5 - Clan ID
  1836. For most purposes other than printing it, a number is better to have than a name
  1837. (people do horrifying things to their character names).
  1838. If the character is not in a party or not in a guild, the function will return 0
  1839. if guild or party number is requested. If a name is specified and the character
  1840. is not found, 0 is returned.
  1841. If getcharid(0) returns a zero, the script got called not by a character and
  1842. doesn't have an attached RID. Note that this will cause the map server to
  1843. print "player not attached!" error messages, so it is preferred to use
  1844. "playerattached" to check for the character attached to the script.
  1845. if (getcharid(2) == 0)
  1846. mes "Only members of a guild are allowed here!";
  1847. ---------------------------------------
  1848. *getnpcid(<type>{,"<npc name>"});
  1849. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1850. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1851. to retrieve and can be one of the following:
  1852. 0 - NPC Game ID
  1853. If an invalid type is given or the NPC does not exist, 0 is returned.
  1854. ---------------------------------------
  1855. *getchildid({<char_id>})
  1856. *getmotherid({<char_id>})
  1857. *getfatherid({<char_id>})
  1858. These functions return the character ID of the attached player's child,
  1859. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1860. if (getmotherid()) mes "Your mother's ID is: " + getmotherid();
  1861. ---------------------------------------
  1862. *ispartneron({<char_id>})
  1863. This function returns 1 if the invoking character's marriage partner is
  1864. currently online and 0 if they are not or if the character has no partner.
  1865. ---------------------------------------
  1866. *getpartnerid({<char_id>})
  1867. This function returns the character ID of the invoking character's marriage
  1868. partner, if any. If the invoking character is not married, it will return 0,
  1869. which is a quick way to see if they are married:
  1870. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1871. if (getpartnerid()) mes "You're married already!";
  1872. ---------------------------------------
  1873. *getlook(<type>{,<char_id>})
  1874. This function will return the number for the current character look value
  1875. specified by type. See 'setlook' for valid look types.
  1876. This can be used to make a certain script behave differently for characters
  1877. dressed in black.
  1878. ---------------------------------------
  1879. *getsavepoint(<information type>{,<char_id>})
  1880. This function will return information about the invoking character's save point.
  1881. You can use it to let a character swap between several recorded save points.
  1882. Available information types are:
  1883. 0 - Map name (a string)
  1884. 1 - X coordinate
  1885. 2 - Y coordinate
  1886. ---------------------------------------
  1887. *getcharip({"<character name>"|<account id>|<char id>})
  1888. This function will return the IP address of the invoking character, or, if a player
  1889. is specified, of that character. A blank string is returned if no player is attached.
  1890. Examples:
  1891. // Outputs IP address of attached player.
  1892. mes "Your IP: " + getcharip();
  1893. // Outputs IP address of character "Silver".
  1894. mes "Silver's IP: " + getcharip("Silver");
  1895. ---------------------------------------
  1896. *vip_status(<type>,{"<character name>"})
  1897. Returns various information about a player's VIP status.
  1898. Valid types:
  1899. VIP_STATUS_ACTIVE - VIP status: true if the player is a VIP or false if not
  1900. VIP_STATUS_EXPIRE - VIP expire timestamp if the player is VIP or 0 if not
  1901. VIP_STATUS_REMAINING - VIP time remaining in seconds
  1902. NOTE: This command is only available if the VIP System is enabled.
  1903. ---------------------------------------
  1904. *vip_time <time>,{"<character name>"};
  1905. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1906. negative value will decrease time.
  1907. NOTE: This command is only available if the VIP System is enabled.
  1908. ---------------------------------------
  1909. *addspiritball <count>,<duration>{,<char_id>};
  1910. Adds spirit ball to player for 'duration' in milisecond.
  1911. ---------------------------------------
  1912. *delspiritball <count>{,<char_id>};
  1913. Deletes the spirit ball(s) from player.
  1914. ---------------------------------------
  1915. *countspiritball {<char_id>};
  1916. Counts the spirit ball that player has.
  1917. ---------------------------------------
  1918. *ignoretimeout <flag>{,<char_id>};
  1919. Disables the SECURE_NPCTIMEOUT function on the character invoking the script,
  1920. or by the given character ID/character name.
  1921. Valid flag:
  1922. 0 - Enabled SECURE_NPCTIMEOUT.
  1923. 1 - Disable SECURE_NPCTIMEOUT.
  1924. Note: SECURE_NPCTIMEOUT must be enabled for this to work.
  1925. ---------------------------------------
  1926. \\
  1927. 2,2 Item-related commands
  1928. \\
  1929. ---------------------------------------
  1930. *getequipid({<equipment slot>,<char_id>})
  1931. This function returns the item ID of the item slot that calls the script
  1932. on the invoking character or the specified equipment slot. If nothing is
  1933. equipped there, it returns -1.
  1934. Valid equipment slots are:
  1935. EQI_COMPOUND_ON (-1) - Item slot that calls this script (In context of item script)
  1936. EQI_ACC_L (0) - Accessory 1
  1937. EQI_ACC_R (1) - Accessory 2
  1938. EQI_SHOES (2) - Footgear (shoes, boots)
  1939. EQI_GARMENT (3) - Garment (mufflers, hoods, manteaux)
  1940. EQI_HEAD_LOW (4) - Lower Headgear (beards, some masks)
  1941. EQI_HEAD_MID (5) - Middle Headgear (masks, glasses)
  1942. EQI_HEAD_TOP (6) - Upper Headgear
  1943. EQI_ARMOR (7) - Armor (jackets, robes)
  1944. EQI_HAND_L (8) - Left hand (weapons, shields)
  1945. EQI_HAND_R (9) - Right hand (weapons)
  1946. EQI_COSTUME_HEAD_TOP (10) - Upper Costume Headgear
  1947. EQI_COSTUME_HEAD_MID (11) - Middle Costume Headgear
  1948. EQI_COSTUME_HEAD_LOW (12) - Lower Costume Headgear
  1949. EQI_COSTUME_GARMENT (13) - Costume Garment
  1950. EQI_AMMO (14) - Arrow/Ammunition
  1951. EQI_SHADOW_ARMOR (15) - Shadow Armor
  1952. EQI_SHADOW_WEAPON (16) - Shadow Weapon
  1953. EQI_SHADOW_SHIELD (17) - Shadow Shield
  1954. EQI_SHADOW_SHOES (18) - Shadow Shoes
  1955. EQI_SHADOW_ACC_R (19) - Shadow Accessory 2
  1956. EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
  1957. Notice that a few items occupy several equipment slots, and if the character is
  1958. wearing such an item, 'getequipid' will return its ID number for either slot.
  1959. Can be used to check if you have something equipped, or if you haven't got
  1960. something equipped:
  1961. if (getequipid(EQI_HEAD_TOP) == 2234)
  1962. mes "What a lovely Tiara you have on";
  1963. else
  1964. mes "Come back when you have a Tiara on";
  1965. close;
  1966. You can also use it to make sure people don't pass a point before removing an
  1967. item totally from them. Let's say you don't want people to wear Legion Plate
  1968. armor, but also don't want them to equip if after the check, you would do this:
  1969. if (getequipid(EQI_ARMOR) == 2341 || getequipid(EQI_ARMOR) == 2342) {
  1970. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  1971. close;
  1972. }
  1973. // the || is used as an or argument, there is 2341 and 2342 cause there are
  1974. // two different legion plate armors, one with a slot one without.
  1975. if (countitem(2341) > 0 || countitem(2432) > 0) {
  1976. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  1977. close;
  1978. }
  1979. mes "I will lets you pass.";
  1980. close2;
  1981. warp "place",50,50;
  1982. end;
  1983. ---------------------------------------
  1984. *getequipuniqueid(<equipment slot>{,<char_id>})
  1985. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  1986. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  1987. See 'getequipid' for a full list of valid equipment slots.
  1988. ---------------------------------------
  1989. *getequipname(<equipment slot>{,<char_id>})
  1990. Returns the jname of the item equipped in the specified equipment slot on the
  1991. invoking character, or an empty string if nothing is equipped in that position.
  1992. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  1993. what your are wearing, or maybe saving as a string variable.
  1994. See 'getequipid' for a full list of valid equipment slots.
  1995. if ( getequipname(EQI_HEAD_TOP) != "" )
  1996. mes "So you are wearing a " + getequipname(EQI_HEAD_TOP) + " on your head";
  1997. else
  1998. mes "You are not wearing any head gear";
  1999. ---------------------------------------
  2000. *getitemname(<item id>)
  2001. Given the database ID number of an item, this function will return the text
  2002. stored in the 'japanese name' field (which, in rAthena, stores an English name
  2003. the players would normally see on screen.)
  2004. ---------------------------------------
  2005. *getbrokenid(<number>{,<char_id>})
  2006. This function will search the invoking character's inventory for any broken
  2007. items, and will return their item ID numbers. Since the character may have
  2008. several broken items, 1 given as an argument will return the first one found, 2
  2009. will return the second one, etc. Will return 0 if no such item is found.
  2010. // Let's see if they have anything broken:
  2011. if (getbrokenid(1) == 0)
  2012. mes "You don't have anything broken, quit bothering me.";
  2013. else
  2014. // They do, so let's print the name of the first broken item:
  2015. mes "Oh, I see you have a broken " + getitemname(getbrokenid(1)) + " here!";
  2016. end;
  2017. ---------------------------------------
  2018. *getequipisequiped(<equipment slot>{,<char_id>})
  2019. This functions will return 1 if there is an equipment placed on the specified
  2020. equipment slot and 0 otherwise. For a list of equipment slots
  2021. see 'getequipid'. Function originally used by the refining NPCs:
  2022. if (getequipisequiped(EQI_HEAD_TOP)) {
  2023. mes "[Refiner]";
  2024. mes "That's a fine hat you are wearing there...";
  2025. close;
  2026. } else {
  2027. mes "[Refiner]";
  2028. mes "Do you want me to refine your dumb head?";
  2029. close;
  2030. }
  2031. ---------------------------------------
  2032. *getequipisenableref(<equipment slot>{,<char_id>})
  2033. Will return 1 if the item equipped on the invoking character in the specified
  2034. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  2035. see 'getequipid'.
  2036. if (getequipisenableref(EQI_HEAD_TOP)) {
  2037. mes "[Refiner]";
  2038. mes "Ok I can refine this";
  2039. close;
  2040. } else {
  2041. mes "[Refiner]";
  2042. mes "I can't refine this hat!...";
  2043. close;
  2044. }
  2045. ---------------------------------------
  2046. *getequiprefinerycnt(<equipment slot>{,<char_id>})
  2047. Returns the current number of pluses for the item in the specified equipment
  2048. slot. For a list of equipment slots see 'getequipid'.
  2049. Can be used to check if you have reached a maximum refine value, default for
  2050. this is +10:
  2051. if (getequiprefinerycnt(EQI_HEAD_TOP) < 10)
  2052. mes "I will now upgrade your " + getequipname(EQI_HEAD_TOP);
  2053. else
  2054. mes "Sorry, it's not possible to refine hats better than +10";
  2055. close;
  2056. ---------------------------------------
  2057. *getequipweaponlv(<equipment slot>{,<char_id>})
  2058. This function returns the weapon level for the weapon equipped in the specified
  2059. equipment slot on the invoking character. For a list of equipment slots see
  2060. 'getequipid'.
  2061. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  2062. a weapon level. You can, however, probably, use this field for other equippable
  2063. custom items as a flag or something.
  2064. If no item is equipped in this slot, or if it doesn't have a weapon level
  2065. according to the database, 0 will be returned.
  2066. Examples:
  2067. // Right hand can only contain a weapon.
  2068. switch (getequipweaponlv(EQI_HAND_R)) {
  2069. case 1: mes "You are holding a lvl 1 weapon."; break;
  2070. case 2: mes "You are holding a lvl 2 weapon."; break;
  2071. case 3: mes "You are holding a lvl 3 weapon."; break;
  2072. case 4: mes "You are holding a lvl 4 weapon."; break;
  2073. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2074. default: mes "Seems you don't have a weapon on."; break;
  2075. }
  2076. // Left hand can hold either a weapon or shield.
  2077. if (getequipid(EQI_HAND_R) == 0) {
  2078. mes "Seems you have nothing equipped here.";
  2079. close;
  2080. }
  2081. switch (getequipweaponlv(EQI_HAND_L)) {
  2082. case 0: mes "You are holding a shield, so it doesn't have a level."; break;
  2083. case 1: mes "You are holding a lvl 1 weapon."; break;
  2084. case 2: mes "You are holding a lvl 2 weapon."; break;
  2085. case 3: mes "You are holding a lvl 3 weapon."; break;
  2086. case 4: mes "You are holding a lvl 4 weapon."; break;
  2087. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2088. }
  2089. ---------------------------------------
  2090. *getequippercentrefinery(<equipment slot>{,<enriched>,<char_id>})
  2091. This function calculates and returns the percent value chance to successfully
  2092. refine the item found in the specified equipment slot of the invoking character
  2093. by +1. There is no actual formula, the success rate for a given weapon level of
  2094. a certain refine level is found in the db/(pre-)re/refine_db.yml file. For a list of
  2095. equipment slots see 'getequipid'.
  2096. If enriched parameter is set to true, chance to successfully refine the item with
  2097. enriched material is returned instead.
  2098. These values can be displayed for the player to see, or used to calculate the
  2099. random change of a refine succeeding or failing and then going through with it
  2100. (which is what the official NPC refinery scripts use it for)
  2101. // This will find a random number from 0 - 99 and if that is equal to or more
  2102. // than the value recovered by this command it will go to L_Fail
  2103. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2104. ---------------------------------------
  2105. *getequiprefinecost(<equipment slot>,<type>,<information>{,<char id>})
  2106. This function returns refine cost for equipment in <equipment slot> based on
  2107. passed arguments <type> and <information>.
  2108. Valid cost types are:
  2109. REFINE_COST_NORMAL - For normal refining
  2110. REFINE_COST_OVER10 - For refining over +10
  2111. REFINE_COST_HD - For refining with HD ores
  2112. REFINE_COST_ENRICHED - For refining with enriched ores
  2113. REFINE_COST_OVER10_HD - For refining over +10 with HD ores
  2114. REFINE_COST_HOLINK - For refining at Holink in Malangdo
  2115. REFINE_COST_WAGJAK - For refining at Refining Machine Wagjak in the Novice Academy
  2116. This function will return required cost for refining based on <information> argument.
  2117. Valid information types are:
  2118. REFINE_ZENY_COST - Zeny
  2119. REFINE_MATERIAL_ID - Material Item ID
  2120. This function will return -1 on failure. The function fails if the cost type
  2121. is invalid or if there is no item in the equipment slot.
  2122. ---------------------------------------
  2123. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2124. This function will count all the items with the specified ID number lying on the
  2125. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2126. number.
  2127. This is the only function around where a parameter may be either a string or a
  2128. number! If it's a number, it means that only the items with that item ID number
  2129. will be counted. If it is a string, it is assumed to mean the 'english name'
  2130. field from the item database. If you give it an empty string, or something that
  2131. isn't found from the item database, it will count items number '512' (apples).
  2132. ---------------------------------------
  2133. *getequipcardcnt(<equipment slot>)
  2134. This function will return the number of cards that have been compounded onto a
  2135. specific equipped item for the invoking character. See 'getequipid' for a list
  2136. of possible equipment slots.
  2137. ---------------------------------------
  2138. *getinventorylist {<char_id>};
  2139. This command sets a bunch of arrays with a complete list of whatever the
  2140. invoking character has in their inventory, including all the data needed to
  2141. recreate these items perfectly if they are destroyed. Here's what you get:
  2142. @inventorylist_id[] - array of item ids.
  2143. @inventorylist_amount[] - their corresponding item amounts.
  2144. @inventorylist_equip[] - on which position the item is equipped (see EQP_* constants)
  2145. It will contain 0 if the item is not equipped.
  2146. @inventorylist_refine[] - for how much it is refined.
  2147. @inventorylist_identify[] - whether it is identified.
  2148. @inventorylist_attribute[] - whether it is broken.
  2149. @inventorylist_card1[] - These four arrays contain card data for the items.
  2150. @inventorylist_card2[] These data slots are also used to store names
  2151. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2152. @inventorylist_card4[] if the character owns an item made by a specific
  2153. craftsman.
  2154. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2155. @inventorylist_bound[] - the bound type of the items (see BOUND_* constants)
  2156. @inventorylist_count - the number of items in these lists.
  2157. @inventorylist_option_id1[] - first array of random option IDs
  2158. @inventorylist_option_value1[] - first array of random option values
  2159. @inventorylist_option_parameter1[] - first array of random option parameters
  2160. @inventorylist_option_id2[] - second array of random option IDs
  2161. @inventorylist_option_value2[] - second array of random option values
  2162. @inventorylist_option_parameter2[] - second array of random option parameters
  2163. @inventorylist_option_id3[] - third array of random option IDs
  2164. @inventorylist_option_value3[] - third array of random option values
  2165. @inventorylist_option_parameter3[] - third array of random option parameters
  2166. @inventorylist_option_id4[] - fourth array of random option IDs
  2167. @inventorylist_option_value4[] - fourth array of random option values
  2168. @inventorylist_option_parameter4[] - fourth array of random option parameters
  2169. @inventorylist_option_id5[] - fifth array of random option IDs
  2170. @inventorylist_option_value5[] - fifth array of random option values
  2171. @inventorylist_option_parameter5[] - fifth array of random option parameters
  2172. This could be handy to save/restore a character's inventory, since no other
  2173. command returns such a complete set of data, and could also be the only way to
  2174. correctly handle an NPC trader for carded and named items who could resell them
  2175. - since NPC objects cannot own items, so they have to store item data in
  2176. variables and recreate the items.
  2177. Notice that the variables this command generates are all temporary, attached to
  2178. the character, and integer.
  2179. Be sure to use @inventorylist_count to go through these arrays, and not
  2180. 'getarraysize', because the arrays are not automatically cleared between runs
  2181. of 'getinventorylist'.
  2182. ---------------------------------------
  2183. *cardscnt()
  2184. This function will return the number of cards inserted into the equipment
  2185. from which the function is called.
  2186. This function is intended for use in item scripts.
  2187. ---------------------------------------
  2188. *getrefine()
  2189. This function will return the refine count of the equipment from which the
  2190. function is called.
  2191. This function is intended for use in item scripts.
  2192. ---------------------------------------
  2193. *getnameditem(<item id>,"<name to inscribe>"|<char id>);
  2194. *getnameditem("<item name>","<name to inscribe>"|<char id>);
  2195. This function is equivalent to using 'getitem', however, it will not just give
  2196. the character an item object, but will also inscribe it with a specified
  2197. character's name. You may not inscribe items with arbitrary strings, only with
  2198. names of characters that actually exist. While this isn't said anywhere
  2199. specifically, apparently, named items may not have cards in them, slots or no -
  2200. these data slots are taken by the character ID who's name is inscribed. Only one
  2201. remains free and it's not quite clear if a card may be there.
  2202. This function will return 1 if an item was successfully created and 0 if it
  2203. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2204. 'english name' from the item database as an item name and will return 0 if no
  2205. such item exists.
  2206. ---------------------------------------
  2207. *getitemslots(<item ID>)
  2208. This function will look up the item with the specified ID number in the database
  2209. and return the number of slots this kind of items has - 0 if they are not
  2210. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2211. someone messed up the item database. It will return -1 if there is no such item.
  2212. Example:
  2213. //.@slots now has the amount of slots of the item with ID 1205.
  2214. .@slots = getitemslots(1205);
  2215. ---------------------------------------
  2216. *getiteminfo(<item ID>,<type>)
  2217. This function will look up the item with the specified ID number in the database
  2218. and return the info set by TYPE argument.
  2219. It will return -1 if there is no such item.
  2220. Valid types are:
  2221. 0 - Buy Price
  2222. 1 - Sell Price
  2223. 2 - Type
  2224. 3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2225. if = 0, then monsters don't drop it at all (rare or a quest item)
  2226. if = 10000, then this item is sold in NPC shops only
  2227. 4 - Gender
  2228. 5 - Loc
  2229. 6 - Weight
  2230. 7 - ATK
  2231. 8 - DEF
  2232. 9 - Range
  2233. 10 - Slot
  2234. 11 - View
  2235. 12 - eLV
  2236. 13 - wLV
  2237. 14 - SpriteID from 'db/item_avail.txt'
  2238. 15 - eLVMax
  2239. 16 - matk if RENEWAL is defined
  2240. See the sample in 'doc/sample/getiteminfo.txt'.
  2241. ---------------------------------------
  2242. *getequipcardid(<equipment slot>,<card slot>)
  2243. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2244. This function returns CARD ID, CARD0_FORGE, CARD0_CREATE, or CARD0_PET (for card 0, if the item is produced).
  2245. It's useful for when you want to check whether an item contains cards or if it's signed.
  2246. ---------------------------------------
  2247. *mergeitem({,<char_id>});
  2248. Open merge item window to merge available item can be merged.
  2249. Examples
  2250. 1. See the NPC 'npc/re/other/merge_item.txt'.
  2251. 2. Simple usage:
  2252. mes "Let's check if any item can be merged.";
  2253. close2;
  2254. mergeitem;
  2255. end;
  2256. ---------------------------------------
  2257. *mergeitem2({<item_id>{,<char_id>}});
  2258. *mergeitem2({"<item name>"{,<char_id>}});
  2259. Merge all stackable items that separated by GUID flags
  2260. (either by flag 4 item_flag.txt or GUID in item_group).
  2261. If no item ID/name given, all possible items in player's inventory will be merged.
  2262. ---------------------------------------
  2263. *getequiptradability(<equipment slot>{,<char id>});
  2264. Returns true if the item in <equipment slot> is tradable.
  2265. Returns false otherwise.
  2266. ---------------------------------------
  2267. //
  2268. 2,1.- End of item-related commands.
  2269. //
  2270. ---------------------------------------
  2271. *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  2272. This function will locate a character object, NPC object or pet's coordinates
  2273. and place their coordinates into the variables specified when calling it. It
  2274. will return 0 if the search was successful, and -1 if the parameters given were
  2275. not variables or the search was not successful.
  2276. Type is the type of object to search for:
  2277. UNITTYPE_PC - Character object
  2278. UNITTYPE_NPC - NPC object
  2279. UNITTYPE_PET - Pet object
  2280. UNITTYPE_HOM - Homunculus object
  2281. UNITTYPE_MER - Mercenary object
  2282. UNITTYPE_ELEM - Elemental object
  2283. The search string is optional. If it is not specified, the location of the
  2284. invoking character will always be returned for types UNITTYPE_PC and UNITTYPE_PET,
  2285. the location of the NPC running this function for type 1.
  2286. If a search string is specified, for types UNITTYPE_PC and UNITTYPE_NPC, the
  2287. character or NPC with the specified name will be located.
  2288. If type is UNITTYPE_PET/UNITTYPE_HOM/UNITTYPE_MER/UNITTYPE_ELEM, the search
  2289. will locate the current object of the character who's name is given in the
  2290. search string, it will NOT locate the object by name.
  2291. Example:
  2292. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2293. mes "My name is Meh. I'm here so that Nyah can find me.";
  2294. close;
  2295. }
  2296. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2297. mes "My name is Nyah.";
  2298. mes "I will now search for Meh all across the world!";
  2299. if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "Meh") != 0) {
  2300. mes "I can't seem to find Meh anywhere!";
  2301. close;
  2302. }
  2303. mes "And I found him on map " + @mapname$ + " at X:" + @mapx + " Y:" + @mapy + " !";
  2304. close;
  2305. }
  2306. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2307. ---------------------------------------
  2308. *mapid2name(<map ID>)
  2309. Returns the map name of the given map ID. Returns an empty string if given
  2310. map ID doesn't exist.
  2311. ---------------------------------------
  2312. *getgmlevel({<char_id>})
  2313. This function will return the (GM) level associated with the player group to which
  2314. the invoking character belongs. If this is somehow executed from a console command,
  2315. 99 will be returned, and 0 will be returned if the account has no GM level.
  2316. This allows you to make NPC's only accessible for certain GM levels, or behave
  2317. specially when talked to by GMs.
  2318. if (getgmlevel()) mes "What is your command, your godhood?";
  2319. ---------------------------------------
  2320. *getgroupid({<char_id>})
  2321. This function will return the group id to which the invoking player belongs.
  2322. ---------------------------------------
  2323. *gettimetick(<tick type>)
  2324. This function will return a tick depending on <tick type>:
  2325. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2326. system. This tick is an unsigned int which loops every ~50 days.
  2327. 1: The time, in seconds, since the start of the current day.
  2328. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2329. January 1st, 1970. Useful for reliably measuring time intervals.
  2330. ---------------------------------------
  2331. *gettime(<type>)
  2332. This function will return specified information about the current system time.
  2333. DT_SECOND - Seconds (of the current minute)
  2334. DT_MINUTE - Minutes (of the current hour)
  2335. DT_HOUR - Hour (of the current day)
  2336. DT_DAYOFWEEK - Week day (constants for MONDAY to SUNDAY are available)
  2337. DT_DAYOFMONTH - Day of the current month
  2338. DT_MONTH - Month (constants for JANUARY to DECEMBER are available)
  2339. DT_YEAR - Year
  2340. DT_DAYOFYEAR - Day of the year
  2341. DT_YYYYMMDD - current date in the form YYYYMMDD
  2342. It will only return numbers. If another type is supplied -1 will be returned.
  2343. if (gettime(DT_DAYOFWEEK) == SATURDAY) mes "It's a Saturday. I don't work on Saturdays.";
  2344. ---------------------------------------
  2345. *gettimestr(<"time format">,<max length>{,<time_tick>})
  2346. This function will return a string containing time data as specified by the
  2347. time format.
  2348. This uses the C function 'strfmtime', which obeys special format characters. For
  2349. a full description see, for example, the description of 'strfmtime' at
  2350. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2351. All the format characters given in there should properly work.
  2352. Max length is the maximum length of a time string to generate.
  2353. The example given in rAthena sample scripts works like this:
  2354. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2355. The example above will print the current date and time like 'YYYY-MM/DD HH:MM:SS'.
  2356. The following example will print the date and time when the player's VIP status
  2357. expires by the given <time_tick>:
  2358. mes gettimestr("%Y-%m/%d %H:%M:%S",21,vip_status(VIP_STATUS_EXPIRE));
  2359. ---------------------------------------
  2360. *getusers(<type>)
  2361. This function will return a number of users on a map or the whole server. What
  2362. it returns is specified by Type.
  2363. Type can be one of the following values, which control what will be returned:
  2364. 0 - Count of all characters on the map of the invoking character.
  2365. 1 - Count of all characters in the entire server.
  2366. 8 - Count of all characters on the map of the NPC the script is
  2367. running in.
  2368. ---------------------------------------
  2369. *getmapusers("<map name>")
  2370. This function will return the number of users currently located on the specified
  2371. map.
  2372. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2373. ---------------------------------------
  2374. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2375. This function will return the count of connected characters which are located
  2376. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2377. This is useful for maps that are split into many buildings, such as all the
  2378. "*_in" maps, due to all the shops and houses.
  2379. ---------------------------------------
  2380. \\
  2381. 2,2.- Guild-related commands
  2382. \\
  2383. ---------------------------------------
  2384. *getguildname(<guild id>)
  2385. This function returns a guild's name given an ID number. If there is no such
  2386. guild, "null" will be returned.
  2387. Example:
  2388. mes "The guild " + getguildname(10007) + " are all nice people.";
  2389. ---------------------------------------
  2390. *getguildmember <guild id>{,<type>{,<array_variable>}};
  2391. This command will find all members of a specified guild and returns their names
  2392. (or character id or account id depending on the value of "type") into an array
  2393. of temporary global variables.
  2394. Upon executing this,
  2395. $@guildmembername$[] is a global temporary string array which contains all the
  2396. names of these guild members.
  2397. (only set when type is 0 or not specified)
  2398. $@guildmembercid[] is a global temporary number array which contains the
  2399. character id of these guild members.
  2400. (only set when type is 1)
  2401. $@guildmemberaid[] is a global temporary number array which contains the
  2402. account id of these guild members.
  2403. (only set when type is 2)
  2404. $@guildmembercount is the number of guild members that were found.
  2405. The guild members will be found regardless of whether they are online or offline.
  2406. Note that the names come in no particular order.
  2407. Be sure to use $@guildmembercount to go through this array, and not
  2408. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2409. If 'array_variable' is set, the result will be stored to that variable instead
  2410. using global variable.
  2411. For usage examples, see 'getpartymember'.
  2412. ---------------------------------------
  2413. *getguildmaster(<guild id>)
  2414. This function return the name of the master of the guild which has the specified
  2415. ID number. If there is no such guild, "null" will be returned.
  2416. Example 1:
  2417. // Prints the guild master of guild 10007, whoever that might be.
  2418. mes getguildmaster(10007) + " runs " + getguildname(10007);
  2419. Example 2:
  2420. // Checks if the character is the guild master of the specified guild.
  2421. .@GID = getcharid(2);
  2422. if (.@GID == 0) {
  2423. mes "Sorry, you are not in a guild.";
  2424. close;
  2425. }
  2426. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2427. mes "Sorry, you don't own the guild you are in.";
  2428. close;
  2429. }
  2430. mes "Welcome, guild master of " + getguildname(.@GID);
  2431. close;
  2432. ---------------------------------------
  2433. *getguildmasterid(<guild id>)
  2434. This function will return the character ID number of the guild master of the
  2435. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2436. ---------------------------------------
  2437. *getcastlename("<map name>")
  2438. This function returns the name of the castle when given the map name for that
  2439. castle. The data is read from 'db/castle_db.txt'.
  2440. ---------------------------------------
  2441. *getcastledata("<map name>",<type of data>)
  2442. *setcastledata "<map name>",<type of data>,<value>;
  2443. This function returns the castle ownership information for the castle referred
  2444. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2445. Types of data correspond to `guild_castle` table columns:
  2446. 1 - `guild_id` - Guild ID.
  2447. 2 - `economy` - Castle Economy score.
  2448. 3 - `defense` - Castle Defense score.
  2449. 4 - `triggerE` - Number of times the economy was invested in today.
  2450. 5 - `triggerD` - Number of times the defense was invested in today.
  2451. 6 - `nextTime` - unused
  2452. 7 - `payTime` - unused
  2453. 8 - `createTime` - unused
  2454. 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2455. 10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian)
  2456. 11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2457. 12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2458. 13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian)
  2459. 14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian)
  2460. 15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian)
  2461. 16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian)
  2462. 17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian)
  2463. All types of data have their meaning determined by War of Emperium scripts,
  2464. with exception of:
  2465. - `guild_id` that is always considered ID of the guild that owns the castle,
  2466. - `defense` that is used in Guardians & Emperium HP calculations,
  2467. - `visibleG` that is always considered to hold guardian presence bits.
  2468. The 'setcastledata' command will behave identically, but instead of returning
  2469. values for the specified types of accessible data, it will alter them and cause
  2470. them to be sent to the char-server for storage.
  2471. Changing Guild ID or Castle Defense will trigger additional actions, like
  2472. recalculating guardians' HP.
  2473. ---------------------------------------
  2474. *getgdskilllv(<guild id>,<skill id>)
  2475. *getgdskilllv(<guild id>,"<skill name>")
  2476. This function returns the level of the skill <skill id> of the guild <guild id>.
  2477. If the guild does not have that skill, 0 is returned.
  2478. If the guild does not exist, -1 is returned.
  2479. Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
  2480. ---------------------------------------
  2481. *requestguildinfo <guild id>{,"<event label>"};
  2482. This command requests the guild data from the char server and merrily continues
  2483. with the execution. Whenever the guild information becomes available (which
  2484. happens instantly if the guild information is already in memory, or later, if it
  2485. isn't and the map server has to wait for the char server to reply) it will run
  2486. the specified event as in a 'donpcevent' call.
  2487. ---------------------------------------
  2488. *getmapguildusers("<map name>",<guild id>)
  2489. Returns the amount of characters from the specified guild on the given map.
  2490. Example:
  2491. mes "You have " + getMapGuildUsers("prontera",getcharid(2)) + " guild members in Prontera.";
  2492. ---------------------------------------
  2493. //
  2494. 2,2.- End of guild-related commands
  2495. //
  2496. ---------------------------------------
  2497. *getskilllv(<skill id>)
  2498. *getskilllv("<skill name>")
  2499. This function returns the level of the specified skill that the invoking
  2500. character has. If they don't have the skill, 0 will be returned. The full list
  2501. of character skills is available in 'db/(pre-)re/skill_db.txt'.
  2502. There are two main uses for this function, it can check whether the character
  2503. has a skill or not, and it can tell you if the level is high enough.
  2504. Example 1:
  2505. if (getskilllv(152))
  2506. mes "You have got the skill Throw Stone";
  2507. else
  2508. mes "You don't have Throw Stone";
  2509. close;
  2510. Example 2:
  2511. if (getskilllv(28) >= 5)
  2512. mes "Your heal lvl is 5 or more";
  2513. else if (getskilllv(28) == 10)
  2514. mes "Your heal lvl has been maxed";
  2515. else
  2516. mes "You heal skill is below lvl 5";
  2517. close;
  2518. ---------------------------------------
  2519. *getskilllist({<char_id>});
  2520. This command sets a bunch of arrays with a complete list of skills the
  2521. invoking character has. Here's what you get:
  2522. @skilllist_id[] - skill ids.
  2523. @skilllist_lv[] - skill levels.
  2524. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2525. @skilllist_count - number of skills in the above arrays.
  2526. While 'getskillv' is probably more useful for most situations, this is the
  2527. easiest way to store all the skills and make the character something else for a
  2528. while. Advanced job for a day? This could also be useful to see how many
  2529. skills a character has.
  2530. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2531. ---------------------------------------
  2532. *getmonsterinfo(<mob ID>,<type>)
  2533. This function will look up the monster with the specified ID number in the
  2534. mob database and return the info set by TYPE argument.
  2535. It will return -1 if there is no such monster (or the type value is invalid),
  2536. or "null" if you requested the monster's name.
  2537. Valid types are:
  2538. MOB_NAME - monster's name, if there is no such monster "null" is returned
  2539. MOB_LV - monster's level
  2540. MOB_MAXHP - monster's maximum hp
  2541. MOB_BASEEXP - monster's base experience
  2542. MOB_JOBEXP - monster's job experience
  2543. MOB_ATK1 - monster's atk
  2544. MOB_ATK2 - monster's atk2
  2545. MOB_DEF - monster's def
  2546. MOB_MDEF - monster's mdef
  2547. MOB_STR - monster's str
  2548. MOB_AGI - monster's agi
  2549. MOB_VIT - monster's vit
  2550. MOB_INT - monster's int
  2551. MOB_DEX - monster's dex
  2552. MOB_LUK - monster's luk
  2553. MOB_RANGE - monster's range
  2554. MOB_RANGE2 - monster's range2
  2555. MOB_RANGE3 - monster's range3
  2556. MOB_SIZE - monster's size
  2557. MOB_RACE - monster's race
  2558. MOB_ELEMENT - monster's element(doesn't return the element level, only the element ID)
  2559. MOB_MODE - monster's mode
  2560. MOB_MVPEXP - monster's mvp experience
  2561. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2562. ---------------------------------------
  2563. *getmobdrops(<mob id>)
  2564. This command will find all drops of the specified mob and return the item IDs
  2565. and drop percentages into arrays of temporary global variables.
  2566. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2567. Upon executing this,
  2568. $@MobDrop_item[] is a global temporary number array which contains the
  2569. item IDs of the monster's drops.
  2570. $@MobDrop_rate[] is a global temporary number array which contains the
  2571. drop percentages of each item. (1 = .01%)
  2572. $@MobDrop_count is the number of item drops found.
  2573. Be sure to use $@MobDrop_count to go through the arrays, and not
  2574. 'getarraysize', because the temporary global arrays are not cleared between
  2575. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2576. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2577. the server will not clear the arrays for you, overwriting the values instead. So
  2578. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2579. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2580. belong to the new mob. $@MobDrop_count will always contain the correct number
  2581. (5), unlike 'getarraysize()' which would return 7 in this case.
  2582. Example:
  2583. // get a Mob ID from the user
  2584. input .@mob_id;
  2585. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2586. // immediately copy global temporary variables into scope variables,
  2587. // since we don't know when 'getmobdrops' will get called again for
  2588. // another mob, overwriting your global temporary variables
  2589. .@count = $@MobDrop_count;
  2590. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2591. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2592. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2593. for( .@i = 0; .@i < .@count; .@i++ ) {
  2594. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2595. }
  2596. } else {
  2597. mes "Unknown monster ID.";
  2598. }
  2599. close;
  2600. ---------------------------------------
  2601. *skillpointcount({<char_id>})
  2602. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2603. This command can be used to check the currently attached characters total amount of skill points.
  2604. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2605. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2606. Example 1:
  2607. .@skillPoints = skillpointcount();
  2608. mes "You have " + .@skillPoints + " skill points in total!";
  2609. Example 2:
  2610. if (skillpointcount() > 20)
  2611. mes "Wow, you have more then 20 Skill Points in total!";
  2612. ---------------------------------------
  2613. *getscrate(<effect type>,<base rate>{,<GID>})
  2614. This function will return the chance of a status effect affecting the invoking
  2615. character, in percent, modified by the their current defense against said
  2616. status. The 'base rate' is the base chance of the status effect being inflicted,
  2617. in percent.
  2618. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2619. You can see the full list of available effect types you can possibly inflict in
  2620. 'db/const.txt' under 'Eff_'.
  2621. ---------------------------------------
  2622. ========================
  2623. |3.- Checking commands.|
  2624. ========================
  2625. -------------------------
  2626. *playerattached()
  2627. Returns the ID of the player currently attached to the script. It will return
  2628. 0 if no one is attached, or if the attached player no longer exists on the map
  2629. server. It is wise to check for the attached player in script functions that
  2630. deal with timers as there's no guarantee the player will still be logged on
  2631. when the timer triggers. Note that the ID of a player is actually their
  2632. account ID.
  2633. ---------------------------------------
  2634. *getattachedrid();
  2635. Returns RID from running script. Script may not be attached to any RID like
  2636. a floating script or function and will return 0.
  2637. ---------------------------------------
  2638. *isloggedin(<account id>{,<char id>})
  2639. This function returns 1 if the specified account is logged in and 0 if they
  2640. aren't. You can also pass the char id to check for both account and char id.
  2641. ---------------------------------------
  2642. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2643. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2644. *checkweight2(<id_array>,<amount_array>);
  2645. These functions will compute and return 1 if the total weight of the specified
  2646. number of specific items does not exceed the invoking character's carrying
  2647. capacity, and 0 otherwise. It is important to see if a player can carry the
  2648. items you expect to give them, failing to do that may open your script up to
  2649. abuse or create some very unfair errors.
  2650. The second function will check an array of items and amounts, and also
  2651. returns 1 on success and 0 on failure.
  2652. The functions, in addition to checking to see if the player is capable of
  2653. holding a set amount of items, also ensure the player has room in their
  2654. inventory for the item(s) they will be receiving.
  2655. Like 'getitem', this function will also accept an 'english name' from the
  2656. database as an argument.
  2657. Example 1:
  2658. if (checkweight(512,10)) {
  2659. getitem 512,10;
  2660. } else {
  2661. mes "Sorry, you cannot hold this amount of apples!";
  2662. }
  2663. Example 2:
  2664. setarray .@item[0],512,513,514;
  2665. setarray .@amount[0],10,5,5;
  2666. if (!checkweight2(.@item,.@amount)) {
  2667. mes "Sorry, you cannot hold this amount of fruit!";
  2668. }
  2669. ---------------------------------------
  2670. *basicskillcheck()
  2671. This function will return the state of the configuration option
  2672. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2673. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2674. it is by default, characters must have a certain number of basic skill levels to
  2675. sit, request a trade, use emotions, etc. Making your script behave differently
  2676. depending on whether the characters must actually have the skill to do all these
  2677. things might in some cases be required.
  2678. ---------------------------------------
  2679. *checkoption(<option number>{,<char_id>})
  2680. *checkoption1(<option number>{,<char_id>})
  2681. *checkoption2(<option number>{,<char_id>})
  2682. *setoption <option number>{,<flag>{,<char_id>}};
  2683. The 'setoption' series of functions check for a so-called option that is set on
  2684. the invoking character. 'Options' are used to store status conditions and a lot
  2685. of other non-permanent character data of the yes-no kind. For most common cases,
  2686. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2687. functions, but there are some options which you cannot get at this way. They
  2688. return 1 if the option is set and 0 if the option is not set.
  2689. Option numbers valid for the first (option) version of this command are:
  2690. 0x1 - Sight in effect.
  2691. 0x2 - Hide in effect.
  2692. 0x4 - Cloaking in effect.
  2693. 0x8 - Cart number 1 present.
  2694. 0x10 - Falcon present.
  2695. 0x20 - Peco Peco present.
  2696. 0x40 - GM Perfect Hide in effect.
  2697. 0x80 - Cart number 2 present.
  2698. 0x100 - Cart number 3 present.
  2699. 0x200 - Cart number 4 present.
  2700. 0x400 - Cart number 5 present.
  2701. 0x800 - Orc head present.
  2702. 0x1000 - The character is wearing a wedding sprite.
  2703. 0x2000 - Ruwach is in effect.
  2704. 0x4000 - Chasewalk in effect.
  2705. 0x8000 - Flying or Xmas suit.
  2706. 0x10000 - Sighttrasher.
  2707. 0x100000 - Warg present.
  2708. 0x200000 - The character is riding a warg.
  2709. Option numbers valid for the second version (opt1) of this command are:
  2710. 1 - Petrified.
  2711. 2 - Frozen.
  2712. 3 - Stunned.
  2713. 4 - Sleeping.
  2714. 6 - Petrifying (the state where you can still walk)
  2715. Option numbers valid for the third version (opt2) of this command are:
  2716. 0x1 - Poisoned.
  2717. 0x2 - Cursed.
  2718. 0x4 - Silenced.
  2719. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2720. 0x10 - Blinded.
  2721. 0x80 - Deadly poisoned.
  2722. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2723. for several states, but the functions will return true if at least one of them
  2724. is in effect.
  2725. 'setoption' will set options on the invoking character. There are no second and
  2726. third versions of this command, so you can only change the values in the first
  2727. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2728. the option will be added to what the character currently has; if 0, the option is removed.
  2729. This is definitely not a complete list of available option flag numbers. Ask a
  2730. core developer (or read the source: src/map/status.h) for the full list.
  2731. ---------------------------------------
  2732. *setcart {<type>{,<char_id>}};
  2733. *checkcart({<char_id>});
  2734. If <type> is 0 this command will remove the cart from the character.
  2735. Otherwise it gives the invoking character a cart. The cart given will be
  2736. cart number <type> and will work regardless of whether the character is a
  2737. merchant class or not.
  2738. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2739. The accompanying function will return 1 if the invoking character has a cart
  2740. (any kind of cart) and 0 if they don't.
  2741. if (checkcart()) mes "But you already have a cart!";
  2742. ---------------------------------------
  2743. *setfalcon {<flag>{,<char_id>}};
  2744. *checkfalcon({<char_id>});
  2745. If <flag> is 0 this command will remove the falcon from the character.
  2746. Otherwise it gives the invoking character a falcon. The falcon will be there
  2747. regardless of whether the character is a hunter or not. It will (probably) not
  2748. have any useful effects for non-hunters though.
  2749. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2750. The accompanying function will return 1 if the invoking character has a falcon
  2751. and 0 if they don't.
  2752. if (checkfalcon()) mes "But you already have a falcon!";
  2753. ---------------------------------------
  2754. *setriding {<flag>{,<char_id>}};
  2755. *checkriding({<char_id>});
  2756. If <flag> is 0 this command will remove the mount from the character.
  2757. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2758. series class), a GrandPeco (if they are a Crusader series class), or
  2759. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2760. this will not work at all if they aren't of a class which can ride.
  2761. Note: the character needs to have the skill KN_RIDING to gain a mount
  2762. The accompanying function will return 1 if the invoking character is riding a
  2763. bird and 0 if they aren't.
  2764. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2765. ---------------------------------------
  2766. *setdragon {<color>{,<char_id>}};
  2767. *checkdragon({<char_id>});
  2768. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2769. It will return 1 if successful, 0 otherwise.
  2770. The available colors are:
  2771. 1 - Green Dragon (default)
  2772. 2 - Brown Dragon
  2773. 3 - Gray Dragon
  2774. 4 - Blue Dragon
  2775. 5 - Red Dragon
  2776. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2777. The accompanying function will return 1 if the invoking character is riding a
  2778. dragon and 0 if they aren't.
  2779. ---------------------------------------
  2780. *setmadogear {<flag>{,<char_id>}};
  2781. *checkmadogear({<char_id>});
  2782. If <flag> is 0 this command will remove the mount from the character.
  2783. Otherwise it gives the invoking character a Mado (if they are a Mechanic).
  2784. The accompanying function will return 1 if the invoking character has a
  2785. Mado and 0 if they don't.
  2786. ---------------------------------------
  2787. *setmounting {<char_id>};
  2788. *ismounting({<char_id>});
  2789. The 'setmounting' function toggles cash mount for the invoking character.
  2790. It will return 1 if successful, 0 otherwise.
  2791. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2792. The accompanying function will return 1 if the invoking character has a
  2793. cash mount and 0 if they don't.
  2794. ---------------------------------------
  2795. *checkwug({<char_id>});
  2796. This function will return 1 if the invoking character has a
  2797. warg and 0 if they don't.
  2798. ---------------------------------------
  2799. *checkvending({"<Player Name>"})
  2800. Checks if the player is vending or has has a buyingstore. Additionally
  2801. it gives you the information whether the player uses autotrade or not.
  2802. Name is optional, and defaults to the attached player if omitted.
  2803. The returned value is bitmask of.
  2804. 0 = doesn't have a vending or buyingstore (which also means he can't use autotrade)
  2805. 1 = normal vending
  2806. 2 = using @autotrade
  2807. 4 = has a buyingstore
  2808. Examples:
  2809. //This will check Aaron's state
  2810. .@state = checkvending("Aaron");
  2811. if (.@state&1)
  2812. mes "Aaron is currently vending!";
  2813. if (.@state&4)
  2814. mes "Aaron has a buying store!";
  2815. if (.@state&2)
  2816. mes "Aaron is autotrading!";
  2817. ---------------------------------------
  2818. *checkchatting({"<Player Name>"})
  2819. Checks if the player is in a chatroom.
  2820. Name is optional, and defaults to the attached player if omitted.
  2821. Returns 1 if they are in a chat room, 0 if they are not.
  2822. Examples:
  2823. //This will check if the attached player in a chat room or not.
  2824. if (checkchatting())
  2825. mes "You are currently in a chat room!";
  2826. ---------------------------------------
  2827. *checkidle({"<Player Name>"})
  2828. Returns the time, in seconds, that the specified player has been idle.
  2829. Name is optional, and defaults to the attached player if omitted.
  2830. ---------------------------------------
  2831. *agitcheck()
  2832. *agitcheck2()
  2833. *agitcheck3()
  2834. These function will let you check whether the server is currently in WoE:FE mode
  2835. (agitcheck()), WoE:SE mode (agitcheck2()), or WoE:TE mode (agitcheck3()) and will
  2836. return true if War of Emperium is on and false if it isn't.
  2837. ---------------------------------------
  2838. *isnight()
  2839. *isday()
  2840. These functions will return 1 or 0 depending on whether the server is in night
  2841. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2842. the other way around. They can be used interchangeably, pick the one you like
  2843. more:
  2844. // These two are equivalent:
  2845. if (isday()) mes "I only prowl in the night.";
  2846. if (isnight() != 1) mes "I only prowl in the night.";
  2847. ---------------------------------------
  2848. *checkre(<type>)
  2849. Checks if a renewal feature is enabled or not in renewal.h, and returns 1 if
  2850. enabled and 0 for disabled.
  2851. The renewal feature to check is determined by type.
  2852. 0 - RENEWAL (game renewal server mode)
  2853. 1 - RENEWAL_CAST (renewal cast time)
  2854. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  2855. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  2856. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  2857. 5 - RENEWAL_ASPD (renewal ASPD)
  2858. ---------------------------------------
  2859. \\
  2860. 3,1.- Item-related commands
  2861. \\
  2862. ---------------------------------------
  2863. *isequipped(<id>{,<id>{,<id>{,<id>}}})
  2864. This function will return 1 if the invoking character has all of the item
  2865. IDs given equipped (if card IDs are passed, then it checks if the cards are
  2866. inserted into slots in the equipment they are currently wearing). Theoretically
  2867. there is no limit to the number of items that may be tested for at the same time.
  2868. If even one of the items given is not equipped, 0 will be returned.
  2869. // (Poring,Santa Poring,Poporing,Marin)
  2870. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  2871. // (Poring)
  2872. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  2873. The function was meant for item scripts to support the cards released by Gravity
  2874. in February 2005, but it will work just fine in normal NPC scripts.
  2875. ---------------------------------------
  2876. *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
  2877. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  2878. the number of cards in the list given that were found on the invoking character.
  2879. If a given parameter is not a card, the function returns the amount of that
  2880. item equipped on the invoking character.
  2881. if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
  2882. ---------------------------------------
  2883. *checkequipedcard(<card id>)
  2884. This function will return 1 if the card specified by its item ID number is
  2885. inserted into any equipment they have in their inventory, currently equipped or
  2886. not.
  2887. ---------------------------------------
  2888. //
  2889. 3,1.- End of item-related commands
  2890. //
  2891. ---------------------------------------
  2892. ==============================
  2893. |4.- Player-related commands.|
  2894. ==============================
  2895. -------------------------
  2896. *attachrid(<account ID>{,force})
  2897. *detachrid;
  2898. These commands allow the manipulation of the script's currently attached player.
  2899. While 'attachrid' allows attaching of a different player by using its account id
  2900. for the parameter RID, 'detachrid' makes the following commands run as if the
  2901. script was never invoked by a player.
  2902. The command returns false if the player cannot be attached (if the account is offline
  2903. or does not exist), and true upon success.
  2904. By default the command is executed with force, which causes to attach the player
  2905. even if he is currently attached to another script. Since this is not always the
  2906. desired behavior you can also specify false to the command and it will only return
  2907. true if the player is online and was not attached to another script.
  2908. -------------------------
  2909. *addrid(<type>{,<flag>{,<parameters>}});
  2910. This command will attach other RIDs to the current script without detaching the
  2911. invoking RID. It returns 1 if successful and 0 upon failure.
  2912. <type> determines what RIDs are attached:
  2913. 0: All players in the server.
  2914. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  2915. 2: Party members of a specified party ID.
  2916. [ Parameters: <party id> ]
  2917. 3: Guild members of a specified guild ID.
  2918. [ Parameters: <guild id> ]
  2919. 4: All players in a specified area of the map of the invoking player (or NPC).
  2920. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  2921. 5: All players in the map.
  2922. [ Parameters: "<map name>" ]
  2923. Account ID: If type is Account ID, attach the specified account ID.
  2924. <flag> can prevent certain players from being attached:
  2925. 0: Players are always attached. (default)
  2926. 1: Players currently running another script will not be attached.
  2927. ---------------------------------------
  2928. *rid2name(<rid>)
  2929. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  2930. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  2931. Note: rid2name may not produce correct character names since rid = account id.
  2932. It will return the current online character of the account only.
  2933. ---------------------------------------
  2934. *message "<character name>","<message>";
  2935. That command will send a message to the chat window of the character specified
  2936. by name. The text will also appear above the head of that character. It will not
  2937. be seen by anyone else.
  2938. ---------------------------------------
  2939. *dispbottom "<message>"{,<color>{,<char_id>}};
  2940. This command will send the given message with color into the invoking character's chat
  2941. window. The color format is in RGB (0xRRGGBB). The color is
  2942. by default green
  2943. ---------------------------------------
  2944. *showscript "<message>"{,<GID>, <flag>};
  2945. Makes attached player or GID says a message like shouting a skill name, the message
  2946. will be seen to everyone around but not in chat window.
  2947. flag: Specify target
  2948. AREA - Message is sent to players in the vicinity of the source (default).
  2949. SELF - Message is sent only to player attached.
  2950. ---------------------------------------
  2951. *warp "<map name>",<x>,<y>{,<char id>};
  2952. This command will take the invoking character or <char id>, if specified, to the specified map, and if
  2953. wanted, specified coordinates too, but these can be random.
  2954. warp "place",50,55;
  2955. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  2956. coordinates land on an unwalkable map square, it will send the warped character
  2957. to a random place. Same will happen if they are both zero:
  2958. warp "place",0,0;
  2959. Notice that while warping people to coordinates 0,0 will normally get them into
  2960. a random place, it's not certain to always be so. Darned if I know where this is
  2961. actually coded, it might be that this happens because square 0,0 is unwalkable
  2962. on all official maps. If you're using custom maps, beware.
  2963. There are also three special 'map names' you can use.
  2964. "Random" will warp the player randomly on the current map.
  2965. "Save" and "SavePoint" will warp the player back to their save point.
  2966. ---------------------------------------
  2967. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  2968. This command is similar to 'warp', however, it will not refer to the invoking
  2969. character, but instead, all characters within a specified area, defined by the
  2970. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  2971. including the activating character, if they are outside the area.
  2972. areawarp "place",10,10,120,120,"place2",150,150;
  2973. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  2974. shape, on the map called "place", will be affected, and warped to "place2" X 150
  2975. Y 150
  2976. areawarp "place",10,10,120,120,"place2",0,0;
  2977. By using ,0,0; as the destination coordinates it will take all the characters in
  2978. the affected area to a random set of co-ordinates on "place2".
  2979. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  2980. By using the optional x4 and y4 parameters, the destination coordinates will be a
  2981. random place within the defined x3/y3-x4/y4 square.
  2982. Like 'warp', areawarp will also explicitly warp characters randomly into the
  2983. current map if you give the 'to map name' as "Random".
  2984. See also 'warp'.
  2985. ---------------------------------------
  2986. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>",<range x>,<range y>};
  2987. Warps a party to specified map and coordinate given the party ID, which you can get with
  2988. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  2989. You can use the following "map names" for special warping behavior:
  2990. Random: All party members are randomly warped in their current map (as if they
  2991. all used a fly wing)
  2992. SavePointAll: All party members are warped to their respective save point.
  2993. SavePoint: All party members are warped to the save point of the currently
  2994. attached player (will fail if there's no player attached).
  2995. Leader: All party members are warped to the leader's position. The leader must
  2996. be online and in the current map-server for this to work.
  2997. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  2998. The <range x> and <range y> optional values allow for a randomization with the
  2999. player's warp point. The values will randomly add or subtract from the given <x>
  3000. and <y> coordinates.
  3001. Example:
  3002. mes "[Party Warper]";
  3003. mes "Here you go!";
  3004. close2;
  3005. .@party_id = getcharid(1);
  3006. warpparty "prontera",150,100,.@party_id;
  3007. close;
  3008. ---------------------------------------
  3009. *warpguild "<map name>",<x>,<y>,<guild_id>;
  3010. Warps a guild to specified map and coordinate given the guild id, which you can get with
  3011. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  3012. You can use the following "map names" for special warping behavior:
  3013. Random: All guild members are randomly warped in their current map (as if they
  3014. all used a fly wing)
  3015. SavePointAll: All guild members are warped to their respective save point.
  3016. SavePoint: All guild members are warped to the save point of the currently
  3017. attached player (will fail if there's no player attached).
  3018. Example:
  3019. warpguild "prontera",x,y,Guild_ID;
  3020. ---------------------------------------
  3021. *warppartner("<map name>",<x>,<y>);
  3022. This function will find the invoking character's marriage partner, if any, and
  3023. warp them to the map and coordinates given. It will return 1 upon success and
  3024. 0 if the partner is not online, the character is not married, or if there's no
  3025. invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
  3026. ---------------------------------------
  3027. *savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  3028. *save "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  3029. These commands save where the invoking character will return to upon clicking
  3030. "Return to Save Point", after death and in some other cases. The two versions are
  3031. equivalent. They ignore any and all mapflags, and can make a character respawn where
  3032. no teleportation is otherwise possible.
  3033. The <range x> and <range y> optional values allow for a randomization with the
  3034. player's save point. The values will randomly add or subtract from the given <x>
  3035. and <y> coordinates.
  3036. savepoint "place",350,75;
  3037. savepoint "place",350,75,2,2; // Randomly save the character between 348,73 and 352,77
  3038. ---------------------------------------
  3039. *heal <hp>,<sp>{,<char_id>};
  3040. This command will heal a set amount of HP and/or SP on the invoking character.
  3041. heal 30000,0; // This will heal 30,000 HP
  3042. heal 0,30000; // This will heal 30,000 SP
  3043. heal 300,300; // This will heal 300 HP and 300 SP
  3044. This command just alters the hit points and spell points of the invoking
  3045. character and produces no other output whatsoever.
  3046. ---------------------------------------
  3047. *itemheal <hp>,<sp>{,<char_id>};
  3048. This command heals relative amounts of HP and/or SP on the invoking character.
  3049. Unlike heal, this command is intended for use in item scripts. It applies
  3050. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  3051. When used inside an NPC script, certain bonuses are omitted.
  3052. The command also applies a SP/VIT-related bonus:
  3053. heal = heal * [(100 + STATUS*2) / 100]
  3054. Example:
  3055. // If the player has 50 vit and no bonuses, this will heal
  3056. // anything from 200 to 300 HP and 5 SP
  3057. itemheal rand(100,150),5;
  3058. ---------------------------------------
  3059. *percentheal <hp>,<sp>{,<char_id>};
  3060. This command will heal the invoking character. It heals the character, but not
  3061. by a set value - it adds percent of their maximum HP/SP.
  3062. percentheal 100,0; // This will heal 100% HP
  3063. percentheal 0,100; // This will heal 100% SP
  3064. percentheal 50,50; // This will heal 50% HP and 50% SP
  3065. So the amount that this will heal will depend on the total amount of HP or SP
  3066. you have maximum. Like 'heal', this will not call up any animations or effects.
  3067. ---------------------------------------
  3068. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  3069. This command will revive and fully restore the HP/SP of the selected characters.
  3070. It returns 1 upon successful use.
  3071. <type> is the target, and determines the <option> parameter:
  3072. 0: Player -> Character ID number
  3073. 1: Party -> Party ID number
  3074. 2: Guild -> Guild ID number
  3075. 3: Map -> Map name (a string)
  3076. 4: All -> None (takes <revive_flag> as option)
  3077. If no option is specified, the invoking player's character ID, party ID, guild ID,
  3078. or map will be used.
  3079. <revive_flag> determines the action:
  3080. 1: Revive and heal all players (default)
  3081. 2: Heal living players only
  3082. 4: Revive dead players only
  3083. <map name> can optionally be used to define a single map to execute the command on
  3084. for types 1 (party) and 2 (guild).
  3085. Examples:
  3086. // Only revive characters in invoking party on map "morocc"
  3087. recovery 1,getcharid(1),4,"morocc";
  3088. // Fully heal (don't revive) all members of invoking character's guild
  3089. recovery 2,getcharid(2),2;
  3090. // Revive and fully heal everyone in map "prontera"
  3091. recovery 3,"prontera";
  3092. // Only revive all dead characters on server
  3093. recovery 4,4;
  3094. ---------------------------------------
  3095. *jobchange <job number>{,<upper flag>,<char_id>};
  3096. This command will change the job class of the invoking character.
  3097. jobchange 1; // This would change your player into a Swordman
  3098. jobchange 4002; // This would change your player into a Swordman High
  3099. This command does work with numbers, but you can also use job names. The full
  3100. list of job names and the numbers they correspond to can be found in
  3101. 'src/map/script_constants.h'.
  3102. // This would change your player into a Swordman
  3103. jobchange Job_Swordman;
  3104. // This would change your player into a Swordman High
  3105. jobchange Job_Swordman_High;
  3106. 'upper flag' can alternatively be used to specify the type of job one changes
  3107. to. For example, jobchange Job_Swordman,1; will change the character to a high
  3108. swordsman. The upper values are:
  3109. -1 (or when omitted): preserves the current job type.
  3110. 0: Normal/standard classes
  3111. 1: High/Advanced classes
  3112. 2: Baby classes
  3113. This command will also set a permanent character-based variable
  3114. 'jobchange_level' which will contain the job level at the time right before
  3115. changing jobs, which can be checked for later in scripts.
  3116. ---------------------------------------
  3117. *jobname(<job number>)
  3118. This command retrieves the name of the given job using the map_msg entries 550->655.
  3119. mes "[Kid]";
  3120. mes "I never thought I'd met a " + jobname(Class) + " here of all places.";
  3121. close;
  3122. ---------------------------------------
  3123. *eaclass({<job number>,<char_id>})
  3124. This commands returns the "eA job-number" corresponding to the given class, and
  3125. uses the invoking player's class if none is given. The eA job-number is also a
  3126. class number system, but it's one that comes with constants which make it easy
  3127. to convert among classes. The command will return -1 if you pass it a job number
  3128. which doesn't have an eA job-number equivalent.
  3129. @eac = eaclass();
  3130. if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  3131. mes "Your base job is Swordman.";
  3132. if (@eac&EAJL_UPPER)
  3133. mes "You are a rebirth job.";
  3134. if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  3135. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  3136. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  3137. ---------------------------------------
  3138. *roclass(<job number>{,<gender>})
  3139. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3140. corresponding RO class number. A gender is required because both Bard and Dancers
  3141. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3142. gender if none is given (if no player is attached, male will be used by default).
  3143. The command will return -1 if there is no valid class to represent the specified
  3144. job (for example, if you try to get the baby version of a Taekwon class).
  3145. @eac = eaclass();
  3146. //Check if class is already rebirth
  3147. if (@eac&EAJL_UPPER) {
  3148. mes "You look strong.";
  3149. close;
  3150. }
  3151. @eac = roclass(@eac|EAJL_UPPER);
  3152. //Check if class has a rebirth version
  3153. if (@eac != -1) {
  3154. mes "Bet you can't wait to become a " + jobname(@eac) + "!";
  3155. close;
  3156. }
  3157. ---------------------------------------
  3158. *changebase <job ID number>{,<account ID>};
  3159. This command will change a character's appearance to that of the specified job
  3160. class. Nothing but appearance will change.
  3161. The command will run for the invoking character unless an account ID is given.
  3162. changebase Job_Novice; // Changes player to Novice sprite.
  3163. changebase Class; // Changes player back to default sprite.
  3164. ---------------------------------------
  3165. *classchange(<view id>{,"<NPC name>","<flag>"});
  3166. This command is very ancient, its origins are clouded in mystery.
  3167. It will send a 'display id change' packet to everyone in the immediate area of
  3168. the NPC object, which will supposedly make the NPC look like a different sprite,
  3169. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3170. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3171. and most importantly, will not work at all since this command was broken with
  3172. the introduction of advanced classes. The code is written with the assumption
  3173. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3174. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3175. ID numbers on the other end of the number pool where monster sprites float.
  3176. As a result it is currently impossible to call this command with a valid view
  3177. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3178. run will actually just crash the client.
  3179. It could be a real gem if it can be gotten to actually do what it's supposed to
  3180. do, but this will only happen in a later SVN revision.
  3181. Empty <NPC name> means attached NPC.
  3182. Target for <flag>:
  3183. - bc_area : Sprite is sent to players in the vicinity of the source (default value).
  3184. - bc_self : Sprite is sent only to player attached.
  3185. ---------------------------------------
  3186. *changesex({<char_id>});
  3187. This command will change the gender for the attached character's account. If it
  3188. was male, it will become female, if it was female, it will become male. The
  3189. change will be written to the character server, the player will receive the
  3190. message: "Need disconnection to perform change-sex request..." and the player
  3191. will be immediately kicked to the login screen. When they log back in, they will
  3192. be the opposite sex.
  3193. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3194. they will also have their skills reset upon 'changesex'.
  3195. ---------------------------------------
  3196. *changecharsex({<char_id>});
  3197. This command will change the gender of the attached character. If it
  3198. was male, it will become female, if it was female, it will become male. The
  3199. change will be written to the character server, the player will receive the
  3200. message: "Need disconnection to perform change-sex request..." and the player
  3201. will be immediately kicked to the login screen. When they log back in, they will
  3202. be the opposite sex.
  3203. If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
  3204. the character will also have their skills reset upon 'changecharsex'.
  3205. ---------------------------------------
  3206. *getexp <base_exp>,<job_exp>{,<char_id>};
  3207. This command will give the invoking character a specified number of base and job
  3208. experience points. Used for a quest reward. Negative values won't work.
  3209. The EXP values are adjustted by 'quest_exp_rate' config value, VIP bonus, Guild
  3210. Tax and EXP boost items such Battle Manual, Bubble Gum, or items that have
  3211. SC_EXPBOOST or SC_ITEMBOOST.
  3212. getexp 10000,5000;
  3213. ---------------------------------------
  3214. *getexp2 <base_exp>,<job_exp>{,<char_id>};
  3215. This command is safety version of 'set' command for BaseExp and JobExp. If using
  3216. 'set' while the BaseExp or JobExp value is more than 2,147,483,647 (INT_MAX) will
  3217. causing overflow error.
  3218. Unlike 'getexp', this command ignores the adjustment factors!
  3219. ---------------------------------------
  3220. *setlook <look type>,<look value>{,<char_id>};
  3221. *changelook <look type>,<look value>{,<char_id>};
  3222. 'setlook' will alter the look data for the invoking character. It is used
  3223. mainly for changing the palette used on hair and clothes: you specify which look
  3224. type you want to change, then the palette you want to use. Make sure you specify
  3225. a palette number that exists/is usable by the client you use.
  3226. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3227. // This will change your hair color, so that it uses palette 8, what ever your
  3228. // palette 8 is, your hair will use that color
  3229. setlook LOOK_HAIR_COLOR,8;
  3230. // This will change your clothes color, so they are using palette 1, whatever
  3231. // your palette 1 is, your clothes will then use that set of colors.
  3232. setlook LOOK_CLOTHES_COLOR,1;
  3233. Here are the possible look types:
  3234. LOOK_BASE - Base sprite
  3235. LOOK_HAIR - Hairstyle
  3236. LOOK_WEAPON - Weapon
  3237. LOOK_HEAD_BOTTOM - Head bottom
  3238. LOOK_HEAD_TOP - Head top
  3239. LOOK_HEAD_MID - Head mid
  3240. LOOK_HAIR_COLOR - Hair color
  3241. LOOK_CLOTHES_COLOR - Clothes color
  3242. LOOK_SHIELD - Shield
  3243. LOOK_SHOES - Shoes
  3244. LOOK_BODY2 - Body style
  3245. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3246. with this value. It still wants it from the server though, so it is kept, but
  3247. normally doesn't do a thing.
  3248. Only the look data for hairstyle, hair color and clothes color are saved to the
  3249. char server's database and will persist. Body style will also persist if 'save_body_style'
  3250. configuration is enabled in '/conf/battle/client.conf'. The rest freely change as the character
  3251. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3252. should not expect to set them. In fact, messing with them is generally
  3253. hazardous, do it at your own risk, it is not tested what will this actually do -
  3254. it won't cause database corruption and probably won't cause a server crash, but
  3255. it's easy to crash the client with just about anything unusual.
  3256. However, it might be an easy way to quickly check for empty view IDs for
  3257. sprites, which is essential for making custom headgear.
  3258. Since a lot of people have different palettes for hair and clothes, it's
  3259. impossible to tell you what all the color numbers are. If you want a serious
  3260. example, there is a Stylist script inside the default rAthena installation that
  3261. you can look at: 'npc/custom/stylist.txt'
  3262. ---------------------------------------
  3263. *pushpc <direction>,<cells>;
  3264. This command will push the currently attached player to given direction by given
  3265. amount of square cells. Direction is the same as used when declaring NPCs, and
  3266. can be specified by using one of the DIR_* constants (src/map/script_constants.h).
  3267. The knock-back is not restricted by items or map flags, only obstacles are taken
  3268. into account. If there is not enough space to perform the push (e.g. due to a
  3269. wall), the character is pushed only up to the obstacle.
  3270. // pushes the character 5 cells in 3 o'clock direction from its
  3271. // current position.
  3272. pushpc DIR_EAST, 5;
  3273. ---------------------------------------
  3274. *recalculatestat;
  3275. This command will force a stat recalculation for the attached player.
  3276. ---------------------------------------
  3277. *needed_status_point(<type>,<val>{,<char id>});
  3278. Returns the number of stat points needed to change the specified stat <type> by <val>.
  3279. If <val> is negative, returns the number of stat points that would be needed to
  3280. raise the specified stat from (current value - <val>) to current value.
  3281. ---------------------------------------
  3282. *jobcanentermap("<mapname>"{,<JobID>});
  3283. Return true if player (decided by job) can enter the map, false otherwise.
  3284. For optional 'JobID', see constant of Job_*, or use player's Class, BaseJob,
  3285. and BaseClass. If no player is attached, this param must have a value.
  3286. See also db/[pre-]re/job_noenter_map.txt
  3287. ---------------------------------------
  3288. *get_revision()
  3289. This command will return the SVN revision number that the server is currently
  3290. running on.
  3291. if (get_revision() >= 15000)
  3292. mes "Welcome to rAthena!";
  3293. ---------------------------------------
  3294. *get_githash()
  3295. This command will return the Git Hash that the server is currently running on.
  3296. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3297. ---------------------------------------
  3298. \\
  3299. 4,1.- Item-related commands
  3300. \\
  3301. ---------------------------------------
  3302. *getitem <item id>,<amount>{,<account ID>};
  3303. *getitem "<item name>",<amount>{,<account ID>};
  3304. This command will give an amount of specified items to the invoking character.
  3305. If an optional account ID is specified, and the target character is currently
  3306. online, items will be created in their inventory instead. If they are not
  3307. online, nothing will happen.
  3308. In the first and most commonly used version of this command, items are
  3309. referred to by their database ID number found inside 'db/(pre-)re/item_db.txt'.
  3310. getitem 502,10 // The person will receive 10 apples
  3311. getitem 617,1 // The person will receive 1 Old Violet Box
  3312. This transaction is logged if the log script generated transactions option is
  3313. enabled.
  3314. You may also create an item by its name in the 'english name' field in the
  3315. item database:
  3316. getitem "RED_POTION",10;
  3317. Which will do what you'd expect. If it can't find that name in the database,
  3318. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3319. This is used in pretty much all NPC scripts that have to do with items and
  3320. quite a few item scripts. For more examples check just about any official script.
  3321. ---------------------------------------
  3322. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3323. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3324. *getitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3325. *getitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3326. This command will give an amount of specified items to the invoking character.
  3327. If an optional account ID is specified, and the target character is currently
  3328. online, items will be created in their inventory instead. If they are not
  3329. online, nothing will happen. It works essentially the same as 'getitem' but is
  3330. a lot more flexible.
  3331. Those parameters that are different from 'getitem' are:
  3332. identify - Whether you want the item to be identified (1) or not (0).
  3333. refine - For how many pluses will it be refined.
  3334. It will not let you refine an item higher than the max refine.
  3335. attribute - Whether the item is broken (1) or not (0).
  3336. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3337. the specific card slot.
  3338. Card1-card4 values are also used to store name information for named items, as
  3339. well as the elemental property of weapons and armor. You can create a named item
  3340. in this manner, however, if you just need a named piece of standard equipment,
  3341. it is much easier to the 'getnameditem' function instead.
  3342. You will need to keep these values if you want to destroy and then perfectly
  3343. recreate a named item, for this see 'getinventorylist'.
  3344. If you still want to try creating a named item with this command because
  3345. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3346. this. Careful, minor magic ahead.
  3347. // First, let's get an ID of a character who's name will be on the item.
  3348. // Only an existing character's name may be there.
  3349. // Let's assume our character is 'Adam' and find his ID.
  3350. @charid = getcharid(0,"Adam");
  3351. // Now we split the character ID number into two portions with a binary
  3352. // shift operation. If you don't understand what this does, just copy it.
  3353. @card3 = @charid & 65535;
  3354. @card4 = @charid >> 16;
  3355. // If you're inscribing non-equipment, @card1 must be 254.
  3356. // Arrows are also not equipment.
  3357. @card1 = 254;
  3358. // For named equipment, card2 means the Star Crumbs and elemental
  3359. // crystals used to make this equipment. For everything else, it's 0.
  3360. @card2 = 0;
  3361. // Now, let's give the character who invoked the script some
  3362. // Adam's Apples:
  3363. getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
  3364. This wasn't tested with all possible items, so I can't give any promises,
  3365. experiment first before relying on it.
  3366. To create equipment, continue this example it like this:
  3367. // We've already have card3 and card4 loaded with correct
  3368. // values so we'll just set up card1 and card2 with data
  3369. // for an Ice Stiletto.
  3370. // If you're inscribing equipment, @card1 must be 255.
  3371. @card1 = 255;
  3372. // That's the number of star crumbs in a weapon.
  3373. @sc = 2;
  3374. // That's the number of elemental property of the weapon.
  3375. @ele = 1;
  3376. // And that's the wacky formula that makes them into
  3377. // a single number.
  3378. @card2 = @ele+((@sc*5)<<8);
  3379. // That will make us an Adam's +2 VVS Ice Stiletto:
  3380. getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
  3381. Experiment with the number of star crumbs - I'm not certain just how much will
  3382. work most and what it depends on. The valid element numbers are:
  3383. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3384. You can, apparently, even create duplicates of the same pet egg with this
  3385. command, creating a pet which is the same, but simultaneously exists in two
  3386. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3387. this really cause.
  3388. 'getitem3' is advance version of 'getitem2' that also use Item Random Option as additional values.
  3389. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3390. <RandomValueArray> : Array variable of item random option's value.
  3391. <RandomParamArray> : Array variable of item random option's param.
  3392. Example to get Crimson Weapon with Ghost property:
  3393. // +9 Crimson Dagger [2]
  3394. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3395. setarray .@OptVal[0],0;
  3396. setarray .@OptParam[0],0;
  3397. getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3398. ---------------------------------------
  3399. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3400. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3401. This command behaves identically to 'getitem', but the items created will be
  3402. bound to the target character as specified by the bound type. All items created
  3403. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3404. some cases cannot be traded or stored.
  3405. Valid bound types are:
  3406. Bound_Account : Account Bound item
  3407. Bound_Guild : Guild Bound item
  3408. Bound_Party : Party Bound item
  3409. Bound_Char : Character Bound item
  3410. ---------------------------------------
  3411. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3412. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3413. *getitembound3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3414. *getitembound3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3415. This command behaves identically to 'getitem2', but the items created will be
  3416. bound to the target character as specified by the bound type. All items created
  3417. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3418. some cases cannot be traded or stored.
  3419. For a list of bound types see 'getitembound'.
  3420. 'getitembound3' is advance version of 'getitembound2' that also use Item Random Option as additional values.
  3421. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3422. <RandomValueArray> : Array variable of item random option's value.
  3423. <RandomParamArray> : Array variable of item random option's param.
  3424. Example to get Crimson Weapon with Ghost property:
  3425. // +9 Crimson Dagger [2]
  3426. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3427. setarray .@OptVal[0],0;
  3428. setarray .@OptParam[0],0;
  3429. getitembound3 28705,1,1,9,0,0,0,0,0,BOUND_CHAR,.@OptID,.@OptVal,.@OptParam;
  3430. ---------------------------------------
  3431. *getnameditem <item id>,<character name|character ID>;
  3432. *getnameditem "<item name>",<character name|character ID>;
  3433. Create an item signed with the given character's name.
  3434. The command returns 1 when the item is created successfully, or 0 if it fails.
  3435. Failure occurs when:
  3436. - There is no player attached.
  3437. - Item name or ID is not valid.
  3438. - The given character ID/name is offline.
  3439. Example:
  3440. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3441. getnameditem "Apple","Aaron";
  3442. //Self-explanatory (I hope).
  3443. if (getnameitem("Apple","Aaron")) {
  3444. mes "You now have a Aaron's Apple!";
  3445. }
  3446. ---------------------------------------
  3447. *rentitem <item id>,<time>{,<account_id>};
  3448. *rentitem "<item name>",<time>{,<account_id>};
  3449. Creates a rental item in the attached character's inventory. The item will expire
  3450. in <time> seconds and be automatically deleted. When receiving a rental item,
  3451. the character will receive a message in their chat window. The character will
  3452. also receive warning messages in their chat window before the item disappears.
  3453. When rentals expire it will call the OnUnequip Script of the item. This can be used
  3454. for special cases such as removing a status change or resetting a variable or state
  3455. of the player.
  3456. This command can not be used to rent stackable items. Rental items cannot be
  3457. dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
  3458. Note: 'delitem' in an NPC script can still remove rental items.
  3459. ---------------------------------------
  3460. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3461. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3462. *rentitem3 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3463. *rentitem3 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3464. Creates a rental item in the attached character's inventory. The item will expire
  3465. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3466. See 'getitem2' for an explanation of the expanded parameters.
  3467. 'rentitem3' is advance version of 'rentitem2' that also use Item Random Option as additional values.
  3468. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3469. <RandomValueArray> : Array variable of item random option's value.
  3470. <RandomParamArray> : Array variable of item random option's param.
  3471. Example to get Crimson Weapon with Ghost property:
  3472. // +9 Crimson Dagger [2]
  3473. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3474. setarray .@OptVal[0],0;
  3475. setarray .@OptParam[0],0;
  3476. rentitem3 28705,(24*60*60),1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3477. ---------------------------------------
  3478. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>;
  3479. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
  3480. This command will create an item on the specified cell of a map.
  3481. As with any dropped items, the items created with this command will disappear after
  3482. a period of time. Using an amount greater than 1 will create a single stack of the
  3483. given amount, not multiple stacks of 1.
  3484. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3485. Apples if the name isn't found.
  3486. If the map name is given as "this", the map the invoking character is on will be used.
  3487. ---------------------------------------
  3488. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3489. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3490. *makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>;
  3491. *makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>;
  3492. This command will create an item on the specified cell of a map. See 'makeitem' for
  3493. further details.
  3494. See 'getitem2' for an explanation of the expanded parameters.
  3495. 'makeitem3' is advance version of 'makeitem2' that also use Item Random Option as additional values.
  3496. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3497. <RandomValueArray> : Array variable of item random option's value.
  3498. <RandomParamArray> : Array variable of item random option's param.
  3499. Example to get Crimson Weapon with Ghost property:
  3500. // 0.5% chance to get +0 Valkyrie Shield [1]
  3501. // with Neutral Resistance +10% and 5% damage reduction from Demi-Human or Player
  3502. // when Valkyrie Randgris killed
  3503. OnNPCKillEvent:
  3504. if (killedrid == 1751 && rand(0,1000) > 950) { // Valkyrie Randgris
  3505. getmapxy(.@map$,.@x,.@y,UNITTYPE_PC);
  3506. setarray .@OptID[0],RDMOPT_ATTR_TOLERACE_NOTHING,RDMOPT_RACE_TOLERACE_HUMAN;
  3507. setarray .@OptVal[0],10,5;
  3508. setarray .@OptParam[0],0;
  3509. makeitem3 2115,1,.@map$,.@x,.@y,0,0,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3510. }
  3511. end;
  3512. ---------------------------------------
  3513. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3514. *cleanmap "<map name>";
  3515. These commands will clear all items lying on the ground on the specified map, either
  3516. within the x1/y1-x2/y2 rectangle or across the entire map.
  3517. ---------------------------------------
  3518. *searchitem <array name>,"<item name>";
  3519. This command will fill the given array with the ID of items whose name matches
  3520. the given one. It returns the number of items found. For performance reasons,
  3521. the results array is limited to 10 items.
  3522. mes "What item are you looking for?";
  3523. input .@name$;
  3524. .@qty = searchitem(.@matches[0],.@name$);
  3525. mes "I found " + .@qty + " items:";
  3526. for (.@i = 0; .@i < .@qty; .@i++)
  3527. // Display name (eg: "Apple[0]")
  3528. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3529. ---------------------------------------
  3530. *delitem <item id>,<amount>{,<account ID>};
  3531. *delitem "<item name>",<amount>{,<account ID>};
  3532. This command will remove a specified amount of items from the invoking/target character.
  3533. Like all the item commands, it uses the item ID found inside 'db/(pre-)re/item_db.txt'.
  3534. delitem 502,10; // The person will lose 10 apples
  3535. delitem 617,1; // The person will lose 1 Old Violet Box
  3536. It is always a good idea to check if the player actually has the items before you delete them.
  3537. If you try to delete more items that the player has, the player will lose the ones he/she has
  3538. and the script will terminate with an error.
  3539. Like 'getitem', this command will also accept an 'english name' field from the
  3540. database. If the name is not found, nothing will be deleted.
  3541. ---------------------------------------
  3542. *cartdelitem <item id>,<amount>{,<account ID>};
  3543. *cartdelitem "<item name>",<amount>{,<account ID>};
  3544. *storagedelitem <item id>,<amount>{,<account ID>};
  3545. *storagedelitem "<item name>",<amount>{,<account ID>};
  3546. *guildstoragedelitem <item id>,<amount>{,<account ID>};
  3547. *guildstoragedelitem "<item name>",<amount>{,<account ID>};
  3548. This command behaves identically to 'delitem', but deletes items from the player's
  3549. cart, storage, or guild storage.
  3550. If no cart is mounted, 'cartdelitem' will return -1.
  3551. If player is not in a guild or storage is open, 'guildstoragedelitem' will return -1.
  3552. ---------------------------------------
  3553. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3554. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3555. *delitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3556. *delitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3557. This command will remove a specified amount of items from the invoking/target character.
  3558. See 'getitem2' for an explanation of the expanded parameters.
  3559. 'delitem3' is advance version of 'delitem2' that also use Item Random Option as criteria.
  3560. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3561. <RandomValueArray> : Array variable of item random option's value.
  3562. <RandomParamArray> : Array variable of item random option's param.
  3563. ---------------------------------------
  3564. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3565. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3566. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3567. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3568. *guildstoragedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3569. *guildstoragedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3570. This command behaves identically to 'delitem2', but deletes items from the player's
  3571. cart, storage, or guild storage.
  3572. If no cart is mounted, 'cartdelitem2' will return -1.
  3573. If player is not in a guild or storage is open, 'guildstoragedelitem2' will return -1.
  3574. ---------------------------------------
  3575. *countitem(<item id>)
  3576. *countitem("<item name>")
  3577. This function will return the number of items for the specified item ID that the
  3578. invoking character has in the inventory.
  3579. mes "[Item Checker]";
  3580. mes "Hmmm, it seems you have " + countitem(502) + " apples";
  3581. close;
  3582. Like 'getitem', this function will also accept an 'english name' from the
  3583. database as an argument.
  3584. If you want to state the number at the end of a sentence, you can do it by
  3585. adding up strings:
  3586. mes "[Item Checker]";
  3587. mes "Hmmm, the total number of apples you are holding is " + countitem("APPLE");
  3588. close;
  3589. ---------------------------------------
  3590. *cartcountitem(<item id>{,<accountID>})
  3591. *cartcountitem("<item name>"{,<accountID>})
  3592. *storagecountitem(<item id>{,<accountID>})
  3593. *storagecountitem("<item name>"{,<accountID>})
  3594. *guildstoragecountitem(<nameID>{,<accountID>})
  3595. *guildstoragecountitem("<item name>"{,<accountID>})
  3596. This command behaves identically to 'countitem', but counts items from the player's
  3597. cart, storage, or guild storage.
  3598. If no cart is mounted, 'cartcountitem' will return -1.
  3599. If player is not in a guild or storage is open, 'guildstoragecountitem' will return -1.
  3600. ---------------------------------------
  3601. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3602. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3603. *countitem3(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>)
  3604. *countitem3("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>)
  3605. Expanded version of 'countitem' function, used for created/carded/forged items.
  3606. This function will return the number of items for the specified item ID and
  3607. other parameters that the invoking character has in the inventory.
  3608. See 'getitem2' for an explanation of the expanded parameters.
  3609. 'countitem3' is advance version of 'countitem2' that also use Item Random Option as criteria.
  3610. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3611. <RandomValueArray> : Array variable of item random option's value.
  3612. <RandomParamArray> : Array variable of item random option's param.
  3613. ---------------------------------------
  3614. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3615. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3616. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3617. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3618. *guildstoragecountitem2(<nameID>,<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3619. *guildstoragecountitem2("<item name>",<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3620. This command behaves identically to 'countitem2', but counts items from the player's
  3621. cart, storage, or guild storage.
  3622. If no cart is mounted, 'cartcountitem2' will return -1.
  3623. If player is not in a guild or storage is open, 'guildstoragecountitem2' will return -1.
  3624. ---------------------------------------
  3625. *countbound({<bound type>{,<char_id>}})
  3626. This function will return the number of bounded items in the character's
  3627. inventory, and sets an array @bound_items[] containing all item IDs of the
  3628. counted items. If a bound type is specified, only those items will be counted.
  3629. For a list of bound types see 'getitembound'.
  3630. Example:
  3631. mes "You currently have " + countbound() + " bounded items.";
  3632. next;
  3633. mes "The list of bounded items include:";
  3634. for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
  3635. mes getitemname(@bound_items[.@i]);
  3636. close;
  3637. ---------------------------------------
  3638. *groupranditem <group id>{,<sub_group>};
  3639. Returns the item_id of a random item picked from the group specified. The
  3640. different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'.
  3641. When used in conjunction with other functions, you can get a random item. For
  3642. example, for a random pet lure:
  3643. getitem groupranditem(IG_Taming),1;
  3644. 'sub_group' is used to get the available random items of item group from specified random
  3645. group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
  3646. More info, see doc/item_group.txt.
  3647. ---------------------------------------
  3648. *getrandgroupitem <group_id>{,<quantity>{,<sub_group>{,<identify>{,<char_id>}}}};
  3649. Similar to the above example, this command allows players to obtain the specified
  3650. quantity of a random item from the group "<group id>". The different groups and
  3651. their group number are specified in db/(pre-)re/item_group_db.txt
  3652. If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
  3653. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
  3654. 'must' item group).
  3655. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
  3656. as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
  3657. if 'identify' is defined with value 1.
  3658. More info, see doc/item_group.txt.
  3659. ---------------------------------------
  3660. *getgroupitem <group_id>{,<identify>{,<char_id>}};
  3661. Gives item(s) to the attached player based on item group contents.
  3662. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3663. item group & sub_group.
  3664. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
  3665. as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
  3666. if 'identify' is defined with value 1.
  3667. More info, see doc/item_group.txt.
  3668. ---------------------------------------
  3669. *enable_items;
  3670. *disable_items;
  3671. These commands toggle the ability to change equipment while interacting with
  3672. an NPC. To avoid possible exploits, the commands affect the particular script
  3673. instance only. Note that if a different script also calls enable_items, it
  3674. will override the last call (so you may want to call this command at the start
  3675. of your script without assuming it is still in effect).
  3676. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3677. ---------------------------------------
  3678. *itemskill <skill id>,<skill level>{,<keep requirement>};
  3679. *itemskill "<skill name>",<skill level>{,<keep requirement>};
  3680. This command is meant for item scripts to replicate single-use skills in usable
  3681. items. It will not work properly if there is a visible dialog window or menu.
  3682. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3683. target cursor is shown.
  3684. If <keep requirement> parameter is set to true, the skill's requirements will be checked.
  3685. By default, the requirements for item skills are not checked, and therefore the default value is false.
  3686. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
  3687. // skill has been used from skill tree.
  3688. 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
  3689. // When Sienna_Execrate_Scroll_1_5 is used, it will cast Sienna Execrate Level 5 and consume 2 Red_Gemstones.
  3690. 23194,Sienna_Execrate_Scroll_1_5,Level 5 Sienna Execrate,11,10,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_SIENNAEXECRATE",5,true; },{},{}
  3691. ---------------------------------------
  3692. *consumeitem <item id>{,<char_id>};
  3693. *consumeitem "<item name>"{,<char_id>};
  3694. This command will run the item script of the specified item on the invoking
  3695. character. The character does not need to possess the item, and the item will
  3696. not be deleted. While this command is intended for usable items, it will run
  3697. for any item type.
  3698. This command does not currently work with the 'itemskill' script command.
  3699. ---------------------------------------
  3700. *produce <item level>;
  3701. This command will open a crafting window on the client connected to the invoking
  3702. character. The 'item level' is a number which determines what kind of a crafting
  3703. window will pop-up.
  3704. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3705. what can actually be produced. The window will not be empty only if the invoking
  3706. character can actually produce the items of that type and has the appropriate raw
  3707. materials in their inventory.
  3708. The success rate to produce the item is the same as the success rate of the skill
  3709. associated with the item level. If there is no skill id, the success rate will be 50%.
  3710. Valid item levels are:
  3711. 1 - Level 1 Weapons
  3712. 2 - Level 2 Weapons
  3713. 3 - Level 3 Weapons
  3714. 21 - Blacksmith's Stones and Metals
  3715. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  3716. 23 - Elemental Converters
  3717. ---------------------------------------
  3718. *cooking <dish level>;
  3719. This command will open a produce window on the client connected to the invoking
  3720. character. The 'dish level' is the number which determines what kind of dish
  3721. level you can produce. You can see the full list of dishes that can be produced in
  3722. 'db/produce_db.txt'.
  3723. The window will be shown empty if the invoking character does not have enough of
  3724. the required incredients to cook a dish.
  3725. Valid dish levels are:
  3726. 11 - Level 1 Dish
  3727. 12 - Level 2 Dish
  3728. 13 - Level 3 Dish
  3729. 14 - Level 4 Dish
  3730. 15 - Level 5 Dish
  3731. 16 - Level 6 Dish
  3732. 17 - Level 7 Dish
  3733. 18 - Level 8 Dish
  3734. 19 - Level 9 Dish
  3735. 20 - Level 10 Dish
  3736. Although it's required to set a dish level, it doesn't matter if you set it to 1
  3737. and you want to cook a level 10 dish, as long as you got the required incredients
  3738. to cook the dish the command works.
  3739. ---------------------------------------
  3740. *makerune <% success bonus>{,<char_id>};
  3741. This command will open a rune crafting window on the client connected to the
  3742. invoking character. Since this command is officially used in rune ores, a bonus
  3743. success rate must be specified (which adds to the base formula).
  3744. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  3745. The window will not be empty only if the invoking character can actually produce
  3746. a rune and has the appropriate raw materials in their inventory.
  3747. ---------------------------------------
  3748. *successremovecards <equipment slot>;
  3749. This command will remove all cards of the cards slots defined by item_db.txt
  3750. from the item found in the specified equipment slot of the invoking character,
  3751. create new card items and give them to the character.
  3752. If any cards were removed in this manner, it will also show a success effect.
  3753. ---------------------------------------
  3754. *failedremovecards <equipment slot>,<type>;
  3755. This command will remove all cards from the item found in the specified
  3756. equipment slot of the invoking character. 'type' determines what happens to the
  3757. item and the cards:
  3758. 0 - will destroy both the item and the cards.
  3759. 1 - will keep the item, but destroy the cards.
  3760. 2 - will keep the cards, but destroy the item.
  3761. Whatever the type is, it will also show a failure effect on screen.
  3762. ---------------------------------------
  3763. *repair <broken item number>{,<char_id>};
  3764. This command repairs a broken piece of equipment, using the same list of broken
  3765. items as available through 'getbrokenid'.
  3766. ---------------------------------------
  3767. *repairall {<char_id>};
  3768. This command repairs all broken equipment in the attached player's inventory.
  3769. A repair effect will be shown if any items are repaired, else the command will
  3770. end silently.
  3771. ---------------------------------------
  3772. *successrefitem <equipment slot>{,<count>{,<char_id>}};
  3773. This command will refine an item in the specified equipment slot of the invoking
  3774. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  3775. This command will also display a 'refine success' effect on the character and put
  3776. appropriate messages into their chat window. It will also give the character fame
  3777. points if a weapon reached +10 this way, even though these will only take effect for
  3778. blacksmith who will later forge a weapon.
  3779. ---------------------------------------
  3780. *failedrefitem <equipment slot>{,<char_id>};
  3781. This command will fail to refine an item in the specified equipment slot of the
  3782. invoking character. The item will be destroyed. This will also display a 'refine
  3783. failure' effect on the character and put appropriate messages into their chat
  3784. window.
  3785. ---------------------------------------
  3786. *downrefitem <equipment slot>{,<count>{,<char_id>}};
  3787. This command will downgrade an item in the specified equipment slot of the invoking
  3788. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  3789. This command will also display a 'refine failure' effect on the character and put
  3790. appropriate messages into their chat window.
  3791. ---------------------------------------
  3792. *unequip <equipment slot>{,<char_id>};
  3793. This command will unequip whatever is currently equipped in the invoking
  3794. character's specified equipment slot. For a full list of possible equipment
  3795. slots see 'getequipid'.
  3796. If an item occupies several equipment slots, it will get unequipped from all of
  3797. them.
  3798. ---------------------------------------
  3799. *delequip <equipment slot>{,<char_id>};
  3800. This command will destroy whatever is currently equipped in the invoking
  3801. character's specified equipment slot. For a full list of possible equipment
  3802. slots see 'getequipid'.
  3803. This command will return 1 if an item was deleted and 0 otherwise.
  3804. ---------------------------------------
  3805. *breakequip <equipment slot>{,<char_id>};
  3806. This command will break and unequip whatever is currently equipped in the
  3807. invoking character's specified equipment slot. For a full list of possible
  3808. equipment slots see 'getequipid'.
  3809. This command will return 1 if an item was broken and 0 otherwise.
  3810. ---------------------------------------
  3811. *clearitem {<char_id>};
  3812. This command will destroy all items the invoking character has in their
  3813. inventory (including equipped items). It will not affect anything else, like
  3814. storage or cart.
  3815. ---------------------------------------
  3816. *equip <item id>{,<char_id>};
  3817. *autoequip <item id>,<option>;
  3818. These commands are to equip a equipment on the attached character.
  3819. The equip function will equip the item ID given when the player has
  3820. this item in his/her inventory, while the autoequip function will
  3821. equip the given item ID when this is looted. The option parameter of
  3822. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  3823. Examples:
  3824. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  3825. equip 1104;
  3826. //The invoked character will now automatically equip a falchion when it's looted.
  3827. autoequip 1104,1;
  3828. //The invoked character will no longer automatically equip a falchion.
  3829. autoequip 1104,0;
  3830. ---------------------------------------
  3831. *buyingstore <slots>;
  3832. Invokes buying store preparation window like the skill 'Open Buying Store',
  3833. without the item requirement. Amount of slots is limited by the server to
  3834. a maximum of 5 slots by default.
  3835. Example:
  3836. // Gives the player opportunity to buy 4 different kinds of items.
  3837. buyingstore 4;
  3838. ---------------------------------------
  3839. *searchstores <uses>,<effect>;
  3840. Invokes the store search window, which allows to search for both vending
  3841. and buying stores. Parameter uses indicates, how many searches can be
  3842. started, before the window has to be reopened. Effect value affects,
  3843. what happens, when a result item is double-clicked and can be one of the
  3844. following:
  3845. 0 = Shows the store's position on the mini-map and highlights the
  3846. shop sign with yellow color, when the store is on same map
  3847. as the invoking player.
  3848. 1 = Directly opens the shop, regardless of distance.
  3849. Example:
  3850. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  3851. searchstores 10,1;
  3852. ---------------------------------------
  3853. *enable_command;
  3854. *disable_command;
  3855. These commands toggle the ability to use atcommand while interacting with an NPC.
  3856. The default setting, 'atcommand_enable_npc', is defined in 'conf/battle/gm.conf'.
  3857. ---------------------------------------
  3858. //
  3859. 4,1.- End of item-related commands
  3860. //
  3861. ---------------------------------------
  3862. *openstorage;
  3863. This will open character's Kafra storage window on the client connected to the
  3864. invoking character. It can be used from any kind of NPC or item script, not just
  3865. limited to Kafra Staff.
  3866. The storage window opens regardless of whether there are open NPC dialogs or
  3867. not, but it is preferred to close the dialog before displaying the storage
  3868. window, to avoid any disruption when both windows overlap.
  3869. mes "Close this window to open your storage.";
  3870. close2;
  3871. openstorage;
  3872. end;
  3873. ---------------------------------------
  3874. *openstorage2 <storage_id>,<mode>{,<account_id>};
  3875. Just like the 'openstorage' command, except this command can open additional storages
  3876. by the specified <storage_id>. For <storage_id>, please read the conf/inter_server.yml
  3877. for storage groups.
  3878. Values for <mode> are:
  3879. STOR_MODE_NONE : Player only can read the storage entries.
  3880. STOR_MODE_GET : Player can get items from the storage.
  3881. STOR_MODE_PUT : Player can put items in the storage.
  3882. Example:
  3883. if (vip_status(VIP_STATUS_ACTIVE)) {
  3884. mes "I will open your Premium storage.";
  3885. mes "Thank you for using our service.";
  3886. close2;
  3887. openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
  3888. } else {
  3889. mes "Sorry, your Premium status is expired.";
  3890. mes "Storage will be opened but you can't put any item into it.";
  3891. close2;
  3892. openstorage2 1,STOR_MODE_GET;
  3893. }
  3894. end;
  3895. ---------------------------------------
  3896. *openmail({<char_id>});
  3897. This will open a character's Mail window on the client connected to the
  3898. invoking character.
  3899. mes "Close this window to open your mail inbox.";
  3900. close2;
  3901. openmail;
  3902. end;
  3903. ---------------------------------------
  3904. *mail <destination id>,"<sender name>","<title>","<body>"{,<zeny>{,<item id array>,<item amount array>{,<item card0 array>{,<item card1 array>{,<item card2 array>{,<item card3 array>
  3905. {,<random option id0 array>, <random option value0 array>, <random option paramter0 array>{,<random option id1 array>, <random option value1 array>, <random option paramter1 array>
  3906. {,<random option id2 array>, <random option value2 array>, <random option paramter2 array>{,<random option id3 array>, <random option value3 array>, <random option paramter3 array>
  3907. {,<random option id4 array>, <random option value4 array>, <random option paramter4 array>}}}}}}};
  3908. This command will send mail to the <destination id> which is a character ID.
  3909. A <sender name> can be specified but does not have to be from the direct creator
  3910. of the mail and is limited to NAME_LENGTH (24) characters. Mail <title> is limited
  3911. to MAIL_TITLE_LENGTH (40) characters. Mail <body> is limited to MAIL_BODY_LENGTH
  3912. (200) characters for PACKETVER < 20150513 or 500 characters for later clients.
  3913. Optional <zeny> and item data can be added to the mail as well. PACKETVER < 20150513
  3914. is limited to 1 item while later clients are limited to MAIL_MAX_ITEM (5).
  3915. The <item id array>, <item amount array>, <item card0 array>, <item card1 array>,
  3916. <item card2 array>, and <item card3 array> should all be integer arrays.
  3917. For random options there can be 5 arrays in pairs of 3 (ids, values, parameters) right after the cards.
  3918. All of these arrays shall be integer arrays as well.
  3919. Example of sending mail with zeny:
  3920. .@charid = getcharid(0);
  3921. .@sender$ = "Poring";
  3922. .@title$ = "Welcome";
  3923. .@body$ = "Hi! I'm a simple Poring from the Prontera fields! Welcome to Ragnarok!";
  3924. .@zeny = 5000;
  3925. mail .@charid, .@sender$, .@title$, .@body$, .@zeny;
  3926. Example of sending mail with items:
  3927. .@charid = getcharid(0);
  3928. .@sender$ = "Angeling";
  3929. .@title$ = "Welcome";
  3930. .@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
  3931. .@zeny = 0;
  3932. setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
  3933. setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
  3934. setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
  3935. setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  3936. setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  3937. mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailcard0, .@mailcard1, .@mailcard2;
  3938. Example of sending mail with items and random options:
  3939. .@charid = getcharid(0);
  3940. .@sender$ = "Angeling";
  3941. .@title$ = "Welcome";
  3942. .@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
  3943. .@zeny = 0;
  3944. setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
  3945. setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
  3946. setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
  3947. setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  3948. setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  3949. setarray .@mailcard3[0], 0, 0, 0, 0; // Empty last slot
  3950. setarray .@mailrndopt_id0[0], 0, 0, 0, 0, RDMOPT_VAR_MAXHPAMOUNT; // Enchant the Dagger with increased HP option
  3951. setarray .@mailrndopt_val0[0], 0, 0, 0, 0, 1000; // Enchant the Dagger with increased HP option by 1000 points
  3952. setarray .@mailrndopt_prm0[0], 0, 0, 0, 0, 0; // Enchant the Dagger with increased HP option - does not need any parameter
  3953. mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailcard0, .@mailcard1, .@mailcard2, .@mailcard3, .@mailrndopt_id0, .@mailrndopt_val0, .@mailrndopt_prm0;
  3954. ---------------------------------------
  3955. *openauction({<char_id>});
  3956. This will open the Auction window on the client connected to the invoking character.
  3957. mes "Close this window to open the Auction window.";
  3958. close2;
  3959. openauction;
  3960. end;
  3961. ---------------------------------------
  3962. \\
  3963. 4,2.- Guild-related commands
  3964. \\
  3965. ---------------------------------------
  3966. *guildopenstorage()
  3967. This function works the same as 'openstorage' but will open a guild storage
  3968. window instead for the guild storage of the guild the invoking character belongs
  3969. to.
  3970. Return values:
  3971. GSTORAGE_OPEN - Successfully opened.
  3972. GSTORAGE_STORAGE_ALREADY_OPEN - Player storage is already open.
  3973. GSTORAGE_ALREADY_OPEN - Guild storage is already open.
  3974. GSTORAGE_NO_GUILD - Player is not in a guild.
  3975. GSTORAGE_NO_STORAGE - Guild hasn't invested in the Guild Storage Expansion skill (only if OFFICIAL_GUILD_STORAGE is enabled).
  3976. GSTORAGE_NO_PERMISSION - Player doesn't have permission to use the guild storage.
  3977. ---------------------------------------
  3978. *guildchangegm(<guild id>,<new master's name>)
  3979. This function will change the Guild Master of a guild. The ID is the guild's
  3980. id, and the new guild master's name must be passed.
  3981. Returns 1 on success, 0 otherwise.
  3982. ---------------------------------------
  3983. *guildgetexp <amount>;
  3984. This will give the specified amount of guild experience points to the guild the
  3985. invoking character belongs to. It will silently fail if they do not belong to
  3986. any guild.
  3987. ---------------------------------------
  3988. *guildskill <skill id>,<level>
  3989. *guildskill "<skill name>",<level>
  3990. This command will bump up the specified guild skill by the specified number of
  3991. levels. This refers to the invoking character and will only work if the invoking
  3992. character is a member of a guild AND its guild master, otherwise no failure
  3993. message will be given and no error will occur, but nothing will happen - same
  3994. about the guild skill trying to exceed the possible maximum. The full list of
  3995. guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
  3996. the end.
  3997. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  3998. // 10000). Notice that if you try to add two levels of Approval, or add
  3999. // Approval when the guild already has it, it will only have one level of
  4000. // Approval afterwards.
  4001. guildskill 10000,1,0;
  4002. You might want to make a quest for getting a certain guild skill, make it hard
  4003. enough that all the guild needs to help or something. Doing this for the Glory
  4004. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  4005. a fun quest.
  4006. ---------------------------------------
  4007. //
  4008. 4,2 End of guild-related commands.
  4009. //
  4010. ---------------------------------------
  4011. *resetlvl <action type>{,<char_id>};
  4012. This is a character reset command, meant mostly for rebirth script supporting
  4013. Advanced jobs, which will reset the invoking character's stats and level
  4014. depending on the action type given. Valid action types are:
  4015. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  4016. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  4017. If the new job is 'Novice High', give 100 status points, give First Aid and
  4018. Play Dead skills.
  4019. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  4020. Skills and attribute values are not altered.
  4021. 3 - Base level 1, base exp 0. Nothing else is changed.
  4022. 4 - Job level 1, job exp 0. Nothing else is changed.
  4023. In all cases everything the character has on will be unequipped.
  4024. Even though it doesn't return a value, it is used as a function in the official
  4025. rebirth scripts. Ask AppleGirl why.
  4026. ---------------------------------------
  4027. *resetstatus({<char_id>});
  4028. This is a character reset command, which will reset the stats on the invoking
  4029. character and give back all the stat points used to raise them previously.
  4030. Nothing will happen to any other numbers about the character.
  4031. Used in reset NPC's (duh!)
  4032. ---------------------------------------
  4033. *resetskill({<char_id>});
  4034. This command takes off all the skill points on the invoking character, so they
  4035. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  4036. to spend again. Nothing else will change but the skills. Quest skills will also
  4037. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  4038. the 'quest_skill_learn' option is set in there, the points in the quest skills
  4039. will also count towards the total.
  4040. Used in reset NPC's (duh!)
  4041. ---------------------------------------
  4042. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  4043. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  4044. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  4045. *sc_end <effect type>{,<GID>};
  4046. *sc_end_class {<char_id>{,<job_id>}};
  4047. These commands will bestow a status effect on a character.
  4048. The <effect type> determines which status is invoked. This can be either a number
  4049. or constant, with the common statuses (mostly negative) found in 'src/map/script_constants.h'
  4050. with the 'SC_' prefix. A full list is located in 'src/map/status.h', though
  4051. they are not currently documented.
  4052. The duration of the status is given in <ticks>, or milleseconds.
  4053. Certain status changes take an additional parameter <value 1>, which typically
  4054. modifies player stats by the given number or percentage. This differs for each
  4055. status, and is sometimes zero.
  4056. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  4057. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  4058. be defined for the rate to work.
  4059. Optional value <flag> is how the status change start will be handled (a bitmask).
  4060. SCSTART_NOAVOID : Status change cannot be avoided.
  4061. SCSTART_NOTICKDEF : Tick cannot be reduced by stats (default).
  4062. SCSTART_LOADED : sc_data loaded, so no value will be altered.
  4063. SCSTART_NORATEDEF : Rate cannot be reduced.
  4064. SCSTART_NOICON : Status icon won't be sent to client
  4065. If a <GID> is given, the status change will be invoked on the specified character
  4066. instead of the one attached to the script. This can only be defined after setting
  4067. a rate and flag.
  4068. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  4069. for effects that require them. The meaning of the extra values vary depending on the
  4070. effect type. For more infos, read status_change.txt containing a list of all Status Changes
  4071. and theirs val1, val2, val3, and val4 usage in source.
  4072. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  4073. perform a complete removal of all statuses (although permanent ones will re-apply).
  4074. 'sc_end_class' works like 'sc_end' but will remove all status effects from any learned
  4075. skill on the invoking character. If <job_id> is provided it will end the effect for that job.
  4076. Examples:
  4077. // This will poison the invoking character for 10 minutes at 50% chance.
  4078. sc_start SC_POISON,600000,0,5000;
  4079. // This will bestow the effect of Level 10 Blessing.
  4080. sc_start SC_BLESSING,240000,10;
  4081. // Adjust element resistance by percentage. Sample with Resist_Fire item script:
  4082. // val1: Water resistance
  4083. // val2: Earth resistance
  4084. // val3: Fire resistance
  4085. // val4: Wind resistance
  4086. sc_start4 SC_ARMOR_ELEMENT,1200000,-15,0,20,0;
  4087. // This will end the Freezing status for the invoking character.
  4088. sc_end SC_FREEZE;
  4089. // This will end the effect of any learned skill for the invoking character.
  4090. sc_end_class;
  4091. // This will end the effect of any learned skill for the character with the <char_id> 150000.
  4092. // val1: <char_id>
  4093. sc_end_class(150000);
  4094. // This will end the effect of any Arch Bishop skill for the invoking character.
  4095. // val1: <char_id>
  4096. // val2: <job_id> of Arch Bishop
  4097. sc_end_class(getcharid(0),Job_Arch_Bishop);
  4098. Note: to use SC_NOCHAT you should alter Manner
  4099. set Manner, -5; // Will mute a user for 5 minutes
  4100. set Manner, 0; // Will unmute a user
  4101. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  4102. ---------------------------------------
  4103. *getstatus(<effect type>{,<type>{,<char_id>}})
  4104. Retrieve information about a specific status effect when called. Depending on <type>
  4105. specified the function will return different information.
  4106. Possible <type> values:
  4107. - 0 or undefined: whether the status is active
  4108. - 1: the val1 of the status
  4109. - 2: the val2 of the status
  4110. - 3: the val3 of the status
  4111. - 4: the val4 of the status
  4112. - 5: the amount of time in milliseconds that the status has remaining
  4113. If <type> is not defined or is set to 0, then the script function will either
  4114. return 1 if the status is active, or 0 if the status is not active. If the status
  4115. is not active when any of the <type> fields are provided, this script function
  4116. will always return 0.
  4117. ---------------------------------------
  4118. *skilleffect <skill id>,<number>;
  4119. *skilleffect "<skill name>",<number>;
  4120. This command displays visual and aural effects of given skill on currently
  4121. attached character. The number parameter is for skill whose visual effect
  4122. involves displaying of a number (healing or damaging). Note, that this command
  4123. will not actually use the skill, it is intended for scripts, which simulate
  4124. skill usage by the NPC, such as buffs, by setting appropriate status and
  4125. displaying the skill's effect.
  4126. mes "Be blessed!";
  4127. // Heal of 2000 HP
  4128. heal 2000,0;
  4129. skilleffect 28,2000;
  4130. // Blessing Level 10
  4131. sc_start SC_BLESSING,240000,10;
  4132. skilleffect 34,0;
  4133. // Increase AGI Level 5
  4134. sc_start SC_INCREASEAGI,140000,5;
  4135. skilleffect 29,0;
  4136. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  4137. Increase AGI Lv 5, and display appropriate effects.
  4138. ---------------------------------------
  4139. *npcskilleffect <skill id>,<number>,<x>,<y>;
  4140. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  4141. This command behaves identically to 'skilleffect', however, the effect will not
  4142. be centered on the invoking character's sprite, nor on the NPC sprite, if any,
  4143. but will be centered at map coordinates given on the same map as the invoking
  4144. character.
  4145. ---------------------------------------
  4146. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  4147. This command will display special effect with the given number, centered on the
  4148. specified NPCs coordinates, if any. For a full list of special effect numbers
  4149. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  4150. some client releases. (Notably, rain is absent from any client executables
  4151. released after April 2005.)
  4152. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  4153. specified does not exist, the command will do nothing. When specifying an NPC,
  4154. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  4155. will retain the default behavior of the command.
  4156. // this will make the NPC "John Doe#1"
  4157. // show the effect "EF_HIT1" specified by
  4158. // Jane Doe. I wonder what John did...
  4159. mes "[Jane Doe]";
  4160. mes "Well, I never!";
  4161. specialeffect EF_HIT1,AREA,"John Doe#1";
  4162. close;
  4163. ---------------------------------------
  4164. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  4165. This command behaves identically to 'specialeffect', but the effect will be
  4166. centered on the invoking character's sprite.
  4167. <Player name> parameter will display <effect number> on another Player than the
  4168. one currently attached to the script. Like with specialeffect, when specifying
  4169. a player, <send_target> must be supplied, specifying AREA will retain the default
  4170. behavior of the command.
  4171. ---------------------------------------
  4172. *statusup <stat>{,<char_id>};
  4173. This command will change a specified stat of the invoking character up by one
  4174. permanently. Stats are to be given as number, but you can use these constants to
  4175. replace them:
  4176. bStr - Strength
  4177. bVit - Vitality
  4178. bInt - Intelligence
  4179. bAgi - Agility
  4180. bDex - Dexterity
  4181. bLuk - Luck
  4182. ---------------------------------------
  4183. *statusup2 <stat>,<amount>{,<char_id>};
  4184. This command will change a specified stat of the invoking character by the
  4185. specified amount permanently. The amount can be negative. See 'statusup'.
  4186. // This will decrease a character's Vit forever.
  4187. statusup2 bVit,-1;
  4188. ---------------------------------------
  4189. *bonus <bonus type>,<val1>;
  4190. *bonus2 <bonus type>,<val1>,<val2>;
  4191. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  4192. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  4193. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  4194. These commands are meant to be used in item scripts. They will probably work
  4195. outside item scripts, but the bonus will not persist for long. They, as
  4196. expected, refer only to an invoking character.
  4197. You can find the full list of possible bonuses and which command to use for each
  4198. kind in 'doc/item_bonus.txt'.
  4199. ---------------------------------------
  4200. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4201. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4202. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  4203. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  4204. These commands are meant to be used in item scripts. They will probably work
  4205. outside item scripts, but the bonus will not persist for long. They, as
  4206. expected, refer only to an invoking character.
  4207. What these commands do is 'attach' a script to the player which will get
  4208. executed on attack (or when attacked in the case of autobonus2).
  4209. Rate is the trigger rate of the script (1000 = 100%).
  4210. Duration is the time that the bonus will last for since the script has triggered.
  4211. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  4212. The optional argument 'flag' is used to classify the type of attack where the script
  4213. can trigger (it shares the same flags as the bAutoSpell bonus script):
  4214. Range criteria:
  4215. BF_SHORT: Trigger on melee attack
  4216. BF_LONG: Trigger on ranged attack
  4217. Default: BF_SHORT+BF_LONG
  4218. Attack type criteria:
  4219. BF_WEAPON: Trigger on weapon skills
  4220. BF_MAGIC: Trigger on magic skills
  4221. BF_MISC: Trigger on misc skills
  4222. Default: BF_WEAPON
  4223. Skill criteria:
  4224. BF_NORMAL: Trigger on normal attacks
  4225. BF_SKILL: Trigger on skills
  4226. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  4227. otherwise BF_SKILL+BF_NORMAL is used.
  4228. The difference between the optional argument 'other script' and the 'bonus script' is that,
  4229. the former one triggers only when attacking(or attacked) and the latter one runs on
  4230. status calculation as well, which makes sure, within the duration, the "bonus" that get
  4231. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  4232. "bonus" command only. And we usually use 'other script' to show visual effects.
  4233. In all cases, when the script triggers, the attached player will be the one
  4234. who holds the bonus. There is currently no way of knowing within this script
  4235. who was the other character (the attacker in autobonus2, or the target in
  4236. autobonus and autobonus3).
  4237. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  4238. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  4239. //effect when the bonus is active.
  4240. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  4241. ---------------------------------------
  4242. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  4243. This command will attach a script to a player for a given duration, in seconds.
  4244. After that time, the script will automatically expire. The same bonus cannot be
  4245. stacked. By default, this bonus will be stored on `bonus_script` table when player
  4246. logs out.
  4247. Flags (bitmask):
  4248. 1 : Remove when dead.
  4249. 2 : Removable by Dispell.
  4250. 4 : Removable by Clearance.
  4251. 8 : Remove when player logs out.
  4252. 16 : Removeable by Banishing Buster.
  4253. 32 : Removable by Refresh.
  4254. 64 : Removable by Lux Anima.
  4255. 128 : Remove when Madogear is activated or deactivated.
  4256. 256 : Remove when receive damage.
  4257. 512 : Script is permanent, cannot be cleared by bonus_script_clear.
  4258. 1024: Force to replace duplicated script by expanding the duration.
  4259. 2048: Force to add duplicated script. This flag cannot be stacked with 1024,
  4260. if both are defined, 1024 will be checked first and ignore this flag.
  4261. Types:
  4262. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  4263. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  4264. 1: Buff
  4265. 2: Debuff
  4266. Status_icon: See "Status Icon" section in 'src/map/script_constants.h'. Default is SI_BLANK (-1).
  4267. Example:
  4268. // Apple gives you +5 Str bonus for 1 minute when it's consumed.
  4269. 512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
  4270. ---------------------------------------
  4271. *bonus_script_clear {<flag>,{<char_id>}};
  4272. Removes attached bonus_script from player. If no 'char_id' given, it will removes
  4273. from the invoker.
  4274. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  4275. it just removes non-permanent script.
  4276. ---------------------------------------
  4277. *skill <skill id>,<level>{,<flag>};
  4278. *skill "<skill name>",<level>{,<flag>};
  4279. *addtoskill <skill id>,<level>{,<flag>};
  4280. *addtoskill "<skill name>",<level>{,<flag>};
  4281. These commands will give the invoking character a specified skill. This is also
  4282. used for item scripts.
  4283. Level is obvious. Skill id is the ID number of the skill in question as per
  4284. 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
  4285. a character a monster's skill, but you're welcome to try with the numbers given
  4286. in 'db/(pre-)re/mob_skill_db.txt'.
  4287. Flag is 0 if the skill is given permanently (will get written with the character
  4288. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  4289. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  4290. 'skill' and to 2 in 'addtoskill'.
  4291. Flag 2 means that the level parameter is to be interpreted as a stackable
  4292. additional bonus to the skill level. If the character did not have that skill
  4293. previously, they will now at 0+the level given.
  4294. Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
  4295. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  4296. Flag constants:
  4297. 0 - SKILL_PERM
  4298. 1 - SKILL_TEMP
  4299. 2 - SKILL_TEMPLEVEL
  4300. 3 - SKILL_PERM_GRANT
  4301. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  4302. // level 1.
  4303. skill 152,1,0;
  4304. ---------------------------------------
  4305. *nude {<char_id>};
  4306. This command will unequip anything equipped on the invoking character.
  4307. It is not required to do this when changing jobs since 'jobchange' will unequip
  4308. everything not equippable by the new job class anyway.
  4309. ---------------------------------------
  4310. *sit {"<character name>"};
  4311. *stand {"<character name>"};
  4312. These commands will make a character sit or stand.
  4313. If no character is specified, the command will run for the invoking character.
  4314. Additionnally Sitting constant is true when the character is sitting, false otherwise.
  4315. ---------------------------------------
  4316. *disguise <Monster ID>{,<char_id>};
  4317. *undisguise {<char_id>};
  4318. This command disguises the current player with a monster sprite.
  4319. The disguise lasts until 'undisguise' is issued or the player logs out.
  4320. Example:
  4321. disguise 1002; // Disguise character as a Poring.
  4322. next;
  4323. undisguise; // Return to normal character sprite.
  4324. ---------------------------------------
  4325. *transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4326. *transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4327. *active_transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4328. *active_transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4329. This command will turn a player into a monster for a given duration and can grant
  4330. a SC attribute effect while transformed. Note that players cannot be transformed
  4331. during War of Emperium or if already disguised.
  4332. Can only be removed when you die or the duration ends.
  4333. 'transform' and 'active_transform' can stack on each other but using 'transform' or
  4334. 'active_transform' twice will not stack (it will cancel the previous bonus for the new).
  4335. 'active_transform' will take priority over transform for its duration.
  4336. ---------------------------------------
  4337. \\
  4338. 4,3 Marriage-related commands
  4339. \\
  4340. ---------------------------------------
  4341. *marriage("<spouse name>");
  4342. This function will marry two characters, the invoking character and the one
  4343. referred to by name given, together, setting them up as each other's marriage
  4344. partner. No second function call has to be issued (in current SVN at least) to
  4345. make sure the marriage works both ways. The function returns 1 upon success, or
  4346. 0 if the marriage could not be completed, either because the other character
  4347. wasn't found or because one of the two characters is already married.
  4348. This will do nothing else for the marriage except setting up the spouse ID for
  4349. both of these characters. No rings will be given and no effects will be shown.
  4350. ---------------------------------------
  4351. *wedding;
  4352. This command will call up wedding effects - the music and confetti - centered on
  4353. the invoking character. Example can be found in the wedding script.
  4354. ---------------------------------------
  4355. *divorce({<char_id>})
  4356. This function will "un-marry" the invoking character from whoever they were
  4357. married to. Both will no longer be each other's marriage partner, (at least in
  4358. current SVN, which prevents the cases of multi-spouse problems). It will return
  4359. 1 upon success or 0 if the character was not married at all.
  4360. This function will also destroy both wedding rings and send a message to both
  4361. players, telling them they are now divorced.
  4362. ---------------------------------------
  4363. *adopt("<parent_name>","<baby_name>");
  4364. *adopt(<parent_id>,<baby_id>);
  4365. This function will send the client adoption request to the specified baby
  4366. character. The parent value can be either parent. Both parents and the baby
  4367. need to be online in order for adoption to work.
  4368. Return values:
  4369. ADOPT_ALLOWED - Sent message to Baby to accept or deny.
  4370. ADOPT_ALREADY_ADOPTED - Character is already adopted.
  4371. ADOPT_MARRIED_AND_PARTY - Parents need to be married and in a party with the baby.
  4372. ADOPT_EQUIP_RINGS - Parents need wedding rings equipped.
  4373. ADOPT_NOT_NOVICE - Baby is not a Novice.
  4374. ADOPT_CHARACTER_NOT_FOUND - A parent or Baby was not found.
  4375. ADOPT_MORE_CHILDREN - You cannot adopt more than 1 child. (client message)
  4376. ADOPT_LEVEL_70 - Parents need to be at least level 70 in order to adopt someone. (client message)
  4377. ADOPT_MARRIED - You cannot adopt a married person. (client message)
  4378. ---------------------------------------
  4379. //
  4380. 4,3.- End of marriage-related commands
  4381. //
  4382. ---------------------------------------
  4383. *pcfollow <id>,<target id>;
  4384. *pcstopfollow <id>;
  4385. Makes a character follow or stop following someone. This command does the same
  4386. as the @follow command. The main difference is that @follow can use character
  4387. names, and this commands needs the account ID for the target.
  4388. Examples:
  4389. // This will make Aaron follow Bullah, when both of these characters are online.
  4390. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4391. // Makes Aaron stop following whoever he is following.
  4392. pcstopfollow getCharID(3,"Aaron");
  4393. ---------------------------------------
  4394. *pcblockmove <id>,<option>;
  4395. *unitblockmove <id>,<option>;
  4396. Prevents the given GID from moving when the option is 1, and enables the ID to
  4397. move again when the option is 0. This command will run for the attached unit
  4398. if the given GID is zero.
  4399. Examples:
  4400. // Prevents the current char from moving away.
  4401. pcblockmove getcharid(3),1;
  4402. // Enables the current char to move again.
  4403. pcblockmove getcharid(3),0;
  4404. ---------------------------------------
  4405. *pcblockskill <id>,<option>;
  4406. *unitblockskill <id>,<option>;
  4407. Prevents the given GID from casting skills when the option is 1, and enables
  4408. the ID to cast skills again when the option is 0. This command will run for
  4409. the attached unit if the given GID is zero.
  4410. Examples:
  4411. // Prevents the current char from casting skills.
  4412. pcblockskill getcharid(3),1;
  4413. // Enables the current char to cast skills again.
  4414. pcblockskill getcharid(3),0;
  4415. ---------------------------------------
  4416. ==================================
  4417. |5.- Mob / NPC -related commands.|
  4418. ==================================
  4419. ---------------------------------------
  4420. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4421. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4422. This command will spawn a monster on the specified coordinates on the specified
  4423. map. If the script is invoked by a character, a special map name, "this", will
  4424. be recognized to mean the name of the map the invoking character is located at.
  4425. This command works fine in the item scripts.
  4426. The same command arguments mean the same things as described above in the
  4427. beginning of this document when talking about permanent monster spawns. Monsters
  4428. spawned in this manner will not respawn upon being killed.
  4429. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4430. be picked from the entire database according to the rules configured in the
  4431. server for dead branches. This will work for all other kinds of non-permanent
  4432. monster spawns.
  4433. The only very special thing about this command is an event label, which is an
  4434. optional parameter. This label is written like '<NPC object name>::<label name>'
  4435. and upon the monster being killed, it will execute the script inside of the
  4436. specified NPC object starting from the label given. The RID of the player
  4437. attached at this execution will be the RID of the killing character. The variable
  4438. 'killedrid' is set to the Class (mob ID) of the monster killed.
  4439. <size> can be:
  4440. Size_Small (0) (default)
  4441. Size_Medium (1)
  4442. Size_Large (2)
  4443. <ai> can be:
  4444. AI_NONE (0) (default)
  4445. AI_ATTACK (1) (attack/friendly)
  4446. AI_SPHERE (2) (Alchemist skill)
  4447. AI_FLORA (3) (Alchemist skill)
  4448. AI_ZANZOU (4) (Kagerou/Oboro skill)
  4449. AI_LEGION (5) (Sera skill)
  4450. AI_FAW (6) (Mechanic skill)
  4451. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4452. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4453. The 'areamonster' command works much like the 'monster' command and is not
  4454. significantly different, but spawns the monsters within a square defined by
  4455. x1/y1-x2/y2.
  4456. Returned value is an array with the game ID of the spawned monster(s) depending
  4457. on the amount spawned. Array is stored in $@mobid[].
  4458. Simple monster killing script:
  4459. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4460. mes "[Summon Man]";
  4461. mes "Want to start the Poring hunt?";
  4462. next;
  4463. if (select("Yes.:No.") == 2) {
  4464. mes "[Summon Man]";
  4465. mes "Come back later.";
  4466. close;
  4467. }
  4468. // Summon 10 Porings.
  4469. // Using coordinates 0,0 will spawn them in a random location.
  4470. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4471. mes "[Summon Man]";
  4472. mes "Now go and kill all the Porings I summoned.";
  4473. close;
  4474. OnPoringKilled:
  4475. $PoringKilled++;
  4476. if ($PoringKilled >= 10) {
  4477. announce "Summon Man: Well done. All the Porings are dead!",3;
  4478. $PoringKilled = 0;
  4479. }
  4480. end;
  4481. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4482. ---------------------------------------
  4483. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4484. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4485. This command will make all monsters of the specified mob ID in the specified
  4486. area use the specified skill. Map name, x, and y define the center of the area,
  4487. which extending <range> cells in each direction (ex: a range of 3 would create
  4488. a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
  4489. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4490. <target type> can be:
  4491. 0 = self
  4492. 1 = the mob's current target
  4493. 2 = the mob's master
  4494. 3 = random target
  4495. Example:
  4496. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4497. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4498. // make the plant cast level 10 Cold Bolt on a random target
  4499. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,ET_KEK,3;
  4500. ---------------------------------------
  4501. *killmonster "<map name>","<event label>"{,<type>};
  4502. This command will kill all monsters that were spawned with 'monster' or
  4503. 'addmonster' and have a specified event label attached to them. Commonly used to
  4504. get rid of remaining quest monsters once the quest is complete.
  4505. If the label is given as "All", all monsters which have their respawn times set
  4506. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4507. command, and all monsters summoned with GM commands, but no other ones - that
  4508. is, all non-permanent monsters) on the specified map will be killed regardless
  4509. of the event label value.
  4510. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4511. will make the command fire "OnMyMobDead" events from any monsters that do die
  4512. as a result of this command.
  4513. ---------------------------------------
  4514. *killmonsterall "<map name>"{,<type>};
  4515. This command will kill all monsters on a specified map name, regardless of how
  4516. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4517. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4518. trigger when there is no player, killmonsterall has also been modified to support this.
  4519. Using this the normal/old way means labels don't trigger when a player didn't
  4520. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4521. forced to use the new method. However, if you wish to use the new label type with this
  4522. command, simply use 1 for type. Any other number won't be recognized.
  4523. ---------------------------------------
  4524. *strmobinfo(<type>,<monster id>);
  4525. This function will return information about a monster record in the database, as
  4526. per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
  4527. It will return 0 if there is no such monster (or the type value is invalid),
  4528. or an empty string if you requested the monster's name.
  4529. 1 - 'english name' field in the database, a string.
  4530. 2 - 'japanese name' field in the database, a string.
  4531. All other returned values are numbers:
  4532. 3 - Level.
  4533. 4 - Maximum HP.
  4534. 5 - Maximum SP.
  4535. 6 - Experience reward.
  4536. 7 - Job experience reward.
  4537. ---------------------------------------
  4538. *mobcount("<map name>","<event label>")
  4539. This function will count all the monsters on the specified map that have a given
  4540. event label and return the number or 0 if it can't find any. Naturally, only
  4541. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4542. event label.
  4543. If you pass this function an empty string for the event label, it will return
  4544. the total count of monster without event label, including permanently spawning monsters.
  4545. With the dynamic mobs system enabled, where mobs are not kept
  4546. in memory for maps with no actual people playing on them, this will return a 0
  4547. for any such map.
  4548. If the event label is given as "all", all monsters will be counted, regardless of
  4549. having any event label attached.
  4550. If the map name is given as "this", the map the invoking character is on will
  4551. be used. If the map is not found, or the invoker is not a character while the map
  4552. is "this", it will return -1.
  4553. ---------------------------------------
  4554. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4555. This command creates a monster which is a copy of another player. The first
  4556. four arguments serve the same purpose as in the monster script command, The
  4557. <char id> is the character id of the player to clone (player must be online).
  4558. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4559. must be a character id of another online player.
  4560. The mode can be specified to determine the behavior of the clone. Its
  4561. values are the same as the ones used for the mode field in the mob_db. The
  4562. default mode is aggressive, assists, can move, can attack.
  4563. Flag can be either zero or one currently. If zero, the clone is a normal
  4564. monster that'll target players, if one, it is considered a summoned monster,
  4565. and as such, it'll target other monsters. Defaults to zero.
  4566. The duration specifies how long the clone will live before it is auto-removed.
  4567. Specified in seconds, defaults to no limit (zero).
  4568. Returned value is the monster ID of the spawned clone. If command fails,
  4569. returned value is zero.
  4570. ---------------------------------------
  4571. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4572. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4573. with other commands, this one will set up the monster to fight to protect the
  4574. invoking character. Monster name and mob id obey the same rules as the one given
  4575. at the beginning of this document for permanent monster spawns with the
  4576. exceptions mentioned when describing 'monster' command.
  4577. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4578. invoking character.
  4579. Timeout is the time in milliseconds the summon lives, and is set default
  4580. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4581. and it is not possible to create a spawn that lasts forever.
  4582. If an event label is given, upon the monster being killed, the event label will
  4583. run as if by 'donpcevent'.
  4584. Returned value is the game ID of the spawned monster.
  4585. // Will summon a dead branch-style monster to fight for the character.
  4586. summon "--ja--",-1;
  4587. ---------------------------------------
  4588. *addmonsterdrop <monster id>,<item id>,<rate>;
  4589. *addmonsterdrop "<monster name>",<item id>,<rate>;
  4590. *delmonsterdrop <monster id>,<item id>;
  4591. *delmonsterdrop "<monster name>",<item id>;
  4592. These commands will temporarily add or delete a monster drop, which will be reset
  4593. when the mob database reloads or the server shuts down. They return 1 upon success.
  4594. If the monster already drops the specified item, its drop rate will be updated with
  4595. the given rate (100 = 1%).
  4596. Examples:
  4597. // Makes Owl Baron drop Honey at an 80% rate.
  4598. addmonsterdrop 1295,518,8000;
  4599. // Deletes Executioner's Mitten from Rybio.
  4600. delmonsterdrop 1201,7017;
  4601. ---------------------------------------
  4602. *disablenpc "<NPC object name>";
  4603. *enablenpc "<NPC object name>";
  4604. These two commands will disable and enable, respectively, an NPC object
  4605. specified by name. The disabled NPC will disappear from sight and will no longer
  4606. be triggerable in the normal way. It is not clear whether it will still be
  4607. accessible through 'donpcevent' and other triggering commands, but it probably
  4608. will be. You can disable even warp NPCs if you know their object names, which is
  4609. an easy way to make a map only accessible through walking half the time. Then
  4610. you 'enablenpc' them back.
  4611. You can also use these commands to create the illusion of an NPC switching
  4612. between several locations, which is often better than actually moving the NPC -
  4613. create one NPC object with a visible and a hidden part to their name, make a few
  4614. copies, and then disable all except one.
  4615. ---------------------------------------
  4616. *hideonnpc "<NPC object name>";
  4617. *hideoffnpc "<NPC object name>";
  4618. These commands will make the NPC object specified display as hidden/visible,
  4619. even though not actually disabled per se. Hidden as in thief Hide skill, but
  4620. unfortunately, not detectable by Ruwach or Sight.
  4621. As they are now, these commands are pointless, it is suggested to use
  4622. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  4623. sprite location and other accompanying data from memory when it is not used.
  4624. However, you can use these for some quest ideas (such as cloaking NPCs talking
  4625. while hidden then revealing.... you can wonder around =P
  4626. ---------------------------------------
  4627. *unloadnpc "<NPC object name>";
  4628. This command will fully unload a NPC object and all of it's duplicates.
  4629. ---------------------------------------
  4630. *doevent "<NPC object name>::<event label>";
  4631. This command will start a new execution thread in a specified NPC object at the
  4632. specified label. The execution of the script running this command will not stop,
  4633. and the event called by the 'doevent' command will not run until the invoking
  4634. script has terminated. No parameters may be passed with a doevent call.
  4635. The script of the NPC object invoked in this manner will run as if it's been
  4636. invoked by the RID that was active in the script that issued a 'doevent'. As
  4637. such, the command will not work if an RID is not attached.
  4638. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  4639. mes "This is what you will see when you click me";
  4640. close;
  4641. OnLabel:
  4642. mes "This is what you will see if the doevent is activated";
  4643. close;
  4644. }
  4645. ....
  4646. doevent "NPC::OnLabel";
  4647. ---------------------------------------
  4648. *donpcevent "<NPC object name>::<event label>";
  4649. This command invokes the event label code within an another NPC or NPCs. It
  4650. starts a separate instance of execution, and the invoking NPC will resume
  4651. execution its immediately.
  4652. If the supplied event label has the form "NpcName::OnLabel", then only given
  4653. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  4654. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  4655. label will be invoked, one after another. In both cases the invoked script
  4656. will run without an attached RID, whether or not the invoking script was
  4657. attached to a player. The event label name is required to start with "On".
  4658. This command can be used to make other NPCs act, as if they were responding to
  4659. the invoking NPC's actions, such as using an emotion or talking.
  4660. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  4661. mes "NPC2 copies my actions!";
  4662. close2;
  4663. donpcevent "NPC2::OnEmote";
  4664. end;
  4665. OnEmote:
  4666. emotion rand(1,30);
  4667. end;
  4668. }
  4669. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  4670. mes "NPC1 copies my actions!";
  4671. close2;
  4672. donpcevent "NPC1::OnEmote";
  4673. end;
  4674. OnEmote:
  4675. emotion rand(1,30);
  4676. end;
  4677. }
  4678. Whichever of the both NPCs is talked to, both will show a random emotion at the
  4679. same time.
  4680. As of r16564, command now returns 1 or 0 on success and failure.
  4681. A debug message also shows on the console when no events are triggered.
  4682. ---------------------------------------
  4683. *cmdothernpc "<npc name>","<command>";
  4684. This is simply "donpcevent <npc name>::OnCommand<command>".
  4685. It is an approximation of official server script language's 'cmdothernpc'.
  4686. Returns true if the command was executed on the other NPC successfully, false if not.
  4687. ---------------------------------------
  4688. *npctalk "<message>"{,"<NPC name>","<flag>"};
  4689. This command will display a message as if the NPC object running it was a player
  4690. talking - that is, above their head and in the chat window.
  4691. The display name of the NPC won't get appended in front of the message.
  4692. If the <NPC name> option is given and not empty, then that NPC will display the message,
  4693. else the attached NPC will display the message.
  4694. Target for <flag>:
  4695. - bc_all : Broadcast message is sent server-wide (only in the chat window).
  4696. - bc_map : Message is sent to everyone in the same map as the source of the npc.
  4697. - bc_area : Message is sent to players in the vicinity of the source (default value).
  4698. - bc_self : Message is sent only to player attached.
  4699. // This will make everyone in the area see the NPC greet the character
  4700. // who just invoked it.
  4701. npctalk "Hello " + strcharinfo(0) + ", how are you?";
  4702. ---------------------------------------
  4703. *chatmes "<message>"{,"<NPC name>"};
  4704. This command will display a message in the waitingroom (chat) of the NPC.
  4705. If the <NPC name> option is given, then that NPC will display the message, else
  4706. the attached NPC will display the message.
  4707. If the NPC is not in a waitingroom, nothing happens.
  4708. // Everyone in the waitingroom will see this message:
  4709. chatmes "Waiting 5 minutes until the next match will start";
  4710. ---------------------------------------
  4711. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  4712. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  4713. *setnpcdisplay("<npc name>", "<display name>")
  4714. *setnpcdisplay("<npc name>", <class id>)
  4715. Changes the display name and/or display class of the target NPC.
  4716. Returns 0 is successful, 1 if the NPC does not exist.
  4717. Size is 0 = normal 1 = small 2 = big.
  4718. ---------------------------------------
  4719. \\
  4720. 5,1.- Time-related commands
  4721. \\
  4722. ---------------------------------------
  4723. *addtimer <ticks>,"NPC::OnLabel";
  4724. *deltimer "NPC::OnLabel";
  4725. *addtimercount <ticks>,"NPC::OnLabel";
  4726. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  4727. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  4728. number of ticks. For all three cases, the event label given is the identifier of
  4729. that timer. The timer runs on the character object that is attached to the script,
  4730. and can have multiple instances. When the label is run, it is run as if the player that
  4731. the timer runs on has clicked the NPC.
  4732. When this timer runs out, a new execution thread will start in the specified NPC
  4733. object at the specified label.
  4734. The ticks are given in 1/1000ths of a second.
  4735. One more thing. These timers are stored as part of player data. If the player
  4736. logs out, all of these get immediately deleted, without executing the script.
  4737. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  4738. Example:
  4739. <NPC Header> {
  4740. dispbottom "Starting a 5 second timer...";
  4741. addtimer 5000, strnpcinfo(3) + "::On5secs";
  4742. end;
  4743. On5secs:
  4744. dispbottom "5 seconds have passed!";
  4745. end;
  4746. }
  4747. ---------------------------------------
  4748. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4749. { "<NPC name>" | <Attach Flag> };
  4750. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  4751. { "<NPC name>" | <Detach Flag> };
  4752. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4753. { "<NPC name>" | <Attach Flag> };
  4754. *setnpctimer <tick>{,"<NPC name>"};
  4755. *getnpctimer(<type of information>{,"<NPC name>"})
  4756. *attachnpctimer {"<character name>"};
  4757. *detachnpctimer {"<NPC name>"};
  4758. This set of commands and functions will create and manage an NPC-based timer.
  4759. The NPC name may be omitted, in which case the calling NPC is used as target.
  4760. Contrary to addtimer/deltimer commands which let you have many different timers
  4761. referencing different labels in the same NPC, each with their own countdown,
  4762. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  4763. and let you know how many were triggered already and how many still remain.
  4764. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  4765. creating this timer, the execution will not stop, but will happily continue
  4766. onward. The timer will then invoke new execution threads at labels
  4767. "OnTimer<time>:" in the NPC object it is attached to.
  4768. To create the timer, use the 'initnpctimer', which will start it running.
  4769. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  4770. 'startnpctimer' will let the paused timer continue.
  4771. By default timers do not have a RID attached, which lets them continue even
  4772. if the player that started them logs off. To attach a RID to a timer, you can
  4773. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  4774. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  4775. stopnpctimer lets you detach any RID after stopping the timer, and by using
  4776. 'detachnpctimer' you can detach a RID at any time.
  4777. Normally there is only a single timer per NPC, but as an exception, as long as
  4778. you attach a player to the timer, you can have multiple timers running at once,
  4779. because these will get stored on the players instead of the NPC.
  4780. NOTE: You need to attach the RID before the timer _before_ you start it to
  4781. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  4782. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  4783. event label of that NPC will be triggered, so you can do the appropriate
  4784. cleanup (the player is still attached when this event is triggered).
  4785. The 'setnpctimer' command will explicitly set the timer to a given tick.
  4786. 'getnpctimer' provides timer information. Its parameter defines what type:
  4787. 0 - Will return the current tick count of the timer.
  4788. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  4789. specified NPC waiting for execution.
  4790. 2 - Will return the number of times the timer has triggered and will trigger
  4791. an "OnTimer<tick>:" label in the specified NPC.
  4792. Example 1:
  4793. <NPC Header> {
  4794. // We need to use attachnpctimer because the mes command below needs RID attach
  4795. attachnpctimer;
  4796. initnpctimer;
  4797. npctalk "I cant talk right now, give me 10 seconds";
  4798. end;
  4799. OnTimer5000:
  4800. npctalk "Ok 5 seconds more";
  4801. end;
  4802. OnTimer6000:
  4803. npctalk "4";
  4804. end;
  4805. OnTimer7000:
  4806. npctalk "3";
  4807. end;
  4808. OnTimer8000:
  4809. npctalk "2";
  4810. end;
  4811. OnTimer9000:
  4812. npctalk "1";
  4813. end;
  4814. OnTimer10000:
  4815. stopnpctimer;
  4816. mes "[Man]";
  4817. mes "Ok we can talk now";
  4818. detachnpctimer;
  4819. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  4820. }
  4821. Example 2:
  4822. OnTimer15000:
  4823. npctalk "Another 15 seconds have passed.";
  4824. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  4825. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  4826. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  4827. initnpctimer;
  4828. end;
  4829. // This OnInit label will run when the script is loaded, so that the timer
  4830. // is initialized immediately as the server starts. It is dropped back to 0
  4831. // every time the NPC says something, so it will cycle continuously.
  4832. OnInit:
  4833. initnpctimer;
  4834. end;
  4835. Example 3:
  4836. mes "[Man]";
  4837. mes "I have been waiting " + (getnpctimer(0)/1000) + " seconds for you.";
  4838. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  4839. close;
  4840. Example 4:
  4841. mes "[Man]";
  4842. mes "Ok, I will let you have 30 more seconds...";
  4843. close2;
  4844. setnpctimer (getnpctimer(0)-30000);
  4845. // Notice the 'close2'. If there were a 'next' there the timer would be
  4846. // changed only after the player pressed the 'next' button.
  4847. end;
  4848. ---------------------------------------
  4849. *sleep {<milliseconds>};
  4850. *sleep2 {<milliseconds>};
  4851. *awake "<NPC name>";
  4852. These commands are used to control the pause of a NPC.
  4853. sleep and sleep2 will pause the script for the given amount of milliseconds.
  4854. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  4855. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  4856. basically do the same, but the main difference is that sleep will not keep the rid,
  4857. while sleep2 does. Also sleep2 will stop the script if there is no unit attached.
  4858. Examples:
  4859. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  4860. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  4861. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  4862. ---------------------------------------
  4863. *progressbar "<color>",<seconds>;
  4864. This command works almost like sleep2, but displays a progress bar
  4865. above the head of the currently attached character (like cast bar).
  4866. Once the given amount of seconds passes, the script resumes. If the
  4867. character moves while the progress bar progresses, it is aborted and
  4868. the script ends. The color format is in RGB (RRGGBB). The color is
  4869. currently ignored by the client and appears always green.
  4870. ---------------------------------------
  4871. *progressbar_npc "<color>",<seconds>{,<"NPC Name">};
  4872. This command works like progressbar, but displays a progress bar
  4873. above the head of the currently attached (or given) NPC. Once the
  4874. given amount of seconds passes, the script resumes. The color format
  4875. is in RGB (RRGGBB). The color is currently ignored by the client and
  4876. appears always green.
  4877. Note: If a player is attached to the NPC, they are detached from the NPC
  4878. as soon as the progress bar activates.
  4879. ---------------------------------------
  4880. //
  4881. 5,1.- End of time-related commands
  4882. //
  4883. ---------------------------------------
  4884. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  4885. This command will broadcast a message to all or most players, similar to
  4886. @kami/@kamib GM commands.
  4887. announce "This will be shown to everyone at all in yellow.",0;
  4888. The region the broadcast is heard in (target), source of the broadcast
  4889. and the color the message will come up as is determined by the flags.
  4890. The flag values are coded as constants in 'src/map/script_constants.h' to make them easier to use.
  4891. Target flags:
  4892. - bc_all: Broadcast message is sent server-wide (default).
  4893. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  4894. - bc_area: Message is sent to players in the vicinity of the source.
  4895. - bc_self: Message is sent only to current player.
  4896. You cannot use more than one target flag.
  4897. Source flags:
  4898. - bc_pc: Broadcast source is the attached player (default).
  4899. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  4900. (useful when a player is not attached or the message should be sent to those
  4901. nearby the NPC).
  4902. You cannot use more than one source flag.
  4903. Special flags:
  4904. - bc_yellow: Broadcast will be displayed in yellow color (default).
  4905. - bc_blue: Broadcast will be displayed in blue color.
  4906. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  4907. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  4908. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  4909. If any of the optional parameters is used, special flag is ignored.
  4910. Optional parameters may not work well (or at all) depending on a game client used.
  4911. The color parameter is a single number which can be in hexadecimal notation.
  4912. For example:
  4913. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  4914. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  4915. In official scripts only two font-weights (types) are used:
  4916. - normal (FW_NORMAL = 400, default),
  4917. - bold (FW_BOLD = 700).
  4918. Default font size is 12.
  4919. Using this for private messages to players is probably not that good an idea,
  4920. but it can be used instead in NPCs to "preview" an announce.
  4921. // This will be a private message to the player using the NPC that made the
  4922. // announcement
  4923. announce "This is my message just for you",bc_blue|bc_self;
  4924. // This will be shown on everyones screen that is in sight of the NPC.
  4925. announce "This is my message just for you people here",bc_npc|bc_area;
  4926. ---------------------------------------
  4927. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4928. This command will work like 'announce' but will only broadcast to characters
  4929. currently residing on the specified map. The flag and optional parameters
  4930. parameters are the same as in 'announce', but target and source flags are ignored.
  4931. ---------------------------------------
  4932. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4933. This command works like 'announce' but will only broadcast to characters
  4934. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  4935. optional parameters are the same as in 'announce', but target and source flags are ignored.
  4936. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  4937. ---------------------------------------
  4938. *callshop "<name>",<option>;
  4939. These are a series of commands used to create dynamic shops.
  4940. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  4941. The options are:
  4942. 0 = The normal window (buy, sell and cancel)
  4943. 1 = The buy window
  4944. 2 = The sell window
  4945. Note: The <option> parameter only works on the 'shop' type NPC.
  4946. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  4947. (as long as an npcshop* command is executed from that NPC, see note below). These
  4948. labels, if used, will replace how the shop handles the buying and selling of items,
  4949. allowing for the creation of dynamic shops.
  4950. The label "OnBuyItem" sets the following arrays:
  4951. @bought_nameid - item ID bought
  4952. @bought_quantity - amount bought
  4953. The label "OnSellItem" sets the following arrays:
  4954. @sold_nameid - item ID sold
  4955. @sold_quantity - amount sold
  4956. @sold_refine - refine count
  4957. @sold_attribute - if the item is broken (1) or not (0)
  4958. @sold_identify - if the item is identified (1) or not (0)
  4959. @sold_card1 - card slot 1
  4960. @sold_card2 - card slot 2
  4961. @sold_card3 - card slot 3
  4962. @sold_card4 - card slot 4
  4963. @sold_option_id1 - random option ID 1
  4964. @sold_option_val1 - random option value 1
  4965. @sold_option_param1 - random option param 1
  4966. @sold_option_id2 - random option ID 2
  4967. @sold_option_val2 - random option value 2
  4968. @sold_option_param2 - random option param 2
  4969. @sold_option_id3 - random option ID 3
  4970. @sold_option_val3 - random option value 3
  4971. @sold_option_param3 - random option param 3
  4972. @sold_option_id4 - random option ID 4
  4973. @sold_option_val4 - random option value 4
  4974. @sold_option_param4 - random option param 4
  4975. @sold_option_id5 - random option ID 5
  4976. @sold_option_val5 - random option value 5
  4977. @sold_option_param5 - random option param 5
  4978. Note: These labels will only be triggered if an npcshop* command is executed because these
  4979. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  4980. are triggered in the NPC whose master_nd is given in the shop.
  4981. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  4982. ---------------------------------------
  4983. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4984. This command lets you override the contents of an existing NPC shop or cashshop. The
  4985. current sell list will be wiped, and only the items specified with the price
  4986. specified will be for sale.
  4987. The function returns 1 if shop was updated successfully, or 0 if not found.
  4988. NOTES:
  4989. - That you cannot use -1 to specify default selling price!
  4990. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4991. and make sure don't add duplication item!
  4992. ---------------------------------------
  4993. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4994. This command will add more items at the end of the selling list for the
  4995. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  4996. appear twice on the sell list.
  4997. The function returns 1 if shop was updated successfully, or 0 if not found.
  4998. NOTES:
  4999. - That you cannot use -1 to specify default selling price!
  5000. - If attached shop type is market shop, need an extra param after price, it's <qty>
  5001. and make sure don't add duplication item!
  5002. ---------------------------------------
  5003. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  5004. This command will remove items from the specified NPC shop or cashshop.
  5005. If the item to remove exists more than once on the shop, all instances will be
  5006. removed.
  5007. Note that the function returns 1 even if no items were removed. The return
  5008. value is only to confirm that the shop was indeed found.
  5009. ---------------------------------------
  5010. *npcshopattach "<name>"{,<flag>};
  5011. This command will attach the current script to the given NPC shop.
  5012. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  5013. of your script will be executed whenever a player buys/sells from the shop.
  5014. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  5015. and @sold_quantity[] will be filled up with the items and quantities
  5016. bought/sold.
  5017. The optional parameter specifies whether to attach ("1") or detach ("0") from
  5018. the shop (the default is to attach). Note that detaching will detach any NPC
  5019. attached to the shop, even if it's from another script, while attaching will
  5020. override any other script that may be already attached.
  5021. The function returns 0 if the shop was not found, 1 otherwise.
  5022. NOTES:
  5023. - If attached shop type is market shop, will be default to call the 'buy' window.
  5024. ---------------------------------------
  5025. *npcshopupdate "<name>",<item_id>,<price>{,<stock>}
  5026. Update an entry from shop. If price is 0 means don't change the price, maybe used for
  5027. marketshop to update the stock quantity. Except marketshop type, 'stock' value means
  5028. nothing.
  5029. ---------------------------------------
  5030. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  5031. This command will create a chat room, owned by the NPC object running this
  5032. script and displayed above the NPC sprite.
  5033. The maximum length of a chat room name is 60 letters.
  5034. The limit is the maximum number of people allowed to enter the chat room.
  5035. The attached NPC is included in this count. If the optional event and trigger
  5036. parameters are given, the event label ("<NPC object name>::<label name>")
  5037. will be invoked as if with a 'doevent' upon the number of people in the chat
  5038. room reaching the given triggering amount.
  5039. // The NPC will just show a box above its head that says "Hello World", clicking
  5040. // it will do nothing, since the limit is zero.
  5041. waitingroom "Hello World",0;
  5042. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  5043. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  5044. // the player will be able to wait until 7 players accumulate. Once this happens,
  5045. // it will cause the NPC "Bouncer" run the label "OnStart".
  5046. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  5047. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  5048. // and will have 8 waiting slots. Clicking this will allow a player who has
  5049. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  5050. // able to wait until 7 players accumulate. Once this happens, it will cause
  5051. // the NPC "Bouncer" run the label "OnStart".
  5052. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  5053. Creating a waiting room does not stop the execution of the script and it will
  5054. continue to the next line.
  5055. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  5056. of waiting rooms.
  5057. ---------------------------------------
  5058. *delwaitingroom {"<NPC object name"};
  5059. This command will delete a waiting room. If no parameter is given, it will
  5060. delete a waiting room attached to the NPC object running this command, if it is,
  5061. it will delete a waiting room owned by another NPC object. This is the only way
  5062. to get rid of a waiting room, nothing else will cause it to disappear.
  5063. It's not clear what happens to a waiting room if the NPC is disabled with
  5064. 'disablenpc', by the way.
  5065. ---------------------------------------
  5066. *enablewaitingroomevent {"<NPC object name>"};
  5067. *disablewaitingroomevent {"<NPC object name>"};
  5068. *enablearena;
  5069. *disablearena;
  5070. This will enable and disable triggering the waiting room event (see
  5071. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  5072. for a specified NPC object. The chat room will not disappear when triggering is
  5073. disabled and enabled in this manner and players will not be kicked out of it.
  5074. Enabling a chat room event will also cause it to immediately check whether the
  5075. number of users in it exceeded the trigger amount and trigger the event
  5076. accordingly.
  5077. Normally, whenever a waiting room was created to make sure that only one
  5078. character is, for example, trying to pass a job quest trial, and no other
  5079. characters are present in the room to mess up the script.
  5080. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  5081. These are supposedly left here for compatibility with official server scripts,
  5082. but no rAthena script uses these at the moment.
  5083. ---------------------------------------
  5084. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  5085. This function will return information about the waiting room state for the
  5086. attached waiting room or for a waiting room attached to the specified NPC if
  5087. any.
  5088. The valid information types are:
  5089. 0 - Number of users currently chatting.
  5090. 1 - Maximum number of users allowed.
  5091. 2 - Will return 1 if the waiting room has a trigger set.
  5092. 0 otherwise.
  5093. 3 - Will return 1 if the waiting room is currently disabled.
  5094. 0 otherwise.
  5095. 4 - The Title of the waiting room (string)
  5096. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  5097. set a password on a waiting room right now.
  5098. 16 - Event name of the waiting room (string)
  5099. 32 - Whether or not the waiting room is full.
  5100. 33 - Whether the amount of users in the waiting room is higher than the trigger
  5101. number.
  5102. ---------------------------------------
  5103. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  5104. This command will warp the amount of characters equal to the trigger number of
  5105. the waiting room chat attached to the NPC object running this command to the
  5106. specified map and coordinates, kicking them out of the chat. Those waiting the
  5107. longest will get warped first. It can also do a random warp on the same map
  5108. ("Random" instead of map name) and warp to the save point ("SavePoint").
  5109. The list of characters to warp is taken from the list of the chat room members.
  5110. Those not in the chat room will not be considered even if they are talking to
  5111. the NPC in question. If the number of people is given, exactly this much people
  5112. will be warped.
  5113. This command can also keep track of who just got warped. It does this by setting
  5114. special variables:
  5115. $@warpwaitingpc[] is an array containing the account_id numbers of the
  5116. characters who were just warped.
  5117. $@warpwaitingpcnum contains the number of the character it just warped.
  5118. See also 'getpartymember' for advice on what to do with those variables.
  5119. The obvious way of using this effectively would be to set up a waiting room for
  5120. two characters to be warped onto a random PVP map for a one-on-one duel, for
  5121. example.
  5122. ---------------------------------------
  5123. *waitingroomkick "<NPC object name>" , "<character name>";
  5124. This command kicks the given character from the waiting room attached to the given NPC.
  5125. ---------------------------------------
  5126. *getwaitingroomusers "<NPC object name>";
  5127. This command get all the characters in the waiting room of the given NPC and stores
  5128. their gids in the array .@waitingroom_users[]. Also, stores the the number of characters
  5129. in the variable .@waitingroom_usercount
  5130. ---------------------------------------
  5131. *kickwaitingroomall {"<NPC object name>"};
  5132. This command kicks everybody out of a specified waiting room chat.
  5133. ---------------------------------------
  5134. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  5135. This command sets the 'nosave' flag for the specified map and also gives an
  5136. alternate respawn-upon-relogin point.
  5137. It does not make a map impossible to make a save point on as you would normally
  5138. think, 'savepoint' will still work. It will, however, make the specified map
  5139. kick the reconnecting players off to the alternate map given to the coordinates
  5140. specified.
  5141. ---------------------------------------
  5142. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  5143. This command marks a specified map with the given map flag, which will alter the
  5144. behavior of the map. A full list of mapflags is located in 'src/map/script_constants.hpp' with
  5145. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  5146. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  5147. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  5148. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  5149. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  5150. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  5151. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  5152. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  5153. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  5154. The optional parameter <zone> is used to set the zone for 'restricted' mapflags,
  5155. GM level bypass for 'nocommand', base/job experience for 'bexp'/'jexp', and
  5156. flag for 'battleground'.
  5157. For 'skill_damage' mapflag:
  5158. - Setting the flag here will adjust the global (all skills) damage on the map.
  5159. - <zone> is the -100 to 100000 damage adjustment value of the skills.
  5160. - See 'getmapflag' for the different <type> values.
  5161. ---------------------------------------
  5162. *removemapflag "<map name>",<flag>{,<zone>};
  5163. This command removes a mapflag from a specified map.
  5164. See 'setmapflag' for a list of mapflags.
  5165. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  5166. ---------------------------------------
  5167. *getmapflag("<map name>",<flag>{,<type>})
  5168. This command checks the status of a given mapflag and returns the mapflag's state.
  5169. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  5170. For MF_RESTRICTED, the zone value of the map is returned.
  5171. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  5172. SKILLDMG_MAX: if mapflag is set (default)
  5173. SKILLDMG_PC: damage against players
  5174. SKILLDMG_MOB: damage against mobs
  5175. SKILLDMG_BOSS: damage against bosses
  5176. SKILLDMG_OTHER: damage against other
  5177. SKILLDMG_CASTER: caster type
  5178. ---------------------------------------
  5179. *setbattleflag "<battle flag>",<value>{,<reload>};
  5180. *getbattleflag("<battle flag>")
  5181. Sets or gets the value of the given battle flag.
  5182. Battle flags are the flags found in the battle / *.conf files and is also used in Lupus' variable rates script.
  5183. If the reload value is given then the server will attempt to reload monster data
  5184. to properly apply the new rates. This applies to EXP/Drop type configs. The server
  5185. will only attempt to reload specific configs.
  5186. Examples:
  5187. // Will set the base experience rate to 20x (2000%) - Monster data will continue to use previous rates at server start
  5188. setBattleFlag "base_exp_rate",2000;
  5189. // Will set the base experience rate to 20x (2000%) - Monster data will be reloaded to new value
  5190. setBattleFlag "base_exp_rate",2000,true;
  5191. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  5192. mes getBattleFlag("base_exp_rate");
  5193. ---------------------------------------
  5194. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  5195. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  5196. The source coordinates specify the portal's location on the map of the invoking NPC.
  5197. The target map and coordinates determine the destination of the portal.
  5198. Examples:
  5199. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  5200. warpportal 150,150,"prontera",150,180;
  5201. ---------------------------------------
  5202. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  5203. This command will collect all characters located on the From map and warp them
  5204. wholesale to the same point on the To map, or randomly distribute them there if
  5205. the coordinates are zero. "Random" is understood as a special To map name and
  5206. will mean randomly shuffling everyone on the same map.
  5207. Optionally, a type and ID can be specified. Available types are:
  5208. 0 - Everyone
  5209. 1 - Guild
  5210. 2 - Party
  5211. Example:
  5212. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  5213. mapwarp "prontera","alberta",150,150,1,63;
  5214. ---------------------------------------
  5215. \\
  5216. 5,2.- Guild-related commands
  5217. \\
  5218. ---------------------------------------
  5219. *maprespawnguildid "<map name>",<guild id>,<flag>;
  5220. This command goes through the specified map and for each player and monster
  5221. found there does stuff.
  5222. Flag is a bit-mask (add up numbers to get effects you want)
  5223. 1 - warp all guild members to their save points.
  5224. 2 - warp all non-guild members (including guildless players) to their save points.
  5225. 4 - remove all monsters which are not guardian or Emperium.
  5226. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  5227. kick all characters out', which is what the official scripts do upon castle
  5228. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  5229. For examples, check the WoE scripts in the distribution.
  5230. ---------------------------------------
  5231. *agitstart;
  5232. *agitend;
  5233. *agitstart2;
  5234. *agitend2;
  5235. *agitstart3;
  5236. *agitend3;
  5237. These commands will start and end War of Emperium FE, War of Emperium SE,
  5238. or War of Emperium TE.
  5239. This is a bit more complex than it sounds, since the commands themselves won't
  5240. actually do anything interesting, except causing all 'OnAgitStart:' and
  5241. 'OnAgitEnd:', 'OnAgitStart2:' and 'OnAgitEnd2:', or 'OnAgitStart3:' and
  5242. 'OnAgitEnd3:' in the case of latter two commands, events to run everywhere,
  5243. respectively. They are used as simple triggers to run a lot of complex scripts
  5244. all across the server, and they, in turn, are triggered by clock with an
  5245. 'OnClock<time>:' time-triggering label.
  5246. ---------------------------------------
  5247. *gvgon "<map name>";
  5248. *gvgoff "<map name>";
  5249. These commands will turn GVG mode for the specified maps on and off, setting up
  5250. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  5251. even though WoE itself may or may not actually be in effect.
  5252. ---------------------------------------
  5253. *gvgon3 "<map name>";
  5254. *gvgoff3 "<map name>";
  5255. Theses commands behave identically to gvgon/gvgoff, but apply GVG_TE mapflag.
  5256. ---------------------------------------
  5257. *flagemblem <guild id>;
  5258. This command only works when run by the NPC objects which have sprite id 722,
  5259. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  5260. will be seen by anyone. If it is invoked in that manner, the emblem of the
  5261. specified guild will appear on the flag, though, if any players are watching it
  5262. at this moment, they will not see the emblem change until they move out of sight
  5263. of the flag and return.
  5264. This is commonly used in official guildwar scripts with a function call which
  5265. returns a guild id:
  5266. // This will change the emblem on the flag to that of the guild that owns
  5267. // "guildcastle"
  5268. flagemblem GetCastleData("guildcastle",1);
  5269. ---------------------------------------
  5270. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  5271. This command is roughly equivalent to 'monster', but is meant to be used with
  5272. castle guardian monsters and will only work with them. It will set the guardian
  5273. characteristics up according to the castle's investment values and otherwise
  5274. set the things up that only castle guardians need.
  5275. Since trunk r12524:
  5276. Returns the id of the mob or 0 if an error occurred.
  5277. When 'guardian index' isn't supplied it produces a temporary guardian.
  5278. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  5279. ---------------------------------------
  5280. *guardianinfo("<map name>", <guardian number>, <type>);
  5281. This function will return various info about the specified guardian, or -1
  5282. if it fails for some reason. It is primarily used in the castle manager NPC.
  5283. Map name and guardian number (value between 0 and 7) define the target.
  5284. Type indicates what information to return:
  5285. 0 - visibility (whether the guardian is installed or not)
  5286. 1 - max. hp
  5287. 2 - current hp
  5288. ---------------------------------------
  5289. *getguildalliance(<guild id1>, <guild id2>);
  5290. This command will return the relation between 2 guilds.
  5291. NOTE: This should be used in collaboration with 'requestguildinfo' as the
  5292. map-server needs to request for information from the char-server.
  5293. Return values:
  5294. -2 - Guild ID1 does not exist
  5295. -1 - Guild ID2 does not exist
  5296. 0 - Both guilds have no relation OR guild ID aren't given
  5297. 1 - Both guilds are allies
  5298. 2 - Both guilds are antagonists
  5299. ---------------------------------------
  5300. //
  5301. 5,2.- End of guild-related commands
  5302. //
  5303. ---------------------------------------
  5304. *npcspeed <speed value>;
  5305. *npcwalkto <x>,<y>;
  5306. *npcstop;
  5307. These commands will make the NPC object in question move around the map. As they
  5308. currently are, they are a bit buggy and are not useful for much more than making
  5309. an NPC move randomly around the map.
  5310. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  5311. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  5312. possible (instant motion). 100 is the default character walking speed.
  5313. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  5314. on the same map it is currently on. The script proceeds immediately after the
  5315. NPC begins moving.
  5316. 'npcstop' will stop the motion.
  5317. While in transit, the NPC will be clickable, but invoking it will cause it to
  5318. stop moving, which will make its coordinates different from what the client
  5319. computed based on the speed and motion coordinates. The effect is rather
  5320. unnerving.
  5321. Only a few NPC sprites have walking animations, and those that do, do not get
  5322. the animation invoked when moving the NPC, due to the problem in the NPC walking
  5323. code, which looks a bit silly. You might have better success by defining a job-
  5324. sprite based sprite id in 'db/mob_avail.txt' with this.
  5325. ---------------------------------------
  5326. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  5327. This command looks like the NPCWalkToxy function,but is a little different.
  5328. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  5329. sometimes gives problems if the path isn't a straight line without objects),
  5330. this command just moves the NPC. It basically warps out and in on the current
  5331. and given spot. Direction can be used to change the NPC's facing direction.
  5332. Example:
  5333. // This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
  5334. moveNPC "Bugga",100,20;
  5335. ---------------------------------------
  5336. =====================
  5337. |6.- Other commands.|
  5338. =====================
  5339. ---------------------------------------
  5340. *debugmes "<message>";
  5341. This command will send the message to the server console (map-server window). It
  5342. will not be displayed anywhere else.
  5343. // Displays "NAME has clicked me!" in the map-server window.
  5344. debugmes strcharinfo(0) + " has clicked me!";
  5345. ---------------------------------------
  5346. *logmes "<message>";
  5347. This command will write the message given to the map server NPC log file, as
  5348. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  5349. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  5350. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  5351. same log file.
  5352. If logs are not enabled, nothing will happen.
  5353. ---------------------------------------
  5354. *globalmes "<message>"{,"<NPC name>"};
  5355. This command will send a message to the chat window of all currently connected
  5356. characters.
  5357. If NPC name is specified, the message will be sent as if the sender would be
  5358. the NPC with the said name.
  5359. The display name of the NPC won't get appended in front of the message.
  5360. ---------------------------------------
  5361. *rand(<number>{,<number>});
  5362. This function returns a number ...
  5363. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  5364. (if you specify two) ... randomly positioned between the two numbers you specify.
  5365. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  5366. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  5367. rand(2,5) would result in 2,3,4 or 5
  5368. ---------------------------------------
  5369. *viewpoint <action>,<x>,<y>,<point number>,<color>;
  5370. This command will mark places on the mini map in the client connected to the
  5371. invoking character. It uses the normal X and Y coordinates from the main map.
  5372. The colors of the marks are defined using a hexadecimal number, same as the ones
  5373. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  5374. (They look like 0x<six numbers>.)
  5375. Action is what you want to do with a point, 1 will set it, while 2 will clear
  5376. it. 0 will also set it, but automatically removes the point after 15 seconds.
  5377. Point number is the number of the point - you can have several. If more than
  5378. one point is drawn at the same coordinates, they will cycle, which can be used
  5379. to create flashing marks.
  5380. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  5381. // and will be red.
  5382. viewpoint 1,30,40,1,0xFF0000;
  5383. This will create three points:
  5384. viewpoint 1,30,40,1,0xFF0000;
  5385. viewpoint 1,35,45,2,0xFF0000;
  5386. viewpoint 1,40,50,3,0xFF0000;
  5387. And this is how you remove them:
  5388. viewpoint 2,30,40,1,0xFF0000;
  5389. viewpoint 2,35,45,2,0xFF0000;
  5390. viewpoint 2,40,50,3,0xFF0000;
  5391. The client determines what it does with the points entirely, the server keeps no
  5392. memory of where the points are set whatsoever.
  5393. ---------------------------------------
  5394. *cutin "<filename>",<position>;
  5395. This command will display a picture, usually an NPC illustration, also called
  5396. cutin, for the currently attached client. The position parameter determines the
  5397. placement of the illustration and takes following values:
  5398. 0 - bottom left corner
  5399. 1 - bottom middle
  5400. 2 - bottom right corner
  5401. 3 - middle of screen in a movable window with an empty title bar
  5402. 4 - middle of screen without the window header, but still movable
  5403. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  5404. and data folder, and is required to be a bitmap. The file extension .bmp can be
  5405. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  5406. placed on the size of the illustrations by the client, although loading of large
  5407. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  5408. Typically the size is about 320x480. New illustrations can be added by just
  5409. putting the new file into the location above.
  5410. The client is able to display only one cutin at the same time and each new one
  5411. will cause the old one to disappear. To delete the currently displayed
  5412. illustration without displaying a new one, an empty file name and position 255
  5413. must be used.
  5414. // Displays the Comodo Kafra illustration in lower right corner.
  5415. cutin "kafra_07",2;
  5416. // Typical way to end a script, which displayed an illustration during a
  5417. // dialog with a player.
  5418. mes "See you.";
  5419. close2;
  5420. cutin "",255;
  5421. end;
  5422. ---------------------------------------
  5423. *emotion <emotion number>{,<target>};
  5424. This command makes an object display an emotion sprite above their own as
  5425. if they were doing that emotion. For a full list of emotion numbers,
  5426. see 'src/map/script_constants.h' under 'ET_'. The not so obvious ones are 'ET_QUESTION'
  5427. (a question mark) and 'ET_SURPRISE' (the exclamation mark).
  5428. The optional target parameter specifies who will get the emotion on top of
  5429. their head. Use the target Game ID (GID).
  5430. ---------------------------------------
  5431. *misceffect <effect number>;
  5432. This command, if run from an NPC object that has a sprite, will call up a
  5433. specified effect number, centered on the NPC sprite. If the running code does
  5434. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  5435. all (an item script) the effect will be centered on the character who's RID got
  5436. attached to the script, if any. For usable item scripts, this command will
  5437. create an effect centered on the player using the item.
  5438. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  5439. those that actually work may differ greatly between client versions.
  5440. ---------------------------------------
  5441. *soundeffect "<effect filename>",<type>;
  5442. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  5443. These two commands will play a sound effect to either the invoking character
  5444. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  5445. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  5446. object at all (an item script) the sound will be centered on the character who's
  5447. RID got attached to the script, if any. If it does, it will be centered on that
  5448. object. (an NPC sprite)
  5449. Effect filename is the filename in a GRF. It must have the .wav extension.
  5450. It's not quite certain what the 'type' actually does, it is sent to the client
  5451. directly. It probably determines which directory to play the effect from.
  5452. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  5453. but where the other numbers will read from is unclear.
  5454. The sound files themselves must be in the PCM format, and file names should also
  5455. have a maximum length of 23 characters including the .wav extension:
  5456. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  5457. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  5458. You can add your own effects this way, naturally.
  5459. ---------------------------------------
  5460. *playBGM "<BGM filename>";
  5461. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  5462. These two commands will play a Background Music to either the invoking character
  5463. only ('playBGM') or multiple characters ('playBGMall').
  5464. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  5465. It's not required to specify the extension inside the script.
  5466. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  5467. is omitted as well the BGM will be played for the entire server.
  5468. You can add your own BGMs this way, naturally.
  5469. ---------------------------------------
  5470. *pvpon "<map name>";
  5471. *pvpoff "<map name>";
  5472. These commands will turn PVP mode for the specified maps on and off. Beside
  5473. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5474. timer and ranking as will @pvpon GM command do.
  5475. ---------------------------------------
  5476. *atcommand "<command>";
  5477. This command will run the given command line exactly as if it was typed in from
  5478. the keyboard by the player connected to the invoking character, and that
  5479. character belonged to an account which had GM level 99.
  5480. // This will ask the invoker for a character name and then use the '@nuke'
  5481. // GM command on them, killing them mercilessly.
  5482. input .@player$;
  5483. atcommand "@nuke " + .@player$;
  5484. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5485. original atcommand, not the script-bound atcommand.
  5486. ---------------------------------------
  5487. *charcommand "<command>";
  5488. This command will run the given command line exactly as if it was typed in from
  5489. the keyboard from a character that belonged to an account which had GM level 99.
  5490. The commands can also run without an attached rid.
  5491. // This would do the same as above, but now
  5492. // it doesn't need a player attached by default.
  5493. charcommand "#option 0 0 0 Roy";
  5494. ---------------------------------------
  5495. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5496. This command will bind a NPC event label to an atcommand. Upon execution of the
  5497. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5498. one binding. If you rebind, it will override the original binding.
  5499. Note: The default level for atcommand is 0 while the default level for charcommand is 100.
  5500. The following variables are set upon execution:
  5501. .@atcmd_command$ = The name of the @command used.
  5502. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5503. .@atcmd_numparameters = The number of parameters defined.
  5504. Example:
  5505. When a user types the command "@test", an angel effect will be shown.
  5506. - script atcmd_example -1,{
  5507. OnInit:
  5508. bindatcmd "test",strnpcinfo(3) + "::OnAtcommand";
  5509. end;
  5510. OnAtcommand:
  5511. specialeffect2 EF_ANGEL2;
  5512. end;
  5513. }
  5514. ---------------------------------------
  5515. *unbindatcmd "<command>";
  5516. This command will unbind a NPC event label from an atcommand.
  5517. ---------------------------------------
  5518. *useatcmd "<command>";
  5519. This command will execute a script-bound atcommand for the attached RID. If the
  5520. supplied command is not bound to any script, this command will act like 'atcommand'
  5521. and attempt to execute a source-defined command.
  5522. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  5523. in this way.
  5524. ---------------------------------------
  5525. \\
  5526. 6,1.- Unit-related commands
  5527. \\
  5528. ---------------------------------------
  5529. *unitwalk <GID>,<x>,<y>{,"<event label>"};
  5530. *unitwalkto <GID>,<Target GID>{,"<event label>"};
  5531. This command will tell a <GID> to walk to a position, defined either as a set of
  5532. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  5533. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  5534. unit's current map. While there is no way to move across an entire map with 1 command
  5535. use, this could be used in a loop to move long distances.
  5536. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
  5537. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  5538. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  5539. target ID will result in an error.
  5540. An optional Event Label can be passed as well which will execute when the <GID> has reached
  5541. the given coordinates or <Target GID>.
  5542. Examples:
  5543. // Makes player walk to the coordinates (150,150).
  5544. unitwalk getcharid(3),150,150;
  5545. // Performs a conditional check with the command and reports success or failure to the player.
  5546. if (unitwalk(getcharid(3),150,150))
  5547. dispbottom "Walking you there...";
  5548. else
  5549. dispbottom "That's too far away, man.";
  5550. // Makes player walk to another character named "WalkToMe".
  5551. unitwalkto getcharid(3),getcharid(3,"WalkToMe");
  5552. ---------------------------------------
  5553. *unitattack <GID>,<Target ID>{,<action type>};
  5554. *unitattack <GID>,"<Target Name>"{,<action type>};
  5555. This command will make a <GID> attack the specified target. It returns true upon
  5556. success and false for all failures.
  5557. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  5558. continuous attack instead of a single attack.
  5559. Note:
  5560. Using unitattack with <GID> 0 means that it will use the currently attached unit.
  5561. For players any attack requests will fail, because talking to an NPC prevents attacking a monster.
  5562. Therefore you need to detach the player from the NPC before using this command.
  5563. ---------------------------------------
  5564. *unitkill <GID>;
  5565. This command will kill a <GID>.
  5566. ---------------------------------------
  5567. *unitwarp <GID>,"<map name>",<x>,<y>;
  5568. This command will warp a <GID> to the specified map and coordinates.
  5569. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  5570. used with "OnTouch" to warp monsters:
  5571. OnTouch:
  5572. unitwarp 0,"this",-1,-1;
  5573. ---------------------------------------
  5574. *unitstopattack <GID>;
  5575. This command will make a <GID> stop attacking.
  5576. ---------------------------------------
  5577. *unitstopwalk <GID>{,<flag>};
  5578. This command will make a <GID> stop moving.
  5579. Note: If this is called from OnTouch, then the walktimer attached to the unit is
  5580. removed from OnTouch which causes this command to not stop the unit from walking.
  5581. Suggest to use 'unitblockmove' to forcefully stop the unit with OnTouch.
  5582. The <flag> value affects how the unit is stopped. The following flags are bitwise
  5583. values (can be combined using the pipe operator):
  5584. USW_NONE = Unit will keep walking to their original destination.
  5585. USW_FIXPOS = Issue a fixpos packet afterwards.
  5586. USW_MOVE_ONCE = Force the unit to move one cell if it hasn't yet.
  5587. 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).
  5588. USW_FORCE_STOP = Force stop moving.
  5589. ---------------------------------------
  5590. *unittalk <GID>,"<text>"{,flag};
  5591. This command will make a <GID> say a message. The display name of the <GID> won't get appended in front of the message.
  5592. flag: Specify target
  5593. bc_area - Message is sent to players in the vicinity of the source (default).
  5594. bc_self - Message is sent only to player attached.
  5595. ---------------------------------------
  5596. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>,<casttime>};
  5597. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>,<casttime>};
  5598. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>{,<casttime>};
  5599. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>{,<casttime>};
  5600. This is the replacement of the older commands, these use the same values for
  5601. GID as the other unit* commands (See 'GID').
  5602. Skill ID is the ID of the skill, skill level is the level of the skill.
  5603. Cast time is the amount of seconds to add or remove from the skill. Use a positive value to
  5604. add and negative value to subtract. Using 0 or no value will use the default skill cast time.
  5605. For the position, the x and y are given in the UnitSkillUsePos.
  5606. ---------------------------------------
  5607. *unitexists <GID>;
  5608. Checks if the given Game ID exists. Returns false if the object doesn't exist, or true if
  5609. it does.
  5610. ---------------------------------------
  5611. *getunittype <GID>;
  5612. Returns the type of object from the given Game ID. Returns -1 if the given GID does not
  5613. exist.
  5614. UNITTYPE_PC 0
  5615. UNITTYPE_NPC 1
  5616. UNITTYPE_PET 2
  5617. UNITTYPE_MOB 3
  5618. UNITTYPE_HOM 4
  5619. UNITTYPE_MER 5
  5620. UNITTYPE_ELEM 6
  5621. ---------------------------------------
  5622. *getunitname <GID>;
  5623. Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
  5624. Mercenary and Elemental don't support custom names.
  5625. Returns "Unknown" if unit is not found.
  5626. ---------------------------------------
  5627. *setunitname <GID>,"<new name>";
  5628. Changes the name of the given unit to the new name given. Supported types are monster,
  5629. homunculus, and pet. To change an NPC's name, see 'setnpcdisplay'. Mercenary and
  5630. Elemental don't support custom names.
  5631. Changing a homunculus or pet name will be permanent.
  5632. Returns "Unknown" if unit is not found.
  5633. ---------------------------------------
  5634. *getunitdata <GID>,<arrayname>;
  5635. *setunitdata <GID>,<parameter>,<new value>;
  5636. This is used to get and set special data related to the unit.
  5637. With getunitdata, the array given will be filled with the current data. In setunitdata
  5638. the indexes in the array would be used to set that data on the unit.
  5639. Both getunitdata and setunitdata will return -1 if the given GID does not exist.
  5640. Note: When adjusting a unit's stat (STR, AGI, etc) the unit's respective statuses are
  5641. recalculated (HIT, FLEE, etc) automatically. Keep in mind that some stats don't
  5642. affect a unit's status and will have to directly be modified.
  5643. Parameters (indexes) for monsters are:
  5644. UMOB_SIZE
  5645. UMOB_LEVEL
  5646. UMOB_HP
  5647. UMOB_MAXHP
  5648. UMOB_MASTERAID
  5649. UMOB_MAPID
  5650. UMOB_X
  5651. UMOB_Y
  5652. UMOB_SPEED
  5653. UMOB_MODE
  5654. UMOB_AI
  5655. UMOB_SCOPTION
  5656. UMOB_SEX
  5657. UMOB_CLASS
  5658. UMOB_HAIRSTYLE
  5659. UMOB_HAIRCOLOR
  5660. UMOB_HEADBOTTOM
  5661. UMOB_HEADMIDDLE
  5662. UMOB_HEADTOP
  5663. UMOB_CLOTHCOLOR
  5664. UMOB_SHIELD
  5665. UMOB_WEAPON
  5666. UMOB_LOOKDIR
  5667. UMOB_CANMOVETICK
  5668. UMOB_STR
  5669. UMOB_AGI
  5670. UMOB_VIT
  5671. UMOB_INT
  5672. UMOB_DEX
  5673. UMOB_LUK
  5674. UMOB_SLAVECPYMSTRMD
  5675. UMOB_DMGIMMUNE
  5676. UMOB_ATKRANGE
  5677. UMOB_ATKMIN
  5678. UMOB_ATKMAX
  5679. UMOB_MATKMIN
  5680. UMOB_MATKMAX
  5681. UMOB_DEF
  5682. UMOB_MDEF
  5683. UMOB_HIT
  5684. UMOB_FLEE
  5685. UMOB_PDODGE
  5686. UMOB_CRIT
  5687. UMOB_RACE
  5688. UMOB_ELETYPE
  5689. UMOB_ELELEVEL
  5690. UMOB_AMOTION
  5691. UMOB_ADELAY
  5692. UMOB_DMOTION
  5693. UMOB_TARGETID
  5694. -----
  5695. Parameter (indexes) for homunculi are:
  5696. UHOM_SIZE
  5697. UHOM_LEVEL
  5698. UHOM_HP
  5699. UHOM_MAXHP
  5700. UHOM_SP
  5701. UHOM_MAXSP
  5702. UHOM_MASTERCID
  5703. UHOM_MAPID
  5704. UHOM_X
  5705. UHOM_Y
  5706. UHOM_HUNGER
  5707. UHOM_INTIMACY
  5708. UHOM_SPEED
  5709. UHOM_LOOKDIR
  5710. UHOM_CANMOVETICK
  5711. UHOM_STR
  5712. UHOM_AGI
  5713. UHOM_VIT
  5714. UHOM_INT
  5715. UHOM_DEX
  5716. UHOM_LUK
  5717. UHOM_DMGIMMUNE
  5718. UHOM_ATKRANGE
  5719. UHOM_ATKMIN
  5720. UHOM_ATKMAX
  5721. UHOM_MATKMIN
  5722. UHOM_MATKMAX
  5723. UHOM_DEF
  5724. UHOM_MDEF
  5725. UHOM_HIT
  5726. UHOM_FLEE
  5727. UHOM_PDODGE
  5728. UHOM_CRIT
  5729. UHOM_RACE
  5730. UHOM_ELETYPE
  5731. UHOM_ELELEVEL
  5732. UHOM_AMOTION
  5733. UHOM_ADELAY
  5734. UHOM_DMOTION
  5735. UHOM_TARGETID
  5736. -----
  5737. Parameter (indexes) for pets are:
  5738. UPET_SIZE
  5739. UPET_LEVEL
  5740. UPET_HP
  5741. UPET_MAXHP
  5742. UPET_MASTERAID
  5743. UPET_MAPID
  5744. UPET_X
  5745. UPET_Y
  5746. UPET_HUNGER
  5747. UPET_INTIMACY
  5748. UPET_SPEED
  5749. UPET_LOOKDIR
  5750. UPET_CANMOVETICK
  5751. UPET_STR
  5752. UPET_AGI
  5753. UPET_VIT
  5754. UPET_INT
  5755. UPET_DEX
  5756. UPET_LUK
  5757. UPET_DMGIMMUNE
  5758. UPET_ATKRANGE
  5759. UPET_ATKMIN
  5760. UPET_ATKMAX
  5761. UPET_MATKMIN
  5762. UPET_MATKMAX
  5763. UPET_DEF
  5764. UPET_MDEF
  5765. UPET_HIT
  5766. UPET_FLEE
  5767. UPET_PDODGE
  5768. UPET_CRIT
  5769. UPET_RACE
  5770. UPET_ELETYPE
  5771. UPET_ELELEVEL
  5772. UPET_AMOTION
  5773. UPET_ADELAY
  5774. UPET_DMOTION
  5775. -----
  5776. Parameter (indexes) for mercenaries are:
  5777. UMER_SIZE
  5778. UMER_HP
  5779. UMER_MAXHP
  5780. UMER_MASTERCID
  5781. UMER_MAPID
  5782. UMER_X
  5783. UMER_Y
  5784. UMER_KILLCOUNT
  5785. UMER_LIFETIME
  5786. UMER_SPEED
  5787. UMER_LOOKDIR
  5788. UMER_CANMOVETICK
  5789. UMER_STR
  5790. UMER_AGI
  5791. UMER_VIT
  5792. UMER_INT
  5793. UMER_DEX
  5794. UMER_LUK
  5795. UMER_DMGIMMUNE
  5796. UMER_ATKRANGE
  5797. UMER_ATKMIN
  5798. UMER_ATKMAX
  5799. UMER_MATKMIN
  5800. UMER_MATKMAX
  5801. UMER_DEF
  5802. UMER_MDEF
  5803. UMER_HIT
  5804. UMER_FLEE
  5805. UMER_PDODGE
  5806. UMER_CRIT
  5807. UMER_RACE
  5808. UMER_ELETYPE
  5809. UMER_ELELEVEL
  5810. UMER_AMOTION
  5811. UMER_ADELAY
  5812. UMER_DMOTION
  5813. UMER_TARGETID
  5814. -----
  5815. Parameter (indexes) for elementals are:
  5816. UELE_SIZE
  5817. UELE_HP
  5818. UELE_MAXHP
  5819. UELE_SP
  5820. UELE_MAXSP
  5821. UELE_MASTERCID
  5822. UELE_MAPID
  5823. UELE_X
  5824. UELE_Y
  5825. UELE_LIFETIME
  5826. UELE_MODE
  5827. UELE_SPEED
  5828. UELE_LOOKDIR
  5829. UELE_CANMOVETICK
  5830. UELE_STR
  5831. UELE_AGI
  5832. UELE_VIT
  5833. UELE_INT
  5834. UELE_DEX
  5835. UELE_LUK
  5836. UELE_DMGIMMUNE
  5837. UELE_ATKRANGE
  5838. UELE_ATKMIN
  5839. UELE_ATKMAX
  5840. UELE_MATKMIN
  5841. UELE_MATKMAX
  5842. UELE_DEF
  5843. UELE_MDEF
  5844. UELE_HIT
  5845. UELE_FLEE
  5846. UELE_PDODGE
  5847. UELE_CRIT
  5848. UELE_RACE
  5849. UELE_ELETYPE
  5850. UELE_ELELEVEL
  5851. UELE_AMOTION
  5852. UELE_ADELAY
  5853. UELE_DMOTION
  5854. UELE_TARGETID
  5855. -----
  5856. Parameter (indexes) for NPCs are:
  5857. UNPC_DISPLAY
  5858. UNPC_LEVEL
  5859. UNPC_HP
  5860. UNPC_MAXHP
  5861. UNPC_MAPID
  5862. UNPC_X
  5863. UNPC_Y
  5864. UNPC_LOOKDIR
  5865. UNPC_STR
  5866. UNPC_AGI
  5867. UNPC_VIT
  5868. UNPC_INT
  5869. UNPC_DEX
  5870. UNPC_LUK
  5871. UNPC_PLUSALLSTAT
  5872. UNPC_DMGIMMUNE
  5873. UNPC_ATKRANGE
  5874. UNPC_ATKMIN
  5875. UNPC_ATKMAX
  5876. UNPC_MATKMIN
  5877. UNPC_MATKMAX
  5878. UNPC_DEF
  5879. UNPC_MDEF
  5880. UNPC_HIT
  5881. UNPC_FLEE
  5882. UNPC_PDODGE
  5883. UNPC_CRIT
  5884. UNPC_RACE
  5885. UNPC_ELETYPE
  5886. UNPC_ELELEVEL
  5887. UNPC_AMOTION
  5888. UNPC_ADELAY
  5889. UNPC_DMOTION
  5890. *Notes:
  5891. - *_SIZE: small (0); medium (1); large (2)
  5892. - *_MAPID: this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c)
  5893. -- For 'setunitdata', map name can also be passed in as a valid value instead of map ID
  5894. - *_SPEED: 20 - 1000
  5895. - *_MODE: see doc/mob_db_mode_list.txt
  5896. - *_LOOKDIR: north (0), northwest (1), west (2), etc
  5897. - *_CANMOVETICK: seconds * 1000 the unit will be unable to move
  5898. - *_DMGIMMUNE: unit will be immune to damage (1), or will receive damage (0)
  5899. - *_HUNGER: 0 - 100
  5900. - *_INTIMACY: 0 - 1000
  5901. - *_LIFETIME: seconds * 1000 the unit will be 'alive' for
  5902. - *_AMOTION: see doc/mob_db.txt
  5903. - *_ADELAY: see doc/mob_db.txt
  5904. - *_DMOTION: see doc/mob_db.txt
  5905. - UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
  5906. - UMOB_SCOPTION: see the 'Variables' section at the top of this document
  5907. - UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0)
  5908. - UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreses all stats by given amount
  5909. Example:
  5910. // Spawn some Porings and save the Game ID.
  5911. // - Keep in mind, when the 'monster' script command is used,
  5912. // - all the spawned monster GID's are stored in an array
  5913. // - called $@mobid[].
  5914. monster "prontera",149,190,"Poring",1002,10;
  5915. .GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!
  5916. // Save the strong Poring's mob data in the @por_arr[] variable. (@por_arr[1] being level, @por_arr[13] being class, etc.)
  5917. // With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
  5918. getunitdata .GID,@por_arr;
  5919. // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
  5920. setunitdata .GID,UMOB_MAXHP,1000;
  5921. ---------------------------------------
  5922. *geteleminfo <type>{,<char_id>};
  5923. Get info of elemental of attached player or player by char_id.
  5924. Other info can be obtained by 'getunitdata' command.
  5925. Valid types are:
  5926. 0: Elemental ID
  5927. 1: Elemental Game ID
  5928. ---------------------------------------
  5929. \\
  5930. 6,1.- End of unit-related commands
  5931. \\
  5932. ---------------------------------------
  5933. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  5934. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  5935. This command causes the attached NPC object to cast a skill on the attached
  5936. player. The skill will have no cast time or cooldown. The player must be
  5937. within the default skill range or the command will fail silently.
  5938. The "stat point" parameter temporarily sets all NPC stats to the given value,
  5939. and "NPC level" is the temporary level of the NPC (used in some skills).
  5940. Neither value can be greater than the max level defined in config, and will
  5941. not work properly if the NPC has a mob sprite.
  5942. Before using skills, NPCs must have basic stats applied to them depending on the
  5943. skill being used: UNPC_ATKMIN, UNPC_ATKMAX, UNPC_MATKMIN, UNPC_MATKMAX, UNPC_STR,
  5944. UNPC_AGI, UNPC_VIT, UNPC_INT, UNPC_DEX, UNPC_LUK.
  5945. See 'setunitdata' for more information on usage.
  5946. // Casts Level 10 Heal on the attached player, calculated with
  5947. // all stats 99 and base level 60.
  5948. npcskill "AL_HEAL",10,99,60;
  5949. ---------------------------------------
  5950. *day;
  5951. *night;
  5952. These two commands will switch the entire server between day and night mode
  5953. respectively. If your server is set to cycle between day and night by
  5954. configuration, it will eventually return to that cycle.
  5955. Example:
  5956. - script DayNight -1,{
  5957. OnClock0600:
  5958. day;
  5959. end;
  5960. OnInit:
  5961. // setting correct mode upon server start-up
  5962. if (gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
  5963. OnClock1800:
  5964. night;
  5965. end;
  5966. }
  5967. This script allows to emulate the day/night cycle as the server does, but also
  5968. allows triggering additional effects upon change, like announces, gifts, etc.
  5969. The day/night cycle set by configuration should be disabled when this script is used.
  5970. ---------------------------------------
  5971. *defpattern <set number>,"<regular expression pattern>","<event label>";
  5972. *activatepset <set number>;
  5973. *deactivatepset <set number>;
  5974. *deletepset <set number>;
  5975. This set of commands is only available if the server is compiled with regular
  5976. expressions library enabled. Default compilation and most binary distributions
  5977. aren't, which is probably bad, since these, while complex to use, are quite
  5978. fascinating.
  5979. They will make the NPC object listen for text spoken publicly by players and
  5980. match it against regular expression patterns, then trigger labels associated
  5981. with these regular expression patterns.
  5982. Patterns are organized into sets, which are referred to by a set number. You can
  5983. have multiple sets patterns, and multiple patterns may be active at once.
  5984. Numbers for pattern sets start at 1.
  5985. 'defpattern' will associate a given regular expression pattern with an event
  5986. label. This event will be triggered whenever something a player says is matched
  5987. by this regular expression pattern, if the pattern is currently active.
  5988. 'activatepset' will make the pattern set specified active. An active pattern
  5989. will enable triggering labels defined with 'defpattern', which will not happen
  5990. by default.
  5991. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  5992. set number in this case will deactivate all pattern sets defined.
  5993. 'deletepset' will delete a pattern set from memory, so you can create a new
  5994. pattern set in its place.
  5995. Using regular expressions is high wizardry. But with this high wizardry comes
  5996. unparalleled power of text manipulation. For an explanation of what a regular
  5997. expression pattern is, see a few web pages:
  5998. http://www.regular-expressions.info/
  5999. http://www.weitz.de/regex-coach/
  6000. For an example of this in use, see doc/sample/npc_test_pcre.txt
  6001. With this you could, for example, automatically punish players for asking for
  6002. Zeny in public places, or alternatively, automatically give them Zeny instead if
  6003. they want it so much.
  6004. ---------------------------------------
  6005. *pow(<number>,<power>)
  6006. Returns the result of the calculation.
  6007. Example:
  6008. .@i = pow(2,3); // .@i will be 8
  6009. ---------------------------------------
  6010. *sqrt(<number>)
  6011. Returns the square-root of a number.
  6012. Example:
  6013. .@i = sqrt(25); // .@i will be 5
  6014. ---------------------------------------
  6015. *distance(<x0>,<y0>,<x1>,<y1>)
  6016. Returns distance between 2 points.
  6017. Example:
  6018. .@i = distance(100,200,101,202);
  6019. ---------------------------------------
  6020. *min(<number or array>{,<number or array>,...})
  6021. *minimum(<number or array>{,<number or array>,...})
  6022. *max(<number or array>{,<number or array>,...})
  6023. *maximum(<number or array>{,<number or array>,...})
  6024. Returns the smallest (or biggest) from the set of given parameters.
  6025. These parameters have to be either numbers or number arrays.
  6026. Example:
  6027. .@minimum = min( 1, -6, -2, 8, 2 ); // .@minimum will be equal to -6
  6028. .@maximum = max( 0, 5, 10, 4 ); // .@maximum will be equal to 10
  6029. .@level = min( BaseLevel, 70 ); // .@level will be the character's base level, capped to 70
  6030. setarray .@testarray, 4, 5, 12, 6, 7, 3, 8, 9, 10;
  6031. .@minimum = min( .@testarray ); // .@minimum will be equal to 3
  6032. .@maximum = max( .@testarray ); // .@maximum will be equal to 12
  6033. .@minimum = min( -6, 1, 2, 3, .@testarray ); // .@minimum will be equal to -6
  6034. .@maximum = max( -6, 1, 2, 3, .@testarray ); // .@maximum will be equal to 12
  6035. ---------------------------------------
  6036. *round(<number>,<precision>);
  6037. *ceil(<number>,<precision>);
  6038. *floor(<number>,<precision>);
  6039. Returns <number> rounded to multiple of <precision>.
  6040. `round` function will round the <number> up if its division with <precision> yield a remainder
  6041. with a value equals to or more than half of <precision>. Otherwise, it rounds the <number> down.
  6042. `ceil` always round the <number> up.
  6043. `floor` always round the <number> down.
  6044. ---------------------------------------
  6045. *md5("<string>")
  6046. Returns the md5 checksum of a number or string.
  6047. Example:
  6048. mes md5(12345);
  6049. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  6050. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  6051. ---------------------------------------
  6052. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  6053. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  6054. Executes an SQL query. A 'select' query can fill array variables with up to 2 billion rows of
  6055. values, and will return the number of rows (i.e. array size) or -1 on failure.
  6056. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  6057. Example:
  6058. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  6059. mes "Hall Of Fame: TOP5";
  6060. mes "1." + .@name$[0] + "(" + .@fame[0] + ")"; // largest fame value.
  6061. mes "2." + .@name$[1] + "(" + .@fame[1] + ")";
  6062. mes "3." + .@name$[2] + "(" + .@fame[2] + ")";
  6063. mes "4." + .@name$[3] + "(" + .@fame[3] + ")";
  6064. mes "5." + .@name$[4] + "(" + .@fame[4] + ")";
  6065. ---------------------------------------
  6066. *escape_sql(<value>)
  6067. Converts the value to a string and escapes special characters so that it is safe to
  6068. use in query_sql(). Returns the escaped form of the given value.
  6069. Example:
  6070. .@name$ = "John's Laptop";
  6071. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  6072. ---------------------------------------
  6073. *setiteminfo(<item id>,<type>,<value>)
  6074. This function will set some value of an item.
  6075. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  6076. Valid types are:
  6077. 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
  6078. 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
  6079. if = 0, then monsters don't drop it at all (rare or a quest item)
  6080. if = 10000, then this item is sold in NPC shops only
  6081. 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
  6082. 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
  6083. Example:
  6084. setiteminfo 7049,6,9990; // Stone now weighs 999.0
  6085. ---------------------------------------
  6086. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  6087. Set a new script bonus to the Item. Very useful for game events.
  6088. You can remove an item's itemscript by leaving the itemscript argument empty.
  6089. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  6090. Type can optionally be used indicates which script to set (default is 0):
  6091. 0 - Script
  6092. 1 - OnEquip_Script
  6093. 2 - OnUnequip_Script
  6094. Example:
  6095. setitemscript 2637,"{ if (isequipped(2236) == 0)end; if (getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  6096. setitemscript 2637,"";
  6097. ---------------------------------------
  6098. *atoi("<string>")
  6099. *axtoi("<string>")
  6100. *strtol("<string>", base)
  6101. These commands are used to convert strings to numbers. 'atoi' will interpret
  6102. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  6103. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  6104. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  6105. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  6106. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  6107. 32 bit int range (INT_MIN ~ INT_MAX).
  6108. Examples:
  6109. .@var = atoi("11"); // Sets .@var to 11
  6110. .@var = axtoi("FF"); // Sets .@var to 255
  6111. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  6112. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  6113. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  6114. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  6115. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  6116. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  6117. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  6118. ---------------------------------------
  6119. *compare("<string>","<substring>")
  6120. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  6121. This command is not case sensitive.
  6122. Examples:
  6123. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  6124. if (compare("Bloody Murderer","Blood"))
  6125. dothis;
  6126. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  6127. if (compare("Blood Butterfly","Bloody"))
  6128. dothat;
  6129. ---------------------------------------
  6130. *strcmp("<string>","<string>")
  6131. This command compares two strings are returns a value:
  6132. 1: string 1 > string 2
  6133. 0: strings are equal
  6134. -1: string 1 < string 2
  6135. ---------------------------------------
  6136. *getstrlen("<string>")
  6137. This function will return the length of the string given as an argument. It is
  6138. useful to check if anything input by the player exceeds name length limits and
  6139. other length limits and asking them to try to input something else.
  6140. ---------------------------------------
  6141. *charisalpha("<string>",<position>)
  6142. This function will return 1 if the character number Position in the given string
  6143. is a letter, 0 if it isn't a letter but a digit or a space.
  6144. The first letter is position 0.
  6145. ---------------------------------------
  6146. *charat(<string>,<index>)
  6147. Returns char at specified index. If index is out of range, returns empty string.
  6148. The first letter of a string is index 0.
  6149. Example:
  6150. charat("This is a string", 10); //returns "s"
  6151. ---------------------------------------
  6152. *setchar(<string>,<char>,<index>)
  6153. Returns the original string with the char at the specified index set to the
  6154. specified char. If index out of range, the original string will be returned.
  6155. Only the 1st char in the <char> parameter will be used.
  6156. Example:
  6157. setchar("Cat", "B", 0); //returns "Bat"
  6158. ---------------------------------------
  6159. *insertchar(<string>,<char>,<index>)
  6160. Returns the original string with the specified char inserted at the specified
  6161. index. If index is out of range, the char will be inserted on the end of the
  6162. string that it is closest. Only the 1st char in the <char> parameter will be used.
  6163. Example:
  6164. insertchar("laughter", "s", 0); //returns "slaughter"
  6165. ---------------------------------------
  6166. *delchar(<string>,<index>)
  6167. Returns the original string with the char at the specified index removed.
  6168. If index is out of range, original string will be returned.
  6169. Example:
  6170. delchar("Diet", 3); //returns "Die"
  6171. ---------------------------------------
  6172. *strtoupper(<string>)
  6173. *strtolower(<string>)
  6174. Returns the specified string in its uppercase/lowercase form.
  6175. All non-alpha characters will be preserved.
  6176. Example:
  6177. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  6178. ---------------------------------------
  6179. *charisupper(<string>,<index>)
  6180. *charislower(<string>,<index>)
  6181. Returns 1 if character at specified index of specified string is
  6182. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  6183. Example:
  6184. charisupper("rAthena", 1); //returns 1
  6185. ---------------------------------------
  6186. *substr(<string>,<start_index>,<end_index>)
  6187. Returns the sub-string of the specified string inclusively between the set
  6188. indexes. If indexes are out of range, or the start index is after the end
  6189. index, an empty string will be returned.
  6190. Example:
  6191. substr("foobar", 3, 5); //returns "bar"
  6192. ---------------------------------------
  6193. *explode(<dest_array>,<string>,<delimiter>)
  6194. Breaks a string up into substrings based on the specified delimiter. Substrings
  6195. will be stored within the specified string array. Only the 1st char of the
  6196. delimiter parameter will be used. If an empty string is passed as a delimiter,
  6197. the string will be placed in the array in its original form.
  6198. Example:
  6199. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  6200. //.@my_array$ contents will be...
  6201. //.@my_array$[0]: "Explode"
  6202. //.@my_array$[1]: "Test"
  6203. //.@my_array$[2]: "1965"
  6204. //.@my_array$[3]: "red"
  6205. //.@my_array$[4]: "PIE"
  6206. ---------------------------------------
  6207. *implode(<string_array>{,<glue>})
  6208. Combines all substrings within the specified string array into a single string.
  6209. If the glue parameter is specified, it will be inserted inbetween each substring.
  6210. Example:
  6211. setarray .@my_array$[0], "This", "is", "a", "test";
  6212. implode(.@my_array$, " "); //returns "This is a test"
  6213. ---------------------------------------
  6214. *sprintf(<format>[,param[,param[,...]]])
  6215. C style sprintf. The resulting string is returned same as in PHP. All C format
  6216. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  6217. The number of params is only limited by rA's script engine.
  6218. Example:
  6219. .@format$ = "The %s contains %d monkeys";
  6220. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  6221. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  6222. ---------------------------------------
  6223. *sscanf(<string>,<format>[,param[,param[,...]]])
  6224. C style sscanf. All C format specifiers are supported.
  6225. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  6226. by rA's script engine.
  6227. Example:
  6228. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  6229. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  6230. ---------------------------------------
  6231. *strpos(<haystack>,<needle>{,<offset>})
  6232. PHP style strpos. Finds a substring (needle) within a string (haystack).
  6233. The offset parameter indicates the index of the string to start searching.
  6234. Returns index of substring on successful search, else -1.
  6235. Comparison is case sensitive.
  6236. Example:
  6237. strpos("foobar", "bar", 0); //returns 3
  6238. strpos("foobarfoo", "foo", 0); //returns 0
  6239. strpos("foobarfoo", "foo", 1); //returns 6
  6240. ---------------------------------------
  6241. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  6242. Replaces all instances of a search string in the input with the specified
  6243. replacement string. By default is case sensitive unless <usecase> is set
  6244. to 0. If specified it will only replace as many instances as specified
  6245. in the count parameter.
  6246. Example:
  6247. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  6248. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  6249. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  6250. ---------------------------------------
  6251. *countstr(<input>, <search>{, <usecase>})
  6252. Counts all instances of a search string in the input. By default is case
  6253. sensitive unless <usecase> is set to 0.
  6254. Example:
  6255. countstr("test test test Test", "test"); //returns 3
  6256. countstr("cake Cake", "Cake", 0); //returns 2
  6257. ---------------------------------------
  6258. *preg_match(<regular expression pattern>,<string>{,<offset>})
  6259. Searches a string for a match to the regular expression provided. The
  6260. offset parameter indicates the index of the string to start searching.
  6261. Returns offsets to captured substrings, or 0 if no match is found.
  6262. This command is only available if the server is compiled with the regular
  6263. expressions library enabled.
  6264. ---------------------------------------
  6265. *setfont <font>;
  6266. This command sets the current RO client interface font to one of the
  6267. fonts stored in data\*.eot by using an ID of the font. When the ID
  6268. of the currently used font is used, default interface font is used
  6269. again.
  6270. 0 - Default
  6271. 1 - RixLoveangel
  6272. 2 - RixSquirrel
  6273. 3 - NHCgogo
  6274. 4 - RixDiary
  6275. 5 - RixMiniHeart
  6276. 6 - RixFreshman
  6277. 7 - RixKid
  6278. 8 - RixMagic
  6279. 9 - RixJJangu
  6280. ---------------------------------------
  6281. *showdigit <value>{,<type>};
  6282. Displays given numeric 'value' in large digital clock font on top of
  6283. the screen. The optional parameter 'type' specifies visual aspects
  6284. of the "clock" and can be one of the following values:
  6285. 0 - Displays the value for 5 seconds (default).
  6286. 1 - Incremental counter (1 tick/second).
  6287. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  6288. but overflows.
  6289. 3 - Decremental counter (2 ticks/second). Two digits only, stops
  6290. at zero.
  6291. Except for type 3 the value is interpreted as seconds and formatted
  6292. as time in days, hours, minutes and seconds. Note, that the official
  6293. script command does not have the optional parameter.
  6294. // displays 23:59:59 for 5 seconds
  6295. showdigit 86399;
  6296. // counter that starts at 60 and runs for 30 seconds
  6297. showdigit 60,3;
  6298. ---------------------------------------
  6299. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  6300. Each map cell has several 'flags' that specify the properties of that cell.
  6301. These include terrain properties (walkability, shootability, presence of water),
  6302. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  6303. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  6304. This command lets you alter these flags for all map cells in the specified
  6305. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  6306. The 'type' defines which flag to modify. Possible options see 'src/map/script_constants.h'.
  6307. Example:
  6308. setcell "arena",0,0,300,300,cell_basilica,1;
  6309. setcell "arena",140,140,160,160,cell_basilica,0;
  6310. setcell "arena",135,135,165,165,cell_walkable,0;
  6311. setcell "arena",140,140,160,160,cell_walkable,1;
  6312. This will add a makeshift ring into the center of the map. The ring will be
  6313. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  6314. the rest of the map will be marked as 'basilica', preventing observers from
  6315. casting any offensive skills or fighting among themselves. Note that the wall
  6316. will not be shown nor known client-side, which may cause movement problems.
  6317. Another example:
  6318. OnBarricadeDeploy:
  6319. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  6320. end;
  6321. OnBarricadeBreak:
  6322. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  6323. end;
  6324. This could be a part of the WoE:SE script, where attackers are not allowed
  6325. to proceed until all barricades are destroyed. This script would place and
  6326. remove a nonwalkable row of cells after the barricade mobs.
  6327. ---------------------------------------
  6328. *checkcell ("<map name>",<x>,<y>,<type>);
  6329. This command will return 1 or 0, depending on whether the specified cell has
  6330. the 'type' flag set or not. There are various types to check, all mimicking
  6331. the server's cell_chk enumeration. The types can be found in 'src/map/script_constants.h'.
  6332. The meaning of the individual types can be confusing, so here's an overview:
  6333. - cell_chkwall/water/cliff
  6334. these check directly for the 'terrain component' of the specified cell
  6335. - cell_chkpass/reach/nopass/noreach
  6336. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  6337. - cell_chknpc/basilica/landprotector/novending/nochat
  6338. these check for specific dynamic flags (their name indicates what they do)
  6339. Example:
  6340. mes "Pick a destination map.";
  6341. input .@map$;
  6342. mes "Alright, now give me the coordinates.";
  6343. input .@x;
  6344. input .@y;
  6345. if ( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  6346. mes "Can't warp you there, sorry!";
  6347. close;
  6348. } else {
  6349. mes "Ok, get ready...";
  6350. close2;
  6351. warp .@map$, .@x, .@y;
  6352. end;
  6353. }
  6354. ---------------------------------------
  6355. *getfreecell "<map name>",<rX>,<rY>{,<x>,<y>,<rangeX>,<rangeY>,<flag>};
  6356. Finds a free cell on the given map and stores the reference to the found cell
  6357. in <rX> and <rY>. Passing <x> and <y> with <rangeX> and <rangeY> allows for
  6358. searching within a specified area on the given map. The <flag> is a bitmask
  6359. and has the following possible values:
  6360. - 1 = Random cell on the map or from <x>,<y> range. (default)
  6361. - 2 = The target should be able to walk to the target tile.
  6362. - 4 = There shouldn't be any players around the target tile (use the no_spawn_on_player setting).
  6363. Examples:
  6364. getfreecell("prontera",.@x,.@y); // Find a random empty cell in Prontera and store it within .@x and .@y
  6365. 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
  6366. ---------------------------------------
  6367. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  6368. *delwall "<name>";
  6369. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  6370. line of the given size in the given direction. The difference with setcell is
  6371. this one update client part too to avoid the glitch problem. Directions are the
  6372. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  6373. ---------------------------------------
  6374. *checkwall "<name>";
  6375. This command will return true if the wall with the given name exists, false otherwise.
  6376. ---------------------------------------
  6377. *readbook <book id>,<page>;
  6378. This command will open a book item at the specified page.
  6379. ---------------------------------------
  6380. *open_roulette( {char_id} )
  6381. Opens the roulette window for the currently attached character or the character
  6382. with the given character id.
  6383. ---------------------------------------
  6384. ========================
  6385. |7.- Instance commands.|
  6386. ========================
  6387. ---------------------------------------
  6388. *instance_create("<instance name>"{,<instance mode>{,<owner id>}});
  6389. Creates an instance for the <owner id> of <mode>. The instance name, along with
  6390. all other instance data, is read from 'db/(pre-)re/instance_db.txt'. Upon success,
  6391. the command generates a unique instance ID, duplicates all listed maps and NPCs,
  6392. sets the alive time, and triggers the "OnInstanceInit" label in all NPCs inside
  6393. the instance.
  6394. Instance Mode options:
  6395. IM_NONE: Attached to no one.
  6396. IM_CHAR: Attached to a single character.
  6397. IM_PARTY: Attached to a party (default instance mode).
  6398. IM_GUILD: Attached to a guild.
  6399. IM_CLAN: Attached to a clan.
  6400. The command returns the instance ID upon success, and these values upon failure:
  6401. -1: Invalid type.
  6402. -2: Character/Party/Guild/Clan not found.
  6403. -3: Instance already exists.
  6404. -4: No free instances (MAX_INSTANCE exceeded).
  6405. ---------------------------------------
  6406. *instance_destroy {<instance id>};
  6407. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  6408. the script is attached to is used. If the script is not attached to an instance,
  6409. the instance of the currently attached player is used (if it is a character, party,
  6410. guild or clan mode). If it is not owned by anyone, no player needs to be attached. If
  6411. that fails, the script will come to a halt. This will also trigger the "OnInstanceDestroy"
  6412. label in all NPCs inside the instance.
  6413. ---------------------------------------
  6414. *instance_enter("<instance name>",{<x>,<y>,<char_id>,<instance id>});
  6415. Warps player to the specified instance after the script terminates. The map and
  6416. coordinates are located in 'db/(pre-)re/instance_db.txt'.
  6417. The command returns IE_OK upon success, and these values upon failure:
  6418. IE_NOMEMBER: Party/Guild/Clan not found (for party/guild/clan modes).
  6419. IE_NOINSTANCE: Character/Party/Guild/Clan does not have an instance.
  6420. IE_OTHER: Other errors (invalid instance name, instance doesn't match with character/party/guild/clan).
  6421. Put -1 for x and y if want to warp player with default entrance coordinates.
  6422. ---------------------------------------
  6423. *instance_npcname("<npc name>"{,<instance id>})
  6424. Returns the unique name of the instanced script. If no ID is specified,
  6425. the instance the script is attached to is used. If the script is not attached to
  6426. an instance, the instance of the currently attached NPC, player, party, guild
  6427. or clan is used. If that fails, the script will come to a halt.
  6428. ---------------------------------------
  6429. *instance_mapname("<map name>"{,<instance id>})
  6430. Returns the unique name of the instanced map. If no instance ID is specified,
  6431. the instance the script is attached to is used. If the script is not attached to
  6432. an instance, the instance of the currently attached player is used (if it is a
  6433. character, party, guild or clan mode). If it is not owned by anyone, no player needs
  6434. to be attached. If that fails, the command returns an empty string instead.
  6435. ---------------------------------------
  6436. *instance_id()
  6437. Returns the unique instance id of the attached script. If the script is not
  6438. attached to an instance, the instance of the currently attached player is
  6439. used (if it is a character, party, guild or clan mode). If it is not owned by anyone, no
  6440. player needs to be attached. If that fails, the function will return 0.
  6441. ---------------------------------------
  6442. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  6443. Warps all players in the instance <instance id> to <map name> at given
  6444. coordinates. If no ID is specified, the instance the script is attached to
  6445. is used. If the script is not attached to an instance, the instance of the
  6446. currently attached player is used (if it is a character, party, guild or clan
  6447. mode). If it is not owned by anyone, no player needs to be attached. If that
  6448. fails, the script will come to a halt.
  6449. ---------------------------------------
  6450. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  6451. Broadcasts a message to all players in the instance <instance id> currently
  6452. residing on an instance map. If 0 is specified for <instance id>, the instance
  6453. the script is attached to is used. If the script is not attached to an instance,
  6454. the instance of the currently attached player is used (if it is a character,
  6455. party, guild or clan mode). If it is not owned by anyone, no player needs to be attached.
  6456. For details on the other parameters, see 'announce'.
  6457. ---------------------------------------
  6458. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  6459. This function checks if a party meets certain requirements, returning 1 if all
  6460. conditions are met and 0 otherwise. It will only check online characters.
  6461. amount - number of online party members (default is 1).
  6462. min - minimum level of all characters in the party (default is 1).
  6463. max - maximum level of all characters in the party (default is max level in conf).
  6464. Example:
  6465. if (instance_check_party(getcharid(1),2,2,149)) {
  6466. mes "Your party meets the Memorial Dungeon requirements.",
  6467. mes "All online members are between levels 1-150 and at least two are online.";
  6468. close;
  6469. } else {
  6470. mes "Sorry, your party does not meet requirements.";
  6471. close;
  6472. }
  6473. ---------------------------------------
  6474. *instance_check_guild(<guild id>{,<amount>{,<min>{,<max>}}})
  6475. This function checks if a guild meets certain requirements, returning 1 if all
  6476. conditions are met and 0 otherwise. It will only check online characters.
  6477. amount - number of online guild members (default is 1).
  6478. min - minimum level of all characters in the guild (default is 1).
  6479. max - maximum level of all characters in the guild (default is max level in conf).
  6480. Example:
  6481. if (instance_check_guild(getcharid(2),2,2,149)) {
  6482. mes "Your guild meets the Memorial Dungeon requirements.",
  6483. mes "All online members are between levels 1-150 and at least two are online.";
  6484. close;
  6485. } else {
  6486. mes "Sorry, your guild does not meet requirements.";
  6487. close;
  6488. }
  6489. ---------------------------------------
  6490. *instance_check_clan(<clan id>{,<amount>{,<min>{,<max>}}})
  6491. This function checks if a clan meets certain requirements, returning 1 if all
  6492. conditions are met and 0 otherwise. It will only check online characters.
  6493. amount - number of online clan members (default is 1).
  6494. min - minimum level of all characters in the clan (default is 1).
  6495. max - maximum level of all characters in the clan (default is max level in conf).
  6496. Example:
  6497. if (instance_check_clan(getcharid(5),2,2,149)) {
  6498. mes "Your clan meets the Memorial Dungeon requirements.",
  6499. mes "All online members are between levels 1-150 and at least two are online.";
  6500. close;
  6501. } else {
  6502. mes "Sorry, your clan does not meet requirements.";
  6503. close;
  6504. }
  6505. ---------------------------------------
  6506. *instance_info("<instance name>",<info type>{,<instance_db map index>});
  6507. Returns the specified <info type> of the given <instance name> from the instance database.
  6508. If the <instance name> is unknown or an invalid <info type> is supplied -1 will be returned.
  6509. Valid info types:
  6510. IIT_ID: Instance database ID as integer.
  6511. IIT_TIME_LIMIT: Instance database total life time as integer.
  6512. IIT_IDLE_TIMEOUT: Instance database timeout time as integer.
  6513. IIT_ENTER_MAP: Instance database enter map as string.
  6514. IIT_ENTER_X: Instance database enter X location as integer.
  6515. IIT_ENTER_Y: Instance database enter Y location as integer.
  6516. IIT_MAPCOUNT: Instance database total maps as integer.
  6517. IIT_MAP: Instance database map name from the given <instance_db map index> as string.
  6518. If the index is invalid an empty string will be returned.
  6519. Example:
  6520. .@name$ = "Endless Tower";
  6521. mes .@name$ + " will be destroyed if no one is in the instance for " + instance_info(.@name$,IIT_IDLETIMEOUT) + " seconds.";
  6522. // Endless Tower will be destroyed if no one is in the instance for 300 seconds.
  6523. ---------------------------------------
  6524. =========================
  6525. |8.- Quest Log commands.|
  6526. =========================
  6527. ---------------------------------------
  6528. *questinfo <Quest ID>,<Icon>{,<Map Mark Color>{,<Job Class>}};
  6529. This is esentially a combination of checkquest and showevent. Use this only
  6530. in an OnInit label. For the Quest ID, specify the quest ID that you want
  6531. checked if it has been started yet.
  6532. For Icon, use one of the following:
  6533. No Icon : QTYPE_NONE
  6534. ! Quest Icon : QTYPE_QUEST
  6535. ? Quest Icon : QTYPE_QUEST2
  6536. ! Job Icon : QTYPE_JOB
  6537. ? Job Icon : QTYPE_JOB2
  6538. ! Event Icon : QTYPE_EVENT
  6539. ? Event Icon : QTYPE_EVENT2
  6540. Warg : QTYPE_WARG (Only for packetver < 20170315)
  6541. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410 and < 20170315)
  6542. Click Me : QTYPE_CLICKME (Only for packetver >= 20170315)
  6543. Daily Quest : QTYPE_DAILYQUEST (Only for packetver >= 20170315)
  6544. ! Event Icon : QTYPE_EVENT3 (Only for packetver >= 20170315)
  6545. Job Quest : QTYPE_JOBQUEST (Only for packetver >= 20170315)
  6546. Jumping Poring : QTYPE_JUMPING_PORING (Only for packetver >= 20170315)
  6547. Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC,
  6548. the available color values are:
  6549. 0 - No Marker (default)
  6550. 1 - Yellow Marker
  6551. 2 - Green Marker
  6552. 3 - Purple Marker
  6553. When a user shows up on a map, each NPC is checked for questinfo that has been set.
  6554. If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear.
  6555. Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
  6556. Example
  6557. izlude,100,100,4 script Test 844,{
  6558. mes "[Test]";
  6559. mes "Hello World.";
  6560. close;
  6561. OnInit:
  6562. questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
  6563. end;
  6564. }
  6565. ---------------------------------------
  6566. *setquestinfo_level <quest_id>,<min_level>,<max_level>;
  6567. Add level range criteria for quest info with quest id 'quest_id'.
  6568. This command must be used after 'questinfo'.
  6569. ---------------------------------------
  6570. *setquestinfo_req <quest_id>,<req_quest_id>,<state>{,<req_quest_id>,<state>,...};
  6571. Add 'req_quest_id' as requirement for quest info with quest id 'quest_id'.
  6572. Value os 'state' are:
  6573. 0: Player doesn't started 'req_quest_id'.
  6574. 1: Player has 'req_quest_id' (state is either "inactive" or "active").
  6575. 2: Player has 'req_quest_id' completed
  6576. This command must be used after 'questinfo'.
  6577. ---------------------------------------
  6578. *setquestinfo_job <quest_id>,<job_id>{,<job_id>...};
  6579. Add job criteria for quest info with quest id 'quest_id'.
  6580. The job criteria may more than one job_id.
  6581. This command must be used after 'questinfo'.
  6582. ---------------------------------------
  6583. *setquest <ID>{,<char_id>};
  6584. Place quest of <ID> in the users quest log, the state of which is "active".
  6585. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  6586. ---------------------------------------
  6587. *completequest <ID>{,<char_id>};
  6588. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  6589. ---------------------------------------
  6590. *erasequest <ID>{,<char_id>};
  6591. Remove the quest of the given <ID> from the user's quest log.
  6592. ---------------------------------------
  6593. *changequest <ID>,<ID2>{,<char_id>};
  6594. Remove quest of the given <ID> from the user's quest log.
  6595. Add quest of the <ID2> to the the quest log, and the state is "active".
  6596. ---------------------------------------
  6597. *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}})
  6598. If no additional argument supplied, return the state of the quest:
  6599. -1 = Quest not started (not in quest log)
  6600. 0 = Quest has been given, but the state is "inactive"
  6601. 1 = Quest has been given, and the state is "active"
  6602. 2 = Quest completed
  6603. If parameter "PLAYTIME" is supplied:
  6604. -1 = Quest not started (not in quest log)
  6605. 0 = the time limit has not yet been reached
  6606. 1 = the time limit has not been reached but the quest is marked as complete
  6607. 2 = the time limit has been reached
  6608. If parameter "HUNTING" is supplied:
  6609. -1 = Quest not started (not in quest log)
  6610. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  6611. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  6612. 2 = you've killed all of the target monsters
  6613. ---------------------------------------
  6614. *isbegin_quest(<ID>{,<char_id>})
  6615. Return the state of the quest:
  6616. 0 = Quest not started (not in quest log)
  6617. 1 = Quest has been given (state is either "inactive" or "active")
  6618. 2 = Quest completed
  6619. ---------------------------------------
  6620. *showevent <icon>{,<mark color>{,<char_id>}}
  6621. Show an emotion on top of a NPC, and optionally,
  6622. a colored mark in the mini-map like "viewpoint".
  6623. This is used to indicate that a NPC has a quest or an event to
  6624. a certain player.
  6625. Available Icons:
  6626. Remove Icon : QTYPE_NONE
  6627. ! Quest Icon : QTYPE_QUEST
  6628. ? Quest Icon : QTYPE_QUEST2
  6629. ! Job Icon : QTYPE_JOB
  6630. ? Job Icon : QTYPE_JOB2
  6631. ! Event Icon : QTYPE_EVENT
  6632. ? Event Icon : QTYPE_EVENT2
  6633. Warg : QTYPE_WARG
  6634. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  6635. Mark Color:
  6636. 0 - No Mark
  6637. 1 - Yellow Mark
  6638. 2 - Green Mark
  6639. 3 - Purple Mark
  6640. ---------------------------------------
  6641. ============================
  6642. |9.- Battleground commands.|
  6643. ============================
  6644. ---------------------------------------
  6645. *waitingroom2bg_single(<battle group>,{"<map name>",<x>,<y>{,"<npc name>"}});
  6646. Adds the first waiting player from the chat room of the given NPC to an existing battleground group.
  6647. The player will also be warped to the default spawn point of the battle group or to the specified coordinates <x> and <y> on the given <map>.
  6648. ---------------------------------------
  6649. *waitingroom2bg("<map name>",<x>,<y>,{"<On Quit Event>","<On Death Event>"{,"<NPC Name>"}});
  6650. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  6651. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  6652. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  6653. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  6654. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  6655. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  6656. Example:
  6657. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  6658. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  6659. end;
  6660. ---------------------------------------
  6661. *bg_create("<map name>",<x>,<y>{,"<On Quit Event>","<On Death Event>"});
  6662. Creates an instance of battleground battle group that can be used with other battleground commands.
  6663. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  6664. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  6665. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  6666. Returns battle group ID on success. Returns 0 on failure.
  6667. ---------------------------------------
  6668. *bg_join(<battle group>,{"<map name>",{<x>,<y>{,<char id>}});
  6669. Adds an attached player or <char id> if specified to an existing battleground group. The player will also be warped to the default spawn point of the battle group or to the specified coordinates <x> and <y> on the given <map>.
  6670. Returns true on success. Returns false on failure.
  6671. ---------------------------------------
  6672. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  6673. Updates the respawn point of the given Battle Group to x,y on the same map. <Battle Group ID> can be retrieved using getcharid(4).
  6674. Example:
  6675. bg_team_setxy getcharid(4),56,212;
  6676. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  6677. end;
  6678. ---------------------------------------
  6679. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  6680. Similar to the 'warp' command.
  6681. Places all members of <Battle Group> at the specified map and coordinates.
  6682. Example:
  6683. //place the battle group one for Tierra Gorge at starting position.
  6684. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  6685. end;
  6686. ---------------------------------------
  6687. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  6688. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  6689. Similar to the 'monster' command.
  6690. Spawns a monster with allegiance to the given Battle Group.
  6691. Does not allow for the summoning of multiple monsters.
  6692. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  6693. Example:
  6694. // It can be used in two different ways.
  6695. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  6696. end;
  6697. // Alternatively, you can set an ID for the monster using "set".
  6698. // This becomes useful when used with the command below.
  6699. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  6700. end;
  6701. ---------------------------------------
  6702. *bg_monster_set_team <GID>,<Battle Group>;
  6703. This command will change the allegiance if a monster in a battle ground.
  6704. GID can be set when spawning the monster via the 'bg_monster' command.
  6705. Example:
  6706. end;
  6707. OnEnable:
  6708. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  6709. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  6710. initnpctimer;
  6711. end;
  6712. OnTimer1000:
  6713. stopnpctimer;
  6714. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  6715. bg_monster_set_team $@Guardian, $@BG_1;
  6716. end;
  6717. ---------------------------------------
  6718. *bg_leave {<char_id>};
  6719. Removes attached player from their Battle Group.
  6720. ---------------------------------------
  6721. *bg_destroy <Batte Group>;
  6722. Destroys the Battle Group created for that battle ground.
  6723. ---------------------------------------
  6724. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  6725. Restores a percentage of the maximum HP/SP of players within a defined area.
  6726. This is primarily used in battleground scripts, but is not limited to them.
  6727. Example:
  6728. areapercentheal "bat_a01",52,208,61,217,100,100;
  6729. end;
  6730. ---------------------------------------
  6731. *bg_get_data(<Battle Group>,<type>);
  6732. Retrieves data related to given Battle Group. Type can be one of the following:
  6733. 0 - Amount of players currently belonging to the group.
  6734. 1 - Store GID of players in <Battle Group> in a temporary global array $@arenamembers
  6735. and returns amount of players currently belonging to the group.
  6736. ---------------------------------------
  6737. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  6738. Retrieves the amount of players belonging to the given Battle Group on the given
  6739. map within the specified rectangular area.
  6740. ---------------------------------------
  6741. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  6742. This command will force the update of the displayed scoreboard.
  6743. It is only usable when the map is defined as a Type 2 Battleground:
  6744. mapflag <map name> battleground 2
  6745. ---------------------------------------
  6746. ====================
  6747. |10.- Pet commands.|
  6748. ====================
  6749. ---------------------------------------
  6750. *bpet;
  6751. *birthpet;
  6752. This command opens up a pet hatching window on the client connected to the
  6753. invoking character. It is used in item script for the pet incubators and will
  6754. let the player hatch an owned egg. If the character has no eggs, it will just
  6755. open up an empty incubator window.
  6756. This is still usable outside item scripts.
  6757. ---------------------------------------
  6758. *pet <pet id>;
  6759. *catchpet <pet id>;
  6760. This command is used in all the item scripts for taming items. Running this
  6761. command will make the pet catching cursor appear on the client connected to the
  6762. invoking character, usable on the monsters with the specified pet ID number. It
  6763. will still work outside an item script.
  6764. If the <pet id> is PET_CATCH_UNIVERSAL the item will attempt to catch the targeted
  6765. monster as long as it is in the pet database and does not have the MD_STATUS_IMMUNE
  6766. monster mode.
  6767. If the <pet id> is PET_CATCH_UNIVERSAL_ITEM the item will attempt to catch the targeted
  6768. monster as long as it is in the pet database and the targeted monster requires the lure
  6769. item used.
  6770. See 'doc/mob_db_mode_list.txt' for more information about monster modes.
  6771. A full list of pet IDs can be found inside 'db/(pre-)re/pet_db.txt'.
  6772. ---------------------------------------
  6773. *makepet <pet id>;
  6774. This command will create a pet egg and put it in the invoking character's
  6775. inventory. The kind of pet is specified by pet ID numbers listed in
  6776. 'db/(pre-)re/pet_db.txt'. The egg is created exactly as if the character just successfully
  6777. caught a pet in the normal way.
  6778. // This will make you a poring:
  6779. makepet 1002;
  6780. Notice that you absolutely have to create pet eggs with this command. If you try
  6781. to give a pet egg with 'getitem', pet data will not be created by the char
  6782. server and the egg will disappear when anyone tries to hatch it.
  6783. ---------------------------------------
  6784. *getpetinfo(<type>{,<char_id>})
  6785. This function will return pet information for the pet the invoking character
  6786. currently has active. Valid types are:
  6787. PETINFO_ID - Pet ID
  6788. PETINFO_CLASS - Pet class number as per 'db/(pre-)re/pet_db.txt' - will tell you what kind of a pet it
  6789. is.
  6790. PETINFO_NAME - Pet name. Will return "null" if there's no pet.
  6791. PETINFO_INTIMATE - Pet friendly level (intimacy score). 1000 is full loyalty.
  6792. PETINFO_HUNGRY - Pet hungry level. 100 is completely full.
  6793. PETINFO_RENAMED - Pet rename flag. 0 means this pet has not been named yet.
  6794. PETINFO_LEVEL - Pet level
  6795. PETINFO_BLOCKID - Pet Game ID
  6796. PETINFO_EGGID - Pet egg item id
  6797. PETINFO_FOODID - Pet food item id
  6798. ---------------------------------------
  6799. =============================
  6800. |10.1.- The Pet AI commands.|
  6801. =============================
  6802. ---------------------------------------
  6803. These commands will only work if the invoking character has a pet, and are meant
  6804. to be executed from pet scripts. They will modify the pet AI decision-making for
  6805. the current pet of the invoking character, and will NOT have any independent
  6806. effect by themselves, which is why only one of them each may be in effect at any
  6807. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  6808. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport'.
  6809. All commands with delays and durations will only make the behavior active for
  6810. the specified duration of seconds, with a delay of the specified number of
  6811. seconds between activations. Rates are a chance of the effect occurring and are
  6812. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  6813. at the maximum possible.
  6814. The behavior modified with the below mentioned commands will only be exhibited if
  6815. the pet is loyal and appropriate configuration options are set in
  6816. 'battle_athena.conf'.
  6817. Pet scripts in the database normally run whenever a pet of that type hatches
  6818. from the egg. Other commands usable in item scripts (see 'bonus') will also
  6819. happily run from pet scripts. Apparently, the pet-specific commands will also
  6820. work in NPC scripts and modify the behavior of the current pet up until the pet
  6821. is hatched again. (Which will also occur when the character is logged in again
  6822. with the pet still out of the egg.) It is not certain for how long the effect of
  6823. such command running from an NPC script will eventually persist, but apparently,
  6824. it is possible to usefully employ them in usable item scripts to create pet
  6825. buffing items.
  6826. Nobody tried this before, so you're essentially on your own here.
  6827. ---------------------------------------
  6828. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  6829. This command will make the pet give a bonus to the owner's stat in certain
  6830. duration in seconds and will be repeated for certain delay in seconds.
  6831. For a full bonus list, see 'doc/item_bonus.txt'
  6832. NOTE: Currently ONLY supported for bonuses that used by 'bonus' script.
  6833. ---------------------------------------
  6834. *petrecovery <status type>,<delay>;
  6835. This command will make the pet cure a specified status condition. The curing
  6836. actions will occur once every Delay seconds. For a full list of status
  6837. conditions that can be cured, see the list of 'SC_' status condition constants
  6838. in 'src/map/script_constants.h'.
  6839. ---------------------------------------
  6840. *petloot <max items>;
  6841. This command will turn on pet looting, with a maximum number of items to loot
  6842. specified. Pet will store items and return them when the maximum is reached or
  6843. when pet performance is activated.
  6844. ---------------------------------------
  6845. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  6846. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  6847. This will make the pet use a specified support skill on the owner whenever the
  6848. HP and SP are below the given percent values, with a specified delay time
  6849. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
  6850. It's not quite certain who's stats will be used for the skills cast, the
  6851. character's or the pets. Probably, Skotlex can answer that question.
  6852. ---------------------------------------
  6853. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  6854. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  6855. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  6856. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  6857. These two commands will make the pet cast an attack skill on the enemy the pet's
  6858. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  6859. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  6860. inflicted and the specified number of attacks.
  6861. Value of 'rate' is between 1 and 100. 100 = 100%
  6862. ---------------------------------------
  6863. ===========================
  6864. |11.- Homunculus commands.|
  6865. ===========================
  6866. ---------------------------------------
  6867. *homevolution;
  6868. This command will try to evolve the current player's homunculus.
  6869. If it doesn't work, the /swt emotion is shown.
  6870. To evolve a homunculus, the invoking player must have a homunculus,
  6871. the homunculus must not be the last evolution and
  6872. the homunculus must have above 91000 intimacy with its owner.
  6873. ---------------------------------------
  6874. *morphembryo;
  6875. This command will try to put the invoking player's Homunculus in an
  6876. uncallable state, required for mutation into a Homunculus S. The player
  6877. will also receive a Strange Embryo (ID 6415) in their inventory if
  6878. successful, which is deleted upon mutation.
  6879. The command will fail if the invoking player does not have an evolved
  6880. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  6881. Returns 1 upon success and 0 for all failures.
  6882. ---------------------------------------
  6883. *hommutate {<ID>};
  6884. This command will try to mutate the invoking player's Homunculus into
  6885. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  6886. The command will fail if the invoking player does not have an evolved
  6887. Homunculus at level 99 or above, if it is not in the embryo state
  6888. (from the 'morphembryo' command), or if the invoking player does not
  6889. possess a Strange Embryo. The /swt emotion is shown upon failure.
  6890. If the optional parameter <ID> is set, the invoking player's Homunculus
  6891. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  6892. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  6893. Returns 1 upon success and 0 for all failures.
  6894. ---------------------------------------
  6895. *checkhomcall()
  6896. This function checks if the attached player's Homunculus is active,
  6897. and will return the following values:
  6898. -1: The player has no Homunculus.
  6899. 0: The player's Homunculus is active.
  6900. 1: The player's Homunculus is vaporized.
  6901. 2: The player's Homunculus is in morph state.
  6902. ---------------------------------------
  6903. *gethominfo(<type>{,<char_id>})
  6904. This function will return Homunculus information for the Homunculus of the
  6905. invoking character, regardless of its vaporize state. It returns zero or
  6906. "null" if the player does not own a Homunculus.
  6907. Valid types are:
  6908. 0 - Homunculus ID
  6909. 1 - Homunculus Class
  6910. 2 - Homunculus Name
  6911. 3 - Homunculus friendly level (intimacy score). 100000 is full loyalty.
  6912. 4 - Homunculus hungry level. 100 is completely full.
  6913. 5 - Homunculus rename flag. 0 means this homunculus has not been named yet.
  6914. 6 - Homunculus level
  6915. 7 - Homunculus Game ID
  6916. ---------------------------------------
  6917. *homshuffle;
  6918. This will recalculate the homunculus stats according to its level, of the
  6919. current invoking character.
  6920. ---------------------------------------
  6921. ==========================
  6922. |12.- Mercenary commands.|
  6923. ==========================
  6924. ---------------------------------------
  6925. *mercenary_create <class>,<contract time>;
  6926. This command summons a mercenary for a given time (in milliseconds). For a
  6927. list of all available classes, see 'db/mercenary_db.txt'.
  6928. This command is typically used in item scripts of mercenary scrolls.
  6929. ---------------------------------------
  6930. *mercenary_heal <hp>,<sp>;
  6931. This command works like 'heal', but affects the mercenary of the
  6932. currently attached character.
  6933. ---------------------------------------
  6934. *mercenary_sc_start <type>,<tick>,<val1>;
  6935. This command works like 'sc_start', but affects the mercenary of the
  6936. currently attached character.
  6937. ---------------------------------------
  6938. *mercenary_get_calls(<guild>);
  6939. *mercenary_set_calls <guild>,<value>;
  6940. Sets or gets the mercenary calls value for given guild for currently
  6941. attached character. Guild can be one or the following constants:
  6942. ARCH_MERC_GUILD
  6943. SPEAR_MERC_GUILD
  6944. SWORD_MERC_GUILD
  6945. ---------------------------------------
  6946. *mercenary_get_faith(<guild>);
  6947. *mercenary_set_faith <guild>,<value>;
  6948. Sets or gets the mercenary faith value for given guild for currently
  6949. attached character. Guild can be one or the following constants:
  6950. ARCH_MERC_GUILD
  6951. SPEAR_MERC_GUILD
  6952. SWORD_MERC_GUILD
  6953. ---------------------------------------
  6954. *getmercinfo(<type>{,<char id>});
  6955. Retrieves information about mercenary of the currently attached
  6956. character. If char id is given, the information of that character is
  6957. retrieved instead. Type specifies what information to retrieve and
  6958. can be one of the following:
  6959. 0 - Mercenary ID
  6960. 1 - Mercenary Class
  6961. 2 - Mercenary Name
  6962. 3 - Mercenary faith value for this mercenary's guild, if any
  6963. 4 - Mercenary calls value for this mercenary's guild, if any
  6964. 5 - Mercenary kill count
  6965. 6 - Mercenary remaining life time in msec
  6966. 7 - Mercenary level
  6967. 8 - Mercenary Game ID
  6968. If the character does not have a mercenary, the command returns ""
  6969. for name and 0 for all other types.
  6970. ---------------------------------------
  6971. ======================
  6972. |13.- Party commands.|
  6973. ======================
  6974. ---------------------------------------
  6975. *getpartyname(<party id>)
  6976. This function will return the name of a party that has the specified ID number.
  6977. If there is no such party ID, "null" will be returned.
  6978. Lets say the ID of a party was saved as a global variable:
  6979. // This would return the name of the party from the ID stored in a variable
  6980. mes "You're in the '" + getpartyname($@var) + "' party, I know!";
  6981. ---------------------------------------
  6982. *getpartymember <party id>{,<type>{,<array_variable>}};
  6983. This command will find all members of a specified party and returns their names
  6984. (or character id or account id depending on the value of "type") into an array
  6985. of temporary global variables. There's actually quite a few commands like this
  6986. which will fill a special variable with data upon execution and not do anything
  6987. else.
  6988. Upon executing this,
  6989. $@partymembername$[] is a global temporary string array which contains all the
  6990. names of these party members
  6991. (only set when type is 0 or not specified)
  6992. $@partymembercid[] is a global temporary number array which contains the
  6993. character id of these party members.
  6994. (only set when type is 1)
  6995. $@partymemberaid[] is a global temporary number array which contains the
  6996. account id of these party members.
  6997. (only set when type is 2)
  6998. $@partymembercount is the number of party members that were found.
  6999. The party members will (apparently) be found regardless of whether they are
  7000. online or offline. Note that the names come in no particular order.
  7001. Be sure to use $@partymembercount to go through this array, and not
  7002. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  7003. someone with 7 party members invokes this script, the array would have 7
  7004. elements. But if another person calls up the NPC, and he has a party of 5, the
  7005. server will not clear the array for you, overwriting the values instead. So in
  7006. addition to returning the 5 member names, the 6th and 7th elements from the last
  7007. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  7008. the new guy's party. $@partymembercount will always contain the correct number,
  7009. (5) unlike 'getarraysize()' which will return 7 in this case.
  7010. If 'array_variable' is set, the result will be stored to that variable instead
  7011. using global variable.
  7012. Example 1: list party member names
  7013. // get the party member names
  7014. getpartymember getcharid(1),0;
  7015. // It's a good idea to copy the global temporary $@partymember*****
  7016. // variables to your own scope variables because if you have pauses in this
  7017. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  7018. // another player could click this NPC, trigger 'getpartymember', and
  7019. // overwrite the $@partymember***** variables.
  7020. .@count = $@partymembercount;
  7021. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  7022. // list the party member names
  7023. for (.@i = 0; .@i < .@count; .@i++)
  7024. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  7025. close;
  7026. Example 2: check party count (with a 'next' pause), before warping to event
  7027. .register_num = 5; // How many party members are required?
  7028. // get the charID and accountID of character's party members
  7029. getpartymember getcharid(1), 1;
  7030. getpartymember getcharid(1), 2;
  7031. if ( $@partymembercount != .register_num ) {
  7032. mes "Please form a party of " + .register_num + " to continue";
  7033. close;
  7034. }
  7035. // loop through both and use 'isloggedin' to count online party members
  7036. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  7037. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  7038. .@count_online++;
  7039. // We search accountID & charID because a single party can have multiple
  7040. // characters from the same account. Without searching through the charID,
  7041. // if a player has 2 characters from the same account inside the party but
  7042. // only 1 char online, it would count their online char twice.
  7043. if ( .@count_online != .register_num ) {
  7044. mes "All your party members must be online to continue";
  7045. close;
  7046. }
  7047. // copy the array to prevent players cheating the system
  7048. copyarray .@partymembercid, $@partymembercid, .register_num;
  7049. mes "Are you ready ?";
  7050. next; // careful here
  7051. select("Yes");
  7052. // When a script hits a next, menu, sleep or input that pauses the script,
  7053. // players can invite or /leave and make changes in their party. To prevent
  7054. // this, we call getpartymember again and compare with the original values.
  7055. getpartymember getcharid(1), 1;
  7056. if ( $@partymembercount != .register_num ) {
  7057. mes "You've made changes to your party !";
  7058. close;
  7059. }
  7060. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  7061. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  7062. mes "You've made changes to your party !";
  7063. close;
  7064. }
  7065. }
  7066. // Finally, it's safe to start the event!
  7067. warpparty "event_map", 0,0, getcharid(1);
  7068. ---------------------------------------
  7069. *getpartyleader(<party id>{,<type>})
  7070. This function returns some information about the given party-id's leader.
  7071. When type is omitted, the default information retrieved is the leader's name.
  7072. Possible types are:
  7073. 1: Leader account id
  7074. 2: Leader character id
  7075. 3: Leader's class
  7076. 4: Leader's current map name
  7077. 5: Leader's current level as stored on the party structure (may not be
  7078. current level if leader leveled up recently).
  7079. If retrieval fails (leader not found or party does not exist), this function
  7080. returns "null" instead of the character name, and -1 for the other types.
  7081. ---------------------------------------
  7082. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  7083. Organizes a party with the attached or specified character as leader. If
  7084. successful, the command returns 1 and sets the global temporary variable
  7085. "$@party_create_id" to the ID of the party created.
  7086. Additionally, item sharing options can be provided:
  7087. - Item Share: 0-Each Take (default), 1-Party Share
  7088. - Item Share Type: 0-Each Take (default), 1-Even Share
  7089. These values are returned upon failure:
  7090. 0: Unknown error.
  7091. -1: Player not found.
  7092. -2: Player already has a party.
  7093. -3: Party name exists.
  7094. ---------------------------------------
  7095. *party_destroy(<party id>);
  7096. Disbands a party. The command returns 1 upon success and 0 upon failure.
  7097. ---------------------------------------
  7098. *party_addmember(<party id>,<character id>);
  7099. Adds a player to an existing party.
  7100. The command returns 1 upon success, and these values upon failure:
  7101. 0: Unknown error.
  7102. -1: Player not found.
  7103. -2: Player already has a party.
  7104. -3: Party not found.
  7105. -4: Party is full.
  7106. -5: Another character from the same account is already in the party.
  7107. ---------------------------------------
  7108. *party_delmember({<character id>,<party id>});
  7109. Removes a player from his/her party. If no player is specified, the command
  7110. will run for the invoking player. If that player is the only party member
  7111. remaining, the party will be disbanded.
  7112. The command returns 1 upon success, and these values upon failure:
  7113. 0: Unknown error.
  7114. -1: Player not found.
  7115. -2: Party not found.
  7116. -3: Player is not in the party.
  7117. ---------------------------------------
  7118. *party_changeleader(<party id>,<character id>);
  7119. Transfers leadership of a party to the specified character.
  7120. The command returns 1 upon success, and these values upon failure:
  7121. 0: Unknown error.
  7122. -1: Party not found.
  7123. -2: Player not found.
  7124. -3: Player is not in the party.
  7125. -4: Player is already party leader.
  7126. ---------------------------------------
  7127. *party_changeoption(<party id>,<option>,<flag>);
  7128. Changes a party option.
  7129. Valid options are:
  7130. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  7131. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  7132. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  7133. The command returns 1 upon success, and these values upon failure:
  7134. 0: Invalid option.
  7135. -1: Party not found.
  7136. ---------------------------------------
  7137. *opendressroom(<flag>{,<char_id>});
  7138. This will open the Dress Room window on the client connected to the invoking character.
  7139. mes "Close this window to open the Dress Room window.";
  7140. close2;
  7141. opendressroom(1);
  7142. end;
  7143. Valid flag are:
  7144. 1 - Open the Dress Room window
  7145. ---------------------------------------
  7146. *navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
  7147. Generates a navigation for attached or specified character. Requires client
  7148. 2011-10-10aRagEXE or newer.
  7149. The flag specifies how the client will calculate the specific route.
  7150. Valid flags are:
  7151. NAV_NONE - No services
  7152. NAV_AIRSHIP_ONLY - Airship only
  7153. NAV_SCROLL_ONLY - Scroll only
  7154. NAV_AIRSHIP_AND_SCROLL - Airship and Scroll
  7155. NAV_KAFRA_ONLY - Kafra only
  7156. NAV_KAFRA_AND_AIRSHIP - Kafra and Airship
  7157. NAV_KAFRA_AND_SCROLL - Kafra and Scroll
  7158. NAV_ALL - All services
  7159. When flag is not specified, the default value is NAV_KAFRA_AND_AIRSHIP.
  7160. The hide_window specifies whether to display (0) or hide (1) the navigation window.
  7161. By default the window is hidden.
  7162. You can specify the monster_id in combination with a mapname to make the
  7163. navigation system tell you, that you have reached the desired mob.
  7164. Note:
  7165. The client requires custom monster spawns be in the navigation file
  7166. for using the embedded client Navigation feature to work properly. In this
  7167. instance sending the player to the map where the monster spawns is a simpler
  7168. solution rather than sending the map and the monster_id.
  7169. ---------------------------------------
  7170. *hateffect(<Hat Effect ID>,<State>);
  7171. This will set a Hat Effect onto the player. The state field allows you to
  7172. enable (true) or disable (false) the effect on the player.
  7173. The Hat Effect constants can be found in 'src/map/script_constants.h' starting
  7174. with HAT_EF_*.
  7175. Requires client 2015-05-13aRagEXE or newer.
  7176. ---------------------------------------
  7177. *getrandomoptinfo(<type>);
  7178. Returns value of an attribute of current random option.
  7179. Valid attributes are:
  7180. ROA_ID - ID of current option
  7181. ROA_VALUE - Value field of current option
  7182. ROA_PARAM - Param field of current option
  7183. This script command is intended for using in random option scripts.
  7184. ---------------------------------------
  7185. *getequiprandomoption(<equipment index>,<index>,<type>{,<char id>});
  7186. Returns value of an attribute of a random option on an equipped item.
  7187. See 'getequipid' for a full list of valid equipment slots.
  7188. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  7189. For valid attribute types, see `getrandomoptinfo` command reference.
  7190. ---------------------------------------
  7191. *setrandomoption(<equipment slot>,<index>,<id>,<value>,<param>{,<char id>});
  7192. Sets <index+1>th random option for equipment equipped at <equipment slot>
  7193. to <id>, <value> and <param>.
  7194. See 'getequipid' for a full list of valid equipment slots.
  7195. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  7196. ID - ID of random option. See db/const.txt for constants.
  7197. Value - Value of random option
  7198. Param - Parameter of random option
  7199. ---------------------------------------
  7200. *clan_join(<clan id>{,<char id>});
  7201. The attached player joins the clan with the <clan id>. On a successful join,
  7202. true is returned, else false if the join failed.
  7203. If <char id> is specified, the specified player is used rather than the attached one.
  7204. ---------------------------------------
  7205. *clan_leave({<char id>});
  7206. The attached player will leave their clan. On a successful leave, true is returned,
  7207. else false if the leave failed.
  7208. If <char id> is specified, the specified player is used rather than the attached one.
  7209. ---------------------------------------
  7210. ========================
  7211. |14.- Channel commands.|
  7212. ========================
  7213. ---------------------------------------
  7214. *channel_create "<chname>","<alias>"{,"<password>"{<option>{,<delay>{,<color>{,<char_id>}}}}};
  7215. Creates a public channel with <chname> as the channel name. To protect the
  7216. channel, use <password> or write "null" to create it without a password.
  7217. Channel name must start with '#' and cannot be the same as the map or ally
  7218. channel names.
  7219. <alias> will be used to change the channel name when the channel message
  7220. is displayed.
  7221. <option> values are:
  7222. CHAN_OPT_BASE - Default option including CHAN_OPT_ANNOUNCE_SELF|CHAN_OPT_MSG_DELAY|CHAN_OPT_CAN_CHAT|CHAN_OPT_CAN_LEAVE
  7223. CHAN_OPT_ANNOUNCE_SELF - Show info for player itself if player has joined/leaves the channel
  7224. CHAN_OPT_ANNOUNCE_JOIN - Display message when player is joining the channel
  7225. CHAN_OPT_ANNOUNCE_LEAVE - Display message when player is leaving the channel
  7226. CHAN_OPT_MSG_DELAY - Enable chat delay for the channel
  7227. CHAN_OPT_COLOR_OVERRIDE - Player's unique font color will override channel's color
  7228. CHAN_OPT_CAN_CHAT - Player can chat in the channel
  7229. CHAN_OPT_CAN_LEAVE - Player can leave the channel
  7230. CHAN_OPT_AUTOJOIN - Players will auto join the channel at login
  7231. The <delay> is the minimum chat delay in millisecond for a single player before
  7232. the player can chat again in the same channel.
  7233. Use <color> hex code to set the color for this channel, if not defined, default
  7234. channel color will be used.
  7235. If <char_id> is defined, the channel will be a private channel and the player
  7236. will be the the channel owner.
  7237. Returns 1 on success.
  7238. /**
  7239. * This example will shows the message on this channel as
  7240. * [rAthena] Admin : Hello world!
  7241. * instead of
  7242. * #rathena Admin : Hello world!
  7243. **/
  7244. channel_create("#rathena","[rAthena]");
  7245. channel_create("#vip","[VIP]","vipmemberonly");
  7246. ---------------------------------------
  7247. *channel_setopt "<chname>",<option>,<value>;
  7248. Set option for the channel. Use 1 in <value> to set it, or 0 to unset.
  7249. The <option> values are the same as the 'channel_create' options.
  7250. For CHAN_OPT_MSG_DELAY, the delay in millisecond must be sent or use 0
  7251. to remove the delay at <value>.
  7252. Returns 1 on success.
  7253. // Example to set delay
  7254. channel_setopt("#global",CHAN_OPT_MSG_DELAY,5000);
  7255. Only for public and private channel.
  7256. ---------------------------------------
  7257. *channel_setcolor "<chname>",<color>;
  7258. To change channel color.
  7259. <color> uses hex RGB values.
  7260. Returns 1 on success.
  7261. ---------------------------------------
  7262. *channel_setpass "<chname>","<password>";
  7263. To set, unset, or change password of a channel.
  7264. Use "null" to remove the password.
  7265. Returns 1 on success.
  7266. Only for public and private channel.
  7267. ---------------------------------------
  7268. *channel_setgroup "<chname>",<group_id>{,...,<group_id>};
  7269. *channel_setgroup2 "<chname>",<array_of_groups>;
  7270. Set group restriction for a channel. Only player with matching <group_id>
  7271. are allowed to to join the channel.
  7272. By using 0 in the first group channel, the group restriction will be
  7273. removed from the channel config.
  7274. 'channel_setgroup2' receives input for group list as an array.
  7275. Returns 0 on failure, and 1 (or n groups count) on success.
  7276. // Example 1: Remove groups
  7277. channel_setgroup("#event",0);
  7278. // Example 2: Multiple values
  7279. channel_setgroup("#vip",2,5);
  7280. // Example 3: Using array
  7281. setarray .@staffs[0],2,3,4,10,99;
  7282. channel_setgroup("#staff",.@staffs);
  7283. Only for public and private channel.
  7284. ---------------------------------------
  7285. *channel_chat "<chname>","<message>"{,<color>};
  7286. Sends message to the channel.
  7287. Returns 1 on success.
  7288. // Example if channel doesn't have alias
  7289. channel_chat(#rathena,"Hello World!"); // #rathena Hello World!
  7290. // Example if channel has alias
  7291. channel_chat(#rathena,"Hello World!"); // [rAthena] Hello World!
  7292. ---------------------------------------
  7293. *channel_ban "<chname>",<char_id>;
  7294. Ban player from a public or private channel.
  7295. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be banned.
  7296. Returns 1 on success.
  7297. ---------------------------------------
  7298. *channel_unban "<chname>",<char_id>;
  7299. Unban player from a public or private channel.
  7300. Returns 1 on success.
  7301. ---------------------------------------
  7302. *channel_kick "<chname>",<char_id>;
  7303. *channel_kick "<chname>","<char_name>";
  7304. Kick player from a public or private channel.
  7305. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be kicked.
  7306. Returns 1 on success.
  7307. ---------------------------------------
  7308. *channel_delete "<chname>";
  7309. Delete an existing public or private channel. Cannot delete ally or
  7310. local map channel.
  7311. Returns 0 on success.
  7312. ---------------------------------------
  7313. ============================
  7314. |15.- Achievement commands.|
  7315. ============================
  7316. ---------------------------------------
  7317. *achievementadd(<achievement id>{,<char id>})
  7318. This function will add an achievement to the player's log for the attached
  7319. player or the supplied <char id>. The objective requirements are not ignored
  7320. when using this function.
  7321. Returns true on success and false on failure.
  7322. ---------------------------------------
  7323. *achievementremove(<achievement id>{,<char id>})
  7324. This function will remove an achievement from the player's log for the attached
  7325. player or the supplied <char id>.
  7326. Returns true on success and false on failure.
  7327. ---------------------------------------
  7328. *achievementinfo(<achievement id>,<type>{,<char id>})
  7329. This function will return the specified <type> value for an achievement of the
  7330. attached player or the supplied <char id>. If the player doesn't have the
  7331. achievement active (no progress has been made): if the achievement doesn't
  7332. exist -1 will be returned, or -2 will be returned on any other error such as
  7333. an invalid <type>.
  7334. Valid types:
  7335. - ACHIEVEINFO_COUNT1
  7336. - ACHIEVEINFO_COUNT2
  7337. - ACHIEVEINFO_COUNT3
  7338. - ACHIEVEINFO_COUNT4
  7339. - ACHIEVEINFO_COUNT5
  7340. - ACHIEVEINFO_COUNT6
  7341. - ACHIEVEINFO_COUNT7
  7342. - ACHIEVEINFO_COUNT8
  7343. - ACHIEVEINFO_COUNT9
  7344. - ACHIEVEINFO_COUNT10
  7345. - ACHIEVEINFO_COMPLETE
  7346. - ACHIEVEINFO_COMPLETEDATE
  7347. - ACHIEVEINFO_GOTREWARD
  7348. - ACHIEVEINFO_LEVEL (<achievement id> is useless for this)
  7349. - ACHIEVEINFO_SCORE (<achievement id> is useless for this)
  7350. ---------------------------------------
  7351. *achievementcomplete(<achievement id>{,<char id>})
  7352. This function will complete an achievement for the attached player or the supplied
  7353. <char id>. The objective requirements are ignored when using this function.
  7354. Returns true on success and false on failure.
  7355. ---------------------------------------
  7356. *achievementexists(<achievement id>{,<char id>});
  7357. This function will return if the achievement exists on the player or the supplied
  7358. <char id>.
  7359. Returns true on success and false on failure.
  7360. ---------------------------------------
  7361. *achievementupdate(<achievement id>,<type>,<value>{,<char id>})
  7362. This function will update an achievement's value for an achievement of the attached
  7363. player or the supplied <char id>. If the player does not have the achievement active
  7364. (no progress has been made) it will be added to the player's log first before updating
  7365. the <type> value.
  7366. Returns true on success and false on failure.
  7367. See 'achievementinfo' for valid <type> values.
  7368. - ACHIEVEINFO_COMPLETE, ACHIEVEINFO_COMPLETEDATE, and ACHIEVEINFO_GOTREWARD require the
  7369. specific value returned from 'gettimetick(2)'.
  7370. - Excludes ACHIEVEINFO_LEVEL and ACHIEVEINFO_SCORE.
  7371. ---------------------------------------