script_commands.txt 401 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093
  1. //===== rAthena Documentation================================
  2. //= rAthena Script Commands
  3. //===== By:==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated:========================================
  6. //= 20220308
  7. //===== Description:=========================================
  8. //= A reference manual for the rAthena scripting language.
  9. //= Commands are sorted depending on their functionality.
  10. //===========================================================
  11. This document is a reference manual for all the scripting commands and functions
  12. available in rAthena. It is not a simple tutorial. When people tell you to
  13. "Read The F***ing Manual", they mean this.
  14. This is not a place to teach you basic programming. This document will not teach
  15. you basic programming by itself. It's more of a reference for those who have at
  16. least a vague idea of what they want to do and want to know what tools they have
  17. available to do it. We've tried to keep it as simple as possible, but if you
  18. don't understand it, getting a clear book on programming in general will help
  19. better than yelling around the forum for help.
  20. A little learning never caused anyone's head to explode.
  21. Structure
  22. ---------
  23. The script commands are listed in no particular order, but are grouped by
  24. relative function.
  25. *Name of the command and parameters (if any).
  26. Descriptive text
  27. Small example if possible. Will usually be incomplete, it's there just to
  28. give you an idea of how it works in practice.
  29. To find a specific command, use Ctrl+F, (or whatever keys call up a search
  30. function in whatever you're reading this with) put an asterisk (*) followed by the command
  31. name, and it should find the command description for you.
  32. If you find anything missing, please let us know!
  33. Syntax
  34. ------
  35. Throughout this document, wherever a command wants an argument, it is given in
  36. <angle brackets>. This doesn't mean you should type the angle brackets. If an
  37. argument of a command is optional, it is given in {curly brackets}. You've
  38. doubtlessly seen this convention somewhere. If a command can optionally take
  39. an unspecified number of arguments, you'll see a list like this:
  40. command <argument>{,<argument>...<argument>}
  41. This still means they will want to be separated by commas.
  42. Where a command wants a string, it will be given in "quotes", if it's a number,
  43. it will be given without them. Normally, you can put an expression, like a bunch
  44. of functions or operators returning a value, in (round brackets) instead of most
  45. numbers. Round brackets will not always be required, but they're often a good
  46. idea.
  47. Wherever you refer to a map name, it's always 'map name' (.gat suffix is deprecated).
  48. Script loading structure
  49. ------------------------
  50. Scripts are loaded by the map server as referenced in the 'conf/map_athena.conf'
  51. configuration file, but in the default configuration, it doesn't load any script
  52. files itself. Instead, it loads the file 'npc/(pre-)re/scripts_main.conf' which itself
  53. contains references to other files. The actual scripts are loaded from txt
  54. files, which are linked up like this:
  55. npc: <path to a filename>
  56. Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the
  57. script contained in this file, which will make the script available. No file
  58. will get loaded twice to prevent possible errors.
  59. Another configuration file option of relevance is:
  60. delnpc: <path to a filename>
  61. This will unload a specified script filename from memory, which, while
  62. seemingly useless, may sometimes be required.
  63. Whenever '//' is encountered in a line upon reading, everything beyond this on
  64. that line is considered to be a comment and is ignored. This works wherever you
  65. place it.
  66. // This line will be ignored when processing the script.
  67. Block comments can also be used, where you can place /* and */ between any text you
  68. wish rAthena to ignore.
  69. Example:
  70. /* This text,
  71. * no matter which new line you start
  72. * is ignored, until the following
  73. * symbol is encountered: */
  74. The asterisks (*) in front of each line is a personal preference and is not required.
  75. Upon loading all the files, the server will execute all the top-level commands
  76. in them. No variables exist yet at this point, no commands can be called other
  77. than those given in this section. These commands set up the basic structure - create
  78. NPC objects, spawn monster objects, set map flags, etc. No code is actually
  79. executed at this point. The top-level commands are pretty confusing, since
  80. they aren't structured like you would expect (command name first), but rather,
  81. normally start with a map name.
  82. What's more confusing about the top-level commands is that most of them use a
  83. tab symbol to divide their arguments.
  84. To prevent problems and confusion, the tab symbols are written as '%TAB%'
  85. throughout this document, even though this makes the text a bit less readable.
  86. Using an invisible symbol to denote arguments is one of the bad things about
  87. this language.
  88. Here is a list of valid top-level commands:
  89. ** Set a map flag:
  90. <map name>%TAB%mapflag%TAB%<flag>
  91. This will, upon loading, set a specified map flag on a map you like. These are
  92. normally in files inside 'npc/mapflag' and are loaded first, so by the time the
  93. server's up, all the maps have the flags they should have. Map flags determine
  94. the behavior of the map in various situations. For more details, see 'setmapflag'
  95. and 'doc/mapflags.txt'.
  96. ** Create a permanent monster spawn:
  97. <map name>{,<x>{,<y>{,<xs>{,<ys>}}}}%TAB%monster%TAB%<monster name>{,<monster level>}%TAB%<mob id>,<amount>{,<delay1>{,<delay2>{,<event>{,<mob size>{,<mob ai>}}}}}
  98. Map name is the name of the map the monsters will spawn on. x,y are the
  99. coordinates where the mob should spawn. If xs and ys are non-zero, they
  100. specify the 'radius' of a spawn-rectangle area centered at x,y.
  101. Putting zeros instead of these coordinates will spawn the monsters randomly.
  102. Note this is only the initial spawn zone, as mobs random-walk, they are free
  103. to move away from their specified spawn region.
  104. Monster name is the name the monsters will have on screen, and has no relation
  105. whatsoever to their names anywhere else. It's the mob id that counts, which
  106. identifies monster record in 'mob_db.yml' database of monsters. If the mob name
  107. is given as "--ja--", the 'japanese name' field from the monster database is
  108. used, (which, in rAthena, actually contains an English name) if it's "--en--",
  109. it's the 'english name' from the monster database (which contains an uppercase
  110. name used to summon the monster with a GM command).
  111. You can specify a custom level to use for the mob different from the one of
  112. the database by adjoining the level after the name with a comma. eg:
  113. "Poring,50" for a name will spawn a monster with name Poring and level 50.
  114. Amount is the amount of monsters that will be spawned when this command is
  115. executed, it is affected by spawn rates in 'battle_athena.conf'.
  116. Delay1 and delay2 control monster respawn delays - the first one is the fixed
  117. base respawn time, and the second is random variance on top of the base time.
  118. Both values are given in milliseconds (1000 = 1 second).
  119. Note that the server also enforces a minimum respawn delay of 5 seconds.
  120. Event is a script event to be executed when the mob is killed. The event must
  121. be in the form "NPCName::OnEventName" to execute, and the event name label
  122. should start with "On". As with all events, if the NPC is an on-touch NPC, the
  123. player who triggers the script must be within 'trigger' range for the event to
  124. work.
  125. There are two optional fields for monster size and AI.
  126. Natural enemies for AI monsters are normal monsters.
  127. <mob size> can be:
  128. Size_Small (0)
  129. Size_Medium (1)
  130. Size_Large (2)
  131. <mob ai> can be:
  132. AI_NONE (0) (default)
  133. AI_ATTACK (1) (attack/friendly)
  134. AI_SPHERE (2) (Alchemist skill)
  135. AI_FLORA (3) (Alchemist skill)
  136. AI_ZANZOU (4) (Kagerou/Oboro skill)
  137. AI_LEGION (5) (Sera skill)
  138. AI_FAW (6) (Mechanic skill)
  139. AI_WAVEMODE (7) Normal monsters will ignore attack from AI_WAVEMODE monsters
  140. Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able
  141. to be detected on the map with the SC_BOSSMAPINFO status (used by Convex Mirror).
  142. ** NPC names
  143. /!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
  144. NPC names are kinda special and are formatted this way:
  145. <Display name>{::<Unique name>}
  146. All NPCs need to have a unique name that is used for identification purposes.
  147. When you have to identify a NPC by its name, you should use <Unique name>.
  148. If <Unique name> is not provided, use <Display name> instead.
  149. The client has a special feature when displaying names:
  150. if the display name contains a '#' character, it hides that part of the name.
  151. ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
  152. <Display name> must be at most 24 characters in length.
  153. <Unique name> must be at most 24 characters in length.
  154. ** Define a warp point
  155. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  156. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp2%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  157. This will define a warp NPC that will warp a player between maps, and while most
  158. arguments of that are obvious, some deserve special mention.
  159. SpanX and SpanY will make the warp sensitive to a character who didn't step
  160. directly on it, but walked into a zone which is centered on the warp from
  161. coordinates and is SpanX in each direction across the X axis and SpanY in each
  162. direction across the Y axis.
  163. Warp NPC objects also have a name, because you can use it to refer to them later
  164. with 'enablenpc'/'disablenpc'
  165. Facing of a warp object is irrelevant, it is not used in the code and all
  166. current scripts have a zero in there.
  167. Unlike 'warp', 'warp2' will also be triggered by hidden player.
  168. ** Define an NPC object.
  169. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  170. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  171. This will place an NPC object on a specified map at the specified location, and
  172. is a top-level command you will use the most in your custom scripting. The NPCs
  173. are triggered by clicking on them, and/or by walking in their trigger area, if
  174. defined, see that below.
  175. Facing is a direction the NPC sprite will face in. Not all NPC sprites have
  176. different images depending on the direction you look from, so for some facing
  177. will be meaningless. Facings are counted counterclockwise in increments of 45
  178. degrees, where 0 means facing towards the top of the map. (So to turn the sprite
  179. towards the bottom of the map, you use facing 4, and to make it look southeast
  180. it's facing 5.)
  181. Sprite ID is the sprite number or constant used to display this particular NPC.
  182. You may also use a monster's ID instead to display a monster sprite for this NPC.
  183. It is possible to use a job sprite as well, but you must first define it as a
  184. monster sprite in 'mob_avail.yml', a full description on how to do this is not
  185. in the scope of this manual.
  186. A '-1' Sprite ID will make the NPC invisible (and unclickable).
  187. A '111' Sprite ID will make an NPC which does not have a sprite, but is still
  188. clickable, which is useful if you want to make a clickable object of the 3D
  189. terrain.
  190. TriggerX and triggerY, if given, will define an area, centered on NPC and
  191. spanning triggerX cells in every direction across X and triggerY in every
  192. direction across Y. Walking into that area will trigger the NPC. If no
  193. 'OnTouch:' special label is present in the NPC code, the execution will start
  194. from the beginning of the script, otherwise, it will start from the 'OnTouch:'
  195. label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
  196. used in this case.
  197. The code part is the script code that will execute whenever the NPC is
  198. triggered. It may contain commands and function calls, descriptions of which
  199. compose most of this document. It has to be in curly brackets, unlike elsewhere
  200. where we use curly brackets, these do NOT signify an optional parameter.
  201. ** Define a 'floating' NPC object.
  202. -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  203. This will define an NPC object not triggerable by normal means. This would
  204. normally mean it's pointless since it can't do anything, but there are
  205. exceptions, mostly related to running scripts at specified time, which is what
  206. these floating NPC objects are for. More on that below.
  207. ** Define a shop/cashshop/itemshop/pointshop NPC.
  208. -%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>{,discount},<itemid>:<price>{,<itemid>:<price>...}
  209. <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>{,discount},<itemid>:<price>{,<itemid>:<price>...}
  210. -%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  211. <map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  212. -%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  213. <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  214. -%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  215. <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  216. <map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<stock>{,<itemid>:<price>:<stock>...}
  217. Note: Additionally barter shops can be defined in npc/barters.yml
  218. This will define a shop NPC, which, when triggered (which can only be done by
  219. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  220. NPCs and you can't change the prices otherwise than by editing the script
  221. itself.
  222. The Item ID is the number of item in the 'db/item_db.yml' database. If Price is set
  223. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  224. price you gave will be used for this item, which is how you create differing
  225. prices for items in different shops.
  226. Optionally you can specify the discount option and set it to "yes" or "no", to enable or disable discounting.
  227. There are other types of shops available:
  228. cashshop - use "cashshop" in place of "shop" to use the Cash Shop interface, allowing
  229. you to buy items with special points that are stored as account variables
  230. called #CASHPOINTS and #KAFRAPOINTS. This type of shop will not allow you to sell
  231. items at it, only make purchases. The layout used to define sale items still count, and
  232. "<price>" refers to how many points will be spent purchasing the them.
  233. "itemshop" and "pointshop" use the Shop interface, allowing you to buy items with a specific
  234. item or special points from a variable. 'pointshop' only supports permanent character variables,
  235. temporary character variables, permanent local account variables or permanent global account
  236. variables. These variables must be of integer type, not string. 'discount' flag is an
  237. optional value which makes the price at that shop become affected by discount skill.
  238. "marketshop" can have limited quantity of an item in stock.
  239. Use -1 in the stock field to have unlimited stock in a marketshop.
  240. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  241. warp/warp2: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  242. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  243. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  244. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  245. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  246. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  247. Warp duplicates inherit the target location.
  248. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  249. NPC duplicates inherit the script code.
  250. The rest (name, location, facing, sprite ID, span/trigger area)
  251. is obtained from the definition of the duplicate (not inherited).
  252. ** Define a function object
  253. function%TAB%script%TAB%<function name>%TAB%{<code>}
  254. This will define a function object, callable with the 'callfunc' command (see
  255. below). This object will load on every map server separately, so you can get at
  256. it from anywhere. It's not possible to call the code in this object by
  257. anything other than the 'callfunc' script command.
  258. The code part is the script code that will execute whenever the function is
  259. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  260. we use curly brackets, these do NOT signify an optional parameter.
  261. Once an object is defined which has a 'code' field to its definition, it
  262. contains script commands which can actually be triggered and executed.
  263. ~ RID? GID? ~
  264. What a RID is and why do you need to know
  265. -----------------------------------------
  266. Most scripting commands and functions will want to request data about a
  267. character, store variables referenced to that character, send stuff to the
  268. client connected to that specific character. Whenever a script is invoked by a
  269. character, it is passed a so-called RID - this is the account ID number of a
  270. character that caused the code to execute by clicking on it, walking into its
  271. OnTouch zone, or otherwise.
  272. If you are only writing common NPCs, you don't need to bother with it. However,
  273. if you use functions, if you use timers, if you use clock-based script
  274. activation, you need to be aware of all cases when a script execution can be
  275. triggered without a RID attached. This will make a lot of commands and functions
  276. unusable, since they want data from a specific character, want to send stuff to
  277. a specific client, want to store variables specific to that character, and they
  278. would not know what character to work on if there's no RID.
  279. Unless you use 'attachrid' to explicitly attach a character to the script first.
  280. Whenever we say 'invoking character', we mean 'the character who's RID is
  281. attached to the running script. The script function "playerattached" can be
  282. used to check which is the currently attached player to the script (it will
  283. return 0 if the there is no player attached or the attached player no longer
  284. is logged on to the map-server).
  285. But what about GID?
  286. -------------------
  287. GID stands for the Game ID of something, this can either be the GID obtained
  288. through mobspawn (mob control commands) or the account ID of a character.
  289. Another way would be to right click on a mob, NPC or char as GM sprited char
  290. to view the GID.
  291. See also 'getpetinfo', 'getmercinfo', 'gethominfo', and 'geteleminfo'.
  292. This is mostly used for the new version of skill and the mob control commands
  293. implemented.
  294. Item and pet scripts
  295. --------------------
  296. Each item in the item database has three special fields - Script , EquipScript
  297. and UnEquipScript. The first is script code run every time a character equips the item,
  298. with the RID of the equipping character. Every time they unequip an item, all
  299. temporary bonuses given by the script commands are cleared, and all the scripts
  300. are executed once again to rebuild them. This also happens in several other
  301. situations (like upon login) but the full list is currently unknown.
  302. EquipScript is a piece of script code run whenever the item is used by a character
  303. by double-clicking on it. UnEquipScript runs whenever the
  304. equipment is unequip by a character
  305. Not all script commands work properly in the item scripts. Where commands and
  306. functions are known to be meant specifically for use in item scripts, they are
  307. described as such.
  308. Every pet in the pet database has a PetScript field, which determines pet
  309. behavior. It is invoked wherever a pet of the specified type is spawned.
  310. (hatched from an egg, or loaded from the char server when a character who had
  311. that pet following them connects) This may occur in some other situations as
  312. well. Don't expect anything other than commands definitely marked as usable in
  313. pet scripts to work in there reliably.
  314. Numbers
  315. -------
  316. Beside the common decimal numbers, which are nothing special whatsoever (though
  317. do not expect to use fractions, since ALL numbers are integer in this language),
  318. the script engine also handles hexadecimal numbers, which are otherwise
  319. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  320. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  321. to 'mes 0x10' it will print '16'.
  322. Number values can't exceed the limits of an integer variable: Any number
  323. greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  324. be capped to those values and will cause a warning to be reported.
  325. Variables
  326. ---------
  327. The meat of every programming language is variables - places where you store
  328. data.
  329. In the rAthena scripting language, variable names are not case sensitive.
  330. Variables are divided into and uniquely identified by the combination of:
  331. prefix - determines the scope and extent (or lifetime) of the variable
  332. name - an identifier consisting of '_' and alphanumeric characters
  333. postfix - determines the type of the variable: integer or string
  334. Scope can be:
  335. global - global to all servers
  336. local - local to the server
  337. account - attached to the account of the character identified by RID
  338. character - attached to the character identified by RID
  339. npc - attached to the NPC
  340. scope - attached to the scope of the instance
  341. Extent can be:
  342. permanent - They still exist when the server resets.
  343. temporary - They cease to exist when the server resets.
  344. Prefix: scope and extent
  345. nothing - A permanent variable attached to the character, the default variable
  346. type. They are stored by char-server in the `char_reg_num` and
  347. `char_reg_str`.
  348. "@" - A temporary variable attached to the character.
  349. SVN versions before 2094 revision and RC5 version will also treat
  350. 'l' as a temporary variable prefix, so beware of having variable
  351. names starting with 'l' if you want full backward compatibility.
  352. "$" - A global permanent variable.
  353. They are stored by map-server in database table `mapreg`.
  354. "$@" - A global temporary variable.
  355. This is important for scripts which are called with no RID
  356. attached, that is, not triggered by a specific character object.
  357. "." - A NPC variable.
  358. They exist in the NPC and disappear when the server restarts or the
  359. NPC is reloaded. Can be accessed from inside the NPC or by calling
  360. 'getvariableofnpc'. Function objects can also have .variables which
  361. are accessible from inside the function, however 'getvariableofnpc'
  362. does NOT work on function objects.
  363. ".@" - A scope variable.
  364. They are unique to the instance and scope. Each instance has its
  365. own scope that ends when the script ends. Calling a function with
  366. callsub/callfunc starts a new scope, returning from the function
  367. ends it. When a scope ends, its variables are converted to values
  368. ('return .@var;' returns a value, not a reference).
  369. "'" - An instance variable.
  370. These are used with the instancing system and are unique to each
  371. instance type. Can be accessed from inside the instance or by calling
  372. 'getinstancevar'.
  373. "#" - A permanent local account variable.
  374. They are stored by char-server in the `acc_reg_num` table and
  375. `acc_reg_str`.
  376. "##" - A permanent global account variable stored by the login server.
  377. They are stored in the `global_acc_reg_num` table and
  378. `global_acc_reg_str`.
  379. The only difference you will note from normal # variables is when
  380. you have multiple char-servers connected to the same login server.
  381. The # variables are unique to each char-server, while the ## variables
  382. are shared by all these char-servers.
  383. Postfix: integer or string
  384. nothing - integer variable, can store positive and negative numbers, but only
  385. whole numbers (so don't expect to do any fractional math)
  386. '$' - string variable, can store text
  387. Examples:
  388. name - permanent character integer variable
  389. name$ - permanent character string variable
  390. @name - temporary character integer variable
  391. @name$ - temporary character string variable
  392. $name - permanent global integer variable
  393. $name$ - permanent global string variable
  394. $@name - temporary global integer variable
  395. $@name$ - temporary global string variable
  396. .name - NPC integer variable
  397. .name$ - NPC string variable
  398. .@name - scope integer variable
  399. .@name$ - scope string variable
  400. 'name - instance integer variable
  401. 'name$ - instance string variable
  402. #name - permanent local account integer variable
  403. #name$ - permanent local account string variable
  404. ##name - permanent global account integer variable
  405. ##name$ - permanent global account string variable
  406. If a variable was never set, it is considered to equal zero for integer
  407. variables or an empty string ("", nothing between the quotes) for string
  408. variables. Once you set it to that, the variable is as good as forgotten
  409. forever, and no trace remains of it even if it was stored with character or
  410. account data.
  411. Some variables are special, that is, they are already defined for you by the
  412. scripting engine. You can see the full list in 'src/map/script_constants.hpp', which
  413. is a file you should read, since it also allows you to replace lots of numbered
  414. arguments for many commands with easier to read text. The special variables most
  415. commonly used are all permanent character-based variables:
  416. Zeny - Amount of Zeny.
  417. Hp - Current amount of hit points.
  418. MaxHp - Maximum amount of hit points.
  419. Sp - Current spell points.
  420. MaxSp - Maximum amount of spell points.
  421. StatusPoint - Amount of status points remaining.
  422. SkillPoint - Amount of skill points remaining.
  423. BaseLevel - Character's base level.
  424. JobLevel - Character's job level.
  425. BaseExp - Amount of base experience points.
  426. JobExp - Amount of job experience points.
  427. NextBaseExp - Amount of base experience points needed to reach the next level.
  428. NextJobExp - Amount of job experience points needed to reach the next level.
  429. Weight - Amount of weight the character currently carries.
  430. MaxWeight - Maximum weight the character can carry.
  431. Sex - 0 if female, 1 if male.
  432. Class - Character's job.
  433. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  434. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  435. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  436. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  437. reached a 1-1 class, it will return Job_Novice.
  438. BaseJob - The character's 'normal' job, regardless of Upper value.
  439. For example, this will return Job_Acolyte for Acolyte,
  440. Baby Acolyte, and High Acolyte.
  441. Karma - The character's karma. Karma system is not fully functional, but
  442. this doesn't mean this doesn't work at all. Not tested.
  443. Manner - The character's manner rating. Becomes negative if the player
  444. utters words forbidden through the use of 'manner.txt' client-side
  445. file.
  446. Ap - Current amount of activity points.
  447. MaxAp - Maximum amount of activity points.
  448. While these behave as variables, do not always expect to just set them - it is
  449. not certain whether this will work for all of them. Whenever there is a command
  450. or a function to set something, it's usually preferable to use that instead. The
  451. notable exception is Zeny, which you can and often will address directly -
  452. setting it will make the character own this number of Zeny.
  453. If you try to set Zeny to a negative number, the script will be terminated with an error.
  454. Some source-end constants can also be accessed in scripts. This list is located in
  455. 'src/map/script_constants.hpp', which contains constants such as server defines and status options:
  456. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  457. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  458. VIP_SCRIPT, MIN_STORAGE
  459. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  460. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  461. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  462. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  463. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  464. Assigning variables
  465. --------- ---------
  466. Variables can be accessed and modified much like in other programming languages.
  467. .@x = 100;
  468. .@x = .@y = 100;
  469. Support for modifying variable values using 'set' is still supported (and required
  470. to exist for this new method to work) so previous scripts will continue to work.
  471. When assigning values, all operator methods are supported which exist in the below
  472. 'Operators' section. For instance:
  473. .@x += 100;
  474. .@x -= 100;
  475. .@x *= 2;
  476. .@x /= 2;
  477. .@x %= 5;
  478. .@x >>= 2;
  479. .@x <<= 2;
  480. Will all work. For more information on available operators, see the Operators section
  481. described below. All operators listed there may be placed in-front of the '=' sign
  482. when modifying variables to perform the action as required.
  483. Note:
  484. !! Currently the scripting engine does not support directly copying array variables.
  485. !! In order to copy arrays between variables the use of 'copyarray' function is still
  486. !! required.
  487. Strings
  488. -------
  489. To include symbol '"' in a string you should use prefix '\"'
  490. Arrays
  491. ------
  492. Arrays (in rAthena at least) are essentially a set of variables going under the
  493. same name. You can tell between the specific variables of an array with an
  494. 'array index', a number of a variable in that array:
  495. <variable name>[<array index>]
  496. All variable types can be used as arrays.
  497. Variables stored in this way, inside an array, are also called 'array elements'.
  498. Arrays are specifically useful for storing a set of similar data (like several
  499. item IDs for example) and then looping through it. You can address any array
  500. variable as if it was a normal variable:
  501. set .@arrayofnumbers[0],1;
  502. You can also do things like using a variable (or an expression, or even a
  503. value from another array) to get at an array value:
  504. set .@x,100;
  505. set .@arrayofnumbers[.@x],10;
  506. This will make .@arrayofnumbers[100] equal to 10.
  507. Index numbering always starts with 0 and arrays can hold over 2 billion
  508. variables. As such, the (guaranteed) allowed values for indices are in the
  509. range 0 ~ 2147483647.
  510. And array indexes probably can't be negative. Nobody tested what happens when
  511. you try to get a negatively numbered variable from an array, but it's not going
  512. to be pretty.
  513. Arrays can naturally store strings:
  514. .@menulines$[0] is the 0th element of the .@menulines$ array of strings. Notice
  515. the '$', normally denoting a string variable, before the square brackets that
  516. denotes an array index.
  517. Variable References
  518. -------------------
  519. //##TODO
  520. Operators
  521. ---------
  522. Operators are things you can do to variables and numbers. They are either the
  523. common mathematical operations or conditional operators
  524. + - will add two numbers. If you try to add two strings, the result will be a
  525. string glued together at the +. You can add a number to a string, and the
  526. result will be a string. No other math operators work with strings.
  527. - - will subtract two numbers.
  528. * - will multiply two numbers.
  529. / - will divide two numbers. Note that this is an integer division, i.e.
  530. 7/2 is not equal 3.5, it's equal 3.
  531. % - will give you the remainder of the division. 7%2 is equal to 1.
  532. There are also conditional operators. This has to do with the conditional
  533. command 'if' and they are meant to return either 1 if the condition is satisfied
  534. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  535. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  536. zero will also be True.)
  537. You can compare numbers to each other and you compare strings to each other, but
  538. you can not compare numbers to strings.
  539. == - Is true if both sides are equal. For strings, it means they are the same.
  540. >= - True if the first value is equal to, or greater than, the second value.
  541. <= - True if the first value is equal to, or less than, the second value
  542. > - True if the first value greater than the second value
  543. < - True if the first value is less than the second value
  544. != - True if the first value IS NOT equal to the second one
  545. Examples:
  546. 1 == 1 is True.
  547. 1<2 is True while 1>2 is False.
  548. .@x>2 is True if .@x is equal to 3. But it isn't true if .@x is 2.
  549. Only ' == ' and '!=' have been tested for comparing strings. Since there's no way
  550. to code a seriously complex data structure in this language, trying to sort
  551. strings by alphabet would be pointless anyway.
  552. Comparisons can be stacked in the same condition:
  553. && - Is True if and only if BOTH sides are true.
  554. ('1 == 1 && 2 == 2' is true. '2 == 1 && 1 == 1' is false.)
  555. || - Is True if either side of this expression is True.
  556. 1 == 1 && 2 == 2 is True.
  557. 1 == 1 && 2 == 1 is False.
  558. 1 == 1 || 2 == 1 is True.
  559. Logical bitwise operators work only on numbers, and they are the following:
  560. << - Left shift.
  561. >> - Right shift.
  562. Left shift moves the binary 1(s) of a number n positions to the left,
  563. which is the same as multiplying by 2, n times.
  564. In the other hand, Right shift moves the binary 1(s) of a number n positions
  565. to the right, which is the same as dividing by 2, n times.
  566. Example:
  567. set b,2;
  568. set a, b << 3;
  569. mes a;
  570. set a, a >> 2;
  571. mes a;
  572. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  573. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  574. & - And.
  575. | - Or.
  576. The bitwise operator AND (&) is used to test two values against each other,
  577. and results in setting bits which are active in both arguments. This can
  578. be used for a few things, but in rAthena this operator is usually used to
  579. create bit-masks in scripts.
  580. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  581. of one of the numbers is 1. This way a variable can hold several values we can check,
  582. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  583. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  584. that a player can have.
  585. A bit-mask basically is (ab)using the variables bits to set various options in
  586. one variable. With the current limit if variables it is possible to store 32
  587. different options in one variable (by using the bits on position 0 to 31).
  588. Example(s):
  589. - Basic example of the & operator, bit example:
  590. 10 & 2 = 2
  591. Why? :
  592. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  593. 2 = 2^1 (2), so in bits (same size) it would be 0010
  594. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  595. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  596. 0010, which is 2.
  597. - Basic example of creating and using a bit-mask:
  598. set .@options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  599. if (.@options & 1) mes "Option 1 is activated";
  600. if (.@options & 2) mes "Option 2 is activated";
  601. if (.@options & 4) mes "Option 3 is activated";
  602. if (.@options & 8) mes "Option 4 is activated";
  603. if (.@options & 16) mes "Options 5 is activated";
  604. This would return the messages about option 2, 3 and 5 being shown (since we've set
  605. the 2,4 and 16 bit to 1).
  606. ^ - Xor.
  607. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  608. numbers have the same value in the said position. On the other hand, it
  609. sets to 1 if they have different values in the said binary position.
  610. This is another way of setting and unsetting bits in bit-masks.
  611. Example:
  612. - First let's set the quests that are currently in progress:
  613. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  614. - After playing for a bit, the player starts another quest:
  615. if (inProgress&2 == 0) {
  616. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  617. set inProgress,inProgress^2;
  618. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  619. close;
  620. }
  621. - After spending some time reading info on Xor's, the player finally completes quest 1:
  622. if (inProgress&1 && isComplete) {
  623. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  624. set inProgress,inProgress^1;
  625. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  626. close;
  627. }
  628. Unary operators with only with a single number, which follows the operator, and
  629. are following:
  630. - - Negation.
  631. The sign of the number will be reversed. If the number was positive, it will
  632. become negative and vice versa.
  633. Example:
  634. set .@myvar,10;
  635. mes "Negative 10 is " + (-.@myvar);
  636. ! - Logical Not.
  637. Reverses the boolean result of an expression. True will become false and
  638. false will become true.
  639. Example:
  640. if (!callfunc("F_dosomething"))
  641. {
  642. mes "Doing something failed.";
  643. close;
  644. }
  645. ~ - Bitwise Not.
  646. Reverses each bit in a number, also known as one's complement. Cleared bits
  647. are set, and set bits are cleared.
  648. Example:
  649. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  650. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  651. Ternary operators take three expressions (numbers, strings or boolean), and are
  652. following:
  653. ?: - Conditional operator
  654. Very useful e.g. to replace
  655. if (Sex) mes "..."; else mes "...";
  656. clauses with simple
  657. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  658. or to replace any other simple if-else clauses. It might be worth
  659. mentioning that ?: has low priority and has to be enclosed with
  660. parenthesis in most (if not all) cases.
  661. Labels
  662. ------
  663. Within executable script code, some lines can be labels:
  664. <label name>:
  665. Labels are points of reference in your script, which can be used to route
  666. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  667. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  668. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  669. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  670. under 22 characters could be wise. It may only contain alphanumeric characters
  671. and underscore. In addition to labels you name yourself, there are also some
  672. special labels which the script engine will start execution from if a special
  673. event happens:
  674. OnClock<hour><minute>:
  675. OnMinute<minute>:
  676. OnHour<hour>:
  677. On<weekday><hour><minute>:
  678. OnDay<month><day>:
  679. This will execute when the server clock hits the specified date or time. Hours
  680. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  681. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  682. Remember the zero.
  683. OnInit:
  684. OnInterIfInit:
  685. OnInterIfInitOnce:
  686. OnInit will execute every time the scripts loading is complete, including when
  687. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  688. the map server connects to a char server, OnInterIfInitOnce will only execute
  689. once and will not execute if the map server reconnects to the char server later.
  690. OnAgitStart:
  691. OnAgitEnd:
  692. OnAgitInit:
  693. OnAgitStart2:
  694. OnAgitEnd2:
  695. OnAgitInit2:
  696. OnAgitStart3:
  697. OnAgitEnd3:
  698. OnAgitInit3:
  699. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  700. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  701. will do likewise for the end of WoE.
  702. OnAgitInit will run when data for all castles and all guilds that hold a castle
  703. is received by map-server from the char-server after initial connect.
  704. No RID will be attached while any of the above mentioned labels are triggered, so
  705. no character or account-based variables will be accessible, until you attach a
  706. RID with 'attachrid' (see below).
  707. The above also applies to, the last three labels, the only difference is that
  708. these labels are used exclusively for WoE SE, and are called independently.
  709. OnInstanceInit:
  710. This label will be executed when an instance is created and initialized through
  711. the 'instance_create' command. It will run again if @reloadscript is used while
  712. an instance is in progress.
  713. OnInstanceDestroy:
  714. This label will be executed when an instance is destroyed by a timeout, exceeding
  715. the keepalive time or through the 'instance_destroy' command. It will be called
  716. exactly before the instance will be destroyed and all other NPCs of the instance
  717. will still be available at this point of time.
  718. OnTouch:
  719. This label will be executed if a trigger area is defined for the NPC object it's
  720. in. If it isn't present, the execution will start from the beginning of the NPC
  721. code. The RID of the triggering character object will be attached.
  722. OnTouch_:
  723. Similar to OnTouch, but will only run one instance. Another character is
  724. chosen once the triggering character leaves the area.
  725. OnTouchNPC:
  726. Similar to OnTouch, but will only trigger for monsters. For this case, by using
  727. 'getattachedrid' will returns GID (ID that returned when use 'monster').
  728. OnPCLoginEvent:
  729. OnPCLogoutEvent:
  730. OnPCBaseLvUpEvent:
  731. OnPCJobLvUpEvent:
  732. It's pretty obvious when these four special labels will be invoked.
  733. OnPCDieEvent:
  734. This special label triggers when a player dies. The variable 'killerrid' is
  735. set to the ID of the killer.
  736. OnPCKillEvent:
  737. This special label triggers when a player kills another player. The variable
  738. 'killedrid' is set to the ID of the player killed.
  739. OnNPCKillEvent:
  740. This special label triggers when a player kills a monster without label.
  741. The variable 'killedrid' is set to the Class (mob ID) of the monster killed.
  742. The variable 'killedgid' is set to the ID (unique mob game ID) of the monster killed.
  743. OnPCLoadMapEvent:
  744. This special label triggers when a player steps in a map marked with the
  745. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  746. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  747. every time a player would change maps. Imagine the server load with 1,000 players
  748. (oh the pain...)
  749. OnWhisperGlobal:
  750. This special label triggers when a player whispers the NPC, and will run with the
  751. player's RID attached. It can accept up to ten parameters, which will be stored
  752. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  753. See 'doc/whisper_sys.txt' for further documentation.
  754. Only the special labels which are not associated with any script command are
  755. listed here. There are other kinds of labels which may be triggered in a similar
  756. manner, but they are described with their associated commands.
  757. OnNaviGenerate:
  758. This special label triggers when running the map-server-generator binary. It is used
  759. in combination with 'naviregisterwarp' to register extra warps for an npc.
  760. On<label name>:
  761. These special labels are used with Mob scripts mostly, and script commands
  762. that requires you to point/link a command to a mob or another NPC, giving a label
  763. name to start from. The label name can be any of your liking, but must be
  764. started with "On".
  765. Example:
  766. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  767. amatsu,13,152,4 script Master 767,{
  768. mes "Hi there";
  769. close;
  770. OnThisMobDeath:
  771. announce "Hey, " + strcharinfo(0) + " just killed a Poringz0rd!",bc_blue|bc_all;
  772. end;
  773. }
  774. Each time you kill one, that announce will appear in blue to everyone.
  775. "Global" labels
  776. There's a catch with labels and doevent. If you call a label (using doevent)
  777. and called label is in NPC that has trigger area, that label must end with
  778. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  779. usually happens since otherwise there would be no point calling the label with
  780. doevent, because OnTouch would do the job). For further reference look for
  781. npc_event in npc.cpp.
  782. Scripting commands and functions
  783. --------------------------------
  784. The commands and functions are listed here in no particular order. There's a
  785. difference between commands and functions - commands leave no 'return value'
  786. which might be used in a conditional statement, as a command argument, or stored
  787. in a variable. Calling commands as if they were functions will sometimes work,
  788. but is not advised, as this can lead to some hard to track errors. Calling
  789. functions as if they were commands will mess up the stack, so 'return' command
  790. will not return correctly after this happens in a particular script.
  791. All commands must end with a ';'.
  792. -------------------------
  793. From here on, we will have the commands sorted as follow:
  794. 1.- Basic commands.
  795. 2.- Information-retrieving commands.
  796. 3.- Checking commands.
  797. 4.- Player-related commands.
  798. 5.- Mob / NPC -related commands.
  799. 6.- Other commands.
  800. 7.- Instance commands.
  801. 8.- Quest Log commands.
  802. 9.- Battleground commands.
  803. 10.- Pet commands.
  804. 10.1.- The Pet AI commands.
  805. 11.- Homunculus commands.
  806. 12.- Mercenary commands.
  807. 13.- Party commands.
  808. 14.- Channel commands.
  809. 15.- Achievement commands.
  810. =====================
  811. |1.- Basic commands.|
  812. =====================
  813. ---------------------------------------
  814. *mes "<string>"{,"<string>"{,...}};
  815. This command will display a box on the screen for the invoking character, if no
  816. such box is displayed already, and will print the string specified into that
  817. box. There is normally no 'close' or 'next' button on this box, unless you
  818. create one with 'close' or 'next', and while it's open the player can't do much
  819. else, so it's important to create a button later. If the string is empty, it
  820. will show up as an empty line.
  821. mes "Text that will appear in the box";
  822. Colors
  823. ------
  824. Inside the string you may put color codes, which will alter the color of the
  825. text printed after them. The color codes are all '^<R><G><B>' and contain three
  826. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  827. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  828. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  829. whenever the client is drawing windows on screen, so printing text in that color
  830. will have kind of a weird effect. Once you've set a text's color to something,
  831. you have to set it back to black unless you want all the rest of the text be in
  832. that color:
  833. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  834. Notice that the text coloring is handled purely by the client. If you use non-
  835. English characters, the color codes might get screwed if they stick to letters
  836. with no intervening space. Separating them with spaces from the letters on
  837. either side solves the problem.
  838. Multiple Lines
  839. --------------
  840. To display multiple lines of message while only using a single 'mes' command,
  841. use the script command in the following format:
  842. mes "Line 1", "Line 2", "Line 3";
  843. This will display 3 different lines while only consuming a single line in
  844. the relevant script file.
  845. Navigation
  846. ----------
  847. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  848. using HTML-like labels:
  849. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  850. The "flag" parameter can be:
  851. 0: Do not open Navigation Window (default).
  852. 1: Open Navigation Window.
  853. The example below will make the [Tool Shop] text clickable and begin navigation
  854. to alberta (98,154) when clicked.
  855. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  856. See also 'navigateto', which can be used for certain NPC events.
  857. Items
  858. -----
  859. You can refer to items by using HTML-like links to certain items:
  860. <ITEMLINK>Display Name<INFO>Item ID</INFO></ITEMLINK>
  861. Where <Display Name> is the name that will be displayed for your link and
  862. <Item ID> being the ID of the item you want to link to when clicked.
  863. In 2015 the tag name was changed to <ITEM> resulting in the following syntax:
  864. <ITEM>Display Name<INFO>Item ID</INFO></ITEM>
  865. The following sample will open a preview window for Red Potion:
  866. mes "Did you ever consume a <ITEMLINK>Red Potion<INFO>501</INFO></ITEMLINK>?";
  867. // Or in 2015:
  868. mes "Did you ever consume a <ITEM>Red Potion<INFO>501</INFO></ITEM>?";
  869. NOTE: Be aware that item links are rendered incorrectly in 2015+ clients at the moment.
  870. URLs
  871. ----
  872. Similarly, you can create links to websites that launch in a new window:
  873. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  874. Quests
  875. ------
  876. You can link to a quest:
  877. <QUEST>Quest<INFO>1</INFO></QUEST>
  878. Message
  879. -------
  880. You can show a message from the msgstringtable:
  881. <MSG>1</MSG>
  882. Tips
  883. ----
  884. You can show a tip box:
  885. <TIPBOX>Show Tip<INFO>1</INFO></TIPBOX>
  886. ---------------------------------------
  887. *next;
  888. This command will display a 'next' button in the message window for the
  889. invoking character. Clicking on it will cause the window to clear and display
  890. a new one. Used to segment NPC-talking, next is often used in combination with
  891. 'mes' and 'close'.
  892. If no window is currently on screen, one will be created, but once the invoking
  893. character clicks on it, a warning is thrown on the server console and the script
  894. will terminate.
  895. mes "[Woman]";
  896. mes "This would appear on the page";
  897. next;
  898. // This is needed since it is a new page and the top will now be blank
  899. mes "[Woman]";
  900. mes "This would appear on the 2nd page";
  901. ---------------------------------------
  902. *clear;
  903. This command will clear the dialog text and continue the script without player interaction.
  904. Example:
  905. mes "This is how the 'clear' script command works.";
  906. sleep2 3000;
  907. clear; // This will clear the dialog and continue to the next one.
  908. mes "I will show you again.";
  909. sleep2 3000;
  910. clear;
  911. mes "Bye!";
  912. close;
  913. ---------------------------------------
  914. *close;
  915. This command will create a 'close' button in the message window for the invoking
  916. character. If no window is currently on screen, the script execution will end. This is one
  917. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  918. script execution will end, and the message box will disappear.
  919. mes "[Woman]";
  920. mes "I am finished talking to you. Click the close button.";
  921. close;
  922. mes "This command will not run at all, since the script has ended.";
  923. ---------------------------------------
  924. *close2;
  925. This command will create a 'close' button in the message window for the invoking
  926. character. WARNING: If no window is currently on screen, the script execution will halt
  927. indefinitely! See 'close'. There is one important difference, though - even though
  928. the message box will have closed, the script execution will not stop, and commands after
  929. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  930. make it stop in some other manner.
  931. mes "[Woman]";
  932. mes "I will warp you now.";
  933. close2;
  934. warp "place",50,50;
  935. end;
  936. Don't expect things to run smoothly if you don't make your scripts 'end'.
  937. ---------------------------------------
  938. *end;
  939. This command will stop the execution for this particular script. The two
  940. versions are perfectly equivalent. It is the normal way to end a script which
  941. does not use 'mes'.
  942. if (BaseLevel <= 10)
  943. npctalk "Look at that you are still a n00b";
  944. else if (BaseLevel <= 20)
  945. npctalk "Look at that you are getting better, but still a n00b";
  946. else if (BaseLevel <= 30)
  947. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  948. else if (BaseLevel <= 40)
  949. npctalk "Look at that you are almost 2nd profession";
  950. end;
  951. Without the use of 'end' it would travel through the labels until the end of the
  952. script. If you were lvl 10 or less, you would see all the speech lines, the use
  953. of 'end' stops this, and ends the script.
  954. ---------------------------------------
  955. *set <variable>,<expression>{,<char_id>};
  956. *set(<variable>,<expression>{,<char id>})
  957. This command will set a variable to the value that the expression results in.
  958. Variables may either be set through this command or directly, much like any
  959. other programming language (refer to the "Assigning variables" section).
  960. This is the most basic script command and is used a lot whenever you try to do
  961. anything more advanced than just printing text into a message box.
  962. set .@x,100;
  963. will make .@x equal 100.
  964. set .@x,1+5/8+9;
  965. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  966. integer in this language) and make .@x equal it.
  967. Returns the variable reference (since trunk r12870).
  968. ---------------------------------------
  969. *setd "<variable name>",<value>{,<char_id>};
  970. Works almost identically as set, except the variable name is identified as a string
  971. and can thus be constructed dynamically.
  972. This command is equivalent to:
  973. set getd("variable name"),<value>;
  974. Examples:
  975. setd ".@var$", "Poporing";
  976. mes .@var$; // Displays "Poporing".
  977. setd ".@" + .@var$ + "123$", "Poporing is cool";
  978. mes .@Poporing123$; // Displays "Poporing is cool".
  979. NOTE:
  980. 'char_id' only works for non-server variables.
  981. Player with Character ID 'char_id' must be online.
  982. ---------------------------------------
  983. *getd("<variable name>")
  984. Returns a reference to a variable, the name can be constructed dynamically.
  985. Refer to 'setd' for usage.
  986. This can also be used to set an array dynamically:
  987. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  988. Examples:
  989. set getd("$varRefence"), 1;
  990. set .@i, getd("$" + "pikachu");
  991. ---------------------------------------
  992. *getvariableofnpc(<variable>,"<npc name>")
  993. Returns a reference to a NPC variable (. prefix) from the target NPC.
  994. This can only be used to get . variables.
  995. Examples:
  996. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  997. getvariableofnpc(.var,"TargetNPC");
  998. //This will set the .v variable to the value of the TargetNPC's .var variable.
  999. set .v, getvariableofnpc(.var,"TargetNPC");
  1000. //This will set the .var variable of TargetNPC to 1.
  1001. set getvariableofnpc(.var,"TargetNPC"), 1;
  1002. Note: even though function objects can have .variables,
  1003. getvariableofnpc will not work on them.
  1004. ---------------------------------------
  1005. *getvar <variable>,<char_id>;
  1006. Get variable value from the specified player. Only player/account variables
  1007. are allowed to be used (temporary character variable "@", permanent
  1008. character "", permanent local account "#", and permanent global account "##").
  1009. ---------------------------------------
  1010. *goto <label>;
  1011. This command will make the script jump to a label, usually used in conjunction
  1012. with other command, such as "if", but often used on its own.
  1013. ...
  1014. goto Label;
  1015. mes "This will not be seen";
  1016. end;
  1017. Label:
  1018. mes "This will be seen";
  1019. end;
  1020. This command should be avoided and only used if there is no other option.
  1021. ---------------------------------------
  1022. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  1023. This command will create a selectable menu for the invoking character. Only one
  1024. menu can be on screen at the same time.
  1025. Depending on what the player picks from the menu, the script execution will
  1026. continue from the corresponding label. (it's string-label pairs, not label-
  1027. string)
  1028. Options can be grouped together, separated by the character ':'.
  1029. menu "A:B",L_Wrong,"C",L_Right;
  1030. It also sets a special temporary character variable @menu, which contains the
  1031. number of option the player picked. (Numbering of options starts at 1.)
  1032. This number is consistent with empty options and grouped options.
  1033. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  1034. L_Wrong:
  1035. // If they click "A" or "B" they will end up here
  1036. // @menu == 1 if "A"
  1037. // @menu == 2 will never happen because the option is empty
  1038. // @menu == 3 if "B"
  1039. L_Impossible:
  1040. // Empty options are not displayed and therefore can't be selected
  1041. // this label will never be reached from the menu command
  1042. L_Right:
  1043. // If they click "C" they will end up here
  1044. // @menu == 5
  1045. If a label is '-', the script execution will continue right after the menu
  1046. command if that option is selected, this can be used to save you time, and
  1047. optimize big scripts.
  1048. menu "A::B:",-,"C",L_Right;
  1049. // If they click "A" or "B" they will end up here
  1050. // @menu == 1 if "A"
  1051. // @menu == 3 if "B"
  1052. L_Right:
  1053. // If they click "C" they will end up here
  1054. // @menu == 5
  1055. Both these examples will perform the exact same task.
  1056. If you give an empty string as a menu item, the item will not display. This
  1057. can effectively be used to script dynamic menus by using empty string for
  1058. entries that should be unavailable at that time.
  1059. You can do it by using arrays, but watch carefully - this trick isn't high
  1060. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1061. until you understand how it works.
  1062. Create a temporary array of strings to contain your menu items, and populate it
  1063. with the strings that should go into the menu at this execution, making sure not
  1064. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1065. this:
  1066. setarray .@possiblemenuitems$[0],<list of potential menu items>;
  1067. .@j = 0; // That's the menu lines counter.
  1068. // We loop through the list of possible menu items.
  1069. // .@i is our loop counter.
  1070. for( .@i = 0; .@i < getarraysize(.@possiblemenuitems$); .@i++ )
  1071. {
  1072. // That 'condition' is whatever condition that determines whether
  1073. // a menu item number .@i actually goes into the menu or not.
  1074. if (<condition>)
  1075. {
  1076. // We record the option into the list of options actually available.
  1077. .@menulist$[@j] = .@possiblemenuitems$[@i];
  1078. // We just copied the string, we do need its number for later
  1079. // though, so we record it as well.
  1080. .@menureference[@j] = .@i;
  1081. // Since we've just added a menu item into the list, we increment
  1082. // the menu lines counter.
  1083. .@j++;
  1084. }
  1085. // We go on to the next possible menu item.
  1086. }
  1087. This will create you an array .@menulist$ which contains the text of all items
  1088. that should actually go into the menu based on your condition, and an array
  1089. .@menureference, which contains their numbers in the list of possible menu items.
  1090. (Remember, arrays start with 0.) There's less of them than the possible menu
  1091. items you've defined, but the menu command can handle the empty lines - only if
  1092. they are last in the list, and if it's made this way, they are. Now comes a
  1093. dirty trick:
  1094. // X is whatever the most menu items you expect to handle.
  1095. menu .@menulist$[0],-,.@menulist$[1],-,...,.@menulist$[<X>],-;
  1096. This calls up a menu of all your items. Since you didn't copy some of the
  1097. possible menu items into the list, its end is empty and so no menu items will
  1098. show up past the end. But this menu call doesn't jump anywhere, it just
  1099. continues execution right after the menu command. (And it's a good thing it
  1100. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1101. know which ones to define if you don't know beforehand which options will end up
  1102. where in your menu?)
  1103. But how do you figure out which option the user picked? Enter the @menu.
  1104. @menu contains the number of option that the user selected from the list,
  1105. starting with 1 for the first option. You know now which option the user picked
  1106. and which number in your real list of possible menu items it translated to:
  1107. mes "You selected " + .@possiblemenuitems$[.@menureference[@menu-1]] + "!";
  1108. @menu is the number of option the user picked.
  1109. @menu-1 is the array index for the list of actually used menu items that we
  1110. made.
  1111. .@menureference[@menu-1] is the number of the item in the array of possible menu
  1112. items that we've saved just for this purpose.
  1113. And .@possiblemenuitems$[.@menureference[@menu-1]] is the string that we used to
  1114. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1115. You can set up a bunch of 'if (.@menureference[@menu-1] == X) goto Y' statements to
  1116. route your execution based on the line selected and still generate a different
  1117. menu every time, which is handy when you want to, for example, make users select
  1118. items in any specific order before proceeding, or make a randomly shuffled menu.
  1119. Kafra code bundled with the standard distribution uses a similar array-based
  1120. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1121. probably since that wasn't documented anywhere.
  1122. See also 'select', which is probably better in this particular case. Instead of
  1123. menu, you could use 'select' like this:
  1124. .@dummy = select(.@menulist$[0],.@menulist$[1],...,.@menulist$[<X>]);
  1125. For the purposes of the technique described above these two statements are
  1126. perfectly equivalent.
  1127. ---------------------------------------
  1128. *select("<option>"{,"<option>",...})
  1129. *prompt("<option>"{,"<option>",...})
  1130. This function is a handy replacement for 'menu' for some specific cases where
  1131. you don't want a complex label structure - like, for example, asking simple yes-
  1132. no questions. It will return the number of menu option picked, starting with 1.
  1133. Like 'menu', it will also set the variable @menu to contain the option the user
  1134. picked.
  1135. if (select("Yes:No" ) == 1)
  1136. mes "You said yes, I know.";
  1137. And like 'menu', the selected option is consistent with grouped options
  1138. and empty options.
  1139. 'prompt' works almost the same as select, except that when a character clicks
  1140. the Cancel button, this function will return 255 instead.
  1141. ---------------------------------------
  1142. *input(<variable>{,<min>{,<max>}})
  1143. This command will make an input box pop up on the client connected to the
  1144. invoking character, to allow entering of a number or a string. This has many
  1145. uses, one example would be a guessing game, also making use of the 'rand'
  1146. function:
  1147. mes "[Woman]";
  1148. mes "Try and guess the number I am thinking of.";
  1149. mes "The number will be between 1 and 10.";
  1150. next;
  1151. .@number = rand(1,10);
  1152. input .@guess;
  1153. if (.@guess == .@number) {
  1154. mes "[Woman]";
  1155. mes "Well done, that was the number I was thinking of!";
  1156. close;
  1157. } else {
  1158. mes "[Woman]";
  1159. mes "Sorry, that wasn't the number I was thinking of.";
  1160. close;
  1161. }
  1162. If you give the input command a string variable to put the input in, it will
  1163. allow the player to enter text. Otherwise, only numbers will be allowed.
  1164. mes "[Woman]";
  1165. mes "Please say HELLO";
  1166. next;
  1167. input .@var$;
  1168. if (.@var$ == "HELLO") {
  1169. mes "[Woman]";
  1170. mes "Well done, you typed it correctly.";
  1171. close;
  1172. } else {
  1173. mes "[Woman]";
  1174. mes "Sorry, you got it wrong.";
  1175. close;
  1176. }
  1177. Normally you may not input a negative number with this command.
  1178. This is done to prevent exploits in badly written scripts, which would
  1179. let people, for example, put negative amounts of Zeny into a bank script and
  1180. receive free Zeny as a result.
  1181. Since trunk r12192 the command has two optional arguments and a return value.
  1182. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1183. 'input_max_value' in script_athena.conf.
  1184. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1185. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1186. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1187. shorter than 'min' and 0 otherwise.
  1188. ---------------------------------------
  1189. *callfunc "<function>"{,<argument>,...<argument>};
  1190. *callfunc("<function>"{,<argument>,...<argument>})
  1191. This command lets you call up a function NPC. A function NPC can be called from
  1192. any script on any map server. Using the 'return' command it will come back to
  1193. the place that called it.
  1194. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1195. mes "[Woman]"
  1196. mes "Let's see if you win...";
  1197. callfunc "funcNPC";
  1198. mes "Well done, you have won!";
  1199. close;
  1200. }
  1201. function%TAB%script%TAB%funcNPC%TAB%{
  1202. .@win = rand(2);
  1203. if (.@win == 0)
  1204. return;
  1205. mes "Sorry, you lost.";
  1206. close;
  1207. }
  1208. You can pass arguments to your function - values telling it what exactly to do -
  1209. which will be available there with getarg() (see 'getarg')
  1210. Notice that returning is not mandatory, you can end execution right there.
  1211. If you want to return a real value from inside your function NPC, it is better
  1212. to write it in the function form, which will also work and will make the script
  1213. generally cleaner:
  1214. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1215. mes "[Man]"
  1216. mes "Gimme a number!";
  1217. next;
  1218. input .@number;
  1219. if (callfunc("OddFunc",.@number)) mes "It's Odd!";
  1220. close;
  1221. }
  1222. function%TAB%script%TAB%OddFunc%TAB%{
  1223. if (getarg(0)%2 == 0)
  1224. return 0;// it's even
  1225. return 1;// it's odd
  1226. }
  1227. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1228. may be called directly without the use of the 'callfunc' script command.
  1229. function<tab>script<tab>SayHello<tab>{
  1230. mes "Hello " + getarg(0);
  1231. return 0;
  1232. }
  1233. place,50,50,6<tab>script<tab>Man<tab>115,{
  1234. mes "[Man]";
  1235. SayHello strcharinfo(0);
  1236. close;
  1237. }
  1238. Note:
  1239. !! A user-defined function must be declared /before/ a script attempts to
  1240. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1241. !! (or loaded in a separate file first) before attempting to call them directly.
  1242. ---------------------------------------
  1243. *callsub <label>{,<argument>,...<argument>};
  1244. *callsub(<label>{,<argument>,...<argument>})
  1245. This command will go to a specified label within the current script (do NOT use
  1246. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1247. arguments given, if any, which can be recovered there with 'getarg'. When done
  1248. there, you should use the 'return' command to go back to the point from where
  1249. this label was called. This is used when there is a specific thing the script
  1250. will do over and over, this lets you use the same bit of code as many times as
  1251. you like, to save space and time, without creating extra NPC objects which are
  1252. needed with 'callfunc'. A label is not callable in this manner from another
  1253. script.
  1254. Example 1: callsub for checking (if checks pass, return to script)
  1255. callsub S_CheckFull, "guild_vs2",50;
  1256. switch( rand(4) ) {
  1257. case 0: warp "guild_vs2",9,50; end;
  1258. case 1: warp "guild_vs2",49,90; end;
  1259. case 2: warp "guild_vs2",90,50; end;
  1260. case 3: warp "guild_vs2",49,9; end;
  1261. }
  1262. ...
  1263. S_CheckFull:
  1264. if (getmapusers(getarg(0)) >= getarg(1)) {
  1265. mes "I'm sorry, this arena is full. Please try again later.";
  1266. close;
  1267. }
  1268. return;
  1269. Example 2: callsub used repeatedly, with different arguments
  1270. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1271. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos")) {
  1272. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1273. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1274. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1275. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1276. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1277. // etc
  1278. }
  1279. ...
  1280. S_DunWarp:
  1281. // getarg(0) = "map name"
  1282. // getarg(1) = x
  1283. // getarg(2) = y
  1284. if (Zeny >= 100) {
  1285. Zeny -= 100;
  1286. warp getarg(0),getarg(1),getarg(2);
  1287. } else {
  1288. mes "Dungeon warp costs 100 Zeny.";
  1289. }
  1290. close;
  1291. ---------------------------------------
  1292. *getarg(<index>{,<default_value>})
  1293. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1294. call you can specify variables that will make that call different from another
  1295. one. This function will return an argument the function or subroutine was
  1296. called with, and is the normal way to get them.
  1297. This is another thing that can let you use the same code more than once.
  1298. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1299. If no such argument was given, a zero is returned.
  1300. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1301. mes "[Woman]";
  1302. mes "Let's see if you win...";
  1303. callfunc "funcNPC",2;
  1304. mes "Well done, you have won!";
  1305. close;
  1306. }
  1307. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1308. mes "[Woman]";
  1309. mes "Let's see if you win...";
  1310. callfunc "funcNPC",5;
  1311. mes "Well done, you have won!";
  1312. close;
  1313. }
  1314. function%TAB%script%TAB%funcNPC%TAB%{
  1315. .@win = rand(getarg(0));
  1316. if (.@win == 0) return;
  1317. mes "Sorry, you lost.";
  1318. close;
  1319. |
  1320. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1321. stated as 2, so when the random number is generated by the 'rand' function, it
  1322. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1323. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1324. "woman2" less likely to say the player won.
  1325. You can pass multiple arguments in a function call:
  1326. callfunc "funcNPC",5,4,3;
  1327. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1328. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1329. If the target argument exists, it is returned.
  1330. Otherwise, if <default_value> is present it is returned instead,
  1331. if not the script terminates immediately.
  1332. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1333. ---------------------------------------
  1334. *getargcount()
  1335. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1336. call you can specify arguments. This function will return the number of arguments
  1337. provided.
  1338. Example:
  1339. callfunc "funcNPC",5,4,3;
  1340. ...
  1341. function%TAB%script%TAB%funcNPC%TAB%{
  1342. .@count = getargcount(); // 3
  1343. ...
  1344. }
  1345. ---------------------------------------
  1346. *return {<value>};
  1347. This command causes the script execution to leave previously called function
  1348. with callfunc or script with callsub and return to the location, where the call
  1349. originated from. Optionally a return value can be supplied, when the call was
  1350. done using the function form.
  1351. Using this command outside of functions or scripts referenced by callsub will
  1352. result in error and termination of the script.
  1353. callfunc "<your function>";// when nothing is returned
  1354. set <variable>,callfunc("<your function>");// when a value is being returned
  1355. ---------------------------------------
  1356. *function <function name>;
  1357. *<function name>{(<argument>,...<argument>)};
  1358. *function <function name> {
  1359. <code>
  1360. }
  1361. This works like callfunc, and is used for cleaner and faster scripting. The function
  1362. must be defined and used within a script, and works like a label with arguments.
  1363. Note that the name may only contain alphanumeric characters and underscore.
  1364. Usage:
  1365. 1. Declare the function.
  1366. function <function name>;
  1367. 2. Call the function anywhere within the script.
  1368. It can also return a value when used with parentheses.
  1369. <function name>;
  1370. 3. Define the function within the script.
  1371. <function name> {<code>}
  1372. Example:
  1373. prontera,154,189,4 script Item Seller 767,{
  1374. /* Function declaration */
  1375. function SF_Selling;
  1376. if (Zeny > 50) {
  1377. mes "Welcome!";
  1378. /* Function call */
  1379. SF_Selling;
  1380. }
  1381. else mes "You need 50z, sorry!";
  1382. close;
  1383. /* Function definition */
  1384. function SF_Selling {
  1385. mes "Would you like to buy a phracon for 50z?";
  1386. next;
  1387. if (select("Yes","No, thanks") == 1) {
  1388. Zeny -= Zeny;
  1389. getitem 1010,1;
  1390. mes "Thank you!";
  1391. }
  1392. return;
  1393. }
  1394. }
  1395. Example with parameters and return value:
  1396. prontera,150,150,0 script TestNPC 123,{
  1397. /* Function declaration */
  1398. function MyAdd;
  1399. mes "Enter two numbers.";
  1400. next;
  1401. input .@a;
  1402. input .@b;
  1403. /* Function call */
  1404. mes .@a + " + " + .@b + " = " + MyAdd(.@a,.@b);
  1405. close;
  1406. /* Function definition */
  1407. function MyAdd {
  1408. return getarg(0)+getarg(1);
  1409. }
  1410. }
  1411. ---------------------------------------
  1412. *is_function("<function name>")
  1413. This command checks whether a function exists.
  1414. It returns 1 if function is found, or 0 if it isn't.
  1415. Example:
  1416. function script try {
  1417. dothat;
  1418. }
  1419. - script test -1,{
  1420. .@try = is_function("try"); // 1
  1421. .@not = is_function("not"); // 0
  1422. }
  1423. ---------------------------------------
  1424. *if (<condition>) <statement>;
  1425. This is the basic conditional statement command, and just about the only one
  1426. available in this scripting language.
  1427. The condition can be any expression. All expressions resulting in a non-zero
  1428. value will be considered True, including negative values. All expressions
  1429. resulting in a zero are false.
  1430. If the expression results in True, the statement will be executed. If it isn't
  1431. true, nothing happens and we move on to the next line of the script.
  1432. if (1) mes "This will always print.";
  1433. if (0) mes "And this will never print.";
  1434. if (5) mes "This will also always print.";
  1435. if (-1) mes "Funny as it is, this will also print just fine.";
  1436. For more information on conditional operators see the operators section above.
  1437. Anything that is returned by a function can be used in a condition check without
  1438. bothering to store it in a specific variable:
  1439. if (strcharinfo(0) == "Daniel Jackson") mes "It is true, you are Daniel!";
  1440. More examples of using the 'if' command in the real world:
  1441. Example 1:
  1442. .@answer = 1;
  1443. input .@input;
  1444. if (.@input == .@answer)
  1445. close;
  1446. mes "Sorry, your answer is incorrect.";
  1447. close;
  1448. Example 2:
  1449. .@answer = 1;
  1450. input .@input;
  1451. if (.@input != .@answer)
  1452. mes "Sorry, your answer is incorrect.";
  1453. close;
  1454. Notice that examples 1 and 2 have the same effect.
  1455. Example 3:
  1456. .@count++;
  1457. mes "[Forgetful Man]";
  1458. if (.@count == 1) mes "This is the first time you have talked to me.";
  1459. if (.@count == 2) mes "This is the second time you have talked to me.";
  1460. if (.@count == 3) mes "This is the third time you have talked to me.";
  1461. if (.@count == 4) {
  1462. mes "This is the fourth time you have talked to me.";
  1463. mes "I think I am getting amnesia, I have forgotten about you...";
  1464. .@count = 0;
  1465. }
  1466. close;
  1467. Example 4:
  1468. mes "[Quest Person]";
  1469. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in db/item_db.yml
  1470. mes "Can you please bring me an apple?";
  1471. close;
  1472. }
  1473. mes "Oh, you brought an Apple!";
  1474. mes "I didn't want it, I just wanted to see one.";
  1475. close;
  1476. Example 5:
  1477. mes "[Person Checker]";
  1478. if ($@name$ == "") { // global variable not yet set
  1479. mes "Please tell me someones name";
  1480. next;
  1481. input $@name$;
  1482. $@name2$ = strcharinfo(0);
  1483. mes "[Person Checker]";
  1484. mes "Thank you.";
  1485. close;
  1486. }
  1487. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1488. mes "You are the person that " + $@name2$ + " just mentioned.";
  1489. mes "Nice to meet you!";
  1490. // reset the global variables
  1491. $@name$ = "";
  1492. $@name2$ = "";
  1493. close;
  1494. }
  1495. mes "You are not the person that " + $name2$ + " mentioned.";
  1496. close;
  1497. See 'strcharinfo' for an explanation of what this function does.
  1498. Example 6: Using complex conditions.
  1499. mes "[Multiple Checks]";
  1500. if (@queststarted == 1 && countitem(512) >= 5) {
  1501. mes "Well done, you have started the quest and brought me 5 Apples.";
  1502. @queststarted = 0;
  1503. delitem 512,5;
  1504. close;
  1505. }
  1506. mes "Please bring me 5 apples.";
  1507. @queststarted = 1;
  1508. close;
  1509. The script engine also supports nested 'if' statements:
  1510. if (<condition>)
  1511. dothis;
  1512. else
  1513. dothat;
  1514. If the condition isn't met, it'll do the action following the 'else'.
  1515. We can also group several actions depending on a condition:
  1516. if (<condition>) {
  1517. dothis1;
  1518. dothis2;
  1519. } else {
  1520. dothat1;
  1521. dothat2;
  1522. dothat3;
  1523. }
  1524. Remember that if you plan to do several actions upon the condition being false, and
  1525. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1526. the output of the condition, unless of course, you stop the execution of the script if the
  1527. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1528. Also, you can have multiple conditions nested or chained.
  1529. if (<condition 1>)
  1530. dothis;
  1531. else if (<condition 2>) {
  1532. dothat;
  1533. end;
  1534. } else
  1535. dothis;
  1536. ---------------------------------------
  1537. *jump_zero (<condition>),<label>;
  1538. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1539. If the condition is false (equal to zero) this command will immediately jump to
  1540. the specified label like in 'goto'. While 'if' is more generally useful, for
  1541. some cases this could be an optimization.
  1542. The main reason for this command is that other control statements, like
  1543. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1544. with this command when a script is parsed.
  1545. ---------------------------------------
  1546. *switch (expression);
  1547. The switch statement is similar to a series of if statements on the same expression.
  1548. In many occasions, you may want to compare the same variable (or expression)
  1549. with many different values, and execute a different piece of code depending
  1550. on which value it equals to. This is exactly what the switch statement is for.
  1551. It is important to understand how the switch statement is executed in order
  1552. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1553. In the beginning, no code is executed. Only when a case statement is found
  1554. with a value that matches the value of the switch expression the case statement(s)
  1555. will to executed. The parser continues to execute the statements until the end
  1556. of the switch block, or the first time it sees a break statement. If you don't
  1557. write a break statement at the end of a case's statement list, the parser will
  1558. go on executing the statements of the following case (fall-through).
  1559. Example 1:
  1560. switch(select("Yes:No")) {
  1561. case 1:
  1562. mes "You said yes!";
  1563. break;
  1564. case 2:
  1565. mes "Aww, why?";
  1566. break;
  1567. }
  1568. close;
  1569. The example above would work like a menu and would go to the first case if
  1570. the user selects option, otherwise, would go to the second one.
  1571. Example 2:
  1572. switch(getgroupid()) {
  1573. case 1:
  1574. mes "Wow, you're super!";
  1575. break;
  1576. case 2:
  1577. mes "A helping hand!";
  1578. break;
  1579. case 3:
  1580. mes "10001010010011";
  1581. break;
  1582. case 4:
  1583. mes "Yes, milord?";
  1584. break;
  1585. default:
  1586. mes "Hello there!";
  1587. break;
  1588. }
  1589. The example above would print a message depending on the player's groupid.
  1590. If there is no statement declared for the corresponding groupid, the script
  1591. would use the 'default' statement that applies to rest of possible values,
  1592. similar to 'else' in the if-else statement.
  1593. ---------------------------------------
  1594. *while (<condition>) <statement>;
  1595. This is probably the simplest and most frequently used loop structure. The 'while'
  1596. statement can be interpreted as "while <condition> is true, perform <statement>".
  1597. It is a pretest loop, meaning the conditional expression is tested before any of the
  1598. statements in the body of the loop are performed. If the condition evaluates to
  1599. false, the statement(s) in the body of the loop is/are never executed. If the
  1600. condition evaluates to true, the statement(s) are executed, then control transfers
  1601. back to the conditional expression, which is reevaluated and the cycle continues.
  1602. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1603. Example 1:
  1604. while (switch(select("Yes:No") == 2 ))
  1605. mes "You picked no.";
  1606. close;
  1607. Example 2: multiple statements
  1608. while (switch(select("Yes:No") == 2 )) {
  1609. mes "Why did you pick no?";
  1610. mes "You should pick yes instead!";
  1611. }
  1612. close;
  1613. Example 3: counter-controlled loop
  1614. .@i = 1;
  1615. while (.@i <= 5) {
  1616. mes "This line will print 5 times.";
  1617. .@i += 1;
  1618. }
  1619. close;
  1620. Example 4: sentinel-controlled loop
  1621. mes "Input 0 to stop";
  1622. input .@num;
  1623. while (.@num != 0) {
  1624. mes "You entered " + .@num;
  1625. input .@num;
  1626. }
  1627. close;
  1628. ---------------------------------------
  1629. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1630. Another pretest looping structure is the 'for' statement. It is considered a
  1631. specialized form of the 'while' statement, and is usually associated with counter-
  1632. controlled loops. Here are the steps of the 'for' statement: the initialize
  1633. statement is executed first and only once. The condition test is performed.
  1634. When the condition evaluates to false, the rest of the for statement is skipped.
  1635. When the condition evaluates to true, the body of the loop is executed, then the
  1636. update statement is executed (this usually involves incrementing a variable).
  1637. Then the condition is reevaluated and the cycle continues.
  1638. Example 1:
  1639. for( .@i = 1; .@i <= 5; .@i++ )
  1640. mes "This line will print 5 times.";
  1641. Example 2:
  1642. mes "This will print the numbers 1 - 5.";
  1643. for( .@i = 1; .@i <= 5; .@i++ )
  1644. mes "Number: " + .@i;
  1645. ---------------------------------------
  1646. *do { <statement>; } while (<condition>);
  1647. The 'do...while' is the only post-test loop structure available in this script
  1648. language. With a post-test, the statements are executed once before the condition
  1649. is tested. When the condition is true, the statement(s) are repeated. When the
  1650. condition is false, control is transferred to the statement following the
  1651. 'do...while' loop expression.
  1652. Example 1: sentinel-controlled loop
  1653. mes "This menu will keep appearing until you pick Cancel";
  1654. do {
  1655. .@menu = select("One:Two:Three:Cancel");
  1656. } while (.@menu != 4);
  1657. Example 2: counter-controlled loop
  1658. mes "This will countdown from 10 to 1.";
  1659. .@i = 10;
  1660. do {
  1661. mes .@i;
  1662. .@i -= 1;
  1663. } while (.@i > 0);
  1664. ---------------------------------------
  1665. *freeloop({<toggle>})
  1666. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1667. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1668. warn you if an infinite loop is detected.
  1669. The command will return the state of freeloop for the attached script, even if no
  1670. argument is provided.
  1671. Example:
  1672. freeloop(1); // enable script to loop freely
  1673. // be careful with what you do here
  1674. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1675. dothis;
  1676. // will sleep the script for 1ms when detect an infinity loop to
  1677. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1678. }
  1679. freeloop(0); // disable freeloop
  1680. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1681. dothis;
  1682. // throw an infinity loop error
  1683. }
  1684. ---------------------------------------
  1685. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1686. This command will allow you to quickly fill up an array in one go. Check the
  1687. Kafra scripts in the distribution to see this used a lot.
  1688. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1689. First value is the index of the first element of the array to alter. For
  1690. example:
  1691. setarray .@array[0],200,200,200;
  1692. setarray .@array[1],300,150;
  1693. will produce:
  1694. .@array[0]=200
  1695. .@array[1]=300
  1696. .@array[2]=150
  1697. ---------------------------------------
  1698. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1699. This command will change many array values at the same time to the same value.
  1700. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1701. // This will make all 6 values 0
  1702. cleararray .@array[0],0,6;
  1703. // This will make array element 0 change to 245
  1704. cleararray .@array[0],245,1;
  1705. // This will make elements 1 and 2 change to 345
  1706. cleararray .@array[1],345,2;
  1707. See 'setarray'.
  1708. ---------------------------------------
  1709. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1710. This command lets you quickly shuffle a lot of data between arrays, which is in
  1711. some cases invaluable.
  1712. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1713. // So we have made .@array[]
  1714. copyarray .@array2[0],@array[2],2;
  1715. // Now, .@array2[0] will be equal to .@array[2] (300) and
  1716. // .@array2[1] will be equal to .@array[3].
  1717. So using the examples above:
  1718. .@array[0] = 100
  1719. .@array[1] = 200
  1720. .@array[2] = 300
  1721. .@array[3] = 400
  1722. .@array[4] = 500
  1723. .@array[5] = 600
  1724. New Array:
  1725. .@array2[0] = 300
  1726. .@array2[1] = 400
  1727. .@array2[2] = 0
  1728. .@array2[3] = 0
  1729. Notice that .@array[4] and .@array[5] won't be copied to the second array, and it will return a
  1730. 0.
  1731. ---------------------------------------
  1732. *deletearray <array name>[<first value>]{,<how much to delete>};
  1733. This command will delete a specified number of array elements totally from an
  1734. array, shifting all the elements beyond this towards the beginning.
  1735. // This will delete array element 0, and move all the other array elements
  1736. // up one place.
  1737. deletearray .@array[0],1
  1738. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1739. // place, and move the other elements ups, so there are no gaps.
  1740. deletearray .@array[1],3
  1741. ---------------------------------------
  1742. *inarray <array name>,<value>;
  1743. This command returns the index of the first matching value found in the array.
  1744. It will return -1 if the value is not found.
  1745. setarray .@array[0], 100, 200, 300, 400, 500, 600, 100;
  1746. inarray(.@array[0], 200);
  1747. //return 1 because 200 is in index 1
  1748. //another way to say it that .@array[1] == 200
  1749. .@index = inarray(.@array[0], 600);
  1750. //.@index is now 5 because .@array[5] == 600
  1751. inarray(.@array[0], 100);
  1752. //while index 6 is also 100, the command will return the first instance it finds
  1753. //return 0 because .@array[0] == 100
  1754. inarray(.@array[0], 800);
  1755. //return -1 because 800 is not an element of the array .@array
  1756. For more details, see the sample in 'doc/sample/inarray.txt'.
  1757. ---------------------------------------
  1758. *countinarray <array name>{[<start index>]},<array name>{[<start index>]};
  1759. This command will check for matches between the array values and return the number of matches.
  1760. While being optional, if [<start index>] is supplied, the search will begin from the given index value.
  1761. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1762. .@variable = 100;
  1763. if(countinarray(.@array[0], .@variable))
  1764. mes "The number 100 was found in the array .@array";
  1765. countinarray(.@array[0], .@variable);
  1766. //return 1 because the number 100 is an element of the array .@array
  1767. setarray .@array2[0],100,500;
  1768. countinarray(.@array[0], .@array2[0]);
  1769. //return 2 because the numbers 100 and 500 are elements of the array .@array
  1770. setarray .@array3[0],100,700;
  1771. countinarray(.@array[0], .@array3[0]);
  1772. //return 1 because the number 100 is an element of the array .@array
  1773. //but the number 700 is not an element of the array .@array
  1774. //also you can change the position between the arrays in the command
  1775. if(countinarray(.@array[0], .@array3[0]) == countinarray(.@array3[0], .@array[0]))
  1776. //This is true
  1777. For more details, see the sample in 'doc/sample/inarray.txt'.
  1778. ---------------------------------------
  1779. ======================================
  1780. |2.- Information-retrieving commands.|
  1781. ======================================
  1782. ---------------------------------------
  1783. *strcharinfo(<type>{,<char_id>})
  1784. This function will return either the name, party name or guild name for the
  1785. invoking character. Whatever it returns is determined by type.
  1786. 0 - Character's name.
  1787. 1 - The name of the party they're in if any.
  1788. 2 - The name of the guild they're in if any.
  1789. 3 - The name of the map the character is in.
  1790. If a character is not a member of any party or guild, an empty string will be
  1791. returned when requesting that information.
  1792. ---------------------------------------
  1793. *convertpcinfo(<char_id>,<type>)
  1794. *convertpcinfo(<account_id>,<type>)
  1795. *convertpcinfo(<player_name>,<type>)
  1796. This function will return the information <type> for the
  1797. specified character. Whatever it returns is determined by type.
  1798. CPC_NAME - Character's name.
  1799. CPC_CHAR - Character ID.
  1800. CPC_ACCOUNT - Account ID.
  1801. If a character is not found (or not online) when requesting that information,
  1802. an empty string will be returned for CPC_NAME, 0 for other <type>.
  1803. ---------------------------------------
  1804. *strnpcinfo(<type>)
  1805. This function will return the various parts of the name of the calling NPC.
  1806. Whatever it returns is determined by type.
  1807. 0 - The NPC's display name (visible#hidden)
  1808. 1 - The visible part of the NPC's display name
  1809. 2 - The hidden part of the NPC's display name
  1810. 3 - The NPC's unique name (::name)
  1811. 4 - The name of the map the NPC is in.
  1812. ---------------------------------------
  1813. *getarraysize(<array name>)
  1814. This function returns highest index of the array that is filled.
  1815. Notice that zeros and empty strings at the end of this array are not
  1816. counted towards this number.
  1817. For example:
  1818. setarray .@array[0], 100, 200, 300, 400, 500, 600;
  1819. set .@arraysize,getarraysize(.@array);
  1820. This will make .@arraysize == 6. But if you try this:
  1821. setarray .@array[0], 100, 200, 300, 400, 500, 600, 0;
  1822. set .@arraysize,getarraysize(.@array);
  1823. .@arraysize will still equal 6, even though you've set 7 values.
  1824. ---------------------------------------
  1825. *getelementofarray(<array name>,<index>)
  1826. This command retrieves the value of the element of given array at given index.
  1827. This is equivalent to using:
  1828. <array name>[<index>]
  1829. The reason for this is, that this short form is internally converted into a call
  1830. to getelementofarray, when the script is loaded.
  1831. Also useful when passing arrays to functions or accessing another npc's arrays:
  1832. getelementofarray(getarg(0),<index>)
  1833. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1834. ---------------------------------------
  1835. *readparam(<parameter number>{,"<character name>"})
  1836. *readparam(<parameter number>{,<char_id>})
  1837. This function will return the specified stat of the invoking character, or, if a
  1838. character name or character id is specified, of that player. The stat can either
  1839. be a number or parameter name, defined in 'src/map/script_constants.hpp'.
  1840. Some example parameters:
  1841. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1842. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1843. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk, Ap, MaxAp
  1844. All of these also behave as variables, but don't expect to be able to just 'set'
  1845. them - some will not work for various internal reasons.
  1846. Example 1:
  1847. // Returns how many status points you haven't spent yet.
  1848. mes "Unused status points: " + readparam(9);
  1849. Using this particular information as a function call is not required. Typing this
  1850. will return the same result:
  1851. mes "Unused status points: " + StatusPoint;
  1852. Example 2:
  1853. You can also use this command to get stat values.
  1854. if (readparam(bVit) > 77)
  1855. mes "Only people with over 77 Vit are reading this!";
  1856. ---------------------------------------
  1857. *getcharid(<type>{,"<character name>"})
  1858. This function will return a unique ID number of the invoking character, or, if a
  1859. character name is specified, of that player.
  1860. Type is the kind of associated ID number required:
  1861. 0 - Character ID
  1862. 1 - Party ID
  1863. 2 - Guild ID
  1864. 3 - Account ID
  1865. 4 - Battle Ground ID
  1866. 5 - Clan ID
  1867. For most purposes other than printing it, a number is better to have than a name
  1868. (people do horrifying things to their character names).
  1869. If the character is not in a party or not in a guild, the function will return 0
  1870. if guild or party number is requested. If a name is specified and the character
  1871. is not found, 0 is returned.
  1872. If getcharid(0) returns a zero, the script got called not by a character and
  1873. doesn't have an attached RID. Note that this will cause the map server to
  1874. print "player not attached!" error messages, so it is preferred to use
  1875. "playerattached" to check for the character attached to the script.
  1876. if (getcharid(2) == 0)
  1877. mes "Only members of a guild are allowed here!";
  1878. ---------------------------------------
  1879. *getnpcid(<type>{,"<npc name>"});
  1880. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1881. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1882. to retrieve and can be one of the following:
  1883. 0 - NPC Game ID
  1884. If an invalid type is given or the NPC does not exist, 0 is returned.
  1885. ---------------------------------------
  1886. *getchildid({<char_id>})
  1887. *getmotherid({<char_id>})
  1888. *getfatherid({<char_id>})
  1889. These functions return the character ID of the attached player's child,
  1890. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1891. if (getmotherid()) mes "Your mother's ID is: " + getmotherid();
  1892. ---------------------------------------
  1893. *ispartneron({<char_id>})
  1894. This function returns 1 if the invoking character's marriage partner is
  1895. currently online and 0 if they are not or if the character has no partner.
  1896. ---------------------------------------
  1897. *getpartnerid({<char_id>})
  1898. This function returns the character ID of the invoking character's marriage
  1899. partner, if any. If the invoking character is not married, it will return 0,
  1900. which is a quick way to see if they are married:
  1901. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1902. if (getpartnerid()) mes "You're married already!";
  1903. ---------------------------------------
  1904. *getlook(<type>{,<char_id>})
  1905. This function will return the number for the current character look value
  1906. specified by type. See 'setlook' for valid look types.
  1907. This can be used to make a certain script behave differently for characters
  1908. dressed in black.
  1909. ---------------------------------------
  1910. *getsavepoint(<information type>{,<char_id>})
  1911. This function will return information about the invoking character's save point.
  1912. You can use it to let a character swap between several recorded save points.
  1913. Available information types are:
  1914. 0 - Map name (a string)
  1915. 1 - X coordinate
  1916. 2 - Y coordinate
  1917. ---------------------------------------
  1918. *getcharip({"<character name>"|<account id>|<char id>})
  1919. This function will return the IP address of the invoking character, or, if a player
  1920. is specified, of that character. A blank string is returned if no player is attached.
  1921. Examples:
  1922. // Outputs IP address of attached player.
  1923. mes "Your IP: " + getcharip();
  1924. // Outputs IP address of character "Silver".
  1925. mes "Silver's IP: " + getcharip("Silver");
  1926. ---------------------------------------
  1927. *vip_status(<type>,{"<character name>"})
  1928. Returns various information about a player's VIP status.
  1929. Valid types:
  1930. VIP_STATUS_ACTIVE - VIP status: true if the player is a VIP or false if not
  1931. VIP_STATUS_EXPIRE - VIP expire timestamp if the player is VIP or 0 if not
  1932. VIP_STATUS_REMAINING - VIP time remaining in seconds
  1933. NOTE: This command is only available if the VIP System is enabled.
  1934. ---------------------------------------
  1935. *vip_time <time>,{"<character name>"};
  1936. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1937. negative value will decrease time.
  1938. NOTE: This command is only available if the VIP System is enabled.
  1939. ---------------------------------------
  1940. *addspiritball <count>,<duration>{,<char_id>};
  1941. Adds spirit ball to player for 'duration' in milisecond.
  1942. ---------------------------------------
  1943. *delspiritball <count>{,<char_id>};
  1944. Deletes the spirit ball(s) from player.
  1945. ---------------------------------------
  1946. *countspiritball {<char_id>};
  1947. Counts the spirit ball that player has.
  1948. ---------------------------------------
  1949. *ignoretimeout <flag>{,<char_id>};
  1950. Disables the SECURE_NPCTIMEOUT function on the character invoking the script,
  1951. or by the given character ID/character name.
  1952. Valid flag:
  1953. 0 - Enabled SECURE_NPCTIMEOUT.
  1954. 1 - Disable SECURE_NPCTIMEOUT.
  1955. Note: SECURE_NPCTIMEOUT must be enabled for this to work.
  1956. ---------------------------------------
  1957. \\
  1958. 2,2 Item-related commands
  1959. \\
  1960. ---------------------------------------
  1961. *getequipid({<equipment slot>,<char_id>})
  1962. This function returns the item ID of the item slot that calls the script
  1963. on the invoking character or the specified equipment slot. If nothing is
  1964. equipped there, it returns -1.
  1965. Valid equipment slots are:
  1966. EQI_COMPOUND_ON (-1) - Item slot that calls this script (In context of item script) - exclusive to getequipid
  1967. EQI_ACC_L (0) - Accessory 1
  1968. EQI_ACC_R (1) - Accessory 2
  1969. EQI_SHOES (2) - Footgear (shoes, boots)
  1970. EQI_GARMENT (3) - Garment (mufflers, hoods, manteaux)
  1971. EQI_HEAD_LOW (4) - Lower Headgear (beards, some masks)
  1972. EQI_HEAD_MID (5) - Middle Headgear (masks, glasses)
  1973. EQI_HEAD_TOP (6) - Upper Headgear
  1974. EQI_ARMOR (7) - Armor (jackets, robes)
  1975. EQI_HAND_L (8) - Left hand (weapons, shields)
  1976. EQI_HAND_R (9) - Right hand (weapons)
  1977. EQI_COSTUME_HEAD_TOP (10) - Upper Costume Headgear
  1978. EQI_COSTUME_HEAD_MID (11) - Middle Costume Headgear
  1979. EQI_COSTUME_HEAD_LOW (12) - Lower Costume Headgear
  1980. EQI_COSTUME_GARMENT (13) - Costume Garment
  1981. EQI_AMMO (14) - Arrow/Ammunition
  1982. EQI_SHADOW_ARMOR (15) - Shadow Armor
  1983. EQI_SHADOW_WEAPON (16) - Shadow Weapon
  1984. EQI_SHADOW_SHIELD (17) - Shadow Shield
  1985. EQI_SHADOW_SHOES (18) - Shadow Shoes
  1986. EQI_SHADOW_ACC_R (19) - Shadow Accessory 2
  1987. EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
  1988. Notice that a few items occupy several equipment slots, and if the character is
  1989. wearing such an item, 'getequipid' will return its ID number for either slot.
  1990. Can be used to check if you have something equipped, or if you haven't got
  1991. something equipped:
  1992. if (getequipid(EQI_HEAD_TOP) == 2234)
  1993. mes "What a lovely Tiara you have on";
  1994. else
  1995. mes "Come back when you have a Tiara on";
  1996. close;
  1997. You can also use it to make sure people don't pass a point before removing an
  1998. item totally from them. Let's say you don't want people to wear Legion Plate
  1999. armor, but also don't want them to equip if after the check, you would do this:
  2000. if (getequipid(EQI_ARMOR) == 2341 || getequipid(EQI_ARMOR) == 2342) {
  2001. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  2002. close;
  2003. }
  2004. // the || is used as an or argument, there is 2341 and 2342 cause there are
  2005. // two different legion plate armors, one with a slot one without.
  2006. if (countitem(2341) > 0 || countitem(2432) > 0) {
  2007. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  2008. close;
  2009. }
  2010. mes "I will lets you pass.";
  2011. close2;
  2012. warp "place",50,50;
  2013. end;
  2014. ---------------------------------------
  2015. *getequipuniqueid(<equipment slot>{,<char_id>})
  2016. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  2017. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  2018. See 'getequipid' for a full list of valid equipment slots.
  2019. ---------------------------------------
  2020. *getequipname(<equipment slot>{,<char_id>})
  2021. Returns the jname of the item equipped in the specified equipment slot on the
  2022. invoking character, or an empty string if nothing is equipped in that position.
  2023. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  2024. what your are wearing, or maybe saving as a string variable.
  2025. See 'getequipid' for a full list of valid equipment slots.
  2026. if ( getequipname(EQI_HEAD_TOP) != "" )
  2027. mes "So you are wearing a " + getequipname(EQI_HEAD_TOP) + " on your head";
  2028. else
  2029. mes "You are not wearing any head gear";
  2030. ---------------------------------------
  2031. *getitemname(<item id>)
  2032. *getitemname(<aegis item name>)
  2033. Given the database ID number of an item, this function will return the text
  2034. stored in the 'Name' field in item_db_*.yml for text version
  2035. or 'name_english' field for SQL version.
  2036. ---------------------------------------
  2037. *getbrokenid(<number>{,<char_id>})
  2038. This function will search the invoking character's inventory for any broken
  2039. items, and will return their item ID numbers. Since the character may have
  2040. several broken items, 1 given as an argument will return the first one found, 2
  2041. will return the second one, etc. Will return 0 if no such item is found.
  2042. // Let's see if they have anything broken:
  2043. if (getbrokenid(1) == 0)
  2044. mes "You don't have anything broken, quit bothering me.";
  2045. else
  2046. // They do, so let's print the name of the first broken item:
  2047. mes "Oh, I see you have a broken " + getitemname(getbrokenid(1)) + " here!";
  2048. end;
  2049. ---------------------------------------
  2050. *getequipisequiped(<equipment slot>{,<char_id>})
  2051. This functions will return 1 if there is an equipment placed on the specified
  2052. equipment slot and 0 otherwise. For a list of equipment slots
  2053. see 'getequipid'. Function originally used by the refining NPCs:
  2054. if (getequipisequiped(EQI_HEAD_TOP)) {
  2055. mes "[Refiner]";
  2056. mes "That's a fine hat you are wearing there...";
  2057. close;
  2058. } else {
  2059. mes "[Refiner]";
  2060. mes "Do you want me to refine your dumb head?";
  2061. close;
  2062. }
  2063. ---------------------------------------
  2064. *getequipisenableref(<equipment slot>{,<char_id>})
  2065. Will return 1 if the item equipped on the invoking character in the specified
  2066. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  2067. see 'getequipid'.
  2068. if (getequipisenableref(EQI_HEAD_TOP)) {
  2069. mes "[Refiner]";
  2070. mes "Ok I can refine this";
  2071. close;
  2072. } else {
  2073. mes "[Refiner]";
  2074. mes "I can't refine this hat!...";
  2075. close;
  2076. }
  2077. ---------------------------------------
  2078. *getequiprefinerycnt(<equipment slot>{,<char_id>})
  2079. Returns the current number of pluses for the item in the specified equipment
  2080. slot. For a list of equipment slots see 'getequipid'.
  2081. Can be used to check if you have reached a maximum refine value, default for
  2082. this is +10:
  2083. if (getequiprefinerycnt(EQI_HEAD_TOP) < 10)
  2084. mes "I will now upgrade your " + getequipname(EQI_HEAD_TOP);
  2085. else
  2086. mes "Sorry, it's not possible to refine hats better than +10";
  2087. close;
  2088. ---------------------------------------
  2089. *getequipweaponlv({<equipment slot>{,<char_id>}})
  2090. This function returns the weapon level for the weapon equipped in the specified
  2091. equipment slot on the invoking character. For a list of equipment slots see
  2092. 'getequipid'.
  2093. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  2094. a weapon level.
  2095. If no item is equipped in this slot, or if it doesn't have a weapon level
  2096. according to the database, 0 will be returned.
  2097. Examples:
  2098. switch (getequipweaponlv(EQI_HAND_R)) {
  2099. case 1: mes "You are holding a lvl 1 weapon."; break;
  2100. case 2: mes "You are holding a lvl 2 weapon."; break;
  2101. case 3: mes "You are holding a lvl 3 weapon."; break;
  2102. case 4: mes "You are holding a lvl 4 weapon."; break;
  2103. case 5: mes "You are holding a lvl 5 weapon."; break;
  2104. case 6: mes "You are holding a lvl 6 weapon, hm, must be a custom design..."; break;
  2105. default: mes "Seems you don't have a weapon on."; break;
  2106. }
  2107. if (getequipid(EQI_HAND_L) == 0) {
  2108. mes "Seems you have nothing equipped here.";
  2109. close;
  2110. }
  2111. switch (getequipweaponlv(EQI_HAND_L)) {
  2112. case 0: mes "You are not holding a weapon, so it doesn't have a level."; break;
  2113. case 1: mes "You are holding a lvl 1 weapon."; break;
  2114. case 2: mes "You are holding a lvl 2 weapon."; break;
  2115. case 3: mes "You are holding a lvl 3 weapon."; break;
  2116. case 4: mes "You are holding a lvl 4 weapon."; break;
  2117. case 5: mes "You are holding a lvl 5 weapon."; break;
  2118. case 6: mes "You are holding a lvl 6 weapon, hm, must be a custom design..."; break;
  2119. }
  2120. ---------------------------------------
  2121. *getequiparmorlv({<equipment slot>{,<char_id>}})
  2122. This function returns the armor level for the item equipped in the specified
  2123. equipment slot on the invoking character. For a list of equipment slots see
  2124. 'getequipid'.
  2125. If no item is equipped in this slot, or if it doesn't have an armor level
  2126. according to the database, 0 will be returned.
  2127. if (getequipid(EQI_ARMOR) == 0) {
  2128. mes "Seems you have nothing equipped here.";
  2129. close;
  2130. }
  2131. switch (getequiparmorlv(EQI_ARMOR)) {
  2132. case 1: mes "You are wearing a lvl 1 armor."; break;
  2133. case 2: mes "You are wearing a lvl 2 armor."; break;
  2134. case 3: mes "You are wearing a lvl 3 armor, hm, must be a custom design..."; break;
  2135. }
  2136. ---------------------------------------
  2137. *getequippercentrefinery(<equipment slot>{,<enriched>,<char_id>})
  2138. This function calculates and returns the percent value chance to successfully
  2139. refine the item found in the specified equipment slot of the invoking character
  2140. by +1. There is no actual formula, the success rate for a given weapon level of
  2141. a certain refine level is found in the db/(pre-)re/refine_db.yml file. For a list of
  2142. equipment slots see 'getequipid'.
  2143. If enriched parameter is set to true, chance to successfully refine the item with
  2144. enriched material is returned instead.
  2145. These values can be displayed for the player to see, or used to calculate the
  2146. random change of a refine succeeding or failing and then going through with it
  2147. (which is what the official NPC refinery scripts use it for)
  2148. // This will find a random number from 0 - 99 and if that is equal to or more
  2149. // than the value recovered by this command it will go to L_Fail
  2150. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2151. ---------------------------------------
  2152. *getequiprefinecost(<equipment slot>,<type>,<information>{,<char id>})
  2153. This function returns refine cost for equipment in <equipment slot> based on
  2154. passed arguments <type> and <information>.
  2155. Valid cost types are:
  2156. REFINE_COST_NORMAL - For normal refining
  2157. REFINE_COST_HD - For refining with HD ores
  2158. REFINE_COST_ENRICHED - For refining with enriched ores
  2159. This function will return required cost for refining based on <information> argument.
  2160. Valid information types are:
  2161. REFINE_ZENY_COST - Zeny
  2162. REFINE_MATERIAL_ID - Material Item ID
  2163. This function will return -1 on failure. The function fails if the cost type
  2164. is invalid or if there is no item in the equipment slot.
  2165. ---------------------------------------
  2166. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2167. This function will count all the items with the specified ID number lying on the
  2168. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2169. number.
  2170. This is the only function around where a parameter may be either a string or a
  2171. number! If it's a number, it means that only the items with that item ID number
  2172. will be counted. If it is a string, it is assumed to mean the 'english name'
  2173. field from the item database.
  2174. ---------------------------------------
  2175. *getequipcardcnt(<equipment slot>)
  2176. This function will return the number of cards that have been compounded onto a
  2177. specific equipped item for the invoking character. See 'getequipid' for a list
  2178. of possible equipment slots.
  2179. ---------------------------------------
  2180. *getinventorylist {<char_id>};
  2181. This command sets a bunch of arrays with a complete list of whatever the
  2182. invoking character has in their inventory, including all the data needed to
  2183. recreate these items perfectly if they are destroyed. Here's what you get:
  2184. @inventorylist_id[] - array of item ids.
  2185. @inventorylist_idx[] - array of item inventory index.
  2186. @inventorylist_amount[] - their corresponding item amounts.
  2187. @inventorylist_equip[] - on which position the item is equipped (see EQP_* constants)
  2188. It will contain 0 if the item is not equipped.
  2189. @inventorylist_refine[] - for how much it is refined.
  2190. @inventorylist_identify[] - whether it is identified.
  2191. @inventorylist_attribute[] - whether it is broken.
  2192. @inventorylist_card1[] - These four arrays contain card data for the items.
  2193. @inventorylist_card2[] These data slots are also used to store names
  2194. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2195. @inventorylist_card4[] if the character owns an item made by a specific
  2196. craftsman.
  2197. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2198. @inventorylist_bound[] - the bound type of the items (see BOUND_* constants)
  2199. @inventorylist_enchantgrade[] - the enchantgrade of the items
  2200. @inventorylist_count - the number of items in these lists.
  2201. @inventorylist_option_id1[] - first array of random option IDs
  2202. @inventorylist_option_value1[] - first array of random option values
  2203. @inventorylist_option_parameter1[] - first array of random option parameters
  2204. @inventorylist_option_id2[] - second array of random option IDs
  2205. @inventorylist_option_value2[] - second array of random option values
  2206. @inventorylist_option_parameter2[] - second array of random option parameters
  2207. @inventorylist_option_id3[] - third array of random option IDs
  2208. @inventorylist_option_value3[] - third array of random option values
  2209. @inventorylist_option_parameter3[] - third array of random option parameters
  2210. @inventorylist_option_id4[] - fourth array of random option IDs
  2211. @inventorylist_option_value4[] - fourth array of random option values
  2212. @inventorylist_option_parameter4[] - fourth array of random option parameters
  2213. @inventorylist_option_id5[] - fifth array of random option IDs
  2214. @inventorylist_option_value5[] - fifth array of random option values
  2215. @inventorylist_option_parameter5[] - fifth array of random option parameters
  2216. @inventorylist_tradable - Returns if an item is tradable or not (Pass item_db.yml, bound, and rental restrictions).
  2217. @inventorylist_favorite - Returns if an item is favorite or not
  2218. This could be handy to save/restore a character's inventory, since no other
  2219. command returns such a complete set of data, and could also be the only way to
  2220. correctly handle an NPC trader for carded and named items who could resell them
  2221. - since NPC objects cannot own items, so they have to store item data in
  2222. variables and recreate the items.
  2223. Notice that the variables this command generates are all temporary, attached to
  2224. the character, and integer.
  2225. Be sure to use @inventorylist_count to go through these arrays, and not
  2226. 'getarraysize', because the arrays are not automatically cleared between runs
  2227. of 'getinventorylist'.
  2228. ---------------------------------------
  2229. *cardscnt()
  2230. This function will return the number of cards inserted into the equipment
  2231. from which the function is called.
  2232. This function is intended for use in item scripts.
  2233. ---------------------------------------
  2234. *getrefine()
  2235. This function will return the refine count of the equipment from which the
  2236. function is called.
  2237. This function is intended for use in item scripts.
  2238. ---------------------------------------
  2239. *getnameditem(<item id>,"<name to inscribe>"|<char id>);
  2240. *getnameditem("<item name>","<name to inscribe>"|<char id>);
  2241. This function is equivalent to using 'getitem', however, it will not just give
  2242. the character an item object, but will also inscribe it with a specified
  2243. character's name. You may not inscribe items with arbitrary strings, only with
  2244. names of characters that actually exist. While this isn't said anywhere
  2245. specifically, apparently, named items may not have cards in them, slots or no -
  2246. these data slots are taken by the character ID who's name is inscribed. Only one
  2247. remains free and it's not quite clear if a card may be there.
  2248. This function will return 1 if an item was successfully created and 0 if it
  2249. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2250. 'english name' from the item database as an item name and will return 0 if no
  2251. such item exists.
  2252. ---------------------------------------
  2253. *getitemslots(<item ID>)
  2254. This function will look up the item with the specified ID number in the database
  2255. and return the number of slots this kind of items has - 0 if they are not
  2256. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2257. someone messed up the item database. It will return -1 if there is no such item.
  2258. Example:
  2259. //.@slots now has the amount of slots of the item with ID 1205.
  2260. .@slots = getitemslots(1205);
  2261. ---------------------------------------
  2262. *getiteminfo(<item ID>,<type>)
  2263. *getiteminfo(<item name>,<type>)
  2264. *getiteminfo(<aegis item name>,<type>)
  2265. This function will look up the item with the specified ID number in the database
  2266. and return the info set by TYPE argument.
  2267. It will return -1 if there is no such item or "" if the aegis item name is requested.
  2268. Valid types are:
  2269. ITEMINFO_BUY (0) - Buy Price
  2270. ITEMINFO_SELL (1) - Sell Price
  2271. ITEMINFO_TYPE (2) - Type
  2272. ITEMINFO_MAXCHANCE (3) - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2273. if = 0, then monsters don't drop it at all (rare or a quest item)
  2274. if = 10000, then this item is sold in NPC shops only
  2275. ITEMINFO_GENDER (4) - Gender
  2276. ITEMINFO_LOCATIONS (5) - Location(s)
  2277. ITEMINFO_WEIGHT (6) - Weight
  2278. ITEMINFO_ATTACK (7) - ATK
  2279. ITEMINFO_DEFENSE (8) - DEF
  2280. ITEMINFO_RANGE (9) - Range
  2281. ITEMINFO_SLOT (10) - Slot
  2282. ITEMINFO_VIEW (11) - View
  2283. ITEMINFO_EQUIPLEVELMIN (12) - equipment LV
  2284. ITEMINFO_WEAPONLEVEL (13) - weapon LV
  2285. ITEMINFO_ALIASNAME (14) - AliasName
  2286. ITEMINFO_EQUIPLEVELMAX (15) - equipment LV Max
  2287. ITEMINFO_MAGICATTACK (16) - matk if RENEWAL is defined
  2288. ITEMINFO_ID (17) - item ID
  2289. ITEMINFO_AEGISNAME (18) - aegis item name
  2290. ITEMINFO_ARMORLEVEL (19) - armor LV
  2291. ITEMINFO_SUBTYPE (20) - Subtype
  2292. See the sample in 'doc/sample/getiteminfo.txt'.
  2293. ---------------------------------------
  2294. *getequipcardid(<equipment slot>,<card slot>)
  2295. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2296. This function returns CARD ID, CARD0_FORGE, CARD0_CREATE, or CARD0_PET (for card 0, if the item is produced).
  2297. It's useful for when you want to check whether an item contains cards or if it's signed.
  2298. ---------------------------------------
  2299. *mergeitem({,<char_id>});
  2300. Open merge item window to merge available item can be merged.
  2301. Examples
  2302. 1. See the NPC 'npc/re/other/merge_item.txt'.
  2303. 2. Simple usage:
  2304. mes "Let's check if any item can be merged.";
  2305. close2;
  2306. mergeitem;
  2307. end;
  2308. ---------------------------------------
  2309. *mergeitem2({<item_id>{,<char_id>}});
  2310. *mergeitem2({"<item name>"{,<char_id>}});
  2311. Merge all stackable items that separated by GUID flags
  2312. (UniqueId in item_db or in item_group).
  2313. If no item ID/name given, all possible items in player's inventory will be merged.
  2314. ---------------------------------------
  2315. *getequiptradability(<equipment slot>{,<char id>});
  2316. Returns true if the item in <equipment slot> is tradable.
  2317. Returns false otherwise.
  2318. ---------------------------------------
  2319. *identifyall({<type>{,<account_id>}});
  2320. Returns the count of unidentified items in the player inventory.
  2321. If <type> is true the command will identify all the unidentified items as well (default).
  2322. If <type> is false the command only returns the count of unidentified items.
  2323. ---------------------------------------
  2324. *getenchantgrade({<equipment slot>,<char_id>})
  2325. This function will return the enchantgrade of the equipment from which the
  2326. function is called or the specified equipment slot. If nothing is
  2327. equipped there, it returns -1.
  2328. Valid equipment slots are:
  2329. EQI_COMPOUND_ON - Item slot that calls this script (In context of item script) (default)
  2330. For a list of others equipment slots see 'getequipid'.
  2331. ---------------------------------------
  2332. *getitempos()
  2333. This function will return the equip position of the equipment from which the
  2334. function is called. (see EQP_* constants)
  2335. This function is intended for use in item scripts.
  2336. ---------------------------------------
  2337. //
  2338. 2,1.- End of item-related commands.
  2339. //
  2340. ---------------------------------------
  2341. *getmapxy("<variable for map name>",<variable for x>,<variable for y>{,<type>,"<search value>"})
  2342. This function will locate a character object, NPC object or pet's coordinates
  2343. and place their coordinates into the variables specified when calling it. It
  2344. will return 0 if the search was successful, and -1 if the parameters given were
  2345. not variables or the search was not successful.
  2346. Type is the type of object to search for:
  2347. BL_PC - Character object (default)
  2348. BL_NPC - NPC object
  2349. BL_PET - Pet object
  2350. BL_HOM - Homunculus object
  2351. BL_MER - Mercenary object
  2352. BL_ELEM - Elemental object
  2353. The search value is optional. If it is not specified, the location of the
  2354. invoking character will always be returned for types BL_PC and BL_PET,
  2355. the location of the NPC running this function for type BL_NPC.
  2356. If a search value is specified, for types BL_PC and BL_NPC, the
  2357. character or NPC with the specified name or GID will be located.
  2358. If type is BL_PET/BL_HOM/BL_MER/BL_ELEM, the search
  2359. will locate the current object of the character who's name/GID is given in the
  2360. search value, it will NOT locate the object by name.
  2361. Example:
  2362. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2363. mes "My name is Meh. I'm here so that Nyah can find me.";
  2364. close;
  2365. }
  2366. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2367. mes "My name is Nyah.";
  2368. mes "I will now search for Meh all across the world!";
  2369. if (getmapxy(.@mapname$, .@mapx, .@mapy, BL_NPC, "Meh") != 0) {
  2370. mes "I can't seem to find Meh anywhere!";
  2371. close;
  2372. }
  2373. mes "And I found him on map " + .@mapname$ + " at X:" + .@mapx + " Y:" + .@mapy + " !";
  2374. close;
  2375. }
  2376. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2377. ---------------------------------------
  2378. *mapid2name(<map ID>)
  2379. Returns the map name of the given map ID. Returns an empty string if given
  2380. map ID doesn't exist.
  2381. ---------------------------------------
  2382. *getgmlevel({<char_id>})
  2383. This function will return the (GM) level associated with the player group to which
  2384. the invoking character belongs. If this is somehow executed from a console command,
  2385. 99 will be returned, and 0 will be returned if the account has no GM level.
  2386. This allows you to make NPC's only accessible for certain GM levels, or behave
  2387. specially when talked to by GMs.
  2388. if (getgmlevel()) mes "What is your command, your godhood?";
  2389. ---------------------------------------
  2390. *getgroupid({<char_id>})
  2391. This function will return the group id to which the invoking player belongs.
  2392. ---------------------------------------
  2393. *gettimetick(<tick type>)
  2394. This function will return a tick depending on <tick type>:
  2395. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2396. system. This tick is an unsigned int which loops every ~50 days.
  2397. 1: The time, in seconds, since the start of the current day.
  2398. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2399. January 1st, 1970. Useful for reliably measuring time intervals.
  2400. ---------------------------------------
  2401. *gettime(<type>)
  2402. This function will return specified information about the current system time.
  2403. DT_SECOND - Seconds (of the current minute)
  2404. DT_MINUTE - Minutes (of the current hour)
  2405. DT_HOUR - Hour (of the current day)
  2406. DT_DAYOFWEEK - Week day (constants for MONDAY to SUNDAY are available)
  2407. DT_DAYOFMONTH - Day of the current month
  2408. DT_MONTH - Month (constants for JANUARY to DECEMBER are available)
  2409. DT_YEAR - Year
  2410. DT_DAYOFYEAR - Day of the year
  2411. DT_YYYYMMDD - current date in the form YYYYMMDD
  2412. It will only return numbers. If another type is supplied -1 will be returned.
  2413. if (gettime(DT_DAYOFWEEK) == SATURDAY) mes "It's a Saturday. I don't work on Saturdays.";
  2414. ---------------------------------------
  2415. *gettimestr(<"time format">,<max length>{,<time_tick>})
  2416. This function will return a string containing time data as specified by the
  2417. time format.
  2418. This uses the C function 'strfmtime', which obeys special format characters. For
  2419. a full description see, for example, the description of 'strfmtime' at
  2420. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2421. All the format characters given in there should properly work.
  2422. Max length is the maximum length of a time string to generate.
  2423. The example given in rAthena sample scripts works like this:
  2424. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2425. The example above will print the current date and time like 'YYYY-MM/DD HH:MM:SS'.
  2426. The following example will print the date and time when the player's VIP status
  2427. expires by the given <time_tick>:
  2428. mes gettimestr("%Y-%m/%d %H:%M:%S",21,vip_status(VIP_STATUS_EXPIRE));
  2429. ---------------------------------------
  2430. *getusers(<type>)
  2431. This function will return a number of users on a map or the whole server. What
  2432. it returns is specified by Type.
  2433. Type can be one of the following values, which control what will be returned:
  2434. 0 - Count of all characters on the map of the invoking character.
  2435. 1 - Count of all characters in the entire server.
  2436. 8 - Count of all characters on the map of the NPC the script is
  2437. running in.
  2438. ---------------------------------------
  2439. *getmapusers("<map name>")
  2440. This function will return the number of users currently located on the specified
  2441. map.
  2442. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2443. ---------------------------------------
  2444. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2445. This function will return the count of connected characters which are located
  2446. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2447. This is useful for maps that are split into many buildings, such as all the
  2448. "*_in" maps, due to all the shops and houses.
  2449. ---------------------------------------
  2450. *getunits(<type>{,<array_variable>[<first value>]})
  2451. *getmapunits(<type>,<"map name">{,<array_variable>[<first value>]})
  2452. *getareaunits(<type>,<"map name">,<x1>,<y1>,<x2>,<y2>{,<array_variable>[<first value>]})
  2453. The 'getunits' command will return the number of <type> objects active on the server.
  2454. The 'getmapunits' command will return the number of <type> objects active on the
  2455. specified <"map name">.
  2456. The 'getareaunits' command will return the number of <type> objects actively located
  2457. within the specified area where <x1>, <y1>, <x2>, <y2> form the area.
  2458. Type is the type of object to search for:
  2459. BL_PC - Character objects
  2460. BL_MOB - Monster objects
  2461. BL_PET - Pet objects
  2462. BL_HOM - Homunculus objects
  2463. BL_MER - Mercenary objects
  2464. BL_NPC - NPC objects
  2465. BL_ELEM - Elemental objects
  2466. If <array_variable> is provided:
  2467. - An int variable will return the list of GID.
  2468. - A string variable will return the list of names.
  2469. Example 1:
  2470. // getting the players count and building a string array of the names.
  2471. .@num = getunits(BL_PC,.@array$[0]);
  2472. mes "the number of Users Connected to the server is " + .@num + " .";
  2473. mes "list of Players names :";
  2474. freeloop(1); // for if the list was too big.
  2475. for(.@i=0;.@i<getarraysize(.@array$);.@i++)
  2476. mes (.@i + 1) + " " + .@array$[.@i];
  2477. freeloop(0);
  2478. end;
  2479. Example 2:
  2480. // getting the npc count in Prontera and building a string array of the names.
  2481. .@num = getmapunits(BL_NPC,"prontera",.@array$[0]);
  2482. mes "the number of NPCs in Prontera is " + .@num + " .";
  2483. mes "list of NPCs name :";
  2484. freeloop(1); // for if the list was too big.
  2485. for(.@i=0;.@i<getarraysize(.@array$);.@i++)
  2486. mes (.@i + 1) + " " + .@array$[.@i];
  2487. freeloop(0);
  2488. end;
  2489. Example 3:
  2490. // getting the monster count in Prontera with specific coordinates and building a int array of the GIDs.
  2491. .@num = getareaunits(BL_MOB,"prontera",154,186,159,182,.@array[0]);
  2492. mes "the number of Monsters in Prontera in that Coordinates is " + .@num + " .";
  2493. mes "list of Monsters GID :";
  2494. freeloop(1); // for if the list was too big.
  2495. for(.@i=0;.@i<getarraysize(.@array);.@i++)
  2496. mes (.@i + 1) + " " + .@array[.@i];
  2497. freeloop(0);
  2498. end;
  2499. ---------------------------------------
  2500. \\
  2501. 2,2.- Guild-related commands
  2502. \\
  2503. ---------------------------------------
  2504. *getguildname(<guild id>)
  2505. This function returns a guild's name given an ID number. If there is no such
  2506. guild, "null" will be returned.
  2507. Example:
  2508. mes "The guild " + getguildname(10007) + " are all nice people.";
  2509. ---------------------------------------
  2510. *getguildmember <guild id>{,<type>{,<array_variable>}};
  2511. This command will find all members of a specified guild and returns their names
  2512. (or character id or account id depending on the value of "type") into an array
  2513. of temporary global variables.
  2514. Upon executing this,
  2515. $@guildmembername$[] is a global temporary string array which contains all the
  2516. names of these guild members.
  2517. (only set when type is 0 or not specified)
  2518. $@guildmembercid[] is a global temporary number array which contains the
  2519. character id of these guild members.
  2520. (only set when type is 1)
  2521. $@guildmemberaid[] is a global temporary number array which contains the
  2522. account id of these guild members.
  2523. (only set when type is 2)
  2524. $@guildmembercount is the number of guild members that were found.
  2525. The guild members will be found regardless of whether they are online or offline.
  2526. Note that the names come in no particular order.
  2527. Be sure to use $@guildmembercount to go through this array, and not
  2528. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2529. If 'array_variable' is set, the result will be stored to that variable instead
  2530. using global variable.
  2531. For usage examples, see 'getpartymember'.
  2532. ---------------------------------------
  2533. *getguildmaster(<guild id>)
  2534. This function return the name of the master of the guild which has the specified
  2535. ID number. If there is no such guild, "null" will be returned.
  2536. Example 1:
  2537. // Prints the guild master of guild 10007, whoever that might be.
  2538. mes getguildmaster(10007) + " runs " + getguildname(10007);
  2539. Example 2:
  2540. // Checks if the character is the guild master of the specified guild.
  2541. .@GID = getcharid(2);
  2542. if (.@GID == 0) {
  2543. mes "Sorry, you are not in a guild.";
  2544. close;
  2545. }
  2546. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2547. mes "Sorry, you don't own the guild you are in.";
  2548. close;
  2549. }
  2550. mes "Welcome, guild master of " + getguildname(.@GID);
  2551. close;
  2552. ---------------------------------------
  2553. *getguildmasterid(<guild id>)
  2554. This function will return the character ID number of the guild master of the
  2555. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2556. ---------------------------------------
  2557. *is_guild_leader({<guild ID>})
  2558. This command will return true if the player attached to the script is the leader
  2559. of his/her guild, or, if a guild ID is specified, of that guild.
  2560. ---------------------------------------
  2561. *getcastlename("<map name>")
  2562. This function returns the name of the castle when given the map name for that
  2563. castle. The data is read from 'db/castle_db.yml'.
  2564. ---------------------------------------
  2565. *getcastledata("<map name>",<type of data>)
  2566. *setcastledata "<map name>",<type of data>,<value>;
  2567. This function returns the castle ownership information for the castle referred
  2568. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2569. Types of data correspond to `guild_castle` table columns:
  2570. CD_GUILD_ID - Guild ID.
  2571. CD_CURRENT_ECONOMY - Castle Economy score.
  2572. CD_CURRENT_DEFENSE - Castle Defense score.
  2573. CD_INVESTED_ECONOMY - Number of times the economy was invested in today.
  2574. CD_INVESTED_DEFENSE - Number of times the defense was invested in today.
  2575. CD_NEXT_TIME - unused
  2576. CD_PAY_TIME - unused
  2577. CD_CREATE_TIME - unused
  2578. CD_ENABLED_KAFRA - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2579. CD_ENABLED_GUARDIAN0 - Is 1 if the 1st guardian is present (Soldier Guardian)
  2580. CD_ENABLED_GUARDIAN1 - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2581. CD_ENABLED_GUARDIAN2 - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2582. CD_ENABLED_GUARDIAN3 - Is 1 if the 4th guardian is present (Archer Guardian)
  2583. CD_ENABLED_GUARDIAN4 - Is 1 if the 5th guardian is present (Archer Guardian)
  2584. CD_ENABLED_GUARDIAN5 - Is 1 if the 6th guardian is present (Knight Guardian)
  2585. CD_ENABLED_GUARDIAN6 - Is 1 if the 7th guardian is present (Knight Guardian)
  2586. CD_ENABLED_GUARDIAN7 - Is 1 if the 8th guardian is present (Knight Guardian)
  2587. All types of data have their meaning determined by War of Emperium scripts,
  2588. with exception of:
  2589. - CD_GUILD_ID that is always considered ID of the guild that owns the castle,
  2590. - CD_CURRENT_DEFENSE that is used in Guardians & Emperium HP calculations,
  2591. - CD_ENABLED_GUARDIANX that is always considered to hold guardian presence bits.
  2592. The 'setcastledata' command will behave identically, but instead of returning
  2593. values for the specified types of accessible data, it will alter them and cause
  2594. them to be sent to the char-server for storage.
  2595. Changing Guild ID or Castle Defense will trigger additional actions, like
  2596. recalculating guardians' HP.
  2597. ---------------------------------------
  2598. *getgdskilllv(<guild id>,<skill id>)
  2599. *getgdskilllv(<guild id>,"<skill name>")
  2600. This function returns the level of the skill <skill id> of the guild <guild id>.
  2601. If the guild does not have that skill, 0 is returned.
  2602. If the guild does not exist, -1 is returned.
  2603. Refer to 'db/(pre-)re/skill_db.yml' for the full list of skills. (GD_* are guild skills)
  2604. ---------------------------------------
  2605. *requestguildinfo <guild id>{,"<event label>"};
  2606. This command requests the guild data from the char server and merrily continues
  2607. with the execution. Whenever the guild information becomes available (which
  2608. happens instantly if the guild information is already in memory, or later, if it
  2609. isn't and the map server has to wait for the char server to reply) it will run
  2610. the specified event as in a 'donpcevent' call.
  2611. ---------------------------------------
  2612. *getmapguildusers("<map name>",<guild id>)
  2613. Returns the amount of characters from the specified guild on the given map.
  2614. Example:
  2615. mes "You have " + getMapGuildUsers("prontera",getcharid(2)) + " guild members in Prontera.";
  2616. ---------------------------------------
  2617. //
  2618. 2,2.- End of guild-related commands
  2619. //
  2620. ---------------------------------------
  2621. *getskilllv(<skill id>)
  2622. *getskilllv("<skill name>")
  2623. This function returns the level of the specified skill that the invoking
  2624. character has. If they don't have the skill, 0 will be returned. The full list
  2625. of character skills is available in 'db/(pre-)re/skill_db.yml'.
  2626. There are two main uses for this function, it can check whether the character
  2627. has a skill or not, and it can tell you if the level is high enough.
  2628. Example 1:
  2629. if (getskilllv(152))
  2630. mes "You have got the skill Throw Stone";
  2631. else
  2632. mes "You don't have Throw Stone";
  2633. close;
  2634. Example 2:
  2635. if (getskilllv(28) >= 5)
  2636. mes "Your heal lvl is 5 or more";
  2637. else if (getskilllv(28) == 10)
  2638. mes "Your heal lvl has been maxed";
  2639. else
  2640. mes "You heal skill is below lvl 5";
  2641. close;
  2642. ---------------------------------------
  2643. *getskilllist({<char_id>});
  2644. This command sets a bunch of arrays with a complete list of skills the
  2645. invoking character has. Here's what you get:
  2646. @skilllist_id[] - skill ids.
  2647. @skilllist_lv[] - skill levels.
  2648. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2649. @skilllist_count - number of skills in the above arrays.
  2650. While 'getskillv' is probably more useful for most situations, this is the
  2651. easiest way to store all the skills and make the character something else for a
  2652. while. Advanced job for a day? This could also be useful to see how many
  2653. skills a character has.
  2654. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2655. ---------------------------------------
  2656. *getmonsterinfo(<mob ID>,<type>)
  2657. This function will look up the monster with the specified ID number in the
  2658. mob database and return the info set by TYPE argument.
  2659. It will return -1 if there is no such monster (or the type value is invalid),
  2660. or "null" if you requested the monster's name.
  2661. Valid types are:
  2662. MOB_NAME - monster's name, if there is no such monster "null" is returned
  2663. MOB_LV - monster's level
  2664. MOB_MAXHP - monster's maximum hp
  2665. MOB_BASEEXP - monster's base experience
  2666. MOB_JOBEXP - monster's job experience
  2667. MOB_ATK1 - monster's atk
  2668. MOB_ATK2 - monster's atk2
  2669. MOB_DEF - monster's def
  2670. MOB_MDEF - monster's mdef
  2671. MOB_RES - monster's res
  2672. MOB_MRES - monster's mres
  2673. MOB_STR - monster's str
  2674. MOB_AGI - monster's agi
  2675. MOB_VIT - monster's vit
  2676. MOB_INT - monster's int
  2677. MOB_DEX - monster's dex
  2678. MOB_LUK - monster's luk
  2679. MOB_RANGE - monster's range
  2680. MOB_RANGE2 - monster's range2
  2681. MOB_RANGE3 - monster's range3
  2682. MOB_SIZE - monster's size
  2683. MOB_RACE - monster's race
  2684. MOB_ELEMENT - monster's element(doesn't return the element level, only the element ID)
  2685. MOB_MODE - monster's mode
  2686. MOB_MVPEXP - monster's mvp experience
  2687. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2688. ---------------------------------------
  2689. *getmobdrops(<mob id>)
  2690. This command will find all drops of the specified mob and return the item IDs
  2691. and drop percentages into arrays of temporary global variables.
  2692. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2693. Upon executing this,
  2694. $@MobDrop_item[] is a global temporary number array which contains the
  2695. item IDs of the monster's drops.
  2696. $@MobDrop_rate[] is a global temporary number array which contains the
  2697. drop percentages of each item. (1 = .01%)
  2698. $@MobDrop_nosteal[] is a global temporary number array which contains the
  2699. StealProtected flag of each item. (default false)
  2700. $@MobDrop_randomopt[] is a global temporary number array which contains the
  2701. random option group ID of each item. (default 0)
  2702. $@MobDrop_count is the number of item drops found.
  2703. Be sure to use $@MobDrop_count to go through the arrays, and not
  2704. 'getarraysize', because the temporary global arrays are not cleared between
  2705. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2706. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2707. the server will not clear the arrays for you, overwriting the values instead. So
  2708. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2709. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2710. belong to the new mob. $@MobDrop_count will always contain the correct number
  2711. (5), unlike 'getarraysize()' which would return 7 in this case.
  2712. Example:
  2713. // get a Mob ID from the user
  2714. input .@mob_id;
  2715. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2716. // immediately copy global temporary variables into scope variables,
  2717. // since we don't know when 'getmobdrops' will get called again for
  2718. // another mob, overwriting your global temporary variables
  2719. .@count = $@MobDrop_count;
  2720. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2721. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2722. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2723. for( .@i = 0; .@i < .@count; .@i++ ) {
  2724. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2725. }
  2726. } else {
  2727. mes "Unknown monster ID.";
  2728. }
  2729. close;
  2730. ---------------------------------------
  2731. *skillpointcount({<char_id>})
  2732. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2733. This command can be used to check the currently attached characters total amount of skill points.
  2734. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2735. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2736. Example 1:
  2737. .@skillPoints = skillpointcount();
  2738. mes "You have " + .@skillPoints + " skill points in total!";
  2739. Example 2:
  2740. if (skillpointcount() > 20)
  2741. mes "Wow, you have more then 20 Skill Points in total!";
  2742. ---------------------------------------
  2743. *getscrate(<effect type>,<base rate>{,<GID>})
  2744. This function will return the chance of a status effect affecting the invoking
  2745. character, in percent, modified by the their current defense against said
  2746. status. The 'base rate' is the base chance of the status effect being inflicted,
  2747. in percent.
  2748. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2749. You can see the full list of available effect types you can possibly inflict in
  2750. 'src/map/script_constants.hpp' under 'Eff_'.
  2751. ---------------------------------------
  2752. ========================
  2753. |3.- Checking commands.|
  2754. ========================
  2755. ---------------------------------------
  2756. *playerattached()
  2757. Returns the ID of the player currently attached to the script. It will return
  2758. 0 if no one is attached, or if the attached player no longer exists on the map
  2759. server. It is wise to check for the attached player in script functions that
  2760. deal with timers as there's no guarantee the player will still be logged on
  2761. when the timer triggers. Note that the ID of a player is actually their
  2762. account ID.
  2763. ---------------------------------------
  2764. *getattachedrid();
  2765. Returns RID from running script. Script may not be attached to any RID like
  2766. a floating script or function and will return 0.
  2767. ---------------------------------------
  2768. *isloggedin(<account id>{,<char id>})
  2769. This function returns 1 if the specified account is logged in and 0 if they
  2770. aren't. You can also pass the char id to check for both account and char id.
  2771. ---------------------------------------
  2772. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2773. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2774. *checkweight2(<id_array>,<amount_array>);
  2775. These functions will compute and return 1 if the total weight of the specified
  2776. number of specific items does not exceed the invoking character's carrying
  2777. capacity, and 0 otherwise. It is important to see if a player can carry the
  2778. items you expect to give them, failing to do that may open your script up to
  2779. abuse or create some very unfair errors.
  2780. The second function will check an array of items and amounts, and also
  2781. returns 1 on success and 0 on failure.
  2782. The functions, in addition to checking to see if the player is capable of
  2783. holding a set amount of items, also ensure the player has room in their
  2784. inventory for the item(s) they will be receiving.
  2785. Like 'getitem', this function will also accept an 'english name' from the
  2786. database as an argument.
  2787. Example 1:
  2788. if (checkweight(512,10)) {
  2789. getitem 512,10;
  2790. } else {
  2791. mes "Sorry, you cannot hold this amount of apples!";
  2792. }
  2793. Example 2:
  2794. setarray .@item[0],512,513,514;
  2795. setarray .@amount[0],10,5,5;
  2796. if (!checkweight2(.@item,.@amount)) {
  2797. mes "Sorry, you cannot hold this amount of fruit!";
  2798. }
  2799. ---------------------------------------
  2800. *basicskillcheck()
  2801. This function will return the state of the configuration option
  2802. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2803. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2804. it is by default, characters must have a certain number of basic skill levels to
  2805. sit, request a trade, use emotions, etc. Making your script behave differently
  2806. depending on whether the characters must actually have the skill to do all these
  2807. things might in some cases be required.
  2808. ---------------------------------------
  2809. *checkoption(<option number>{,<char_id>})
  2810. *checkoption1(<option number>{,<char_id>})
  2811. *checkoption2(<option number>{,<char_id>})
  2812. *setoption <option number>{,<flag>{,<char_id>}};
  2813. The 'setoption' series of functions check for a so-called option that is set on
  2814. the invoking character. 'Options' are used to store status conditions and a lot
  2815. of other non-permanent character data of the yes-no kind. For most common cases,
  2816. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2817. functions, but there are some options which you cannot get at this way. They
  2818. return 1 if the option is set and 0 if the option is not set.
  2819. Option numbers valid for the first (option) version of this command are:
  2820. 0x1 - Sight in effect.
  2821. 0x2 - Hide in effect.
  2822. 0x4 - Cloaking in effect.
  2823. 0x8 - Cart number 1 present.
  2824. 0x10 - Falcon present.
  2825. 0x20 - Peco Peco present.
  2826. 0x40 - GM Perfect Hide in effect.
  2827. 0x80 - Cart number 2 present.
  2828. 0x100 - Cart number 3 present.
  2829. 0x200 - Cart number 4 present.
  2830. 0x400 - Cart number 5 present.
  2831. 0x800 - Orc head present.
  2832. 0x1000 - The character is wearing a wedding sprite.
  2833. 0x2000 - Ruwach is in effect.
  2834. 0x4000 - Chasewalk in effect.
  2835. 0x8000 - Flying or Xmas suit.
  2836. 0x10000 - Sighttrasher.
  2837. 0x100000 - Warg present.
  2838. 0x200000 - The character is riding a warg.
  2839. Option numbers valid for the second version (opt1) of this command are:
  2840. 1 - Petrified.
  2841. 2 - Frozen.
  2842. 3 - Stunned.
  2843. 4 - Sleeping.
  2844. 6 - Petrifying (the state where you can still walk)
  2845. Option numbers valid for the third version (opt2) of this command are:
  2846. 0x1 - Poisoned.
  2847. 0x2 - Cursed.
  2848. 0x4 - Silenced.
  2849. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2850. 0x10 - Blinded.
  2851. 0x80 - Deadly poisoned.
  2852. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2853. for several states, but the functions will return true if at least one of them
  2854. is in effect.
  2855. 'setoption' will set options on the invoking character. There are no second and
  2856. third versions of this command, so you can only change the values in the first
  2857. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2858. the option will be added to what the character currently has; if 0, the option is removed.
  2859. This is definitely not a complete list of available option flag numbers. Ask a
  2860. core developer (or read the source: src/map/status.hpp) for the full list.
  2861. ---------------------------------------
  2862. *setcart {<type>{,<char_id>}};
  2863. *checkcart({<char_id>});
  2864. If <type> is 0 this command will remove the cart from the character.
  2865. Otherwise it gives the invoking character a cart. The cart given will be
  2866. cart number <type> and will work regardless of whether the character is a
  2867. merchant class or not.
  2868. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2869. The accompanying function will return 1 if the invoking character has a cart
  2870. (any kind of cart) and 0 if they don't.
  2871. if (checkcart()) mes "But you already have a cart!";
  2872. ---------------------------------------
  2873. *setfalcon {<flag>{,<char_id>}};
  2874. *checkfalcon({<char_id>});
  2875. If <flag> is 0 this command will remove the falcon from the character.
  2876. Otherwise it gives the invoking character a falcon. The falcon will be there
  2877. regardless of whether the character is a hunter or not. It will (probably) not
  2878. have any useful effects for non-hunters though.
  2879. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2880. The accompanying function will return 1 if the invoking character has a falcon
  2881. and 0 if they don't.
  2882. if (checkfalcon()) mes "But you already have a falcon!";
  2883. ---------------------------------------
  2884. *setriding {<flag>{,<char_id>}};
  2885. *checkriding({<char_id>});
  2886. If <flag> is 0 this command will remove the mount from the character.
  2887. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2888. series class), a GrandPeco (if they are a Crusader series class), or
  2889. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2890. this will not work at all if they aren't of a class which can ride.
  2891. Note: the character needs to have the skill KN_RIDING to gain a mount
  2892. The accompanying function will return 1 if the invoking character is riding a
  2893. bird and 0 if they aren't.
  2894. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2895. ---------------------------------------
  2896. *setdragon {<color>{,<char_id>}};
  2897. *checkdragon({<char_id>});
  2898. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2899. It will return 1 if successful, 0 otherwise.
  2900. The available colors are:
  2901. 1 - Green Dragon (default)
  2902. 2 - Brown Dragon
  2903. 3 - Gray Dragon
  2904. 4 - Blue Dragon
  2905. 5 - Red Dragon
  2906. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2907. The accompanying function will return 1 if the invoking character is riding a
  2908. dragon and 0 if they aren't.
  2909. ---------------------------------------
  2910. *setmadogear {<flag>{,<type>{,<char_id>}}};
  2911. *checkmadogear({<char_id>});
  2912. If <flag> is false this command will remove the mount from the character.
  2913. Otherwise it gives the invoking character a Mado (if they are a Mechanic and have the skill NC_MADOLICENCE).
  2914. When using client version PACKETVER_MAIN_NUM >= 20191120 or PACKETVER_RE_NUM >= 20191106
  2915. the <type> flag can be used to specify a specific madogear.
  2916. Types:
  2917. MADO_ROBOT (default)
  2918. MADO_SUIT
  2919. The accompanying function will return 1 if the invoking character has a
  2920. Mado and 0 if they don't.
  2921. ---------------------------------------
  2922. *setmounting {<char_id>};
  2923. *ismounting({<char_id>});
  2924. The 'setmounting' function toggles cash mount for the invoking character.
  2925. It will return 1 if successful, 0 otherwise.
  2926. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2927. The accompanying function will return 1 if the invoking character has a
  2928. cash mount and 0 if they don't.
  2929. ---------------------------------------
  2930. *checkwug({<char_id>});
  2931. This function will return 1 if the invoking character has a
  2932. warg and 0 if they don't.
  2933. ---------------------------------------
  2934. *checkvending({"<Player Name>"})
  2935. Checks if the player is vending or has has a buyingstore. Additionally
  2936. it gives you the information whether the player uses autotrade or not.
  2937. Name is optional, and defaults to the attached player if omitted.
  2938. The returned value is bitmask of.
  2939. 0 = doesn't have a vending or buyingstore (which also means he can't use autotrade)
  2940. 1 = normal vending
  2941. 2 = using @autotrade
  2942. 4 = has a buyingstore
  2943. Examples:
  2944. //This will check Aaron's state
  2945. .@state = checkvending("Aaron");
  2946. if (.@state&1)
  2947. mes "Aaron is currently vending!";
  2948. if (.@state&4)
  2949. mes "Aaron has a buying store!";
  2950. if (.@state&2)
  2951. mes "Aaron is autotrading!";
  2952. ---------------------------------------
  2953. *checkchatting({"<Player Name>"})
  2954. Checks if the player is in a chatroom.
  2955. Name is optional, and defaults to the attached player if omitted.
  2956. Returns 1 if they are in a chat room, 0 if they are not.
  2957. Examples:
  2958. //This will check if the attached player in a chat room or not.
  2959. if (checkchatting())
  2960. mes "You are currently in a chat room!";
  2961. ---------------------------------------
  2962. *checkidle({"<Player Name>"})
  2963. Returns the time, in seconds, that the specified player has been idle.
  2964. Name is optional, and defaults to the attached player if omitted.
  2965. ---------------------------------------
  2966. *checkidlehom({"<Player Name>"})
  2967. Returns the time, in seconds, that the specified player has been idle for homunculus item/exp share.
  2968. Name is optional, and defaults to the attached player if omitted.
  2969. This will only work if 'hom_idle_no_share' and 'idletime_hom_option' are enabled (see '/conf/battle/homunc.conf').
  2970. ---------------------------------------
  2971. *checkidlemer({"<Player Name>"})
  2972. Returns the time, in seconds, that the specified player has been idle for mercenary item share.
  2973. Name is optional, and defaults to the attached player if omitted.
  2974. This will only work if 'mer_idle_no_share' and 'idletime_mer_option' are enabled (see '/conf/battle/drops.conf').
  2975. ---------------------------------------
  2976. *agitcheck()
  2977. *agitcheck2()
  2978. *agitcheck3()
  2979. These function will let you check whether the server is currently in WoE:FE mode
  2980. (agitcheck()), WoE:SE mode (agitcheck2()), or WoE:TE mode (agitcheck3()) and will
  2981. return true if War of Emperium is on and false if it isn't.
  2982. ---------------------------------------
  2983. *isnight()
  2984. *isday()
  2985. These functions will return 1 or 0 depending on whether the server is in night
  2986. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2987. the other way around. They can be used interchangeably, pick the one you like
  2988. more:
  2989. // These two are equivalent:
  2990. if (isday()) mes "I only prowl in the night.";
  2991. if (isnight() != 1) mes "I only prowl in the night.";
  2992. ---------------------------------------
  2993. *checkre(<type>)
  2994. Checks if a renewal feature is enabled or not in renewal.hpp, and returns 1 if
  2995. enabled and 0 for disabled.
  2996. The renewal feature to check is determined by the number <type>.
  2997. 0 - RENEWAL enabled (game renewal server mode)
  2998. 1 - RENEWAL_CAST (renewal cast time)
  2999. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  3000. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  3001. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  3002. 5 - RENEWAL_ASPD (renewal ASPD)
  3003. ---------------------------------------
  3004. \\
  3005. 3,1.- Item-related commands
  3006. \\
  3007. ---------------------------------------
  3008. *isequipped(<id>{,<id>{,..}})
  3009. This function will return 1 if the invoking character has all of the item
  3010. IDs given equipped (if item/card IDs are passed, then it checks if the items/cards are
  3011. inserted into slots in the equipment they are currently wearing). Theoretically
  3012. there is no limit to the number of items that may be tested for at the same time.
  3013. If even one of the items given is not equipped, 0 will be returned.
  3014. // (Poring,Santa Poring,Poporing,Marin)
  3015. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  3016. // (Poring)
  3017. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  3018. The function was meant for item scripts to support the cards released by Gravity
  3019. in February 2005, but it will work just fine in normal NPC scripts.
  3020. ---------------------------------------
  3021. *isequippedcnt(<id>{,<id>{,..}})
  3022. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  3023. the amount of item/card equipped that were found on the invoking character from the given list.
  3024. Example:
  3025. if (isequippedcnt(4001,4005,4033,4196) == 5)
  3026. mes "Finally got 5 cards from poring monsters type?";
  3027. ---------------------------------------
  3028. *checkequipedcard(<item id>)
  3029. This function will return 1 if the item/card specified by its item ID number is
  3030. inserted into any equipment they have in their inventory, currently equipped or
  3031. not.
  3032. ---------------------------------------
  3033. //
  3034. 3,1.- End of item-related commands
  3035. //
  3036. ---------------------------------------
  3037. ==============================
  3038. |4.- Player-related commands.|
  3039. ==============================
  3040. ---------------------------------------
  3041. *attachrid(<account ID>{,force})
  3042. *detachrid;
  3043. These commands allow the manipulation of the script's currently attached player.
  3044. While 'attachrid' allows attaching of a different player by using its account id
  3045. for the parameter RID, 'detachrid' makes the following commands run as if the
  3046. script was never invoked by a player.
  3047. The command returns false if the player cannot be attached (if the account is offline
  3048. or does not exist), and true upon success.
  3049. By default the command is executed with force, which causes to attach the player
  3050. even if he is currently attached to another script. Since this is not always the
  3051. desired behavior you can also specify false to the command and it will only return
  3052. true if the player is online and was not attached to another script.
  3053. ---------------------------------------
  3054. *addrid(<type>{,<flag>{,<parameters>}});
  3055. This command will attach other RIDs to the current script without detaching the
  3056. invoking RID. It returns 1 if successful and 0 upon failure.
  3057. <type> determines what RIDs are attached:
  3058. 0: All players in the server.
  3059. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  3060. 2: Party members of a specified party ID.
  3061. [ Parameters: <party id> ]
  3062. 3: Guild members of a specified guild ID.
  3063. [ Parameters: <guild id> ]
  3064. 4: All players in a specified area of the map of the invoking player (or NPC).
  3065. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  3066. 5: All players in the map.
  3067. [ Parameters: "<map name>" ]
  3068. Account ID: If type is Account ID, attach the specified account ID.
  3069. <flag> can prevent certain players from being attached:
  3070. 0: Players are always attached. (default)
  3071. 1: Players currently running another script will not be attached.
  3072. ---------------------------------------
  3073. *rid2name(<rid>)
  3074. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  3075. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  3076. Note: rid2name may not produce correct character names since rid = account id.
  3077. It will return the current online character of the account only.
  3078. ---------------------------------------
  3079. *message "<character name>","<message>";
  3080. That command will send a message to the chat window of the character specified
  3081. by name. The text will also appear above the head of that character. It will not
  3082. be seen by anyone else.
  3083. ---------------------------------------
  3084. *dispbottom "<message>"{,<color>{,<char_id>}};
  3085. This command will send the given message with color into the invoking character's chat
  3086. window. The color format is in RGB (0xRRGGBB). The color is
  3087. by default green
  3088. ---------------------------------------
  3089. *showscript "<message>"{,<GID>, <flag>};
  3090. Makes attached player or GID says a message like shouting a skill name, the message
  3091. will be seen to everyone around but not in chat window.
  3092. flag: Specify target
  3093. AREA - Message is sent to players in the vicinity of the source (default).
  3094. SELF - Message is sent only to player attached.
  3095. ---------------------------------------
  3096. *warp "<map name>",<x>,<y>{,<char id>};
  3097. This command will take the invoking character or <char id>, if specified, to the specified map, and if
  3098. wanted, specified coordinates too, but these can be random.
  3099. warp "place",50,55;
  3100. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  3101. coordinates land on an unwalkable map square, it will send the warped character
  3102. to a random place. Same will happen if they are both zero:
  3103. warp "place",0,0;
  3104. Notice that while warping people to coordinates 0,0 will normally get them into
  3105. a random place, it's not certain to always be so. Darned if I know where this is
  3106. actually coded, it might be that this happens because square 0,0 is unwalkable
  3107. on all official maps. If you're using custom maps, beware.
  3108. There are also three special 'map names' you can use.
  3109. "Random" will warp the player randomly on the current map.
  3110. "Save" and "SavePoint" will warp the player back to their save point.
  3111. ---------------------------------------
  3112. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  3113. This command is similar to 'warp', however, it will not refer to the invoking
  3114. character, but instead, all characters within a specified area, defined by the
  3115. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  3116. including the activating character, if they are outside the area.
  3117. areawarp "place",10,10,120,120,"place2",150,150;
  3118. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  3119. shape, on the map called "place", will be affected, and warped to "place2" X 150
  3120. Y 150
  3121. areawarp "place",10,10,120,120,"place2",0,0;
  3122. By using ,0,0; as the destination coordinates it will take all the characters in
  3123. the affected area to a random set of co-ordinates on "place2".
  3124. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  3125. By using the optional x4 and y4 parameters, the destination coordinates will be a
  3126. random place within the defined x3/y3-x4/y4 square.
  3127. Like 'warp', areawarp will also explicitly warp characters randomly into the
  3128. current map if you give the 'to map name' as "Random".
  3129. See also 'warp'.
  3130. ---------------------------------------
  3131. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>",<range x>,<range y>};
  3132. Warps a party to specified map and coordinate given the party ID, which you can get with
  3133. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  3134. You can use the following "map names" for special warping behavior:
  3135. Random: All party members are randomly warped in their current map (as if they
  3136. all used a fly wing)
  3137. SavePointAll: All party members are warped to their respective save point.
  3138. SavePoint: All party members are warped to the save point of the currently
  3139. attached player (will fail if there's no player attached).
  3140. Leader: All party members are warped to the leader's position. The leader must
  3141. be online and in the current map-server for this to work.
  3142. RandomAll: All party members are warped to the same random position in their current map
  3143. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  3144. The <range x> and <range y> optional values allow for a randomization with the
  3145. player's warp point. The values will randomly add or subtract from the given <x>
  3146. and <y> coordinates.
  3147. Example:
  3148. mes "[Party Warper]";
  3149. mes "Here you go!";
  3150. close2;
  3151. .@party_id = getcharid(1);
  3152. warpparty "prontera",150,100,.@party_id;
  3153. close;
  3154. ---------------------------------------
  3155. *warpguild "<map name>",<x>,<y>,<guild_id>;
  3156. Warps a guild to specified map and coordinate given the guild id, which you can get with
  3157. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  3158. You can use the following "map names" for special warping behavior:
  3159. Random: All guild members are randomly warped in their current map (as if they
  3160. all used a fly wing)
  3161. SavePointAll: All guild members are warped to their respective save point.
  3162. SavePoint: All guild members are warped to the save point of the currently
  3163. attached player (will fail if there's no player attached).
  3164. Example:
  3165. warpguild "prontera",x,y,Guild_ID;
  3166. ---------------------------------------
  3167. *warppartner("<map name>",<x>,<y>);
  3168. This function will find the invoking character's marriage partner, if any, and
  3169. warp them to the map and coordinates given. It will return 1 upon success and
  3170. 0 if the partner is not online, the character is not married, or if there's no
  3171. invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
  3172. ---------------------------------------
  3173. *savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  3174. *save "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  3175. These commands save where the invoking character will return to upon clicking
  3176. "Return to Save Point", after death and in some other cases. The two versions are
  3177. equivalent. They ignore any and all mapflags, and can make a character respawn where
  3178. no teleportation is otherwise possible.
  3179. The <range x> and <range y> optional values allow for a randomization with the
  3180. player's save point. The values will randomly add or subtract from the given <x>
  3181. and <y> coordinates.
  3182. savepoint "place",350,75;
  3183. savepoint "place",350,75,2,2; // Randomly save the character between 348,73 and 352,77
  3184. ---------------------------------------
  3185. *heal <hp>,<sp>{,<char_id>};
  3186. This command will heal a set amount of HP and/or SP on the invoking character.
  3187. heal 30000,0; // This will heal 30,000 HP
  3188. heal 0,30000; // This will heal 30,000 SP
  3189. heal 300,300; // This will heal 300 HP and 300 SP
  3190. This command just alters the hit points and spell points of the invoking
  3191. character and produces no other output whatsoever.
  3192. ---------------------------------------
  3193. *healap <ap>{,<char_id>};
  3194. This command will heal a set amount of AP on the invoking character.
  3195. healap 10; // This will give 10 AP
  3196. healap -10; // This will remove 10 AP
  3197. This command just alters the activity points of the invoking
  3198. character and produces no other output whatsoever.
  3199. ---------------------------------------
  3200. *itemheal <hp>,<sp>{,<char_id>};
  3201. This command heals relative amounts of HP and/or SP on the invoking character.
  3202. Unlike heal, this command is intended for use in item scripts. It applies
  3203. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  3204. When used inside an NPC script, certain bonuses are omitted.
  3205. The command also applies a SP/VIT-related bonus:
  3206. heal = heal * [(100 + STATUS*2) / 100]
  3207. Example:
  3208. // If the player has 50 vit and no bonuses, this will heal
  3209. // anything from 200 to 300 HP and 5 SP
  3210. itemheal rand(100,150),5;
  3211. ---------------------------------------
  3212. *percentheal <hp>,<sp>{,<char_id>};
  3213. This command will heal the invoking character. It heals the character, but not
  3214. by a set value - it adds percent of their maximum HP/SP.
  3215. percentheal 100,0; // This will heal 100% HP
  3216. percentheal 0,100; // This will heal 100% SP
  3217. percentheal 50,50; // This will heal 50% HP and 50% SP
  3218. So the amount that this will heal will depend on the total amount of HP or SP
  3219. you have maximum. Like 'heal', this will not call up any animations or effects.
  3220. ---------------------------------------
  3221. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  3222. This command will revive and fully restore the HP/SP of the selected characters.
  3223. It returns 1 upon successful use.
  3224. <type> is the target, and determines the <option> parameter:
  3225. 0: Player -> Character ID number
  3226. 1: Party -> Party ID number
  3227. 2: Guild -> Guild ID number
  3228. 3: Map -> Map name (a string)
  3229. 4: All -> None (takes <revive_flag> as option)
  3230. If no option is specified, the invoking player's character ID, party ID, guild ID,
  3231. or map will be used.
  3232. <revive_flag> determines the action:
  3233. 1: Revive and heal all players (default)
  3234. 2: Heal living players only
  3235. 4: Revive dead players only
  3236. <map name> can optionally be used to define a single map to execute the command on
  3237. for types 1 (party) and 2 (guild).
  3238. Examples:
  3239. // Only revive characters in invoking party on map "morocc"
  3240. recovery 1,getcharid(1),4,"morocc";
  3241. // Fully heal (don't revive) all members of invoking character's guild
  3242. recovery 2,getcharid(2),2;
  3243. // Revive and fully heal everyone in map "prontera"
  3244. recovery 3,"prontera";
  3245. // Only revive all dead characters on server
  3246. recovery 4,4;
  3247. ---------------------------------------
  3248. *jobchange <job number>{,<upper flag>,<char_id>};
  3249. This command will change the job class of the invoking character.
  3250. jobchange 1; // This would change your player into a Swordman
  3251. jobchange 4002; // This would change your player into a Swordman High
  3252. This command does work with numbers, but you can also use job names. The full
  3253. list of job names and the numbers they correspond to can be found in
  3254. 'src/map/script_constants.hpp'.
  3255. // This would change your player into a Swordman
  3256. jobchange Job_Swordman;
  3257. // This would change your player into a Swordman High
  3258. jobchange Job_Swordman_High;
  3259. 'upper flag' can alternatively be used to specify the type of job one changes
  3260. to. For example, jobchange Job_Swordman,1; will change the character to a high
  3261. swordsman. The upper values are:
  3262. -1 (or when omitted): preserves the current job type.
  3263. 0: Normal/standard classes
  3264. 1: High/Advanced classes
  3265. 2: Baby classes
  3266. This command will also set a permanent character-based variable
  3267. 'jobchange_level' which will contain the job level at the time right before
  3268. changing jobs, which can be checked for later in scripts.
  3269. ---------------------------------------
  3270. *jobname(<job number>)
  3271. This command retrieves the name of the given job using the map_msg entries 550->655.
  3272. mes "[Kid]";
  3273. mes "I never thought I'd met a " + jobname(Class) + " here of all places.";
  3274. close;
  3275. ---------------------------------------
  3276. *eaclass({<job number>,<char_id>})
  3277. This commands returns the "eA job-number" corresponding to the given class, and
  3278. uses the invoking player's class if none is given. The eA job-number is also a
  3279. class number system, but it's one that comes with constants which make it easy
  3280. to convert among classes. The command will return -1 if you pass it a job number
  3281. which doesn't have an eA job-number equivalent.
  3282. .@eac = eaclass();
  3283. if ((.@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  3284. mes "Your base job is Swordman.";
  3285. if (.@eac&EAJL_UPPER)
  3286. mes "You are a rebirth job.";
  3287. if ((.@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  3288. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  3289. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  3290. ---------------------------------------
  3291. *roclass(<job number>{,<gender>})
  3292. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3293. corresponding RO class number. A gender is required because both Bard and Dancers
  3294. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3295. gender if none is given (if no player is attached, male will be used by default).
  3296. The command will return -1 if there is no valid class to represent the specified
  3297. job (for example, if you try to get the baby version of a Taekwon class).
  3298. .@eac = eaclass();
  3299. //Check if class is already rebirth
  3300. if (.@eac&EAJL_UPPER) {
  3301. mes "You look strong.";
  3302. close;
  3303. }
  3304. .@eac = roclass(.@eac|EAJL_UPPER);
  3305. //Check if class has a rebirth version
  3306. if (.@eac != -1) {
  3307. mes "Bet you can't wait to become a " + jobname(.@eac) + "!";
  3308. close;
  3309. }
  3310. ---------------------------------------
  3311. *changebase <job ID number>{,<account ID>};
  3312. This command will change a character's appearance to that of the specified job
  3313. class. Nothing but appearance will change.
  3314. The command will run for the invoking character unless an account ID is given.
  3315. changebase Job_Novice; // Changes player to Novice sprite.
  3316. changebase Class; // Changes player back to default sprite.
  3317. ---------------------------------------
  3318. *classchange(<view id>{,"<NPC name>","<flag>"});
  3319. This command is very ancient, its origins are clouded in mystery.
  3320. It will send a 'display id change' packet to everyone in the immediate area of
  3321. the NPC object, which will supposedly make the NPC look like a different sprite,
  3322. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3323. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3324. and most importantly, will not work at all since this command was broken with
  3325. the introduction of advanced classes. The code is written with the assumption
  3326. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3327. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3328. ID numbers on the other end of the number pool where monster sprites float.
  3329. As a result it is currently impossible to call this command with a valid view
  3330. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3331. run will actually just crash the client.
  3332. It could be a real gem if it can be gotten to actually do what it's supposed to
  3333. do, but this will only happen in a later SVN revision.
  3334. Empty <NPC name> means attached NPC.
  3335. Target for <flag>:
  3336. - bc_area : Sprite is sent to players in the vicinity of the source (default value).
  3337. - bc_self : Sprite is sent only to player attached.
  3338. ---------------------------------------
  3339. *changesex({<char_id>});
  3340. This command will change the gender for the attached character's account. If it
  3341. was male, it will become female, if it was female, it will become male. The
  3342. change will be written to the character server, the player will receive the
  3343. message: "Need disconnection to perform change-sex request..." and the player
  3344. will be immediately kicked to the login screen. When they log back in, they will
  3345. be the opposite sex.
  3346. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3347. they will also have their skills reset upon 'changesex'.
  3348. ---------------------------------------
  3349. *changecharsex({<char_id>});
  3350. This command will change the gender of the attached character. If it
  3351. was male, it will become female, if it was female, it will become male. The
  3352. change will be written to the character server, the player will receive the
  3353. message: "Need disconnection to perform change-sex request..." and the player
  3354. will be immediately kicked to the login screen. When they log back in, they will
  3355. be the opposite sex.
  3356. If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
  3357. the character will also have their skills reset upon 'changecharsex'.
  3358. ---------------------------------------
  3359. *getexp <base_exp>,<job_exp>{,<char_id>};
  3360. This command will give the invoking character a specified number of base and job
  3361. experience points. Used for a quest reward. Negative values won't work.
  3362. The EXP values are adjustted by 'quest_exp_rate' config value, VIP bonus, Guild
  3363. Tax and EXP boost items such Battle Manual, Bubble Gum, or items that have
  3364. SC_EXPBOOST or SC_ITEMBOOST.
  3365. getexp 10000,5000;
  3366. ---------------------------------------
  3367. *getexp2 <base_exp>,<job_exp>{,<char_id>};
  3368. This command is safety version of 'set' command for BaseExp and JobExp. If using
  3369. 'set' while the BaseExp or JobExp value is more than 2,147,483,647 (INT_MAX) will
  3370. causing overflow error.
  3371. Unlike 'getexp', this command ignores the adjustment factors!
  3372. ---------------------------------------
  3373. *getbaseexp_ratio(<percent>{,<base_level>{,char_id});
  3374. Returns the amount of base experience representing the given <percent> of the
  3375. required base experience at <base_level>. If no base level is specified the base
  3376. level of the attached character will be used.
  3377. ---------------------------------------
  3378. *getjobexp_ratio(<percent>{,<job_level>{,char_id});
  3379. Returns the amount of job experience representing the given <percent> of the
  3380. required job experience at <job_level>. If no job level is specified the job
  3381. level of the attached character will be used.
  3382. ---------------------------------------
  3383. *setlook <look type>,<look value>{,<char_id>};
  3384. *changelook <look type>,<look value>{,<char_id>};
  3385. 'setlook' will alter the look data for the invoking character. It is used
  3386. mainly for changing the palette used on hair and clothes: you specify which look
  3387. type you want to change, then the palette you want to use. Make sure you specify
  3388. a palette number that exists/is usable by the client you use.
  3389. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3390. // This will change your hair color, so that it uses palette 8, what ever your
  3391. // palette 8 is, your hair will use that color
  3392. setlook LOOK_HAIR_COLOR,8;
  3393. // This will change your clothes color, so they are using palette 1, whatever
  3394. // your palette 1 is, your clothes will then use that set of colors.
  3395. setlook LOOK_CLOTHES_COLOR,1;
  3396. Here are the possible look types:
  3397. LOOK_BASE - Base sprite
  3398. LOOK_HAIR - Hairstyle
  3399. LOOK_WEAPON - Weapon
  3400. LOOK_HEAD_BOTTOM - Head bottom
  3401. LOOK_HEAD_TOP - Head top
  3402. LOOK_HEAD_MID - Head mid
  3403. LOOK_HAIR_COLOR - Hair color
  3404. LOOK_CLOTHES_COLOR - Clothes color
  3405. LOOK_SHIELD - Shield
  3406. LOOK_SHOES - Shoes
  3407. LOOK_BODY2 - Body style
  3408. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3409. with this value. It still wants it from the server though, so it is kept, but
  3410. normally doesn't do a thing.
  3411. Only the look data for hairstyle, hair color and clothes color are saved to the
  3412. char server's database and will persist. Body style will also persist if 'save_body_style'
  3413. configuration is enabled in '/conf/battle/client.conf'. The rest freely change as the character
  3414. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3415. should not expect to set them. In fact, messing with them is generally
  3416. hazardous, do it at your own risk, it is not tested what will this actually do -
  3417. it won't cause database corruption and probably won't cause a server crash, but
  3418. it's easy to crash the client with just about anything unusual.
  3419. However, it might be an easy way to quickly check for empty view IDs for
  3420. sprites, which is essential for making custom headgear.
  3421. Since a lot of people have different palettes for hair and clothes, it's
  3422. impossible to tell you what all the color numbers are. If you want a serious
  3423. example, there is a Stylist script inside the default rAthena installation that
  3424. you can look at: 'npc/custom/stylist.txt'
  3425. ---------------------------------------
  3426. *pushpc <direction>,<cells>;
  3427. This command will push the currently attached player to given direction by given
  3428. amount of square cells. Direction is the same as used when declaring NPCs, and
  3429. can be specified by using one of the DIR_* constants (src/map/script_constants.hpp).
  3430. The knock-back is not restricted by items or map flags, only obstacles are taken
  3431. into account. If there is not enough space to perform the push (e.g. due to a
  3432. wall), the character is pushed only up to the obstacle.
  3433. // pushes the character 5 cells in 3 o'clock direction from its
  3434. // current position.
  3435. pushpc DIR_EAST, 5;
  3436. ---------------------------------------
  3437. *recalculatestat;
  3438. This command will force a stat recalculation for the attached player.
  3439. ---------------------------------------
  3440. *needed_status_point(<type>,<val>{,<char id>});
  3441. Returns the number of stat points needed to change the specified stat <type> by <val>.
  3442. If <val> is negative, returns the number of stat points that would be needed to
  3443. raise the specified stat from (current value - <val>) to current value.
  3444. ---------------------------------------
  3445. *jobcanentermap("<mapname>"{,<JobID>});
  3446. Return true if player (decided by job) can enter the map, false otherwise.
  3447. For optional 'JobID', see constant of Job_*, or use player's Class, BaseJob,
  3448. and BaseClass. If no player is attached, this param must have a value.
  3449. See also db/[pre-]re/job_noenter_map.txt
  3450. ---------------------------------------
  3451. *get_revision()
  3452. This command will return the SVN revision number that the server is currently
  3453. running on.
  3454. if (get_revision() >= 15000)
  3455. mes "Welcome to rAthena!";
  3456. ---------------------------------------
  3457. *get_githash()
  3458. This command will return the Git Hash that the server is currently running on.
  3459. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3460. ---------------------------------------
  3461. \\
  3462. 4,1.- Item-related commands
  3463. \\
  3464. ---------------------------------------
  3465. *getitem <item id>,<amount>{,<account ID>};
  3466. *getitem "<item name>",<amount>{,<account ID>};
  3467. This command will give an amount of specified items to the invoking character.
  3468. If an optional account ID is specified, and the target character is currently
  3469. online, items will be created in their inventory instead. If they are not
  3470. online, nothing will happen.
  3471. In the first and most commonly used version of this command, items are
  3472. referred to by their database ID number found inside 'db/item_db.yml'.
  3473. getitem 502,10 // The person will receive 10 apples
  3474. getitem 617,1 // The person will receive 1 Old Violet Box
  3475. This transaction is logged if the log script generated transactions option is
  3476. enabled.
  3477. You may also create an item by its name in the 'english name' field in the
  3478. item database:
  3479. getitem "RED_POTION",10;
  3480. Which will do what you'd expect. If it can't find that name in the database,
  3481. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3482. This is used in pretty much all NPC scripts that have to do with items and
  3483. quite a few item scripts. For more examples check just about any official script.
  3484. ---------------------------------------
  3485. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3486. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3487. *getitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3488. *getitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3489. *getitem4 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3490. *getitem4 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3491. This command will give an amount of specified items to the invoking character.
  3492. If an optional account ID is specified, and the target character is currently
  3493. online, items will be created in their inventory instead. If they are not
  3494. online, nothing will happen. It works essentially the same as 'getitem' but is
  3495. a lot more flexible.
  3496. Those parameters that are different from 'getitem' are:
  3497. identify - Whether you want the item to be identified (1) or not (0).
  3498. refine - For how many pluses will it be refined.
  3499. It will not let you refine an item higher than the max refine.
  3500. attribute - Whether the item is broken (1) or not (0).
  3501. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3502. the specific card slot.
  3503. Card1-card4 values are also used to store name information for named items, as
  3504. well as the elemental property of weapons and armor. You can create a named item
  3505. in this manner, however, if you just need a named piece of standard equipment,
  3506. it is much easier to the 'getnameditem' function instead.
  3507. You will need to keep these values if you want to destroy and then perfectly
  3508. recreate a named item, for this see 'getinventorylist'.
  3509. If you still want to try creating a named item with this command because
  3510. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3511. this. Careful, minor magic ahead.
  3512. // First, let's get an ID of a character who's name will be on the item.
  3513. // Only an existing character's name may be there.
  3514. // Let's assume our character is 'Adam' and find his ID.
  3515. .@charid = getcharid(0,"Adam");
  3516. // Now we split the character ID number into two portions with a binary
  3517. // shift operation. If you don't understand what this does, just copy it.
  3518. .@card3 = .@charid & 65535;
  3519. .@card4 = .@charid >> 16;
  3520. // If you're inscribing non-equipment, .@card1 must be 254.
  3521. // Arrows are also not equipment.
  3522. .@card1 = 254;
  3523. // For named equipment, card2 means the Star Crumbs and elemental
  3524. // crystals used to make this equipment. For everything else, it's 0.
  3525. .@card2 = 0;
  3526. // Now, let's give the character who invoked the script some
  3527. // Adam's Apples:
  3528. getitem2 512,1,1,0,0,.@card1,.@card2,.@card3,.@card4;
  3529. This wasn't tested with all possible items, so I can't give any promises,
  3530. experiment first before relying on it.
  3531. To create equipment, continue this example it like this:
  3532. // We've already have card3 and card4 loaded with correct
  3533. // values so we'll just set up card1 and card2 with data
  3534. // for an Ice Stiletto.
  3535. // If you're inscribing equipment, .@card1 must be 255.
  3536. .@card1 = 255;
  3537. // That's the number of star crumbs in a weapon.
  3538. .@sc = 2;
  3539. // That's the number of elemental property of the weapon.
  3540. .@ele = 1;
  3541. // And that's the wacky formula that makes them into
  3542. // a single number.
  3543. .@card2 = .@ele+((.@sc*5)<<8);
  3544. // That will make us an Adam's +2 VVS Ice Stiletto:
  3545. getitem2 1216,1,1,2,0,.@card1,.@card2,.@card3,.@card4;
  3546. Experiment with the number of star crumbs - I'm not certain just how much will
  3547. work most and what it depends on. The valid element numbers are:
  3548. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3549. You can, apparently, even create duplicates of the same pet egg with this
  3550. command, creating a pet which is the same, but simultaneously exists in two
  3551. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3552. this really cause.
  3553. 'getitem3' is advance version of 'getitem2' that also use Item Random Option as additional values.
  3554. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3555. <RandomValueArray> : Array variable of item random option's value.
  3556. <RandomParamArray> : Array variable of item random option's param.
  3557. 'getitem4' is advance version of 'getitem3' that also use the grade as additional values.
  3558. Valid grades are:
  3559. ENCHANTGRADE_NONE - No grade
  3560. ENCHANTGRADE_D - Grade D
  3561. ENCHANTGRADE_C - Grade C
  3562. ENCHANTGRADE_B - Grade B
  3563. ENCHANTGRADE_A - Grade A
  3564. Example to get Crimson Weapon with Ghost property:
  3565. // +9 Crimson Dagger [2]
  3566. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3567. setarray .@OptVal[0],0;
  3568. setarray .@OptParam[0],0;
  3569. getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3570. ---------------------------------------
  3571. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3572. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3573. This command behaves identically to 'getitem', but the items created will be
  3574. bound to the target character as specified by the bound type. All items created
  3575. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3576. some cases cannot be traded or stored.
  3577. Valid bound types are:
  3578. Bound_Account : Account Bound item
  3579. Bound_Guild : Guild Bound item
  3580. Bound_Party : Party Bound item
  3581. Bound_Char : Character Bound item
  3582. ---------------------------------------
  3583. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3584. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3585. *getitembound3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3586. *getitembound3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3587. *getitembound4 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3588. *getitembound4 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3589. This command behaves identically to 'getitem2', but the items created will be
  3590. bound to the target character as specified by the bound type. All items created
  3591. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3592. some cases cannot be traded or stored.
  3593. For a list of bound types see 'getitembound'.
  3594. 'getitembound3' is advance version of 'getitembound2' that also use Item Random Option as additional values.
  3595. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3596. <RandomValueArray> : Array variable of item random option's value.
  3597. <RandomParamArray> : Array variable of item random option's param.
  3598. 'getitembound4' is advance version of 'getitembound3' that also use the grade as additional values.
  3599. Valid grades are:
  3600. ENCHANTGRADE_NONE - No grade
  3601. ENCHANTGRADE_D - Grade D
  3602. ENCHANTGRADE_C - Grade C
  3603. ENCHANTGRADE_B - Grade B
  3604. ENCHANTGRADE_A - Grade A
  3605. Example to get Crimson Weapon with Ghost property:
  3606. // +9 Crimson Dagger [2]
  3607. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3608. setarray .@OptVal[0],0;
  3609. setarray .@OptParam[0],0;
  3610. getitembound3 28705,1,1,9,0,0,0,0,0,BOUND_CHAR,.@OptID,.@OptVal,.@OptParam;
  3611. ---------------------------------------
  3612. *getnameditem <item id>,<character name|character ID>;
  3613. *getnameditem "<item name>",<character name|character ID>;
  3614. Create an item signed with the given character's name.
  3615. The command returns 1 when the item is created successfully, or 0 if it fails.
  3616. Failure occurs when:
  3617. - There is no player attached.
  3618. - Item name or ID is not valid.
  3619. - The given character ID/name is offline.
  3620. Example:
  3621. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3622. getnameditem "Apple","Aaron";
  3623. //Self-explanatory (I hope).
  3624. if (getnameitem("Apple","Aaron")) {
  3625. mes "You now have a Aaron's Apple!";
  3626. }
  3627. ---------------------------------------
  3628. *rentitem <item id>,<time>{,<account_id>};
  3629. *rentitem "<item name>",<time>{,<account_id>};
  3630. Creates a rental item in the attached character's inventory. The item will expire
  3631. in <time> seconds and be automatically deleted. When receiving a rental item,
  3632. the character will receive a message in their chat window. The character will
  3633. also receive warning messages in their chat window before the item disappears.
  3634. When rentals expire it will call the UnEquipScript of the item. This can be used
  3635. for special cases such as removing a status change or resetting a variable or state
  3636. of the player.
  3637. This command can not be used to rent stackable items. Rental items cannot be
  3638. dropped, traded, or placed in guild storage. (i.e. trade mask 67)
  3639. Note: 'delitem' in an NPC script can still remove rental items.
  3640. Note: 'countitem' will not count any item with a rental timer. Use 'rentalcountitem' instead.
  3641. ---------------------------------------
  3642. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3643. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3644. *rentitem3 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3645. *rentitem3 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3646. *rentitem4 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3647. *rentitem4 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3648. Creates a rental item in the attached character's inventory. The item will expire
  3649. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3650. See 'getitem2' for an explanation of the expanded parameters.
  3651. 'rentitem3' is advance version of 'rentitem2' that also use Item Random Option as additional values.
  3652. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3653. <RandomValueArray> : Array variable of item random option's value.
  3654. <RandomParamArray> : Array variable of item random option's param.
  3655. 'rentitem4' is advance version of 'rentitem3' that also use the grade as additional values.
  3656. Valid grades are:
  3657. ENCHANTGRADE_NONE - No grade
  3658. ENCHANTGRADE_D - Grade D
  3659. ENCHANTGRADE_C - Grade C
  3660. ENCHANTGRADE_B - Grade B
  3661. ENCHANTGRADE_A - Grade A
  3662. Example to get Crimson Weapon with Ghost property:
  3663. // +9 Crimson Dagger [2]
  3664. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3665. setarray .@OptVal[0],0;
  3666. setarray .@OptParam[0],0;
  3667. rentitem3 28705,(24*60*60),1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3668. ---------------------------------------
  3669. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
  3670. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>{,<canShowEffect>};
  3671. This command will create an item on the specified cell of a map.
  3672. As with any dropped items, the items created with this command will disappear after
  3673. a period of time. Using an amount greater than 1 will create a single stack of the
  3674. given amount, not multiple stacks of 1.
  3675. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3676. Apples if the name isn't found.
  3677. If the map name is given as "this", the map the invoking character is on will be used.
  3678. If <canShowEffect> flag is set to true, it will show a pillar effect on the ground when dropped, depending on the item database's DropEffect flag.
  3679. ---------------------------------------
  3680. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
  3681. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<canShowEffect>};
  3682. *makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3683. *makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3684. *makeitem4 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3685. *makeitem4 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<canShowEffect>};
  3686. This command will create an item on the specified cell of a map. See 'makeitem' for
  3687. further details.
  3688. See 'getitem2' for an explanation of the expanded parameters.
  3689. 'makeitem3' is advance version of 'makeitem2' that also use Item Random Option as additional values.
  3690. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3691. <RandomValueArray> : Array variable of item random option's value.
  3692. <RandomParamArray> : Array variable of item random option's param.
  3693. 'makeitem4' is advance version of 'makeitem3' that also use the grade as additional values.
  3694. Valid grades are:
  3695. ENCHANTGRADE_NONE - No grade
  3696. ENCHANTGRADE_D - Grade D
  3697. ENCHANTGRADE_C - Grade C
  3698. ENCHANTGRADE_B - Grade B
  3699. ENCHANTGRADE_A - Grade A
  3700. Example to get Crimson Weapon with Ghost property:
  3701. // 0.5% chance to get +0 Valkyrie Shield [1]
  3702. // with Neutral Resistance +10% and 5% damage reduction from Demi-Human or Player
  3703. // when Valkyrie Randgris killed
  3704. OnNPCKillEvent:
  3705. if (killedrid == 1751 && rand(0,10000) > 9950) { // Valkyrie Randgris
  3706. getmapxy(.@map$,.@x,.@y,BL_PC);
  3707. setarray .@OptID[0],RDMOPT_ATTR_TOLERACE_NOTHING,RDMOPT_RACE_TOLERACE_HUMAN;
  3708. setarray .@OptVal[0],10,5;
  3709. setarray .@OptParam[0],0;
  3710. makeitem3 2115,1,.@map$,.@x,.@y,0,0,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3711. }
  3712. end;
  3713. ---------------------------------------
  3714. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3715. *cleanmap "<map name>";
  3716. These commands will clear all items lying on the ground on the specified map, either
  3717. within the x1/y1-x2/y2 rectangle or across the entire map.
  3718. ---------------------------------------
  3719. *searchitem <array name>,"<item name>";
  3720. This command will fill the given array with the ID of items whose name matches
  3721. the given one. It returns the number of items found. For performance reasons,
  3722. the results array is limited to 10 items.
  3723. mes "What item are you looking for?";
  3724. input .@name$;
  3725. .@qty = searchitem(.@matches[0],.@name$);
  3726. mes "I found " + .@qty + " items:";
  3727. for (.@i = 0; .@i < .@qty; .@i++)
  3728. // Display name (eg: "Apple[0]")
  3729. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3730. ---------------------------------------
  3731. *delitem <item id>,<amount>{,<account ID>};
  3732. *delitem "<item name>",<amount>{,<account ID>};
  3733. This command will remove a specified amount of items from the invoking/target character.
  3734. Like all the item commands, it uses the item ID found inside 'db/item_db.yml'.
  3735. delitem 502,10; // The person will lose 10 apples
  3736. delitem 617,1; // The person will lose 1 Old Violet Box
  3737. It is always a good idea to check if the player actually has the items before you delete them.
  3738. If you try to delete more items that the player has, the player will lose the ones he/she has
  3739. and the script will terminate with an error.
  3740. Like 'getitem', this command will also accept an 'english name' field from the
  3741. database. If the name is not found, nothing will be deleted.
  3742. ---------------------------------------
  3743. *cartdelitem <item id>,<amount>{,<account ID>};
  3744. *cartdelitem "<item name>",<amount>{,<account ID>};
  3745. *storagedelitem <item id>,<amount>{,<account ID>};
  3746. *storagedelitem "<item name>",<amount>{,<account ID>};
  3747. *guildstoragedelitem <item id>,<amount>{,<account ID>};
  3748. *guildstoragedelitem "<item name>",<amount>{,<account ID>};
  3749. This command behaves identically to 'delitem', but deletes items from the player's
  3750. cart, storage, or guild storage.
  3751. If no cart is mounted, 'cartdelitem' will return -1.
  3752. If player is not in a guild or storage is open, 'guildstoragedelitem' will return -1.
  3753. ---------------------------------------
  3754. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3755. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3756. *delitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3757. *delitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3758. *delitem4 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3759. *delitem4 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3760. This command will remove a specified amount of items from the invoking/target character.
  3761. See 'getitem2' for an explanation of the expanded parameters.
  3762. 'delitem3' is advance version of 'delitem2' that also use Item Random Option as criteria.
  3763. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3764. <RandomValueArray> : Array variable of item random option's value.
  3765. <RandomParamArray> : Array variable of item random option's param.
  3766. 'delitem4' is advance version of 'delitem3' that also use the grade as criteria.
  3767. ---------------------------------------
  3768. *delitemidx <index>{,<amount>{,<char id>}}
  3769. This command will remove an item at the given inventory index.
  3770. If <amount> is not specified, this will remove all of the items at the specified index.
  3771. The only way to get the inventory index is by using 'getinventorylist()'. After deleting
  3772. an item at the given index, that index can remain empty until the player relogs, requiring
  3773. 'getinventorylist()' to be called again. If an item is deleted with an invalid index, the
  3774. script will terminate with an error.
  3775. This command returns true on success and false if the item at the given index could not be deleted or if
  3776. not enough items were available at the given index.
  3777. Example:
  3778. // This will remove all Red Potions from player's inventory
  3779. getinventorylist();
  3780. for (.@i = 0; .@i < @inventorylist_count; ++.@i)
  3781. if (@inventorylist_id[.@i] == 501)
  3782. delitemidx @inventorylist_idx[.@i];
  3783. ---------------------------------------
  3784. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3785. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3786. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3787. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3788. *guildstoragedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3789. *guildstoragedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3790. This command behaves identically to 'delitem2', but deletes items from the player's
  3791. cart, storage, or guild storage.
  3792. If no cart is mounted, 'cartdelitem2' will return -1.
  3793. If player is not in a guild or storage is open, 'guildstoragedelitem2' will return -1.
  3794. ---------------------------------------
  3795. *countitem(<item id>{,<accountID>})
  3796. *countitem("<item name>"{,<accountID>})
  3797. This function will return the number of items for the specified item ID that the
  3798. invoking character has in the inventory.
  3799. mes "[Item Checker]";
  3800. mes "Hmmm, it seems you have " + countitem(502) + " apples";
  3801. close;
  3802. Like 'getitem', this function will also accept an 'english name' from the
  3803. database as an argument.
  3804. If you want to state the number at the end of a sentence, you can do it by
  3805. adding up strings:
  3806. mes "[Item Checker]";
  3807. mes "Hmmm, the total number of apples you are holding is " + countitem("APPLE");
  3808. close;
  3809. ---------------------------------------
  3810. *cartcountitem(<item id>{,<accountID>})
  3811. *cartcountitem("<item name>"{,<accountID>})
  3812. *storagecountitem(<item id>{,<accountID>})
  3813. *storagecountitem("<item name>"{,<accountID>})
  3814. *guildstoragecountitem(<nameID>{,<accountID>})
  3815. *guildstoragecountitem("<item name>"{,<accountID>})
  3816. This command behaves identically to 'countitem', but counts items from the player's
  3817. cart, storage, or guild storage.
  3818. If no cart is mounted, 'cartcountitem' will return -1.
  3819. If player is not in a guild or storage is open, 'guildstoragecountitem' will return -1.
  3820. ---------------------------------------
  3821. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3822. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3823. *countitem3(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3824. *countitem3("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3825. *countitem4(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3826. *countitem4("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3827. Expanded version of 'countitem' function, used for created/carded/forged items.
  3828. This function will return the number of items for the specified item ID and
  3829. other parameters that the invoking character has in the inventory.
  3830. See 'getitem2' for an explanation of the expanded parameters.
  3831. 'countitem3' is advance version of 'countitem2' that also use Item Random Option as criteria.
  3832. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3833. <RandomValueArray> : Array variable of item random option's value.
  3834. <RandomParamArray> : Array variable of item random option's param.
  3835. 'countitem4' is advance version of 'countitem3' that also use the grade as criteria.
  3836. ---------------------------------------
  3837. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3838. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3839. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3840. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3841. *guildstoragecountitem2(<nameID>,<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3842. *guildstoragecountitem2("<item name>",<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3843. This command behaves identically to 'countitem2', but counts items from the player's
  3844. cart, storage, or guild storage.
  3845. If no cart is mounted, 'cartcountitem2' will return -1.
  3846. If player is not in a guild or storage is open, 'guildstoragecountitem2' will return -1.
  3847. ---------------------------------------
  3848. *rentalcountitem(<item id>{,<accountID>})
  3849. *rentalcountitem("<item name>"{,<accountID>})
  3850. This function will return the number of rental items for the specified item ID that the
  3851. invoking character has in the inventory.
  3852. ---------------------------------------
  3853. *rentalcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3854. *rentalcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3855. *rentalcountitem3(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3856. *rentalcountitem3("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3857. *rentalcountitem4(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3858. *rentalcountitem4("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<grade>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<accountID>})
  3859. Expanded version of 'rentalcountitem' function, used for created/carded/forged items.
  3860. This function will return the number of rental items for the specified item ID and
  3861. other parameters that the invoking character has in the inventory.
  3862. See 'getitem2' for an explanation of the expanded parameters.
  3863. 'rentalcountitem3' is advance version of 'rentalcountitem2' that also use Item Random Option as criteria.
  3864. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.yml
  3865. <RandomValueArray> : Array variable of item random option's value.
  3866. <RandomParamArray> : Array variable of item random option's param.
  3867. 'rentalcountitem4' is advance version of 'rentalcountitem3' that also use the grade as criteria.
  3868. ---------------------------------------
  3869. *countbound({<bound type>{,<char_id>}})
  3870. This function will return the number of different bounded items in the character's
  3871. inventory, and sets the arrays @bound_items[] and @bound_amount[] containing all item IDs of the
  3872. counted items and their respective amount. If a bound type is specified, only those items will be counted.
  3873. For a list of bound types see 'getitembound'.
  3874. Example:
  3875. .@total_type = countbound();
  3876. mes "You currently have " + .@total_type + " different type of bounded items.";
  3877. next;
  3878. mes "The list of bounded items include:";
  3879. for(.@i = 0; .@i < .@total_type; .@i++)
  3880. mes "x" + @bound_amount[.@i] + " " + getitemname(@bound_items[.@i]);
  3881. close;
  3882. ---------------------------------------
  3883. *groupranditem <group id>{,<sub_group>};
  3884. Returns the item_id of a random item picked from the group specified. The
  3885. different groups and their group number are specified in 'db/(pre-)re/item_group_db.yml'.
  3886. When used in conjunction with other functions, you can get a random item. For
  3887. example, for a random pet lure:
  3888. getitem groupranditem(IG_Taming),1;
  3889. 'sub_group' is used to get the available random items of item group from specified random
  3890. group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
  3891. More info, see doc/item_group.txt.
  3892. ---------------------------------------
  3893. *getrandgroupitem <group_id>{,<quantity>{,<sub_group>{,<identify>{,<char_id>}}}};
  3894. Similar to the above example, this command allows players to obtain the specified
  3895. quantity of a random item from the group "<group id>". The different groups and
  3896. their group number are specified in db/(pre-)re/item_group_db.yml
  3897. If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
  3898. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
  3899. 'must' item group).
  3900. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
  3901. as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
  3902. if 'identify' is defined with value 1.
  3903. More info, see doc/item_group.txt.
  3904. ---------------------------------------
  3905. *getgroupitem <group_id>{,<identify>{,<char_id>}};
  3906. Gives item(s) to the attached player based on item group contents.
  3907. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3908. item group & sub_group.
  3909. For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
  3910. as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
  3911. if 'identify' is defined with value 1.
  3912. More info, see doc/item_group.txt.
  3913. ---------------------------------------
  3914. *enable_items;
  3915. *disable_items;
  3916. These commands toggle the ability to change equipment while interacting with
  3917. an NPC. To avoid possible exploits, the commands affect the particular script
  3918. instance only. Note that if a different script also calls enable_items, it
  3919. will override the last call (so you may want to call this command at the start
  3920. of your script without assuming it is still in effect).
  3921. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3922. ---------------------------------------
  3923. *itemskill <skill id>,<skill level>{,<keep requirement>};
  3924. *itemskill "<skill name>",<skill level>{,<keep requirement>};
  3925. This command is meant for item scripts to replicate single-use skills in usable
  3926. items. It will not work properly if there is a visible dialog window or menu or if the item is not type 'Delayconsume'.
  3927. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3928. target cursor is shown.
  3929. If <keep requirement> parameter is set to true, the skill's requirements will be checked.
  3930. By default, the requirements for item skills are not checked, and therefore the default value is false.
  3931. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual skill has been used from skill tree.
  3932. - Id: 605
  3933. AegisName: Anodyne
  3934. Name: Anodyne
  3935. Type: Delayconsume
  3936. Buy: 2000
  3937. Weight: 100
  3938. Flags:
  3939. BuyingStore: true
  3940. Script: |
  3941. itemskill "SM_ENDURE",1;
  3942. // When Sienna_Execrate_Scroll_1_5 is used, it will cast Sienna Execrate Level 5 and consume 2 Red_Gemstones.
  3943. - Id: 23194
  3944. AegisName: Sienna_Execrate_Scroll_1_5
  3945. Name: Level 5 Sienna Execrate
  3946. Type: Delayconsume
  3947. Buy: 10
  3948. Weight: 10
  3949. Script: |
  3950. itemskill "WL_SIENNAEXECRATE",5,true;
  3951. ---------------------------------------
  3952. *consumeitem <item id>{,<char_id>};
  3953. *consumeitem "<item name>"{,<char_id>};
  3954. This command will run the item script of the specified item on the invoking
  3955. character. The character does not need to possess the item, and the item will
  3956. not be deleted. While this command is intended for usable items, it will run
  3957. for any item type.
  3958. This command does not currently work with the 'itemskill' script command.
  3959. ---------------------------------------
  3960. *produce <item level>;
  3961. This command will open a crafting window on the client connected to the invoking
  3962. character. The 'item level' is a number which determines what kind of a crafting
  3963. window will pop-up.
  3964. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3965. what can actually be produced. The window will not be empty only if the invoking
  3966. character can actually produce the items of that type and has the appropriate raw
  3967. materials in their inventory.
  3968. The success rate to produce the item is the same as the success rate of the skill
  3969. associated with the item level. If there is no skill id, the success rate will be 50%.
  3970. Valid item levels are:
  3971. 1 - Level 1 Weapons
  3972. 2 - Level 2 Weapons
  3973. 3 - Level 3 Weapons
  3974. 21 - Blacksmith's Stones and Metals
  3975. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  3976. 23 - Elemental Converters
  3977. ---------------------------------------
  3978. *cooking <dish level>;
  3979. This command will open a produce window on the client connected to the invoking
  3980. character. The 'dish level' is the number which determines what kind of dish
  3981. level you can produce. You can see the full list of dishes that can be produced in
  3982. 'db/produce_db.txt'.
  3983. The window will be shown empty if the invoking character does not have enough of
  3984. the required incredients to cook a dish.
  3985. Valid dish levels are:
  3986. 11 - Level 1 Dish
  3987. 12 - Level 2 Dish
  3988. 13 - Level 3 Dish
  3989. 14 - Level 4 Dish
  3990. 15 - Level 5 Dish
  3991. 16 - Level 6 Dish
  3992. 17 - Level 7 Dish
  3993. 18 - Level 8 Dish
  3994. 19 - Level 9 Dish
  3995. 20 - Level 10 Dish
  3996. Although it's required to set a dish level, it doesn't matter if you set it to 1
  3997. and you want to cook a level 10 dish, as long as you got the required incredients
  3998. to cook the dish the command works.
  3999. ---------------------------------------
  4000. *makerune <% success bonus>{,<char_id>};
  4001. This command will open a rune crafting window on the client connected to the
  4002. invoking character. Since this command is officially used in rune ores, a bonus
  4003. success rate must be specified (which adds to the base formula).
  4004. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  4005. The window will not be empty only if the invoking character can actually produce
  4006. a rune and has the appropriate raw materials in their inventory.
  4007. ---------------------------------------
  4008. *successremovecards <equipment slot>;
  4009. This command will remove all cards of the cards slots defined in db/item_db.yml
  4010. from the item found in the specified equipment slot of the invoking character,
  4011. create new card items and give them to the character.
  4012. If any cards were removed in this manner, it will also show a success effect.
  4013. ---------------------------------------
  4014. *failedremovecards <equipment slot>,<type>;
  4015. This command will remove all cards from the item found in the specified
  4016. equipment slot of the invoking character. 'type' determines what happens to the
  4017. item and the cards:
  4018. 0 - will destroy both the item and the cards.
  4019. 1 - will keep the item, but destroy the cards.
  4020. 2 - will keep the cards, but destroy the item.
  4021. Whatever the type is, it will also show a failure effect on screen.
  4022. ---------------------------------------
  4023. *repair <broken item number>{,<char_id>};
  4024. This command repairs a broken piece of equipment, using the same list of broken
  4025. items as available through 'getbrokenid'.
  4026. ---------------------------------------
  4027. *repairall {<char_id>};
  4028. This command repairs all broken equipment in the attached player's inventory.
  4029. A repair effect will be shown if any items are repaired, else the command will
  4030. end silently.
  4031. ---------------------------------------
  4032. *successrefitem <equipment slot>{,<count>{,<char_id>}};
  4033. This command will refine an item in the specified equipment slot of the invoking
  4034. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  4035. This command will also display a 'refine success' effect on the character and put
  4036. appropriate messages into their chat window. It will also give the character fame
  4037. points if a weapon reached +10 this way, even though these will only take effect for
  4038. blacksmith who will later forge a weapon.
  4039. ---------------------------------------
  4040. *failedrefitem <equipment slot>{,<char_id>};
  4041. This command will fail to refine an item in the specified equipment slot of the
  4042. invoking character. The item will be destroyed. This will also display a 'refine
  4043. failure' effect on the character and put appropriate messages into their chat
  4044. window.
  4045. ---------------------------------------
  4046. *downrefitem <equipment slot>{,<count>{,<char_id>}};
  4047. This command will downgrade an item in the specified equipment slot of the invoking
  4048. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  4049. This command will also display a 'refine failure' effect on the character and put
  4050. appropriate messages into their chat window.
  4051. ---------------------------------------
  4052. *unequip <equipment slot>{,<char_id>};
  4053. This command will unequip whatever is currently equipped in the invoking
  4054. character's specified equipment slot. For a full list of possible equipment
  4055. slots see 'getequipid'.
  4056. If an item occupies several equipment slots, it will get unequipped from all of
  4057. them.
  4058. ---------------------------------------
  4059. *delequip <equipment slot>{,<char_id>};
  4060. This command will destroy whatever is currently equipped in the invoking
  4061. character's specified equipment slot. For a full list of possible equipment
  4062. slots see 'getequipid'.
  4063. This command will return 1 if an item was deleted and 0 otherwise.
  4064. ---------------------------------------
  4065. *breakequip <equipment slot>{,<char_id>};
  4066. This command will break and unequip whatever is currently equipped in the
  4067. invoking character's specified equipment slot. For a full list of possible
  4068. equipment slots see 'getequipid'.
  4069. This command will return 1 if an item was broken and 0 otherwise.
  4070. ---------------------------------------
  4071. *clearitem {<char_id>};
  4072. This command will destroy all items the invoking character has in their
  4073. inventory (including equipped items). It will not affect anything else, like
  4074. storage or cart.
  4075. ---------------------------------------
  4076. *equip <item id>{,<char_id>};
  4077. *autoequip <item id>,<option>;
  4078. These commands are to equip a equipment on the attached character.
  4079. The equip function will equip the item ID given when the player has
  4080. this item in his/her inventory, while the autoequip function will
  4081. equip the given item ID when this is looted. The option parameter of
  4082. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  4083. Examples:
  4084. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  4085. equip 1104;
  4086. //The invoked character will now automatically equip a falchion when it's looted.
  4087. autoequip 1104,1;
  4088. //The invoked character will no longer automatically equip a falchion.
  4089. autoequip 1104,0;
  4090. ---------------------------------------
  4091. *buyingstore <slots>;
  4092. Invokes buying store preparation window like the skill 'Open Buying Store',
  4093. without the item requirement. Amount of slots is limited by the server to
  4094. a maximum of 5 slots by default.
  4095. Example:
  4096. // Gives the player opportunity to buy 4 different kinds of items.
  4097. buyingstore 4;
  4098. ---------------------------------------
  4099. *searchstores <uses>,<effect>;
  4100. Invokes the store search window, which allows to search for both vending
  4101. and buying stores. Parameter uses indicates, how many searches can be
  4102. started, before the window has to be reopened. Effect value affects,
  4103. what happens, when a result item is double-clicked and can be one of the
  4104. following:
  4105. 0 = Shows the store's position on the mini-map and highlights the
  4106. shop sign with yellow color, when the store is on same map
  4107. as the invoking player.
  4108. 1 = Directly opens the shop, regardless of distance.
  4109. Example:
  4110. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  4111. searchstores 10,1;
  4112. ---------------------------------------
  4113. *enable_command;
  4114. *disable_command;
  4115. These commands toggle the ability to use atcommand while interacting with an NPC.
  4116. The default setting, 'atcommand_disable_npc', is defined in 'conf/battle/gm.conf'.
  4117. ---------------------------------------
  4118. //
  4119. 4,1.- End of item-related commands
  4120. //
  4121. ---------------------------------------
  4122. *openstorage;
  4123. This will open character's Kafra storage window on the client connected to the
  4124. invoking character. It can be used from any kind of NPC or item script, not just
  4125. limited to Kafra Staff.
  4126. The storage window opens regardless of whether there are open NPC dialogs or
  4127. not, but it is preferred to close the dialog before displaying the storage
  4128. window, to avoid any disruption when both windows overlap.
  4129. mes "Close this window to open your storage.";
  4130. close2;
  4131. openstorage;
  4132. end;
  4133. ---------------------------------------
  4134. *openstorage2 <storage_id>,<mode>{,<account_id>};
  4135. Just like the 'openstorage' command, except this command can open additional storages
  4136. by the specified <storage_id>. For <storage_id>, please read the conf/inter_server.yml
  4137. for storage groups.
  4138. Values for <mode> are:
  4139. STOR_MODE_NONE : Player only can read the storage entries.
  4140. STOR_MODE_GET : Player can get items from the storage.
  4141. STOR_MODE_PUT : Player can put items in the storage.
  4142. Example:
  4143. if (vip_status(VIP_STATUS_ACTIVE)) {
  4144. mes "I will open your Premium storage.";
  4145. mes "Thank you for using our service.";
  4146. close2;
  4147. openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
  4148. } else {
  4149. mes "Sorry, your Premium status is expired.";
  4150. mes "Storage will be opened but you can't put any item into it.";
  4151. close2;
  4152. openstorage2 1,STOR_MODE_GET;
  4153. }
  4154. end;
  4155. ---------------------------------------
  4156. *openmail({<char_id>});
  4157. This will open a character's Mail window on the client connected to the
  4158. invoking character.
  4159. This command is not supported for PACKETVER 20150513 or newer.
  4160. mes "Close this window to open your mail inbox.";
  4161. close2;
  4162. openmail;
  4163. end;
  4164. ---------------------------------------
  4165. *mail <destination id>,"<sender name>","<title>","<body>"{,<zeny>{,<item id array>,<item amount array>{,refine{,bound{,<item card0 array>{,<item card1 array>{,<item card2 array>{,<item card3 array>
  4166. {,<random option id0 array>, <random option value0 array>, <random option paramter0 array>{,<random option id1 array>, <random option value1 array>, <random option paramter1 array>
  4167. {,<random option id2 array>, <random option value2 array>, <random option paramter2 array>{,<random option id3 array>, <random option value3 array>, <random option paramter3 array>
  4168. {,<random option id4 array>, <random option value4 array>, <random option paramter4 array>}}}}}}}}};
  4169. This command will send mail to the <destination id> which is a character ID.
  4170. A <sender name> can be specified but does not have to be from the direct creator
  4171. of the mail and is limited to NAME_LENGTH (24) characters. Mail <title> is limited
  4172. to MAIL_TITLE_LENGTH (40) characters. Mail <body> is limited to MAIL_BODY_LENGTH
  4173. (200) characters for PACKETVER < 20150513 or 500 characters for later clients.
  4174. Optional <zeny> and item data can be added to the mail as well. PACKETVER < 20150513
  4175. is limited to 1 item while later clients are limited to MAIL_MAX_ITEM (5).
  4176. The <item id array>, <item amount array>, <item card0 array>, <item card1 array>,
  4177. <item card2 array>, and <item card3 array> should all be integer arrays.
  4178. For random options there can be 5 arrays in pairs of 3 (ids, values, parameters) right after the cards.
  4179. All of these arrays shall be integer arrays as well.
  4180. Example of sending mail with zeny:
  4181. .@charid = getcharid(0);
  4182. .@sender$ = "Poring";
  4183. .@title$ = "Welcome";
  4184. .@body$ = "Hi! I'm a simple Poring from the Prontera fields! Welcome to Ragnarok!";
  4185. .@zeny = 5000;
  4186. mail .@charid, .@sender$, .@title$, .@body$, .@zeny;
  4187. Example of sending mail with items:
  4188. .@charid = getcharid(0);
  4189. .@sender$ = "Angeling";
  4190. .@title$ = "Welcome";
  4191. .@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
  4192. .@zeny = 0;
  4193. setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
  4194. setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
  4195. setarray .@mailrefine[0], 0, 0, 3, 10; // +3 Hat, +10 Dagger
  4196. setarray .@mailbound[0], 0, 0, Bound_Account, Bound_Char; // Account bounded Hat, Char bounded Dagger
  4197. setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
  4198. setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4199. setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4200. mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailrefine, .@mailbound, .@mailcard0, .@mailcard1, .@mailcard2;
  4201. Example of sending mail with items and random options:
  4202. .@charid = getcharid(0);
  4203. .@sender$ = "Angeling";
  4204. .@title$ = "Welcome";
  4205. .@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
  4206. .@zeny = 0;
  4207. setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
  4208. setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
  4209. setarray .@mailrefine[0], 0, 0, 3, 10; // +3 Hat, +10 Dagger
  4210. setarray .@mailbound[0], 0, 0, Bound_Account, Bound_Char; // Account bounded Hat, Char bounded Dagger
  4211. setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
  4212. setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4213. setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
  4214. setarray .@mailcard3[0], 0, 0, 0, 0; // Empty last slot
  4215. setarray .@mailrndopt_id0[0], 0, 0, 0, RDMOPT_VAR_MAXHPAMOUNT; // Enchant the Dagger with increased HP option
  4216. setarray .@mailrndopt_val0[0], 0, 0, 0, 1000; // Enchant the Dagger with increased HP option by 1000 points
  4217. setarray .@mailrndopt_prm0[0], 0, 0, 0, 0; // Enchant the Dagger with increased HP option - does not need any parameter
  4218. mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailrefine, .@mailbound, .@mailcard0, .@mailcard1, .@mailcard2, .@mailcard3, .@mailrndopt_id0, .@mailrndopt_val0, .@mailrndopt_prm0;
  4219. ---------------------------------------
  4220. *openauction({<char_id>});
  4221. This will open the Auction window on the client connected to the invoking character.
  4222. mes "Close this window to open the Auction window.";
  4223. close2;
  4224. openauction;
  4225. end;
  4226. ---------------------------------------
  4227. \\
  4228. 4,2.- Guild-related commands
  4229. \\
  4230. ---------------------------------------
  4231. *guildopenstorage()
  4232. This function works the same as 'openstorage' but will open a guild storage
  4233. window instead for the guild storage of the guild the invoking character belongs
  4234. to.
  4235. Return values:
  4236. GSTORAGE_OPEN - Successfully opened.
  4237. GSTORAGE_STORAGE_ALREADY_OPEN - Player storage is already open.
  4238. GSTORAGE_ALREADY_OPEN - Guild storage is already open.
  4239. GSTORAGE_NO_GUILD - Player is not in a guild.
  4240. GSTORAGE_NO_STORAGE - Guild hasn't invested in the Guild Storage Expansion skill (only if OFFICIAL_GUILD_STORAGE is enabled).
  4241. GSTORAGE_NO_PERMISSION - Player doesn't have permission to use the guild storage.
  4242. ---------------------------------------
  4243. *guildopenstorage_log({<char id>})
  4244. Opens the guild storage log window for the attached character or the given character id.
  4245. Possible return values:
  4246. GUILDSTORAGE_LOG_FINAL_SUCCESS Window was opened successfully.
  4247. GUILDSTORAGE_LOG_EMPTY Window was not opened, because no entries exist.
  4248. GUILDSTORAGE_LOG_FAILED Some database error occurred.
  4249. ---------------------------------------
  4250. *guild_has_permission(<permission>{,<char id>})
  4251. Checks if the attached player or the player with the given character id has the given permission(s).
  4252. Permission can be a bitmask and allows to use multiple values at the same time.
  4253. Returns true if the player has all of the given permissions or false if the player does at least
  4254. miss one of the given permissions or is not in a guild at all.
  4255. Available permissions are:
  4256. GUILD_PERM_INVITE If a player is allowed to invite other players.
  4257. GUILD_PERM_EXPEL If a player is allowed to expel other guild members.
  4258. GUILD_PERM_STORAGE If a player is allowed to access the guild storage.
  4259. GUILD_PERM_ALL A combination of all permissions above.
  4260. ---------------------------------------
  4261. *guildchangegm(<guild id>,<new master's name>)
  4262. This function will change the Guild Master of a guild. The ID is the guild's
  4263. id, and the new guild master's name must be passed.
  4264. Returns 1 on success, 0 otherwise.
  4265. ---------------------------------------
  4266. *guildgetexp <amount>;
  4267. This will give the specified amount of guild experience points to the guild the
  4268. invoking character belongs to. It will silently fail if they do not belong to
  4269. any guild.
  4270. ---------------------------------------
  4271. *guildskill <skill id>,<level>
  4272. *guildskill "<skill name>",<level>
  4273. This command will bump up the specified guild skill by the specified number of
  4274. levels. This refers to the invoking character and will only work if the invoking
  4275. character is a member of a guild AND its guild master, otherwise no failure
  4276. message will be given and no error will occur, but nothing will happen - same
  4277. about the guild skill trying to exceed the possible maximum. The full list of
  4278. guild skills is available in 'db/(pre-)re/skill_db.yml', these are all the GD_ skills at
  4279. the end.
  4280. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  4281. // 10000). Notice that if you try to add two levels of Approval, or add
  4282. // Approval when the guild already has it, it will only have one level of
  4283. // Approval afterwards.
  4284. guildskill 10000,1,0;
  4285. You might want to make a quest for getting a certain guild skill, make it hard
  4286. enough that all the guild needs to help or something. Doing this for the Glory
  4287. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  4288. a fun quest.
  4289. ---------------------------------------
  4290. //
  4291. 4,2 End of guild-related commands.
  4292. //
  4293. ---------------------------------------
  4294. *resetlvl <action type>{,<char_id>};
  4295. This is a character reset command, meant mostly for rebirth script supporting
  4296. Advanced jobs, which will reset the invoking character's stats and level
  4297. depending on the action type given. Valid action types are:
  4298. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  4299. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  4300. If the new job is 'Novice High', give 100 status points, give First Aid and
  4301. Play Dead skills.
  4302. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  4303. Skills and attribute values are not altered.
  4304. 3 - Base level 1, base exp 0. Nothing else is changed.
  4305. 4 - Job level 1, job exp 0. Nothing else is changed.
  4306. In all cases everything the character has on will be unequipped.
  4307. Even though it doesn't return a value, it is used as a function in the official
  4308. rebirth scripts. Ask AppleGirl why.
  4309. ---------------------------------------
  4310. *resetstatus({<char_id>});
  4311. This is a character reset command, which will reset the stats on the invoking
  4312. character and give back all the stat points used to raise them previously.
  4313. Nothing will happen to any other numbers about the character.
  4314. Used in reset NPC's (duh!)
  4315. ---------------------------------------
  4316. *resetskill({<char_id>});
  4317. This command takes off all the skill points on the invoking character, so they
  4318. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  4319. to spend again. Nothing else will change but the skills. Quest skills will also
  4320. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  4321. the 'quest_skill_learn' option is set in there, the points in the quest skills
  4322. will also count towards the total.
  4323. Used in reset NPC's (duh!)
  4324. ---------------------------------------
  4325. *resetfeel({<char_id>});
  4326. This command will reset the Star Gladiator's designated maps on the invoking character.
  4327. Only works on Star Gladiator and Star Emperor classes.
  4328. ---------------------------------------
  4329. *resethate({<char_id>});
  4330. This command will reset the Star Gladiator's designated monsters on the invoking character.
  4331. Only works on Star Gladiator and Star Emperor classes.
  4332. ---------------------------------------
  4333. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  4334. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  4335. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  4336. *sc_end <effect type>{,<GID>};
  4337. *sc_end_class {<char_id>{,<job_id>}};
  4338. These commands will bestow a status effect on a character.
  4339. The <effect type> determines which status is invoked. This can be either a number
  4340. or constant, with the common statuses (mostly negative) found in 'src/map/script_constants.hpp'
  4341. with the 'SC_' prefix. A full list is located in 'src/map/status.hpp', though
  4342. they are not currently documented.
  4343. The duration of the status is given in <ticks>, or milleseconds.
  4344. Use INFINITE_TICK for infinite duration.
  4345. Certain status changes take an additional parameter <value 1>, which typically
  4346. modifies player stats by the given number or percentage. This differs for each
  4347. status, and is sometimes zero.
  4348. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  4349. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  4350. be defined for the rate to work.
  4351. Optional value <flag> is how the status change start will be handled (a bitmask).
  4352. SCSTART_NOAVOID : Status change cannot be avoided.
  4353. SCSTART_NOTICKDEF : Tick cannot be reduced by stats (default).
  4354. SCSTART_LOADED : sc_data loaded, so no value will be altered.
  4355. SCSTART_NORATEDEF : Rate cannot be reduced.
  4356. SCSTART_NOICON : Status icon won't be sent to client
  4357. If a <GID> is given, the status change will be invoked on the specified character
  4358. instead of the one attached to the script. This can only be defined after setting
  4359. a rate and flag.
  4360. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  4361. for effects that require them. The meaning of the extra values vary depending on the
  4362. effect type. For more infos, read status_change.txt containing a list of all Status Changes
  4363. and theirs val1, val2, val3, and val4 usage in source.
  4364. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  4365. perform a complete removal of all statuses (although permanent ones will re-apply).
  4366. 'sc_end_class' works like 'sc_end' but will remove all status effects from any learned
  4367. skill on the invoking character. If <job_id> is provided it will end the effect for that job.
  4368. Examples:
  4369. // This will poison the invoking character for 10 minutes at 50% chance.
  4370. sc_start SC_POISON,600000,0,5000;
  4371. // This will bestow the effect of Level 10 Blessing.
  4372. sc_start SC_BLESSING,240000,10;
  4373. // Adjust element resistance by percentage. Sample with Resist_Fire item script:
  4374. // val1: Water resistance
  4375. // val2: Earth resistance
  4376. // val3: Fire resistance
  4377. // val4: Wind resistance
  4378. sc_start4 SC_ARMOR_ELEMENT,1200000,-15,0,20,0;
  4379. // This will end the Freezing status for the invoking character.
  4380. sc_end SC_FREEZE;
  4381. // This will end the effect of any learned skill for the invoking character.
  4382. sc_end_class;
  4383. // This will end the effect of any learned skill for the character with the <char_id> 150000.
  4384. // val1: <char_id>
  4385. sc_end_class(150000);
  4386. // This will end the effect of any Arch Bishop skill for the invoking character.
  4387. // val1: <char_id>
  4388. // val2: <job_id> of Arch Bishop
  4389. sc_end_class(getcharid(0),Job_Arch_Bishop);
  4390. Note: to use SC_NOCHAT you should alter Manner
  4391. set Manner, -5; // Will mute a user for 5 minutes
  4392. set Manner, 0; // Will unmute a user
  4393. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  4394. ---------------------------------------
  4395. *getstatus(<effect type>{,<type>{,<char_id>}})
  4396. Retrieve information about a specific status effect when called. Depending on <type>
  4397. specified the function will return different information.
  4398. Possible <type> values:
  4399. - 0 or undefined: whether the status is active
  4400. - 1: the val1 of the status
  4401. - 2: the val2 of the status
  4402. - 3: the val3 of the status
  4403. - 4: the val4 of the status
  4404. - 5: the amount of time in milliseconds that the status has remaining
  4405. If <type> is not defined or is set to 0, then the script function will either
  4406. return 1 if the status is active, or 0 if the status is not active. If the status
  4407. is not active when any of the <type> fields are provided, this script function
  4408. will always return 0.
  4409. ---------------------------------------
  4410. *skilleffect <skill id>,<number>;
  4411. *skilleffect "<skill name>",<number>;
  4412. This command displays visual and aural effects of given skill on currently
  4413. attached character. The number parameter is for skill whose visual effect
  4414. involves displaying of a number (healing or damaging). Note, that this command
  4415. will not actually use the skill, it is intended for scripts, which simulate
  4416. skill usage by the NPC, such as buffs, by setting appropriate status and
  4417. displaying the skill's effect.
  4418. mes "Be blessed!";
  4419. // Heal of 2000 HP
  4420. heal 2000,0;
  4421. skilleffect 28,2000;
  4422. // Blessing Level 10
  4423. sc_start SC_BLESSING,240000,10;
  4424. skilleffect 34,0;
  4425. // Increase AGI Level 5
  4426. sc_start SC_INCREASEAGI,140000,5;
  4427. skilleffect 29,0;
  4428. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  4429. Increase AGI Lv 5, and display appropriate effects.
  4430. ---------------------------------------
  4431. *npcskilleffect <skill id>,<number>,<x>,<y>;
  4432. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  4433. This command behaves identically to 'skilleffect', however, ground type skill
  4434. effects will be centered at the map coordinates given on the same map as the
  4435. attached character and all other skill types will be centered on the attached
  4436. character.
  4437. ---------------------------------------
  4438. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  4439. This command will display special effect with the given number, centered on the
  4440. specified NPCs coordinates, if any. For a full list of special effect numbers
  4441. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  4442. some client releases. (Notably, rain is absent from any client executables
  4443. released after April 2005.)
  4444. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  4445. specified does not exist, the command will do nothing. When specifying an NPC,
  4446. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  4447. will retain the default behavior of the command.
  4448. // this will make the NPC "John Doe#1"
  4449. // show the effect "EF_HIT1" specified by
  4450. // Jane Doe. I wonder what John did...
  4451. mes "[Jane Doe]";
  4452. mes "Well, I never!";
  4453. specialeffect EF_HIT1,AREA,"John Doe#1";
  4454. close;
  4455. ---------------------------------------
  4456. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  4457. This command behaves identically to 'specialeffect', but the effect will be
  4458. centered on the invoking character's sprite.
  4459. <Player name> parameter will display <effect number> on another Player than the
  4460. one currently attached to the script. Like with specialeffect, when specifying
  4461. a player, <send_target> must be supplied, specifying AREA will retain the default
  4462. behavior of the command.
  4463. ---------------------------------------
  4464. *removespecialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  4465. Work for 2018-10-02+
  4466. This command behaves parameter same as 'specialeffect', but use for remove effect with <effect number>
  4467. from invoking NPC.
  4468. ---------------------------------------
  4469. *removespecialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  4470. Work for 2018-10-02+
  4471. This command behaves parameter same as 'specialeffect2', but use for remove effect with <effect number>
  4472. from invoking character.
  4473. ---------------------------------------
  4474. *statusup <stat>{,<char_id>};
  4475. This command will change a specified stat of the invoking character up by one
  4476. permanently. Stats are to be given as number, but you can use these constants to
  4477. replace them:
  4478. bStr - Strength
  4479. bVit - Vitality
  4480. bInt - Intelligence
  4481. bAgi - Agility
  4482. bDex - Dexterity
  4483. bLuk - Luck
  4484. ---------------------------------------
  4485. *statusup2 <stat>,<amount>{,<char_id>};
  4486. This command will change a specified stat of the invoking character by the
  4487. specified amount permanently. The amount can be negative. See 'statusup'.
  4488. // This will decrease a character's Vit forever.
  4489. statusup2 bVit,-1;
  4490. ---------------------------------------
  4491. *traitstatusup <stat>{,<char_id>};
  4492. This command will change a specified trait stat of the invoking character up by one
  4493. permanently. Trait stats are to be given as number, but you can use these constants to
  4494. replace them:
  4495. bPow - Power
  4496. bSta - Stamina
  4497. bWis - Wisdom
  4498. bSpl - Spell
  4499. bCon - Concentration
  4500. bCrt - Creative
  4501. ---------------------------------------
  4502. *traitstatusup2 <stat>,<amount>{,<char_id>};
  4503. This command will change a specified trait stat of the invoking character by the
  4504. specified amount permanently. The amount can be negative. See 'statusup'.
  4505. // This will decrease a character's Sta forever.
  4506. traitstatusup2 bSta,-1;
  4507. ---------------------------------------
  4508. *bonus <bonus type>,<val1>;
  4509. *bonus2 <bonus type>,<val1>,<val2>;
  4510. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  4511. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  4512. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  4513. These commands are meant to be used in item scripts. They will probably work
  4514. outside item scripts, but the bonus will not persist for long. They, as
  4515. expected, refer only to an invoking character.
  4516. You can find the full list of possible bonuses and which command to use for each
  4517. kind in 'doc/item_bonus.txt'.
  4518. ---------------------------------------
  4519. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4520. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4521. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  4522. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  4523. These commands are meant to be used in item scripts. They will probably work
  4524. outside item scripts, but the bonus will not persist for long. They, as
  4525. expected, refer only to an invoking character.
  4526. What these commands do is 'attach' a script to the player which will get
  4527. executed on attack (or when attacked in the case of autobonus2).
  4528. Rate is the trigger rate of the script (1000 = 100%).
  4529. Duration is the time in milliseconds that the bonus will last for since the script has triggered.
  4530. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  4531. The optional argument 'flag' is used to classify the type of attack where the script
  4532. can trigger (it shares the same flags as the bAutoSpell bonus script):
  4533. Range criteria:
  4534. BF_SHORT: Trigger on melee attack
  4535. BF_LONG: Trigger on ranged attack
  4536. Default: BF_SHORT+BF_LONG
  4537. Attack type criteria:
  4538. BF_WEAPON: Trigger on weapon skills
  4539. BF_MAGIC: Trigger on magic skills
  4540. BF_MISC: Trigger on misc skills
  4541. Default: BF_WEAPON
  4542. Skill criteria:
  4543. BF_NORMAL: Trigger on normal attacks
  4544. BF_SKILL: Trigger on skills
  4545. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  4546. otherwise BF_SKILL+BF_NORMAL is used.
  4547. The difference between the optional argument 'other script' and the 'bonus script' is that,
  4548. the former one triggers only when attacking(or attacked) and the latter one runs on
  4549. status calculation as well, which makes sure, within the duration, the "bonus" that get
  4550. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  4551. "bonus" command only. And we usually use 'other script' to show visual effects.
  4552. In all cases, when the script triggers, the attached player will be the one
  4553. who holds the bonus. There is currently no way of knowing within this script
  4554. who was the other character (the attacker in autobonus2, or the target in
  4555. autobonus and autobonus3).
  4556. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  4557. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  4558. //effect when the bonus is active.
  4559. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  4560. ---------------------------------------
  4561. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  4562. This command will attach a script to a player for a given duration, in seconds.
  4563. After that time, the script will automatically expire. The same bonus cannot be
  4564. stacked. By default, this bonus will be stored on `bonus_script` table when player
  4565. logs out.
  4566. Flags (bitmask):
  4567. 1 : Remove when dead.
  4568. 2 : Removable by Dispell.
  4569. 4 : Removable by Clearance.
  4570. 8 : Remove when player logs out.
  4571. 16 : Removeable by Banishing Buster.
  4572. 32 : Removable by Refresh.
  4573. 64 : Removable by Lux Anima.
  4574. 128 : Remove when Madogear is activated or deactivated.
  4575. 256 : Remove when receive damage.
  4576. 512 : Script is permanent, cannot be cleared by bonus_script_clear.
  4577. 1024: Force to replace duplicated script by expanding the duration.
  4578. 2048: Force to add duplicated script. This flag cannot be stacked with 1024,
  4579. if both are defined, 1024 will be checked first and ignore this flag.
  4580. Types:
  4581. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  4582. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  4583. 1: Buff
  4584. 2: Debuff
  4585. Status_icon: See "Status Icon" section in 'src/map/script_constants.hpp'. Default is SI_BLANK (-1).
  4586. Example:
  4587. - Id: 512
  4588. AegisName: Apple
  4589. Name: Apple
  4590. Type: Healing
  4591. Buy: 15
  4592. Weight: 20
  4593. Flags:
  4594. BuyingStore: true
  4595. Script: |
  4596. bonus_script "{ bonus bStr,5; }",60;
  4597. ---------------------------------------
  4598. *bonus_script_clear {<flag>,{<char_id>}};
  4599. Removes attached bonus_script from player. If no 'char_id' given, it will removes
  4600. from the invoker.
  4601. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  4602. it just removes non-permanent script.
  4603. ---------------------------------------
  4604. *skill <skill id>,<level>{,<flag>};
  4605. *skill "<skill name>",<level>{,<flag>};
  4606. *addtoskill <skill id>,<level>{,<flag>};
  4607. *addtoskill "<skill name>",<level>{,<flag>};
  4608. These commands will give the invoking character a specified skill. This is also
  4609. used for item scripts.
  4610. Level is obvious. Skill id is the ID number of the skill in question as per
  4611. 'db/(pre-)re/skill_db.yml'. It is not known for certain whether this can be used to give
  4612. a character a monster's skill, but you're welcome to try with the numbers given
  4613. in 'db/(pre-)re/mob_skill_db.txt'.
  4614. Flag is 0 if the skill is given permanently (will get written with the character
  4615. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  4616. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  4617. 'skill' and to 2 in 'addtoskill'.
  4618. Flag 2 means that the level parameter is to be interpreted as a stackable
  4619. additional bonus to the skill level. If the character did not have that skill
  4620. previously, they will now at 0+the level given.
  4621. Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
  4622. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  4623. Flag constants:
  4624. 0 - SKILL_PERM
  4625. 1 - SKILL_TEMP
  4626. 2 - SKILL_TEMPLEVEL
  4627. 3 - SKILL_PERM_GRANT
  4628. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  4629. // level 1.
  4630. skill 152,1,0;
  4631. ---------------------------------------
  4632. *nude {<char_id>};
  4633. This command will unequip anything equipped on the invoking character.
  4634. It is not required to do this when changing jobs since 'jobchange' will unequip
  4635. everything not equippable by the new job class anyway.
  4636. ---------------------------------------
  4637. *sit {"<character name>"};
  4638. *stand {"<character name>"};
  4639. These commands will make a character sit or stand.
  4640. If no character is specified, the command will run for the invoking character.
  4641. Additionnally Sitting constant is true when the character is sitting, false otherwise.
  4642. ---------------------------------------
  4643. *disguise <Monster ID>{,<char_id>};
  4644. *undisguise {<char_id>};
  4645. This command disguises the current player with a monster sprite.
  4646. The disguise lasts until 'undisguise' is issued or the player logs out.
  4647. Example:
  4648. disguise 1002; // Disguise character as a Poring.
  4649. next;
  4650. undisguise; // Return to normal character sprite.
  4651. ---------------------------------------
  4652. *transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4653. *transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4654. *active_transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4655. *active_transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4656. This command will turn a player into a monster for a given duration and can grant
  4657. a SC attribute effect while transformed. Note that players cannot be transformed
  4658. during War of Emperium or if already disguised.
  4659. Can only be removed when you die or the duration ends.
  4660. 'transform' and 'active_transform' can stack on each other but using 'transform' or
  4661. 'active_transform' twice will not stack (it will cancel the previous bonus for the new).
  4662. 'active_transform' will take priority over transform for its duration.
  4663. ---------------------------------------
  4664. \\
  4665. 4,3 Marriage-related commands
  4666. \\
  4667. ---------------------------------------
  4668. *marriage("<spouse name>");
  4669. This function will marry two characters, the invoking character and the one
  4670. referred to by name given, together, setting them up as each other's marriage
  4671. partner. No second function call has to be issued (in current SVN at least) to
  4672. make sure the marriage works both ways. The function returns 1 upon success, or
  4673. 0 if the marriage could not be completed, either because the other character
  4674. wasn't found or because one of the two characters is already married.
  4675. This will do nothing else for the marriage except setting up the spouse ID for
  4676. both of these characters. No rings will be given and no effects will be shown.
  4677. ---------------------------------------
  4678. *wedding;
  4679. This command will call up wedding effects - the music and confetti - centered on
  4680. the invoking character. Example can be found in the wedding script.
  4681. ---------------------------------------
  4682. *divorce({<char_id>})
  4683. This function will "un-marry" the invoking character from whoever they were
  4684. married to. Both will no longer be each other's marriage partner, (at least in
  4685. current SVN, which prevents the cases of multi-spouse problems). It will return
  4686. 1 upon success or 0 if the character was not married at all.
  4687. This function will also destroy both wedding rings and send a message to both
  4688. players, telling them they are now divorced.
  4689. ---------------------------------------
  4690. *adopt("<parent_name>","<baby_name>");
  4691. *adopt(<parent_id>,<baby_id>);
  4692. This function will send the client adoption request to the specified baby
  4693. character. The parent value can be either parent. Both parents and the baby
  4694. need to be online in order for adoption to work.
  4695. Return values:
  4696. ADOPT_ALLOWED - Sent message to Baby to accept or deny.
  4697. ADOPT_ALREADY_ADOPTED - Character is already adopted.
  4698. ADOPT_MARRIED_AND_PARTY - Parents need to be married and in a party with the baby.
  4699. ADOPT_EQUIP_RINGS - Parents need wedding rings equipped.
  4700. ADOPT_NOT_NOVICE - Baby is not a Novice.
  4701. ADOPT_CHARACTER_NOT_FOUND - A parent or Baby was not found.
  4702. ADOPT_MORE_CHILDREN - You cannot adopt more than 1 child. (client message)
  4703. ADOPT_LEVEL_70 - Parents need to be at least level 70 in order to adopt someone. (client message)
  4704. ADOPT_MARRIED - You cannot adopt a married person. (client message)
  4705. ---------------------------------------
  4706. //
  4707. 4,3.- End of marriage-related commands
  4708. //
  4709. ---------------------------------------
  4710. *pcfollow <id>,<target id>;
  4711. *pcstopfollow <id>;
  4712. Makes a character follow or stop following someone. This command does the same
  4713. as the @follow command. The main difference is that @follow can use character
  4714. names, and this commands needs the account ID for the target.
  4715. Examples:
  4716. // This will make Aaron follow Bullah, when both of these characters are online.
  4717. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4718. // Makes Aaron stop following whoever he is following.
  4719. pcstopfollow getCharID(3,"Aaron");
  4720. ---------------------------------------
  4721. *pcblockmove <id>,<option>;
  4722. *unitblockmove <id>,<option>;
  4723. Prevents the given GID from moving when the option is 1, and enables the ID to
  4724. move again when the option is 0. This command will run for the attached unit
  4725. if the given GID is zero.
  4726. Examples:
  4727. // Prevents the current char from moving away.
  4728. pcblockmove getcharid(3),1;
  4729. // Enables the current char to move again.
  4730. pcblockmove getcharid(3),0;
  4731. ---------------------------------------
  4732. *pcblockskill <id>,<option>;
  4733. *unitblockskill <id>,<option>;
  4734. Prevents the given GID from casting skills when the option is 1, and enables
  4735. the ID to cast skills again when the option is 0. This command will run for
  4736. the attached unit if the given GID is zero.
  4737. Examples:
  4738. // Prevents the current char from casting skills.
  4739. pcblockskill getcharid(3),1;
  4740. // Enables the current char to cast skills again.
  4741. pcblockskill getcharid(3),0;
  4742. ---------------------------------------
  4743. *setpcblock <type>,<state>{,<account ID>};
  4744. *getpcblock {<account ID>};
  4745. 'setpcblock' command prevents/allows the player from doing the given <type> of action according
  4746. to the <state> during the player session (note: @reloadscript removes all <type> except PCBLOCK_IMMUNE).
  4747. The <type> values are bit-masks, multiples of <type> can be added to change the player action.
  4748. The action is blocked when the <state> is true, while false allows the action again.
  4749. 'getpcblock' command return the bit-mask value of the currently
  4750. enabled block flags.
  4751. Available <type>:
  4752. PCBLOCK_MOVE Prevent the player from moving.
  4753. PCBLOCK_ATTACK Prevent the player from attacking.
  4754. PCBLOCK_SKILL Prevent the player from using skills/itemskills.
  4755. PCBLOCK_USEITEM Prevent the player from using usable items.
  4756. PCBLOCK_CHAT Prevent the player from sending global/guild/party/whisper messages.
  4757. PCBLOCK_IMMUNE Prevent the player from being hit by monsters.
  4758. PCBLOCK_SITSTAND Prevent the player from sitting/standing.
  4759. PCBLOCK_COMMANDS Prevent the player from using atcommands/charcommands.
  4760. PCBLOCK_NPCCLICK Prevent the player from clicking/touching any NPC/shop/warp.
  4761. PCBLOCK_EMOTION Prevent the player from using emotions.
  4762. PCBLOCK_NPC Simulate NPC interaction. Useful for NPC with no mes window. Sum of PCBLOCK_MOVE|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_NPCCLICK.
  4763. PCBLOCK_ALL Sum of all the flags.
  4764. Examples:
  4765. // Make the attached player invulnerable to monster (same as @monsterignore)
  4766. setpcblock PCBLOCK_IMMUNE, true;
  4767. // Prevents the attached player from attacking and using skills
  4768. setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL, true;
  4769. // Re-enables attack, skills and item use
  4770. setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM, false;
  4771. // getpcblock related checks
  4772. if (getpcblock() & PCBLOCK_IMMUNE)
  4773. mes "You are invulnerable!";
  4774. if (getpcblock() & (PCBLOCK_MOVE|PCBLOCK_SITSTAND))
  4775. mes "You can't walk or sit.";
  4776. if ((getpcblock() & (PCBLOCK_ATTACK|PCBLOCK_SKILL)) == 0)
  4777. mes "You can attack and use skills.";
  4778. if (getpcblock() & PCBLOCK_CHAT)
  4779. mes "You can't chat.";
  4780. ---------------------------------------
  4781. ==================================
  4782. |5.- Mob / NPC -related commands.|
  4783. ==================================
  4784. ---------------------------------------
  4785. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4786. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4787. This command will spawn a monster on the specified coordinates on the specified
  4788. map. If the script is invoked by a character, a special map name, "this", will
  4789. be recognized to mean the name of the map the invoking character is located at.
  4790. This command works fine in the item scripts.
  4791. The same command arguments mean the same things as described above in the
  4792. beginning of this document when talking about permanent monster spawns. Monsters
  4793. spawned in this manner will not respawn upon being killed.
  4794. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4795. be picked from the entire database according to the rules configured in the
  4796. server for dead branches. This will work for all other kinds of non-permanent
  4797. monster spawns.
  4798. The only very special thing about this command is an event label, which is an
  4799. optional parameter. This label is written like '<NPC object name>::<label name>'
  4800. and upon the monster being killed, it will execute the script inside of the
  4801. specified NPC object starting from the label given. The RID of the player
  4802. attached at this execution will be the RID of the killing character.
  4803. The variable 'killedrid' is set to the Class (mob ID) of the monster killed.
  4804. The variable 'killedgid' is set to the ID (unique mob game ID) of the monster killed.
  4805. <size> can be:
  4806. Size_Small (0) (default)
  4807. Size_Medium (1)
  4808. Size_Large (2)
  4809. <ai> can be:
  4810. AI_NONE (0) (default)
  4811. AI_ATTACK (1) (attack/friendly)
  4812. AI_SPHERE (2) (Alchemist skill)
  4813. AI_FLORA (3) (Alchemist skill)
  4814. AI_ZANZOU (4) (Kagerou/Oboro skill)
  4815. AI_LEGION (5) (Sera skill)
  4816. AI_FAW (6) (Mechanic skill)
  4817. AI_WAVEMODE (7) Normal monsters will ignore attack from AI_WAVEMODE monsters
  4818. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4819. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4820. The 'areamonster' command works much like the 'monster' command and is not
  4821. significantly different, but spawns the monsters within a square defined by
  4822. x1/y1-x2/y2.
  4823. Returned value is an array with the game ID of the spawned monster(s) depending
  4824. on the amount spawned. Array is stored in $@mobid[].
  4825. Simple monster killing script:
  4826. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4827. mes "[Summon Man]";
  4828. mes "Want to start the Poring hunt?";
  4829. next;
  4830. if (select("Yes.:No.") == 2) {
  4831. mes "[Summon Man]";
  4832. mes "Come back later.";
  4833. close;
  4834. }
  4835. // Summon 10 Porings.
  4836. // Using coordinates 0,0 will spawn them in a random location.
  4837. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4838. mes "[Summon Man]";
  4839. mes "Now go and kill all the Porings I summoned.";
  4840. close;
  4841. OnPoringKilled:
  4842. $PoringKilled++;
  4843. if ($PoringKilled >= 10) {
  4844. announce "Summon Man: Well done. All the Porings are dead!",3;
  4845. $PoringKilled = 0;
  4846. }
  4847. end;
  4848. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4849. ---------------------------------------
  4850. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4851. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4852. This command will make all monsters of the specified mob ID in the specified
  4853. area use the specified skill. Map name, x, and y define the center of the area,
  4854. which extending <range> cells in each direction (ex: a range of 3 would create
  4855. a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
  4856. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4857. <target type> can be:
  4858. 0 = self
  4859. 1 = the mob's current target
  4860. 2 = the mob's master
  4861. 3 = random target
  4862. Example:
  4863. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4864. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4865. // make the plant cast level 10 Cold Bolt on a random target
  4866. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,ET_KEK,3;
  4867. ---------------------------------------
  4868. *killmonster "<map name>","<event label>"{,<type>};
  4869. This command will kill all monsters that were spawned with 'monster' or
  4870. 'addmonster' and have a specified event label attached to them. Commonly used to
  4871. get rid of remaining quest monsters once the quest is complete.
  4872. If the label is given as "All", all monsters which have their respawn times set
  4873. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4874. command, and all monsters summoned with GM commands, but no other ones - that
  4875. is, all non-permanent monsters) on the specified map will be killed regardless
  4876. of the event label value.
  4877. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4878. will make the command fire "OnMyMobDead" events from any monsters that do die
  4879. as a result of this command.
  4880. ---------------------------------------
  4881. *killmonsterall "<map name>"{,<type>};
  4882. This command will kill all monsters on a specified map name, regardless of how
  4883. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4884. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4885. trigger when there is no player, killmonsterall has also been modified to support this.
  4886. Using this the normal/old way means labels don't trigger when a player didn't
  4887. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4888. forced to use the new method. However, if you wish to use the new label type with this
  4889. command, simply use 1 for type. Any other number won't be recognized.
  4890. ---------------------------------------
  4891. *strmobinfo(<type>,<monster id>);
  4892. This function will return information about a monster record in the database, as
  4893. per 'db/(pre-)re/mob_db.yml'. Type is the kind of information returned. Valid types are:
  4894. It will return 0 if there is no such monster (or the type value is invalid),
  4895. or an empty string if you requested the monster's name.
  4896. 1 - 'english name' field in the database, a string.
  4897. 2 - 'japanese name' field in the database, a string.
  4898. All other returned values are numbers:
  4899. 3 - Level.
  4900. 4 - Maximum HP.
  4901. 5 - Maximum SP.
  4902. 6 - Experience reward.
  4903. 7 - Job experience reward.
  4904. ---------------------------------------
  4905. *mobcount("<map name>","<event label>")
  4906. This function will count all the monsters on the specified map that have a given
  4907. event label and return the number or 0 if it can't find any. Naturally, only
  4908. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4909. event label.
  4910. If you pass this function an empty string for the event label, it will return
  4911. the total count of monster without event label, including permanently spawning monsters.
  4912. With the dynamic mobs system enabled, where mobs are not kept
  4913. in memory for maps with no actual people playing on them, this will return a 0
  4914. for any such map.
  4915. If the event label is given as "all", all monsters will be counted, regardless of
  4916. having any event label attached.
  4917. If the map name is given as "this", the map the invoking character is on will
  4918. be used. If the map is not found, or the invoker is not a character while the map
  4919. is "this", it will return -1.
  4920. ---------------------------------------
  4921. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4922. This command creates a monster which is a copy of another player. The first
  4923. four arguments serve the same purpose as in the monster script command, The
  4924. <char id> is the character id of the player to clone (player must be online).
  4925. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4926. must be a character id of another online player.
  4927. The mode can be specified to determine the behavior of the clone. Its
  4928. values are the same as the ones used for the mode field in the mob_db. The
  4929. default mode is aggressive, assists, can move, can attack.
  4930. Flag can be either zero or one currently. If zero, the clone is a normal
  4931. monster that'll target players, if one, it is considered a summoned monster,
  4932. and as such, it'll target other monsters. Defaults to zero.
  4933. The duration specifies how long the clone will live before it is auto-removed.
  4934. Specified in seconds, defaults to no limit (zero).
  4935. Returned value is the monster ID of the spawned clone. If command fails,
  4936. returned value is zero.
  4937. ---------------------------------------
  4938. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4939. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4940. with other commands, this one will set up the monster to fight to protect the
  4941. invoking character. Monster name and mob id obey the same rules as the one given
  4942. at the beginning of this document for permanent monster spawns with the
  4943. exceptions mentioned when describing 'monster' command.
  4944. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4945. invoking character.
  4946. Timeout is the time in milliseconds the summon lives, and is set default
  4947. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4948. and it is not possible to create a spawn that lasts forever.
  4949. If an event label is given, upon the monster being killed, the event label will
  4950. run as if by 'donpcevent'.
  4951. Returned value is the game ID of the spawned monster.
  4952. // Will summon a dead branch-style monster to fight for the character.
  4953. summon "--ja--",-1;
  4954. ---------------------------------------
  4955. *addmonsterdrop <monster id>,<item id>,<rate>,{<steal protected>,{<random option group id>}};
  4956. *addmonsterdrop "<monster name>",<item id>,<rate>,{<steal protected>,{<random option group id>}};
  4957. *delmonsterdrop <monster id>,<item id>;
  4958. *delmonsterdrop "<monster name>",<item id>;
  4959. These commands will temporarily add or delete a monster drop, which will be reset
  4960. when the mob database reloads or the server shuts down. They return true upon success, false otherwise.
  4961. If the monster already drops the specified item, its drop rate will be updated with
  4962. the given rate (100 = 1%).
  4963. If <steal protected> is true the item will be protected from TF_STEAL (default false).
  4964. <random option group id> binds the item with the given random option group Id (default 0).
  4965. The Id must be valid, like defined in db/[pre-]re/item_randomopt_group.yml
  4966. Examples:
  4967. // Makes Owl Baron drop Honey at an 80% rate.
  4968. addmonsterdrop 1295,518,8000;
  4969. // Makes Owl Baron drop Knife_ at an 80% rate, protected from TF_STEAL and with random option group Id 5.
  4970. addmonsterdrop 1295,1202,8000,true,5;
  4971. // Deletes Executioner's Mitten from Rybio.
  4972. delmonsterdrop 1201,7017;
  4973. ---------------------------------------
  4974. *mob_setidleevent <GID>,<event>;
  4975. This command will attach an event label to the monster with the given <GID> which will execute
  4976. when the <GID> is idle.
  4977. Example:
  4978. monster "prontera",0,0,"Quest Poring",1002,1;
  4979. mob_setidleevent $@mobid[0], "NPC NAME::OnIdle";
  4980. end;
  4981. OnIdle:
  4982. mobchat getattachedrid(),0,0x00FF00,"I'm IDLE!";
  4983. end;
  4984. ---------------------------------------
  4985. *disablenpc {"<NPC object name>"};
  4986. *enablenpc {"<NPC object name>"};
  4987. These two commands will disable and enable, respectively, an NPC object
  4988. specified by name. The disabled NPC will disappear from sight and will no longer
  4989. be triggerable in the normal way. It is not clear whether it will still be
  4990. accessible through 'donpcevent' and other triggering commands, but it probably
  4991. will be. You can disable even warp NPCs if you know their object names, which is
  4992. an easy way to make a map only accessible through walking half the time. Then
  4993. you 'enablenpc' them back.
  4994. You can also use these commands to create the illusion of an NPC switching
  4995. between several locations, which is often better than actually moving the NPC -
  4996. create one NPC object with a visible and a hidden part to their name, make a few
  4997. copies, and then disable all except one.
  4998. ---------------------------------------
  4999. *hideonnpc {"<NPC object name>"};
  5000. *hideoffnpc {"<NPC object name>"};
  5001. These commands will make the NPC object specified display as hidden/visible,
  5002. even though not actually disabled per se. Hidden as in thief Hide skill, but
  5003. unfortunately, not detectable by Ruwach or Sight.
  5004. As they are now, these commands are pointless, it is suggested to use
  5005. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  5006. sprite location and other accompanying data from memory when it is not used.
  5007. However, you can use these for some quest ideas (such as cloaking NPCs talking
  5008. while hidden then revealing.... you can wonder around =P
  5009. ---------------------------------------
  5010. *unloadnpc "<NPC object name>";
  5011. This command will fully unload a NPC object and all of it's duplicates.
  5012. ---------------------------------------
  5013. *cloakonnpc {"<NPC object name>"{,<character ID>}};
  5014. *cloakoffnpc {"<NPC object name>"{,<character ID>}};
  5015. These commands will make the NPC object specified display as cloaked/uncloaked,
  5016. even though not actually disabled.
  5017. The player can interact with a NPC cloaked (via NPC click, monster event..)
  5018. but the NPC trigger area is disabled.
  5019. If <character ID> is given then the NPC will only display to the specified
  5020. player until he/she leaves the map, logs out, or the npc option is changed.
  5021. If no <character ID> is specified it will display to the area.
  5022. ---------------------------------------
  5023. *cloakonnpcself {"<NPC object name>"};
  5024. *cloakoffnpcself {"<NPC object name>"};
  5025. Same command as above, but an attached player is required. The NPC will only display to the attached player.
  5026. ---------------------------------------
  5027. *isnpccloaked {"<NPC object name>"{,<character ID>}};
  5028. Returns true if the NPC has been cloaked to the attached player or given
  5029. <character ID>, false otherwise. This works in association with cloakonnpc
  5030. when it is targetting a specific character.
  5031. ---------------------------------------
  5032. *doevent "<NPC object name>::<event label>";
  5033. This command will start a new execution thread in a specified NPC object at the
  5034. specified label. The execution of the script running this command will not stop,
  5035. and the event called by the 'doevent' command will not run until the invoking
  5036. script has terminated. No parameters may be passed with a doevent call.
  5037. The script of the NPC object invoked in this manner will run as if it's been
  5038. invoked by the RID that was active in the script that issued a 'doevent'. As
  5039. such, the command will not work if an RID is not attached.
  5040. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  5041. mes "This is what you will see when you click me";
  5042. close;
  5043. OnLabel:
  5044. mes "This is what you will see if the doevent is activated";
  5045. close;
  5046. }
  5047. ....
  5048. doevent "NPC::OnLabel";
  5049. ---------------------------------------
  5050. *donpcevent "<NPC object name>::<event label>";
  5051. This command invokes the event label code within an another NPC or NPCs. It
  5052. starts a separate instance of execution, and the invoking NPC will resume
  5053. execution its immediately.
  5054. If the supplied event label has the form "NpcName::OnLabel", then only given
  5055. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  5056. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  5057. label will be invoked, one after another. In both cases the invoked script
  5058. will run without an attached RID, whether or not the invoking script was
  5059. attached to a player. The event label name is required to start with "On".
  5060. This command can be used to make other NPCs act, as if they were responding to
  5061. the invoking NPC's actions, such as using an emotion or talking.
  5062. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  5063. mes "NPC2 copies my actions!";
  5064. close2;
  5065. donpcevent "NPC2::OnEmote";
  5066. end;
  5067. OnEmote:
  5068. emotion rand(1,30);
  5069. end;
  5070. }
  5071. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  5072. mes "NPC1 copies my actions!";
  5073. close2;
  5074. donpcevent "NPC1::OnEmote";
  5075. end;
  5076. OnEmote:
  5077. emotion rand(1,30);
  5078. end;
  5079. }
  5080. Whichever of the both NPCs is talked to, both will show a random emotion at the
  5081. same time.
  5082. As of r16564, command now returns 1 or 0 on success and failure.
  5083. A debug message also shows on the console when no events are triggered.
  5084. ---------------------------------------
  5085. *cmdothernpc "<npc name>","<command>";
  5086. This is simply "donpcevent <npc name>::OnCommand<command>".
  5087. It is an approximation of official server script language's 'cmdothernpc'.
  5088. Returns true if the command was executed on the other NPC successfully, false if not.
  5089. ---------------------------------------
  5090. *npctalk "<message>"{,"<NPC name>",<flag>{,<color>}};
  5091. This command will display a message as if the NPC object running it was a player
  5092. talking - that is, above their head and in the chat window.
  5093. The display name of the NPC won't get appended in front of the message.
  5094. If the <NPC name> option is given and not empty, then that NPC will display the message,
  5095. else the attached NPC will display the message,
  5096. the color format is in RGB (0xRRGGBB). The color is White by default.
  5097. Target for <flag>:
  5098. - bc_all : Broadcast message is sent server-wide (only in the chat window).
  5099. - bc_map : Message is sent to everyone in the same map as the source of the npc.
  5100. - bc_area : Message is sent to players in the vicinity of the source (default value).
  5101. - bc_self : Message is sent only to player attached.
  5102. // This will make everyone in the area see the NPC greet the character
  5103. // who just invoked it.
  5104. npctalk "Hello " + strcharinfo(0) + ", how are you?";
  5105. ---------------------------------------
  5106. *chatmes "<message>"{,"<NPC name>"};
  5107. This command will display a message in the waitingroom (chat) of the NPC.
  5108. If the <NPC name> option is given, then that NPC will display the message, else
  5109. the attached NPC will display the message.
  5110. If the NPC is not in a waitingroom, nothing happens.
  5111. // Everyone in the waitingroom will see this message:
  5112. chatmes "Waiting 5 minutes until the next match will start";
  5113. ---------------------------------------
  5114. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  5115. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  5116. *setnpcdisplay("<npc name>", "<display name>")
  5117. *setnpcdisplay("<npc name>", <class id>)
  5118. Changes the display name and/or display class of the target NPC.
  5119. Returns 0 is successful, 1 if the NPC does not exist.
  5120. Size is 0 = normal 1 = small 2 = big.
  5121. ---------------------------------------
  5122. \\
  5123. 5,1.- Time-related commands
  5124. \\
  5125. ---------------------------------------
  5126. *addtimer <ticks>,"NPC::OnLabel";
  5127. *deltimer "NPC::OnLabel";
  5128. *addtimercount <ticks>,"NPC::OnLabel";
  5129. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  5130. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  5131. number of ticks. For all three cases, the event label given is the identifier of
  5132. that timer. The timer runs on the character object that is attached to the script,
  5133. and can have multiple instances. When the label is run, it is run as if the player that
  5134. the timer runs on has clicked the NPC.
  5135. When this timer runs out, a new execution thread will start in the specified NPC
  5136. object at the specified label.
  5137. The ticks are given in 1/1000ths of a second.
  5138. One more thing. These timers are stored as part of player data. If the player
  5139. logs out, all of these get immediately deleted, without executing the script.
  5140. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  5141. Example:
  5142. <NPC Header> {
  5143. dispbottom "Starting a 5 second timer...";
  5144. addtimer 5000, strnpcinfo(3) + "::On5secs";
  5145. end;
  5146. On5secs:
  5147. dispbottom "5 seconds have passed!";
  5148. end;
  5149. }
  5150. ---------------------------------------
  5151. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  5152. { "<NPC name>" | <Attach Flag> };
  5153. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  5154. { "<NPC name>" | <Detach Flag> };
  5155. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  5156. { "<NPC name>" | <Attach Flag> };
  5157. *setnpctimer <tick>{,"<NPC name>"};
  5158. *getnpctimer(<type of information>{,"<NPC name>"})
  5159. *attachnpctimer {"<character name>"};
  5160. *detachnpctimer {"<NPC name>"};
  5161. This set of commands and functions will create and manage an NPC-based timer.
  5162. The NPC name may be omitted, in which case the calling NPC is used as target.
  5163. Contrary to addtimer/deltimer commands which let you have many different timers
  5164. referencing different labels in the same NPC, each with their own countdown,
  5165. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  5166. and let you know how many were triggered already and how many still remain.
  5167. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  5168. creating this timer, the execution will not stop, but will happily continue
  5169. onward. The timer will then invoke new execution threads at labels
  5170. "OnTimer<time>:" in the NPC object it is attached to.
  5171. To create the timer, use the 'initnpctimer', which will start it running.
  5172. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  5173. 'startnpctimer' will let the paused timer continue.
  5174. By default timers do not have a RID attached, which lets them continue even
  5175. if the player that started them logs off. To attach a RID to a timer, you can
  5176. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  5177. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  5178. stopnpctimer lets you detach any RID after stopping the timer, and by using
  5179. 'detachnpctimer' you can detach a RID at any time.
  5180. Normally there is only a single timer per NPC, but as an exception, as long as
  5181. you attach a player to the timer, you can have multiple timers running at once,
  5182. because these will get stored on the players instead of the NPC.
  5183. NOTE: You need to attach the RID before the timer _before_ you start it to
  5184. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  5185. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  5186. event label of that NPC will be triggered, so you can do the appropriate
  5187. cleanup (the player is still attached when this event is triggered).
  5188. The 'setnpctimer' command will explicitly set the timer to a given tick.
  5189. 'getnpctimer' provides timer information. Its parameter defines what type:
  5190. 0 - Will return the current tick count of the timer.
  5191. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  5192. specified NPC waiting for execution.
  5193. 2 - Will return the number of times the timer has triggered and will trigger
  5194. an "OnTimer<tick>:" label in the specified NPC.
  5195. Example 1:
  5196. <NPC Header> {
  5197. // We need to use attachnpctimer because the mes command below needs RID attach
  5198. attachnpctimer;
  5199. initnpctimer;
  5200. npctalk "I cant talk right now, give me 10 seconds";
  5201. end;
  5202. OnTimer5000:
  5203. npctalk "Ok 5 seconds more";
  5204. end;
  5205. OnTimer6000:
  5206. npctalk "4";
  5207. end;
  5208. OnTimer7000:
  5209. npctalk "3";
  5210. end;
  5211. OnTimer8000:
  5212. npctalk "2";
  5213. end;
  5214. OnTimer9000:
  5215. npctalk "1";
  5216. end;
  5217. OnTimer10000:
  5218. stopnpctimer;
  5219. mes "[Man]";
  5220. mes "Ok we can talk now";
  5221. detachnpctimer;
  5222. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  5223. }
  5224. Example 2:
  5225. OnTimer15000:
  5226. npctalk "Another 15 seconds have passed.";
  5227. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  5228. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  5229. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  5230. initnpctimer;
  5231. end;
  5232. // This OnInit label will run when the script is loaded, so that the timer
  5233. // is initialized immediately as the server starts. It is dropped back to 0
  5234. // every time the NPC says something, so it will cycle continuously.
  5235. OnInit:
  5236. initnpctimer;
  5237. end;
  5238. Example 3:
  5239. mes "[Man]";
  5240. mes "I have been waiting " + (getnpctimer(0)/1000) + " seconds for you.";
  5241. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  5242. close;
  5243. Example 4:
  5244. mes "[Man]";
  5245. mes "Ok, I will let you have 30 more seconds...";
  5246. close2;
  5247. setnpctimer (getnpctimer(0)-30000);
  5248. // Notice the 'close2'. If there were a 'next' there the timer would be
  5249. // changed only after the player pressed the 'next' button.
  5250. end;
  5251. ---------------------------------------
  5252. *sleep {<milliseconds>};
  5253. *sleep2 {<milliseconds>};
  5254. *awake "<NPC name>";
  5255. These commands are used to control the pause of a NPC.
  5256. sleep and sleep2 will pause the script for the given amount of milliseconds.
  5257. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  5258. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  5259. basically do the same, but the main difference is that sleep will not keep the rid,
  5260. while sleep2 does. Also sleep2 will stop the script if there is no unit attached.
  5261. Examples:
  5262. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  5263. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  5264. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  5265. ---------------------------------------
  5266. *progressbar "<color>",<seconds>;
  5267. This command works almost like sleep2, but displays a progress bar
  5268. above the head of the currently attached character (like cast bar).
  5269. Once the given amount of seconds passes, the script resumes. If the
  5270. character moves while the progress bar progresses, it is aborted and
  5271. the script ends. The color format is in RGB (RRGGBB). The color is
  5272. currently ignored by the client and appears always green.
  5273. NOTE:
  5274. Ragexe clients are known to randomly crash if a message window is still open.
  5275. If possible make sure to close all message windows before triggering the progressbar command.
  5276. ---------------------------------------
  5277. *progressbar_npc "<color>",<seconds>{,<"NPC Name">};
  5278. This command works like progressbar, but displays a progress bar
  5279. above the head of the currently attached (or given) NPC. Once the
  5280. given amount of seconds passes, the script resumes. The color format
  5281. is in RGB (RRGGBB). The color is currently ignored by the client and
  5282. appears always green.
  5283. ---------------------------------------
  5284. //
  5285. 5,1.- End of time-related commands
  5286. //
  5287. ---------------------------------------
  5288. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>{,<char_id>}}}}}};
  5289. This command will broadcast a message to all or most players, similar to
  5290. @kami/@kamib GM commands.
  5291. announce "This will be shown to everyone at all in yellow.",0;
  5292. The region the broadcast is heard in (target), source of the broadcast
  5293. and the color the message will come up as is determined by the flags.
  5294. The flag values are coded as constants in 'src/map/script_constants.hpp' to make them easier to use.
  5295. Target flags:
  5296. - bc_all: Broadcast message is sent server-wide (default).
  5297. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  5298. - bc_area: Message is sent to players in the vicinity of the source.
  5299. - bc_self: Message is sent only to current player , if the source flag is bc_pc it also can
  5300. be used to send the Message to the character id if it's provided.
  5301. You cannot use more than one target flag.
  5302. Source flags:
  5303. - bc_pc: Broadcast source is the attached player or the character id if it's provided (default).
  5304. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  5305. (useful when a player is not attached or the message should be sent to those
  5306. nearby the NPC).
  5307. You cannot use more than one source flag.
  5308. Special flags:
  5309. - bc_yellow: Broadcast will be displayed in yellow color (default).
  5310. - bc_blue: Broadcast will be displayed in blue color.
  5311. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  5312. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  5313. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  5314. If any of the optional parameters is used, special flag is ignored.
  5315. Optional parameters may not work well (or at all) depending on a game client used.
  5316. The color parameter is a single number which can be in hexadecimal notation.
  5317. For example:
  5318. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  5319. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  5320. In official scripts only two font-weights (types) are used:
  5321. - normal (FW_NORMAL = 400, default),
  5322. - bold (FW_BOLD = 700).
  5323. Default font size is 12.
  5324. Using this for private messages to players is probably not that good an idea,
  5325. but it can be used instead in NPCs to "preview" an announce.
  5326. // This will be a private message to the player using the NPC that made the
  5327. // announcement
  5328. announce "This is my message just for you",bc_blue|bc_self;
  5329. // This will be shown on everyones screen that is in sight of the NPC.
  5330. announce "This is my message just for you people here",bc_npc|bc_area;
  5331. // This will be a private message to the player with character id 150000
  5332. announce "This is my message just for char id 150000",bc_self,0xFFF618,FW_NORMAL,12,0,0,150000;
  5333. ---------------------------------------
  5334. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  5335. This command will work like 'announce' but will only broadcast to characters
  5336. currently residing on the specified map. The flag and optional parameters
  5337. parameters are the same as in 'announce', but target and source flags are ignored.
  5338. ---------------------------------------
  5339. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  5340. This command works like 'announce' but will only broadcast to characters
  5341. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  5342. optional parameters are the same as in 'announce', but target and source flags are ignored.
  5343. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  5344. ---------------------------------------
  5345. *callshop "<name>"{,<option>};
  5346. These are a series of commands used to create dynamic shops.
  5347. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  5348. The options are:
  5349. 0 = The normal window (buy, sell and cancel) (default)
  5350. 1 = The buy window
  5351. 2 = The sell window
  5352. Note: The <option> parameter only works on the 'shop' type NPC.
  5353. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  5354. (as long as an npcshop* command is executed from that NPC, see note below). These
  5355. labels, if used, will replace how the shop handles the buying and selling of items,
  5356. allowing for the creation of dynamic shops.
  5357. The label "OnBuyItem" sets the following arrays:
  5358. @bought_nameid - item ID bought
  5359. @bought_quantity - amount bought
  5360. The label "OnSellItem" sets the following arrays:
  5361. @sold_nameid - item ID sold
  5362. @sold_quantity - amount sold
  5363. @sold_refine - refine count
  5364. @sold_attribute - if the item is broken (1) or not (0)
  5365. @sold_identify - if the item is identified (1) or not (0)
  5366. @sold_enchantgrade - enchantgrade
  5367. @sold_card1 - card slot 1
  5368. @sold_card2 - card slot 2
  5369. @sold_card3 - card slot 3
  5370. @sold_card4 - card slot 4
  5371. @sold_option_id1 - random option ID 1
  5372. @sold_option_val1 - random option value 1
  5373. @sold_option_param1 - random option param 1
  5374. @sold_option_id2 - random option ID 2
  5375. @sold_option_val2 - random option value 2
  5376. @sold_option_param2 - random option param 2
  5377. @sold_option_id3 - random option ID 3
  5378. @sold_option_val3 - random option value 3
  5379. @sold_option_param3 - random option param 3
  5380. @sold_option_id4 - random option ID 4
  5381. @sold_option_val4 - random option value 4
  5382. @sold_option_param4 - random option param 4
  5383. @sold_option_id5 - random option ID 5
  5384. @sold_option_val5 - random option value 5
  5385. @sold_option_param5 - random option param 5
  5386. Note: These labels will only be triggered if an npcshop* command is executed because these
  5387. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  5388. are triggered in the NPC whose master_nd is given in the shop.
  5389. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  5390. ---------------------------------------
  5391. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  5392. *npcshopitem "<name>",<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,...}}};
  5393. This command lets you override the contents of an existing NPC shop or cashshop. The
  5394. current sell list will be wiped, and only the items specified with the price
  5395. specified will be for sale.
  5396. The function returns 1 if shop was updated successfully, or 0 if not found.
  5397. NOTES:
  5398. - That you cannot use -1 to specify default selling price!
  5399. - If the attached shop type is a market shop, notice that there is an extra parameter after price, <stock>. Make sure to not add duplicate items! For unlimited stock use -1.
  5400. ---------------------------------------
  5401. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  5402. *npcshopadditem "<name>",<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,<item id>,<price>,<stock>{,...}}};
  5403. This command will add more items at the end of the selling list for the
  5404. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  5405. appear twice on the sell list.
  5406. The function returns 1 if shop was updated successfully, or 0 if not found.
  5407. NOTES:
  5408. - That you cannot use -1 to specify default selling price!
  5409. - If attached shop type is market shop, need an extra param after price, it's <stock>
  5410. and make sure don't add duplication item! For unlimited stock use -1.
  5411. ---------------------------------------
  5412. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  5413. This command will remove items from the specified NPC shop or cashshop.
  5414. If the item to remove exists more than once on the shop, all instances will be
  5415. removed.
  5416. Note that the function returns 1 even if no items were removed. The return
  5417. value is only to confirm that the shop was indeed found.
  5418. ---------------------------------------
  5419. *npcshopattach "<name>"{,<flag>};
  5420. This command will attach the current script to the given NPC shop.
  5421. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  5422. of your script will be executed whenever a player buys/sells from the shop.
  5423. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  5424. and @sold_quantity[] will be filled up with the items and quantities
  5425. bought/sold.
  5426. The optional parameter specifies whether to attach ("1") or detach ("0") from
  5427. the shop (the default is to attach). Note that detaching will detach any NPC
  5428. attached to the shop, even if it's from another script, while attaching will
  5429. override any other script that may be already attached.
  5430. The function returns 0 if the shop was not found, 1 otherwise.
  5431. NOTES:
  5432. - If attached shop type is market shop, will be default to call the 'buy' window.
  5433. ---------------------------------------
  5434. *npcshopupdate "<name>",<item_id>,<price>{,<stock>}
  5435. Update an entry from a shop. If the price is 0 it won't be changed. May also be used for
  5436. marketshop to update the stock quantity. For unlimited stock, use -1.
  5437. For other shop types, the stock value has no effect.
  5438. ---------------------------------------
  5439. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  5440. This command will create a chat room, owned by the NPC object running this
  5441. script and displayed above the NPC sprite.
  5442. The maximum length of a chat room name is 60 letters.
  5443. The limit is the maximum number of people allowed to enter the chat room.
  5444. The attached NPC is included in this count. If the optional event and trigger
  5445. parameters are given, the event label ("<NPC object name>::<label name>")
  5446. will be invoked as if with a 'doevent' upon the number of people in the chat
  5447. room reaching the given triggering amount.
  5448. // The NPC will just show a box above its head that says "Hello World", clicking
  5449. // it will do nothing, since the limit is zero.
  5450. waitingroom "Hello World",0;
  5451. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  5452. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  5453. // the player will be able to wait until 7 players accumulate. Once this happens,
  5454. // it will cause the NPC "Bouncer" run the label "OnStart".
  5455. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  5456. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  5457. // and will have 8 waiting slots. Clicking this will allow a player who has
  5458. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  5459. // able to wait until 7 players accumulate. Once this happens, it will cause
  5460. // the NPC "Bouncer" run the label "OnStart".
  5461. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  5462. Creating a waiting room does not stop the execution of the script and it will
  5463. continue to the next line.
  5464. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  5465. of waiting rooms.
  5466. ---------------------------------------
  5467. *delwaitingroom {"<NPC object name"};
  5468. This command will delete a waiting room. If no parameter is given, it will
  5469. delete a waiting room attached to the NPC object running this command, if it is,
  5470. it will delete a waiting room owned by another NPC object. This is the only way
  5471. to get rid of a waiting room, nothing else will cause it to disappear.
  5472. It's not clear what happens to a waiting room if the NPC is disabled with
  5473. 'disablenpc', by the way.
  5474. ---------------------------------------
  5475. *enablewaitingroomevent {"<NPC object name>"};
  5476. *disablewaitingroomevent {"<NPC object name>"};
  5477. *enablearena;
  5478. *disablearena;
  5479. This will enable and disable triggering the waiting room event (see
  5480. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  5481. for a specified NPC object. The chat room will not disappear when triggering is
  5482. disabled and enabled in this manner and players will not be kicked out of it.
  5483. Enabling a chat room event will also cause it to immediately check whether the
  5484. number of users in it exceeded the trigger amount and trigger the event
  5485. accordingly.
  5486. Normally, whenever a waiting room was created to make sure that only one
  5487. character is, for example, trying to pass a job quest trial, and no other
  5488. characters are present in the room to mess up the script.
  5489. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  5490. These are supposedly left here for compatibility with official server scripts,
  5491. but no rAthena script uses these at the moment.
  5492. ---------------------------------------
  5493. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  5494. This function will return information about the waiting room state for the
  5495. attached waiting room or for a waiting room attached to the specified NPC if
  5496. any.
  5497. The valid information types are:
  5498. 0 - Number of users currently chatting.
  5499. 1 - Maximum number of users allowed.
  5500. 2 - Will return 1 if the waiting room has a trigger set.
  5501. 0 otherwise.
  5502. 3 - Will return 1 if the waiting room is currently disabled.
  5503. 0 otherwise.
  5504. 4 - The Title of the waiting room (string)
  5505. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  5506. set a password on a waiting room right now.
  5507. 16 - Event name of the waiting room (string)
  5508. 32 - Whether or not the waiting room is full.
  5509. 33 - Whether the amount of users in the waiting room is higher than the trigger
  5510. number.
  5511. ---------------------------------------
  5512. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  5513. This command will warp the amount of characters equal to the trigger number of
  5514. the waiting room chat attached to the NPC object running this command to the
  5515. specified map and coordinates, kicking them out of the chat. Those waiting the
  5516. longest will get warped first. It can also do a random warp on the same map
  5517. ("Random" instead of map name) and warp to the save point ("SavePoint").
  5518. The list of characters to warp is taken from the list of the chat room members.
  5519. Those not in the chat room will not be considered even if they are talking to
  5520. the NPC in question. If the number of people is given, exactly this much people
  5521. will be warped.
  5522. This command can also keep track of who just got warped. It does this by setting
  5523. special variables:
  5524. $@warpwaitingpc[] is an array containing the account_id numbers of the
  5525. characters who were just warped.
  5526. $@warpwaitingpcnum contains the number of the character it just warped.
  5527. See also 'getpartymember' for advice on what to do with those variables.
  5528. The obvious way of using this effectively would be to set up a waiting room for
  5529. two characters to be warped onto a random PVP map for a one-on-one duel, for
  5530. example.
  5531. ---------------------------------------
  5532. *waitingroomkick "<NPC object name>" , "<character name>";
  5533. This command kicks the given character from the waiting room attached to the given NPC.
  5534. ---------------------------------------
  5535. *getwaitingroomusers "<NPC object name>";
  5536. This command get all the characters in the waiting room of the given NPC and stores
  5537. their gids in the array .@waitingroom_users[]. Also, stores the number of characters
  5538. in the variable .@waitingroom_usercount.
  5539. ---------------------------------------
  5540. *kickwaitingroomall {"<NPC object name>"};
  5541. This command kicks everybody out of a specified waiting room chat.
  5542. ---------------------------------------
  5543. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  5544. This command sets the 'nosave' flag for the specified map and also gives an
  5545. alternate respawn-upon-relogin point.
  5546. It does not make a map impossible to make a save point on as you would normally
  5547. think, 'savepoint' will still work. It will, however, make the specified map
  5548. kick the reconnecting players off to the alternate map given to the coordinates
  5549. specified.
  5550. ---------------------------------------
  5551. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  5552. This command marks a specified map with the given map flag, which will alter the
  5553. behavior of the map. A full list of mapflags is located in 'src/map/script_constants.hpp' with
  5554. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  5555. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  5556. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  5557. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  5558. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  5559. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  5560. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  5561. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  5562. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  5563. The optional parameter <zone> is used to set the zone for 'restricted' mapflags,
  5564. GM level bypass for 'nocommand', base/job experience for 'bexp'/'jexp', and
  5565. flag for 'battleground'.
  5566. For 'skill_damage' mapflag:
  5567. - Setting the flag here will adjust the global (all skills) damage on the map.
  5568. - <zone> is the -100 to 100000 damage adjustment value of the skills.
  5569. - See 'getmapflag' for the different <type> values.
  5570. For 'skill_duration' mapflag:
  5571. - <zone> is the skill ID to adjust.
  5572. - <type> is the percentage of adjustment from 0 to 100000.
  5573. ---------------------------------------
  5574. *removemapflag "<map name>",<flag>{,<zone>};
  5575. This command removes a mapflag from a specified map.
  5576. See 'setmapflag' for a list of mapflags.
  5577. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  5578. ---------------------------------------
  5579. *getmapflag("<map name>",<flag>{,<type>})
  5580. This command checks the status of a given mapflag and returns the mapflag's state.
  5581. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  5582. For MF_RESTRICTED, the zone value of the map is returned.
  5583. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  5584. SKILLDMG_MAX: if mapflag is set (default)
  5585. SKILLDMG_PC: damage against players
  5586. SKILLDMG_MOB: damage against mobs
  5587. SKILLDMG_BOSS: damage against bosses
  5588. SKILLDMG_OTHER: damage against other
  5589. SKILLDMG_CASTER: caster type
  5590. ---------------------------------------
  5591. *setbattleflag "<battle flag>",<value>{,<reload>};
  5592. *getbattleflag("<battle flag>")
  5593. Sets or gets the value of the given battle flag.
  5594. Battle flags are the flags found in the battle / *.conf files and is also used in Lupus' variable rates script.
  5595. If the reload value is given then the server will attempt to reload monster data
  5596. to properly apply the new rates. This applies to EXP/Drop type configs. The server
  5597. will only attempt to reload specific configs.
  5598. Examples:
  5599. // Will set the base experience rate to 20x (2000%) - Monster data will continue to use previous rates at server start
  5600. setBattleFlag "base_exp_rate",2000;
  5601. // Will set the base experience rate to 20x (2000%) - Monster data will be reloaded to new value
  5602. setBattleFlag "base_exp_rate",2000,true;
  5603. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  5604. mes getBattleFlag("base_exp_rate");
  5605. ---------------------------------------
  5606. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  5607. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  5608. The source coordinates specify the portal's location on the map of the invoking NPC.
  5609. The target map and coordinates determine the destination of the portal.
  5610. Examples:
  5611. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  5612. warpportal 150,150,"prontera",150,180;
  5613. ---------------------------------------
  5614. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  5615. This command will collect all characters located on the From map and warp them
  5616. wholesale to the same point on the To map, or randomly distribute them there if
  5617. the coordinates are zero. "Random" is understood as a special To map name and
  5618. will mean randomly shuffling everyone on the same map.
  5619. Optionally, a type and ID can be specified. Available types are:
  5620. 0 - Everyone
  5621. 1 - Guild
  5622. 2 - Party
  5623. Example:
  5624. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  5625. mapwarp "prontera","alberta",150,150,1,63;
  5626. ---------------------------------------
  5627. \\
  5628. 5,2.- Guild-related commands
  5629. \\
  5630. ---------------------------------------
  5631. *maprespawnguildid "<map name>",<guild id>,<flag>;
  5632. This command goes through the specified map and for each player and monster
  5633. found there does stuff.
  5634. Flag is a bit-mask (add up numbers to get effects you want)
  5635. 1 - warp all guild members to their save points.
  5636. 2 - warp all non-guild members (including guildless players) to their save points.
  5637. 4 - remove all monsters which are not guardian or Emperium.
  5638. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  5639. kick all characters out', which is what the official scripts do upon castle
  5640. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  5641. For examples, check the WoE scripts in the distribution.
  5642. ---------------------------------------
  5643. *agitstart;
  5644. *agitend;
  5645. *agitstart2;
  5646. *agitend2;
  5647. *agitstart3;
  5648. *agitend3;
  5649. These commands will start and end War of Emperium FE, War of Emperium SE,
  5650. or War of Emperium TE.
  5651. This is a bit more complex than it sounds, since the commands themselves won't
  5652. actually do anything interesting, except causing all 'OnAgitStart:' and
  5653. 'OnAgitEnd:', 'OnAgitStart2:' and 'OnAgitEnd2:', or 'OnAgitStart3:' and
  5654. 'OnAgitEnd3:' in the case of latter two commands, events to run everywhere,
  5655. respectively. They are used as simple triggers to run a lot of complex scripts
  5656. all across the server, and they, in turn, are triggered by clock with an
  5657. 'OnClock<time>:' time-triggering label.
  5658. ---------------------------------------
  5659. *gvgon "<map name>";
  5660. *gvgoff "<map name>";
  5661. These commands will turn GVG mode for the specified maps on and off, setting up
  5662. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  5663. even though WoE itself may or may not actually be in effect.
  5664. ---------------------------------------
  5665. *gvgon3 "<map name>";
  5666. *gvgoff3 "<map name>";
  5667. Theses commands behave identically to gvgon/gvgoff, but apply GVG_TE mapflag.
  5668. ---------------------------------------
  5669. *flagemblem <guild id>;
  5670. This command only works when run by the NPC objects which have sprite id 722,
  5671. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  5672. will be seen by anyone. If it is invoked in that manner, the emblem of the
  5673. specified guild will appear on the flag, though, if any players are watching it
  5674. at this moment, they will not see the emblem change until they move out of sight
  5675. of the flag and return.
  5676. This is commonly used in official guildwar scripts with a function call which
  5677. returns a guild id:
  5678. // This will change the emblem on the flag to that of the guild that owns
  5679. // "guildcastle"
  5680. flagemblem GetCastleData("guildcastle",1);
  5681. ---------------------------------------
  5682. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  5683. This command is roughly equivalent to 'monster', but is meant to be used with
  5684. castle guardian monsters and will only work with them. It will set the guardian
  5685. characteristics up according to the castle's investment values and otherwise
  5686. set the things up that only castle guardians need.
  5687. Since trunk r12524:
  5688. Returns the id of the mob or 0 if an error occurred.
  5689. When 'guardian index' isn't supplied it produces a temporary guardian.
  5690. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  5691. ---------------------------------------
  5692. *guardianinfo("<map name>", <guardian number>, <type>);
  5693. This function will return various info about the specified guardian, or -1
  5694. if it fails for some reason. It is primarily used in the castle manager NPC.
  5695. Map name and guardian number (value between 0 and 7) define the target.
  5696. Type indicates what information to return:
  5697. 0 - visibility (whether the guardian is installed or not)
  5698. 1 - max. hp
  5699. 2 - current hp
  5700. ---------------------------------------
  5701. *getguildalliance(<guild id1>, <guild id2>);
  5702. This command will return the relation between 2 guilds.
  5703. NOTE: This should be used in collaboration with 'requestguildinfo' as the
  5704. map-server needs to request for information from the char-server.
  5705. Return values:
  5706. -2 - Guild ID1 does not exist
  5707. -1 - Guild ID2 does not exist
  5708. 0 - Both guilds have no relation OR guild ID aren't given
  5709. 1 - Both guilds are allies
  5710. 2 - Both guilds are antagonists
  5711. ---------------------------------------
  5712. //
  5713. 5,2.- End of guild-related commands
  5714. //
  5715. ---------------------------------------
  5716. *npcspeed <speed value>;
  5717. *npcwalkto <x>,<y>;
  5718. *npcstop;
  5719. These commands will make the NPC object in question move around the map. As they
  5720. currently are, they are a bit buggy and are not useful for much more than making
  5721. an NPC move randomly around the map.
  5722. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  5723. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  5724. possible (instant motion). 100 is the default character walking speed.
  5725. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  5726. on the same map it is currently on. The script proceeds immediately after the
  5727. NPC begins moving.
  5728. 'npcstop' will stop the motion.
  5729. While in transit, the NPC will be clickable, but invoking it will cause it to
  5730. stop moving, which will make its coordinates different from what the client
  5731. computed based on the speed and motion coordinates. The effect is rather
  5732. unnerving.
  5733. Only a few NPC sprites have walking animations, and those that do, do not get
  5734. the animation invoked when moving the NPC, due to the problem in the NPC walking
  5735. code, which looks a bit silly. You might have better success by defining a job-
  5736. sprite based sprite id in 'db/mob_avail.yml' with this.
  5737. ---------------------------------------
  5738. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  5739. This command looks like the NPCWalkToxy function,but is a little different.
  5740. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  5741. sometimes gives problems if the path isn't a straight line without objects),
  5742. this command just moves the NPC. It basically warps out and in on the current
  5743. and given spot. Direction can be used to change the NPC's facing direction.
  5744. Example:
  5745. // This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
  5746. moveNPC "Bugga",100,20;
  5747. ---------------------------------------
  5748. =====================
  5749. |6.- Other commands.|
  5750. =====================
  5751. ---------------------------------------
  5752. *debugmes "<message>";
  5753. This command will send a debug message to the server console (map-server window). It
  5754. will not be displayed anywhere else.
  5755. // Displays "NAME has clicked me!" in the map-server window.
  5756. debugmes strcharinfo(0) + " has clicked me!";
  5757. ---------------------------------------
  5758. *errormes "<message>";
  5759. This command will send an error message to the server console (map-server window). It
  5760. will not be displayed anywhere else.
  5761. // Displays "NAME has clicked me!" in the map-server window.
  5762. errormes strcharinfo(0) + " has clicked me!";
  5763. ---------------------------------------
  5764. *logmes "<message>";
  5765. This command will write the message given to the map server NPC log file, as
  5766. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  5767. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  5768. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  5769. same log file.
  5770. If logs are not enabled, nothing will happen.
  5771. ---------------------------------------
  5772. *globalmes "<message>"{,"<NPC name>"};
  5773. This command will send a message to the chat window of all currently connected
  5774. characters.
  5775. If NPC name is specified, the message will be sent as if the sender would be
  5776. the NPC with the said name.
  5777. The display name of the NPC won't get appended in front of the message.
  5778. ---------------------------------------
  5779. *rand(<number>{,<number>});
  5780. This function returns a number ...
  5781. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  5782. (if you specify two) ... randomly positioned between the two numbers you specify.
  5783. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  5784. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  5785. rand(2,5) would result in 2,3,4 or 5
  5786. ---------------------------------------
  5787. *viewpoint <action>,<x>,<y>,<point number>,<color>{,<Char ID>};
  5788. This command will mark places on the mini map in the client connected to the
  5789. invoking character. It uses the normal X and Y coordinates from the main map.
  5790. The colors of the marks are defined using a hexadecimal number, same as the ones
  5791. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  5792. (They look like 0x<six numbers>.)
  5793. Action is what you want to do with a point, 1 will set it, while 2 will clear
  5794. it. 0 will also set it, but automatically removes the point after 15 seconds.
  5795. Point number is the number of the point - you can have several. If more than
  5796. one point is drawn at the same coordinates, they will cycle, which can be used
  5797. to create flashing marks.
  5798. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  5799. // and will be red.
  5800. viewpoint 1,30,40,1,0xFF0000;
  5801. This will create three points:
  5802. viewpoint 1,30,40,1,0xFF0000;
  5803. viewpoint 1,35,45,2,0xFF0000;
  5804. viewpoint 1,40,50,3,0xFF0000;
  5805. And this is how you remove them:
  5806. viewpoint 2,30,40,1,0xFF0000;
  5807. viewpoint 2,35,45,2,0xFF0000;
  5808. viewpoint 2,40,50,3,0xFF0000;
  5809. The client determines what it does with the points entirely, the server keeps no
  5810. memory of where the points are set whatsoever.
  5811. ---------------------------------------
  5812. *viewpointmap "<map name>",<action>,<x>,<y>,<point number>,<color>;
  5813. This command will mark places on the mini map in the client for all players currently
  5814. on the defined map. It uses the normal X and Y coordinates from the main map.
  5815. The colors of the marks are defined using a hexadecimal number, same as the ones
  5816. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  5817. (They look like 0x<six numbers>.)
  5818. Action is what you want to do with a point, 1 will set it, while 2 will clear
  5819. it. 0 will also set it, but automatically removes the point after 15 seconds.
  5820. Point number is the number of the point - you can have several. If more than
  5821. one point is drawn at the same coordinates, they will cycle, which can be used
  5822. to create flashing marks.
  5823. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  5824. // and will be red for all players currently on the map Prontera.
  5825. viewpointmap "prontera",1,30,40,1,0xFF0000;
  5826. This will create three points:
  5827. .@map$ = "prontera";
  5828. viewpointmap .@map$,1,30,40,1,0xFF0000;
  5829. viewpointmap .@map$,1,35,45,2,0xFF0000;
  5830. viewpointmap .@map$,1,40,50,3,0xFF0000;
  5831. And this is how you remove them:
  5832. .@map$ = "prontera";
  5833. viewpointmap .@map$,2,30,40,1,0xFF0000;
  5834. viewpointmap .@map$,2,35,45,2,0xFF0000;
  5835. viewpointmap .@map$,2,40,50,3,0xFF0000;
  5836. The client determines what it does with the points entirely, the server keeps no
  5837. memory of where the points are set whatsoever.
  5838. ---------------------------------------
  5839. *cutin "<filename>",<position>;
  5840. This command will display a picture, usually an NPC illustration, also called
  5841. cutin, for the currently attached client. The position parameter determines the
  5842. placement of the illustration and takes following values:
  5843. 0 bottom left corner
  5844. 1 bottom middle
  5845. 2 bottom right corner
  5846. 3 middle of screen in a movable window with an empty title bar
  5847. 4 middle of screen without the window header, but still movable
  5848. 255 clear all displayed cutins
  5849. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  5850. and data folder, and is required to be a bitmap. The file extension .bmp can be
  5851. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  5852. placed on the size of the illustrations by the client, although loading of large
  5853. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  5854. Typically the size is about 320x480. New illustrations can be added by just
  5855. putting the new file into the location above.
  5856. The client is able to display only one cutin at the same time and each new one
  5857. will cause the old one to disappear. To delete the currently displayed
  5858. illustration without displaying a new one, an empty file name and position 255
  5859. must be used.
  5860. // Displays the Comodo Kafra illustration in lower right corner.
  5861. cutin "kafra_07",2;
  5862. // Typical way to end a script, which displayed an illustration during a
  5863. // dialog with a player.
  5864. mes "See you.";
  5865. close2;
  5866. cutin "",255;
  5867. end;
  5868. ---------------------------------------
  5869. *emotion <emotion number>{,<target>};
  5870. This command makes an object display an emotion sprite above their own as
  5871. if they were doing that emotion. For a full list of emotion numbers,
  5872. see 'src/map/script_constants.hpp' under 'ET_'. The not so obvious ones are 'ET_QUESTION'
  5873. (a question mark) and 'ET_SURPRISE' (the exclamation mark).
  5874. The optional target parameter specifies who will get the emotion on top of
  5875. their head. Use the target Game ID (GID).
  5876. ---------------------------------------
  5877. *misceffect <effect number>;
  5878. This command, if run from an NPC object that has a sprite, will call up a
  5879. specified effect number, centered on the NPC sprite. If the running code does
  5880. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  5881. all (an item script) the effect will be centered on the character who's RID got
  5882. attached to the script, if any. For usable item scripts, this command will
  5883. create an effect centered on the player using the item.
  5884. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  5885. those that actually work may differ greatly between client versions.
  5886. ---------------------------------------
  5887. *soundeffect "<effect filename>",<type>;
  5888. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  5889. These two commands will play a sound effect to either the invoking character
  5890. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  5891. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  5892. object at all (an item script) the sound will be centered on the character who's
  5893. RID got attached to the script, if any. If it does, it will be centered on that
  5894. object. (an NPC sprite)
  5895. Effect filename is the filename in a GRF. It must have the .wav extension.
  5896. It's not quite certain what the 'type' actually does, it is sent to the client
  5897. directly. It probably determines which directory to play the effect from.
  5898. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  5899. but where the other numbers will read from is unclear.
  5900. The sound files themselves must be in the PCM format, and file names should also
  5901. have a maximum length of 23 characters including the .wav extension:
  5902. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  5903. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  5904. You can add your own effects this way, naturally.
  5905. ---------------------------------------
  5906. *playBGM "<BGM filename>";
  5907. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  5908. These two commands will play a Background Music to either the invoking character
  5909. only ('playBGM') or multiple characters ('playBGMall').
  5910. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  5911. It's not required to specify the extension inside the script.
  5912. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  5913. is omitted as well the BGM will be played for the entire server.
  5914. You can add your own BGMs this way, naturally.
  5915. ---------------------------------------
  5916. *pvpon "<map name>";
  5917. *pvpoff "<map name>";
  5918. These commands will turn PVP mode for the specified maps on and off. Beside
  5919. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5920. timer and ranking as will @pvpon GM command do.
  5921. ---------------------------------------
  5922. *atcommand "<command>";
  5923. This command will run the given command line exactly as if it was typed in from
  5924. the keyboard by the player connected to the invoking character, and that
  5925. character belonged to an account which had GM level 99.
  5926. // This will ask the invoker for a character name and then use the '@nuke'
  5927. // GM command on them, killing them mercilessly.
  5928. input .@player$;
  5929. atcommand "@nuke " + .@player$;
  5930. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5931. original atcommand, not the script-bound atcommand.
  5932. ---------------------------------------
  5933. *charcommand "<command>";
  5934. This command will run the given command line exactly as if it was typed in from
  5935. the keyboard from a character that belonged to an account which had GM level 99.
  5936. The commands can also run without an attached rid.
  5937. // This would do the same as above, but now
  5938. // it doesn't need a player attached by default.
  5939. charcommand "#option 0 0 0 Roy";
  5940. ---------------------------------------
  5941. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5942. This command will bind a NPC event label to an atcommand. Upon execution of the
  5943. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5944. one binding. If you rebind, it will override the original binding.
  5945. Note: The default level for atcommand is 0 while the default level for charcommand is 100.
  5946. The following variables are set upon execution:
  5947. .@atcmd_command$ = The name of the @command used.
  5948. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5949. .@atcmd_numparameters = The number of parameters defined.
  5950. Example:
  5951. When a user types the command "@test", an angel effect will be shown.
  5952. - script atcmd_example -1,{
  5953. OnInit:
  5954. bindatcmd "test",strnpcinfo(3) + "::OnAtcommand";
  5955. end;
  5956. OnAtcommand:
  5957. specialeffect2 EF_ANGEL2;
  5958. end;
  5959. }
  5960. ---------------------------------------
  5961. *unbindatcmd "<command>";
  5962. This command will unbind a NPC event label from an atcommand.
  5963. ---------------------------------------
  5964. *useatcmd "<command>";
  5965. This command will execute a script-bound atcommand for the attached RID. If the
  5966. supplied command is not bound to any script, this command will act like 'atcommand'
  5967. and attempt to execute a source-defined command.
  5968. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  5969. in this way.
  5970. ---------------------------------------
  5971. *camerainfo <range>,<rotation>,<latitude>{,<char id>};
  5972. This command will update the client's camera information with the given values where
  5973. the client can be the attached character or the player given by the char id parameter.
  5974. Note: This requires 2016-05-25aRagexeRE or newer.
  5975. The values given will be divided by 100 and transmitted as floating-point number.
  5976. range The zoomfactor of the camera.
  5977. Default: 230000 (230.0) when fully zoomed in
  5978. Maximum: 400000 (400.0) when fully zoomed out
  5979. rotation The rotation of the camera.
  5980. Default: 0 (0.0) when no rotation is applied
  5981. Maximum: 360000 (360.0°) when fully rotated
  5982. latitude The angle of the camera.
  5983. Default: -50000 (-50.0)
  5984. Maximum: -75000 (-75.0)
  5985. ---------------------------------------
  5986. *refineui({<char id>})
  5987. Opens the refine UI for the attached player or the given character id.
  5988. This feature requires 2016-10-12aRagexeRE or newer.
  5989. ---------------------------------------
  5990. *openstylist({<char id>})
  5991. Opens the stylist UI for the attached player or the given character id.
  5992. This feature requires packet version 2015-11-04 or newer.
  5993. ---------------------------------------
  5994. *laphine_synthesis()
  5995. Opens the laphine synthesis UI for the attached player.
  5996. This feature requires packet version 2016-06-01 or newer.
  5997. This function is intended for use in item scripts.
  5998. ---------------------------------------
  5999. *laphine_upgrade()
  6000. Opens the laphine upgrade UI for the attached player.
  6001. This feature requires packet version 2017-07-26 or newer.
  6002. This function is intended for use in item scripts.
  6003. ---------------------------------------
  6004. *openbank({<char id>})
  6005. Opens the Bank UI for the attached player or the given character ID.
  6006. This command requires packet version 2015-12-02 or newer.
  6007. ---------------------------------------
  6008. *enchantgradeui {<char id>};
  6009. Opens the enchantgrade UI for the attached character or the player given by the char ID parameter.
  6010. This command requires packet version 2020-07-24 or newer.
  6011. ---------------------------------------
  6012. *set_reputation_points(<type>,<points>{,<char id>})
  6013. Sets the reputation points via <points> for reputation group <type> for the attached player or the given character ID.
  6014. <type> is the client side index as stored in the Id field of the reputation.yml database files.
  6015. ---------------------------------------
  6016. *get_reputation_points(<type>{,<char id>})
  6017. Gets the reputation points for reputation group <type> for the attached player or the given character ID.
  6018. <type> is the client side index as stored in the Id field of the reputation.yml database files.
  6019. ---------------------------------------
  6020. *item_reform({<item id>{,<char id>}})
  6021. *item_reform({<"item name">{,<char id>}})
  6022. Opens the item reform UI for <item ID> or <item name> for the attached player or the given character ID.
  6023. If run from within an item script <item ID> or <item name> is optional.
  6024. This feature requires packet version 2021-11-03 or newer.
  6025. ---------------------------------------
  6026. \\
  6027. 6,1.- Unit-related commands
  6028. \\
  6029. ---------------------------------------
  6030. *unitwalk <GID>,<x>,<y>{,"<event label>"};
  6031. *unitwalkto <GID>,<Target GID>{,"<event label>"};
  6032. This command will tell a <GID> to walk to a position, defined either as a set of
  6033. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  6034. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  6035. unit's current map. While there is no way to move across an entire map with 1 command
  6036. use, this could be used in a loop to move long distances.
  6037. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
  6038. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  6039. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  6040. target ID will result in an error.
  6041. An optional Event Label can be passed as well which will execute when the <GID> has reached
  6042. the given coordinates or <Target GID>.
  6043. Examples:
  6044. // Makes player walk to the coordinates (150,150).
  6045. unitwalk getcharid(3),150,150;
  6046. // Performs a conditional check with the command and reports success or failure to the player.
  6047. if (unitwalk(getcharid(3),150,150))
  6048. dispbottom "Walking you there...";
  6049. else
  6050. dispbottom "That's too far away, man.";
  6051. // Makes player walk to another character named "WalkToMe".
  6052. unitwalkto getcharid(3),getcharid(3,"WalkToMe");
  6053. ---------------------------------------
  6054. *unitattack <GID>,<Target ID>{,<action type>};
  6055. *unitattack <GID>,"<Target Name>"{,<action type>};
  6056. This command will make a <GID> attack the specified target. It returns true upon
  6057. success and false for all failures.
  6058. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  6059. continuous attack instead of a single attack.
  6060. Note:
  6061. Using unitattack with <GID> 0 means that it will use the currently attached unit.
  6062. For players any attack requests will fail, because talking to an NPC prevents attacking a monster.
  6063. Therefore you need to detach the player from the NPC before using this command.
  6064. ---------------------------------------
  6065. *unitkill <GID>;
  6066. This command will kill a <GID>.
  6067. ---------------------------------------
  6068. *unitwarp <GID>,"<map name>",<x>,<y>;
  6069. This command will warp a <GID> to the specified map and coordinates.
  6070. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  6071. used with "OnTouch" to warp monsters:
  6072. OnTouch:
  6073. unitwarp 0,"this",-1,-1;
  6074. ---------------------------------------
  6075. *unitstopattack <GID>;
  6076. This command will make a <GID> stop attacking.
  6077. ---------------------------------------
  6078. *unitstopwalk <GID>{,<flag>};
  6079. This command will make a <GID> stop moving.
  6080. Note: If this is called from OnTouch, then the walktimer attached to the unit is
  6081. removed from OnTouch which causes this command to not stop the unit from walking.
  6082. Suggest to use 'unitblockmove' to forcefully stop the unit with OnTouch.
  6083. The <flag> value affects how the unit is stopped. The following flags are bitwise
  6084. values (can be combined using the pipe operator):
  6085. USW_NONE = Unit will keep walking to their original destination.
  6086. USW_FIXPOS = Issue a fixpos packet afterwards.
  6087. USW_MOVE_ONCE = Force the unit to move one cell if it hasn't yet.
  6088. 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).
  6089. USW_FORCE_STOP = Force stop moving.
  6090. This command will also remove the state tracking used for 'unitwalk' and 'unitwalkto'.
  6091. ---------------------------------------
  6092. *unittalk <GID>,"<text>"{,flag};
  6093. This command will make a <GID> say a message. The display name of the <GID> won't get appended in front of the message.
  6094. flag: Specify target
  6095. bc_area - Message is sent to players in the vicinity of the source (default).
  6096. bc_self - Message is sent only to player attached.
  6097. ---------------------------------------
  6098. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>,<casttime>,<cancel>,<Line_ID>};
  6099. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>,<casttime>,<cancel>,<Line_ID>};
  6100. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>{,<casttime>,<cancel>,<Line_ID>};
  6101. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>{,<casttime>,<cancel>,<Line_ID>};
  6102. This is the replacement of the older commands, these use the same values for
  6103. GID as the other unit* commands (See 'GID').
  6104. Skill ID is the ID of the skill, skill level is the level of the skill.
  6105. Cast time is the amount of seconds to add or remove from the skill. Use a positive value to
  6106. add and negative value to subtract. Using 0 or no value will use the default skill cast time.
  6107. For the position, the x and y are given in the UnitSkillUsePos.
  6108. <cancel> defines if the cast can be interrupted when hit (true/false).
  6109. CastCancel from skill_db.yml is the default value of <cancel>.
  6110. If <Line_ID> is defined (positive number, default 0) the monster will say the message from 'Line_ID'
  6111. in mob_chat_db.yml when casting the skill.
  6112. ---------------------------------------
  6113. *unitexists <GID>;
  6114. Checks if the given Game ID exists. Returns false if the object doesn't exist, or true if
  6115. it does.
  6116. ---------------------------------------
  6117. *getunittype <GID>;
  6118. Returns the type of object from the given Game ID. Returns -1 if the given GID does not
  6119. exist.
  6120. Return values:
  6121. BL_PC - Character object
  6122. BL_MOB - Monster object
  6123. BL_PET - Pet object
  6124. BL_HOM - Homunculus object
  6125. BL_MER - Mercenary object
  6126. BL_NPC - NPC object
  6127. BL_ELEM - Elemental object
  6128. ---------------------------------------
  6129. *getunitname <GID>;
  6130. Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
  6131. Mercenary and Elemental don't support custom names.
  6132. Returns "Unknown" if unit is not found.
  6133. ---------------------------------------
  6134. *setunitname <GID>,"<new name>";
  6135. Changes the name of the given unit to the new name given. Supported types are monster,
  6136. homunculus, and pet. To change an NPC's name, see 'setnpcdisplay'. Mercenary and
  6137. Elemental don't support custom names.
  6138. Changing a homunculus or pet name will be permanent.
  6139. Returns "Unknown" if unit is not found.
  6140. ---------------------------------------
  6141. *setunittitle <GID>,<title>;
  6142. Apply a <title> to the given <GID>.
  6143. Note: This only works on non-player types. It also will only work on mobs if battle_config.show_mob_info is not enabled.
  6144. ---------------------------------------
  6145. *getunittitle <GID>;
  6146. Returns the title of the given <GID>.
  6147. ---------------------------------------
  6148. *getunitdata <GID>,<arrayname>;
  6149. *setunitdata <GID>,<parameter>,<new value>;
  6150. This is used to get and set special data related to the unit.
  6151. With getunitdata, the array given will be filled with the current data. In setunitdata
  6152. the indexes in the array would be used to set that data on the unit.
  6153. Both getunitdata and setunitdata will return -1 if the given GID does not exist.
  6154. Note: When adjusting a unit's stat (STR, AGI, etc) the unit's respective statuses are
  6155. recalculated (HIT, FLEE, etc) automatically. Keep in mind that some stats don't
  6156. affect a unit's status and will have to directly be modified.
  6157. Parameters (indexes) for monsters are:
  6158. UMOB_SIZE
  6159. UMOB_LEVEL
  6160. UMOB_HP
  6161. UMOB_MAXHP
  6162. UMOB_MASTERAID
  6163. UMOB_MAPID
  6164. UMOB_X
  6165. UMOB_Y
  6166. UMOB_SPEED
  6167. UMOB_MODE
  6168. UMOB_AI
  6169. UMOB_SCOPTION
  6170. UMOB_SEX
  6171. UMOB_CLASS
  6172. UMOB_HAIRSTYLE
  6173. UMOB_HAIRCOLOR
  6174. UMOB_HEADBOTTOM
  6175. UMOB_HEADMIDDLE
  6176. UMOB_HEADTOP
  6177. UMOB_CLOTHCOLOR
  6178. UMOB_SHIELD
  6179. UMOB_WEAPON
  6180. UMOB_LOOKDIR
  6181. UMOB_CANMOVETICK
  6182. UMOB_STR
  6183. UMOB_AGI
  6184. UMOB_VIT
  6185. UMOB_INT
  6186. UMOB_DEX
  6187. UMOB_LUK
  6188. UMOB_SLAVECPYMSTRMD
  6189. UMOB_DMGIMMUNE
  6190. UMOB_ATKRANGE
  6191. UMOB_ATKMIN
  6192. UMOB_ATKMAX
  6193. UMOB_MATKMIN
  6194. UMOB_MATKMAX
  6195. UMOB_DEF
  6196. UMOB_MDEF
  6197. UMOB_HIT
  6198. UMOB_FLEE
  6199. UMOB_PDODGE
  6200. UMOB_CRIT
  6201. UMOB_RACE
  6202. UMOB_ELETYPE
  6203. UMOB_ELELEVEL
  6204. UMOB_AMOTION
  6205. UMOB_ADELAY
  6206. UMOB_DMOTION
  6207. UMOB_TARGETID
  6208. UMOB_ROBE
  6209. UMOB_BODY2
  6210. UMOB_GROUP_ID
  6211. UMOB_IGNORE_CELL_STACK_LIMIT
  6212. UMOB_RES
  6213. UMOB_MRES
  6214. -----
  6215. Parameter (indexes) for homunculi are:
  6216. UHOM_SIZE
  6217. UHOM_LEVEL
  6218. UHOM_HP
  6219. UHOM_MAXHP
  6220. UHOM_SP
  6221. UHOM_MAXSP
  6222. UHOM_MASTERCID
  6223. UHOM_MAPID
  6224. UHOM_X
  6225. UHOM_Y
  6226. UHOM_HUNGER
  6227. UHOM_INTIMACY
  6228. UHOM_SPEED
  6229. UHOM_LOOKDIR
  6230. UHOM_CANMOVETICK
  6231. UHOM_STR
  6232. UHOM_AGI
  6233. UHOM_VIT
  6234. UHOM_INT
  6235. UHOM_DEX
  6236. UHOM_LUK
  6237. UHOM_DMGIMMUNE
  6238. UHOM_ATKRANGE
  6239. UHOM_ATKMIN
  6240. UHOM_ATKMAX
  6241. UHOM_MATKMIN
  6242. UHOM_MATKMAX
  6243. UHOM_DEF
  6244. UHOM_MDEF
  6245. UHOM_HIT
  6246. UHOM_FLEE
  6247. UHOM_PDODGE
  6248. UHOM_CRIT
  6249. UHOM_RACE
  6250. UHOM_ELETYPE
  6251. UHOM_ELELEVEL
  6252. UHOM_AMOTION
  6253. UHOM_ADELAY
  6254. UHOM_DMOTION
  6255. UHOM_TARGETID
  6256. UHOM_GROUP_ID
  6257. -----
  6258. Parameter (indexes) for pets are:
  6259. UPET_SIZE
  6260. UPET_LEVEL
  6261. UPET_HP
  6262. UPET_MAXHP
  6263. UPET_MASTERAID
  6264. UPET_MAPID
  6265. UPET_X
  6266. UPET_Y
  6267. UPET_HUNGER
  6268. UPET_INTIMACY
  6269. UPET_SPEED
  6270. UPET_LOOKDIR
  6271. UPET_CANMOVETICK
  6272. UPET_STR
  6273. UPET_AGI
  6274. UPET_VIT
  6275. UPET_INT
  6276. UPET_DEX
  6277. UPET_LUK
  6278. UPET_DMGIMMUNE
  6279. UPET_ATKRANGE
  6280. UPET_ATKMIN
  6281. UPET_ATKMAX
  6282. UPET_MATKMIN
  6283. UPET_MATKMAX
  6284. UPET_DEF
  6285. UPET_MDEF
  6286. UPET_HIT
  6287. UPET_FLEE
  6288. UPET_PDODGE
  6289. UPET_CRIT
  6290. UPET_RACE
  6291. UPET_ELETYPE
  6292. UPET_ELELEVEL
  6293. UPET_AMOTION
  6294. UPET_ADELAY
  6295. UPET_DMOTION
  6296. UPET_GROUP_ID
  6297. -----
  6298. Parameter (indexes) for mercenaries are:
  6299. UMER_SIZE
  6300. UMER_HP
  6301. UMER_MAXHP
  6302. UMER_MASTERCID
  6303. UMER_MAPID
  6304. UMER_X
  6305. UMER_Y
  6306. UMER_KILLCOUNT
  6307. UMER_LIFETIME
  6308. UMER_SPEED
  6309. UMER_LOOKDIR
  6310. UMER_CANMOVETICK
  6311. UMER_STR
  6312. UMER_AGI
  6313. UMER_VIT
  6314. UMER_INT
  6315. UMER_DEX
  6316. UMER_LUK
  6317. UMER_DMGIMMUNE
  6318. UMER_ATKRANGE
  6319. UMER_ATKMIN
  6320. UMER_ATKMAX
  6321. UMER_MATKMIN
  6322. UMER_MATKMAX
  6323. UMER_DEF
  6324. UMER_MDEF
  6325. UMER_HIT
  6326. UMER_FLEE
  6327. UMER_PDODGE
  6328. UMER_CRIT
  6329. UMER_RACE
  6330. UMER_ELETYPE
  6331. UMER_ELELEVEL
  6332. UMER_AMOTION
  6333. UMER_ADELAY
  6334. UMER_DMOTION
  6335. UMER_TARGETID
  6336. UMER_GROUP_ID
  6337. -----
  6338. Parameter (indexes) for elementals are:
  6339. UELE_SIZE
  6340. UELE_HP
  6341. UELE_MAXHP
  6342. UELE_SP
  6343. UELE_MAXSP
  6344. UELE_MASTERCID
  6345. UELE_MAPID
  6346. UELE_X
  6347. UELE_Y
  6348. UELE_LIFETIME
  6349. UELE_MODE
  6350. UELE_SPEED
  6351. UELE_LOOKDIR
  6352. UELE_CANMOVETICK
  6353. UELE_STR
  6354. UELE_AGI
  6355. UELE_VIT
  6356. UELE_INT
  6357. UELE_DEX
  6358. UELE_LUK
  6359. UELE_DMGIMMUNE
  6360. UELE_ATKRANGE
  6361. UELE_ATKMIN
  6362. UELE_ATKMAX
  6363. UELE_MATKMIN
  6364. UELE_MATKMAX
  6365. UELE_DEF
  6366. UELE_MDEF
  6367. UELE_HIT
  6368. UELE_FLEE
  6369. UELE_PDODGE
  6370. UELE_CRIT
  6371. UELE_RACE
  6372. UELE_ELETYPE
  6373. UELE_ELELEVEL
  6374. UELE_AMOTION
  6375. UELE_ADELAY
  6376. UELE_DMOTION
  6377. UELE_TARGETID
  6378. UELE_GROUP_ID
  6379. -----
  6380. Parameter (indexes) for NPCs are:
  6381. UNPC_LEVEL
  6382. UNPC_HP
  6383. UNPC_MAXHP
  6384. UNPC_MAPID
  6385. UNPC_X
  6386. UNPC_Y
  6387. UNPC_LOOKDIR
  6388. UNPC_STR
  6389. UNPC_AGI
  6390. UNPC_VIT
  6391. UNPC_INT
  6392. UNPC_DEX
  6393. UNPC_LUK
  6394. UNPC_PLUSALLSTAT
  6395. UNPC_DMGIMMUNE
  6396. UNPC_ATKRANGE
  6397. UNPC_ATKMIN
  6398. UNPC_ATKMAX
  6399. UNPC_MATKMIN
  6400. UNPC_MATKMAX
  6401. UNPC_DEF
  6402. UNPC_MDEF
  6403. UNPC_HIT
  6404. UNPC_FLEE
  6405. UNPC_PDODGE
  6406. UNPC_CRIT
  6407. UNPC_RACE
  6408. UNPC_ELETYPE
  6409. UNPC_ELELEVEL
  6410. UNPC_AMOTION
  6411. UNPC_ADELAY
  6412. UNPC_DMOTION
  6413. UNPC_SEX
  6414. UNPC_CLASS
  6415. UNPC_HAIRSTYLE
  6416. UNPC_HAIRCOLOR
  6417. UNPC_HEADBOTTOM
  6418. UNPC_HEADMIDDLE
  6419. UNPC_HEADTOP
  6420. UNPC_CLOTHCOLOR
  6421. UNPC_SHIELD
  6422. UNPC_WEAPON
  6423. UNPC_ROBE
  6424. UNPC_BODY2
  6425. UNPC_DEADSIT
  6426. UNPC_GROUP_ID
  6427. *Notes:
  6428. - *_SIZE: small (0); medium (1); large (2)
  6429. - *_MAPID: this refers to the map_data index (from src/map/map.cpp), not the mapindex_db index (from src/common/mapindex.cpp)
  6430. -- For 'setunitdata', map name can also be passed in as a valid value instead of map ID
  6431. - *_SPEED: 20 - 1000
  6432. - *_MODE: see doc/mob_db_mode_list.txt
  6433. - *_LOOKDIR: north (0), northwest (1), west (2), etc
  6434. - *_CANMOVETICK: seconds * 1000 the unit will be unable to move
  6435. - *_DMGIMMUNE: unit will be immune to damage (1), or will receive damage (0)
  6436. - *_HUNGER: 0 - 100
  6437. - *_INTIMACY: 0 - 1000
  6438. - *_LIFETIME: seconds * 1000 the unit will be 'alive' for
  6439. - *_AMOTION: see doc/mob_db.txt
  6440. - *_ADELAY: see doc/mob_db.txt
  6441. - *_DMOTION: see doc/mob_db.txt
  6442. - *_BODY2: enable (1) the alternate display, or disable (0)
  6443. - *_TARGETID: when set to 0 the unit will release the target and stop attacking
  6444. - UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
  6445. - UMOB_SCOPTION: see the 'Variables' section at the top of this document
  6446. - UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0)
  6447. - UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreases all stats by given amount
  6448. - UNPC_DEADSIT: stand (0), dead (1), sit (2)
  6449. Example:
  6450. // Spawn some Porings and save the Game ID.
  6451. // - Keep in mind, when the 'monster' script command is used,
  6452. // - all the spawned monster GID's are stored in an array
  6453. // - called $@mobid[].
  6454. monster "prontera",149,190,"Poring",1002,10;
  6455. .GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!
  6456. // Save the strong Poring's mob data in the .@por_arr[] variable. (.@por_arr[1] being level, .@por_arr[13] being class, etc.)
  6457. // With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
  6458. getunitdata .GID,.@por_arr;
  6459. // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
  6460. setunitdata .GID,UMOB_MAXHP,1000;
  6461. ---------------------------------------
  6462. *geteleminfo <type>{,<char_id>};
  6463. Get info of elemental of attached player or player by char_id.
  6464. Other info can be obtained by 'getunitdata' command.
  6465. Valid types are:
  6466. 0: Elemental ID
  6467. 1: Elemental Game ID
  6468. ---------------------------------------
  6469. \\
  6470. 6,1.- End of unit-related commands
  6471. \\
  6472. ---------------------------------------
  6473. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  6474. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  6475. This command causes the attached NPC object to cast a skill on the attached
  6476. player. The skill will have no cast time or cooldown. The player must be
  6477. within the default skill range or the command will fail silently.
  6478. The "stat point" parameter temporarily sets all NPC stats to the given value,
  6479. and "NPC level" is the temporary level of the NPC (used in some skills).
  6480. Neither value can be greater than the max level defined in config, and will
  6481. not work properly if the NPC has a mob sprite.
  6482. Before using skills, NPCs must have basic stats applied to them depending on the
  6483. skill being used: UNPC_ATKMIN, UNPC_ATKMAX, UNPC_MATKMIN, UNPC_MATKMAX, UNPC_STR,
  6484. UNPC_AGI, UNPC_VIT, UNPC_INT, UNPC_DEX, UNPC_LUK.
  6485. See 'setunitdata' for more information on usage.
  6486. // Casts Level 10 Heal on the attached player, calculated with
  6487. // all stats 99 and base level 60.
  6488. npcskill "AL_HEAL",10,99,60;
  6489. ---------------------------------------
  6490. *day;
  6491. *night;
  6492. These two commands will switch the entire server between day and night mode
  6493. respectively. If your server is set to cycle between day and night by
  6494. configuration, it will eventually return to that cycle.
  6495. Example:
  6496. - script DayNight -1,{
  6497. OnClock0600:
  6498. day;
  6499. end;
  6500. OnInit:
  6501. // setting correct mode upon server start-up
  6502. if (gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
  6503. OnClock1800:
  6504. night;
  6505. end;
  6506. }
  6507. This script allows to emulate the day/night cycle as the server does, but also
  6508. allows triggering additional effects upon change, like announces, gifts, etc.
  6509. The day/night cycle set by configuration should be disabled when this script is used.
  6510. ---------------------------------------
  6511. *defpattern <set number>,"<regular expression pattern>","<event label>";
  6512. *activatepset <set number>;
  6513. *deactivatepset <set number>;
  6514. *deletepset <set number>;
  6515. This set of commands is only available if the server is compiled with regular
  6516. expressions library enabled. Default compilation and most binary distributions
  6517. aren't, which is probably bad, since these, while complex to use, are quite
  6518. fascinating.
  6519. They will make the NPC object listen for text spoken publicly by players and
  6520. match it against regular expression patterns, then trigger labels associated
  6521. with these regular expression patterns.
  6522. Patterns are organized into sets, which are referred to by a set number. You can
  6523. have multiple sets patterns, and multiple patterns may be active at once.
  6524. Numbers for pattern sets start at 1.
  6525. 'defpattern' will associate a given regular expression pattern with an event
  6526. label. This event will be triggered whenever something a player says is matched
  6527. by this regular expression pattern, if the pattern is currently active.
  6528. 'activatepset' will make the pattern set specified active. An active pattern
  6529. will enable triggering labels defined with 'defpattern', which will not happen
  6530. by default.
  6531. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  6532. set number in this case will deactivate all pattern sets defined.
  6533. 'deletepset' will delete a pattern set from memory, so you can create a new
  6534. pattern set in its place.
  6535. Using regular expressions is high wizardry. But with this high wizardry comes
  6536. unparalleled power of text manipulation. For an explanation of what a regular
  6537. expression pattern is, see a few web pages:
  6538. http://www.regular-expressions.info/
  6539. http://www.weitz.de/regex-coach/
  6540. For an example of this in use, see doc/sample/npc_test_pcre.txt
  6541. With this you could, for example, automatically punish players for asking for
  6542. Zeny in public places, or alternatively, automatically give them Zeny instead if
  6543. they want it so much.
  6544. ---------------------------------------
  6545. *pow(<number>,<power>)
  6546. Returns the result of the calculation.
  6547. Example:
  6548. .@i = pow(2,3); // .@i will be 8
  6549. ---------------------------------------
  6550. *sqrt(<number>)
  6551. Returns the square-root of a number.
  6552. Example:
  6553. .@i = sqrt(25); // .@i will be 5
  6554. ---------------------------------------
  6555. *distance(<x0>,<y0>,<x1>,<y1>)
  6556. Returns distance between 2 points.
  6557. Example:
  6558. .@i = distance(100,200,101,202);
  6559. ---------------------------------------
  6560. *min(<number or array>{,<number or array>,...})
  6561. *minimum(<number or array>{,<number or array>,...})
  6562. *max(<number or array>{,<number or array>,...})
  6563. *maximum(<number or array>{,<number or array>,...})
  6564. Returns the smallest (or biggest) from the set of given parameters.
  6565. These parameters have to be either numbers or number arrays.
  6566. Example:
  6567. .@minimum = min( 1, -6, -2, 8, 2 ); // .@minimum will be equal to -6
  6568. .@maximum = max( 0, 5, 10, 4 ); // .@maximum will be equal to 10
  6569. .@level = min( BaseLevel, 70 ); // .@level will be the character's base level, capped to 70
  6570. setarray .@testarray, 4, 5, 12, 6, 7, 3, 8, 9, 10;
  6571. .@minimum = min( .@testarray ); // .@minimum will be equal to 3
  6572. .@maximum = max( .@testarray ); // .@maximum will be equal to 12
  6573. .@minimum = min( -6, 1, 2, 3, .@testarray ); // .@minimum will be equal to -6
  6574. .@maximum = max( -6, 1, 2, 3, .@testarray ); // .@maximum will be equal to 12
  6575. ---------------------------------------
  6576. *round(<number>,<precision>);
  6577. *ceil(<number>,<precision>);
  6578. *floor(<number>,<precision>);
  6579. Returns <number> rounded to multiple of <precision>.
  6580. `round` function will round the <number> up if its division with <precision> yield a remainder
  6581. with a value equals to or more than half of <precision>. Otherwise, it rounds the <number> down.
  6582. `ceil` always round the <number> up.
  6583. `floor` always round the <number> down.
  6584. ---------------------------------------
  6585. *md5("<string>")
  6586. Returns the md5 checksum of a number or string.
  6587. Example:
  6588. mes md5(12345);
  6589. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  6590. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  6591. ---------------------------------------
  6592. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  6593. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  6594. Executes an SQL query. A 'select' query can fill array variables with up to 2 billion rows of
  6595. values, and will return the number of rows (i.e. array size) or -1 on failure.
  6596. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  6597. Example:
  6598. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  6599. mes "Hall Of Fame: TOP5";
  6600. mes "1." + .@name$[0] + "(" + .@fame[0] + ")"; // largest fame value.
  6601. mes "2." + .@name$[1] + "(" + .@fame[1] + ")";
  6602. mes "3." + .@name$[2] + "(" + .@fame[2] + ")";
  6603. mes "4." + .@name$[3] + "(" + .@fame[3] + ")";
  6604. mes "5." + .@name$[4] + "(" + .@fame[4] + ")";
  6605. ---------------------------------------
  6606. *escape_sql(<value>)
  6607. Converts the value to a string and escapes special characters so that it is safe to
  6608. use in query_sql(). Returns the escaped form of the given value.
  6609. Example:
  6610. .@name$ = "John's Laptop";
  6611. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  6612. ---------------------------------------
  6613. *setiteminfo(<item id>,<type>,<value>)
  6614. *setiteminfo(<aegis item name>,<type>,<value>)
  6615. This function will set some value of an item.
  6616. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  6617. Valid types are:
  6618. ITEMINFO_BUY (0) - Buy Price
  6619. ITEMINFO_SELL (1) - Sell Price
  6620. ITEMINFO_TYPE (2) - Type
  6621. ITEMINFO_MAXCHANCE (3) - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  6622. if = 0, then monsters don't drop it at all (rare or a quest item)
  6623. if = 10000, then this item is sold in NPC shops only
  6624. ITEMINFO_GENDER (4) - Gender
  6625. ITEMINFO_LOCATIONS (5) - Location(s)
  6626. ITEMINFO_WEIGHT (6) - Weight
  6627. ITEMINFO_ATTACK (7) - ATK
  6628. ITEMINFO_DEFENSE (8) - DEF
  6629. ITEMINFO_RANGE (9) - Range
  6630. ITEMINFO_SLOT (10) - Slot
  6631. ITEMINFO_VIEW (11) - View
  6632. ITEMINFO_EQUIPLEVELMIN (12) - equipment LV
  6633. ITEMINFO_WEAPONLEVEL (13) - weapon LV
  6634. ITEMINFO_ALIASNAME (14) - AliasName
  6635. ITEMINFO_EQUIPLEVELMAX (15) - equipment LV Max
  6636. ITEMINFO_MAGICATTACK (16) - matk if RENEWAL is defined
  6637. ITEMINFO_ARMORLEVEL (19) - armor LV
  6638. Example:
  6639. setiteminfo 7049,ITEMINFO_WEIGHT,9990; // Stone now weighs 999.0
  6640. ---------------------------------------
  6641. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  6642. Set a new script bonus to the Item. Very useful for game events.
  6643. You can remove an item's itemscript by leaving the itemscript argument empty.
  6644. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  6645. Type can optionally be used indicates which script to set (default is 0):
  6646. 0 - Script
  6647. 1 - EquipScript
  6648. 2 - UnEquipScript
  6649. Example:
  6650. setitemscript 2637,"{ if (isequipped(2236) == 0)end; if (getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  6651. setitemscript 2637,"";
  6652. ---------------------------------------
  6653. *atoi("<string>")
  6654. *axtoi("<string>")
  6655. *strtol("<string>", base)
  6656. These commands are used to convert strings to numbers. 'atoi' will interpret
  6657. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  6658. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  6659. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  6660. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  6661. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  6662. 32 bit int range (INT_MIN ~ INT_MAX).
  6663. Examples:
  6664. .@var = atoi("11"); // Sets .@var to 11
  6665. .@var = axtoi("FF"); // Sets .@var to 255
  6666. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  6667. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  6668. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  6669. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  6670. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  6671. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  6672. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  6673. ---------------------------------------
  6674. *compare("<string>","<substring>")
  6675. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  6676. This command is not case sensitive.
  6677. Examples:
  6678. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  6679. if (compare("Bloody Murderer","Blood"))
  6680. dothis;
  6681. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  6682. if (compare("Blood Butterfly","Bloody"))
  6683. dothat;
  6684. ---------------------------------------
  6685. *strcmp("<string>","<string>")
  6686. This command compares two strings are returns a value:
  6687. 1: string 1 > string 2
  6688. 0: strings are equal
  6689. -1: string 1 < string 2
  6690. ---------------------------------------
  6691. *getstrlen("<string>")
  6692. This function will return the length of the string given as an argument. It is
  6693. useful to check if anything input by the player exceeds name length limits and
  6694. other length limits and asking them to try to input something else.
  6695. ---------------------------------------
  6696. *charisalpha("<string>",<position>)
  6697. This function will return 1 if the character number Position in the given string
  6698. is a letter, 0 if it isn't a letter but a digit or a space.
  6699. The first letter is position 0.
  6700. ---------------------------------------
  6701. *charat(<string>,<index>)
  6702. Returns char at specified index. If index is out of range, returns empty string.
  6703. The first letter of a string is index 0.
  6704. Example:
  6705. charat("This is a string", 10); //returns "s"
  6706. ---------------------------------------
  6707. *setchar(<string>,<char>,<index>)
  6708. Returns the original string with the char at the specified index set to the
  6709. specified char. If index out of range, the original string will be returned.
  6710. Only the 1st char in the <char> parameter will be used.
  6711. Example:
  6712. setchar("Cat", "B", 0); //returns "Bat"
  6713. ---------------------------------------
  6714. *insertchar(<string>,<char>,<index>)
  6715. Returns the original string with the specified char inserted at the specified
  6716. index. If index is out of range, the char will be inserted on the end of the
  6717. string that it is closest. Only the 1st char in the <char> parameter will be used.
  6718. Example:
  6719. insertchar("laughter", "s", 0); //returns "slaughter"
  6720. ---------------------------------------
  6721. *delchar(<string>,<index>)
  6722. Returns the original string with the char at the specified index removed.
  6723. If index is out of range, original string will be returned.
  6724. Example:
  6725. delchar("Diet", 3); //returns "Die"
  6726. ---------------------------------------
  6727. *strtoupper(<string>)
  6728. *strtolower(<string>)
  6729. Returns the specified string in its uppercase/lowercase form.
  6730. All non-alpha characters will be preserved.
  6731. Example:
  6732. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  6733. ---------------------------------------
  6734. *charisupper(<string>,<index>)
  6735. *charislower(<string>,<index>)
  6736. Returns 1 if character at specified index of specified string is
  6737. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  6738. Example:
  6739. charisupper("rAthena", 1); //returns 1
  6740. ---------------------------------------
  6741. *substr(<string>,<start_index>,<end_index>)
  6742. Returns the sub-string of the specified string inclusively between the set
  6743. indexes. If indexes are out of range, or the start index is after the end
  6744. index, an empty string will be returned.
  6745. Example:
  6746. substr("foobar", 3, 5); //returns "bar"
  6747. ---------------------------------------
  6748. *explode(<dest_array>,<string>,<delimiter>)
  6749. Breaks a string up into substrings based on the specified delimiter. Substrings
  6750. will be stored within the specified string array. Only the 1st char of the
  6751. delimiter parameter will be used. If an empty string is passed as a delimiter,
  6752. the string will be placed in the array in its original form.
  6753. Example:
  6754. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  6755. //.@my_array$ contents will be...
  6756. //.@my_array$[0]: "Explode"
  6757. //.@my_array$[1]: "Test"
  6758. //.@my_array$[2]: "1965"
  6759. //.@my_array$[3]: "red"
  6760. //.@my_array$[4]: "PIE"
  6761. ---------------------------------------
  6762. *implode(<string_array>{,<glue>})
  6763. Combines all substrings within the specified string array into a single string.
  6764. If the glue parameter is specified, it will be inserted inbetween each substring.
  6765. Example:
  6766. setarray .@my_array$[0], "This", "is", "a", "test";
  6767. implode(.@my_array$, " "); //returns "This is a test"
  6768. ---------------------------------------
  6769. *sprintf(<format>[,param[,param[,...]]])
  6770. C style sprintf. The resulting string is returned same as in PHP. All C format
  6771. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  6772. The number of params is only limited by rA's script engine.
  6773. Example:
  6774. .@format$ = "The %s contains %d monkeys";
  6775. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  6776. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  6777. ---------------------------------------
  6778. *sscanf(<string>,<format>[,param[,param[,...]]])
  6779. C style sscanf. All C format specifiers are supported.
  6780. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  6781. by rA's script engine.
  6782. Example:
  6783. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  6784. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  6785. ---------------------------------------
  6786. *strpos(<haystack>,<needle>{,<offset>})
  6787. PHP style strpos. Finds a substring (needle) within a string (haystack).
  6788. The offset parameter indicates the index of the string to start searching.
  6789. Returns index of substring on successful search, else -1.
  6790. Comparison is case sensitive.
  6791. Example:
  6792. strpos("foobar", "bar", 0); //returns 3
  6793. strpos("foobarfoo", "foo", 0); //returns 0
  6794. strpos("foobarfoo", "foo", 1); //returns 6
  6795. ---------------------------------------
  6796. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  6797. Replaces all instances of a search string in the input with the specified
  6798. replacement string. By default is case sensitive unless <usecase> is set
  6799. to 0. If specified it will only replace as many instances as specified
  6800. in the count parameter.
  6801. Example:
  6802. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  6803. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  6804. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  6805. ---------------------------------------
  6806. *countstr(<input>, <search>{, <usecase>})
  6807. Counts all instances of a search string in the input. By default is case
  6808. sensitive unless <usecase> is set to 0.
  6809. Example:
  6810. countstr("test test test Test", "test"); //returns 3
  6811. countstr("cake Cake", "Cake", 0); //returns 2
  6812. ---------------------------------------
  6813. *preg_match(<regular expression pattern>,<string>{,<offset>})
  6814. Searches a string for a match to the regular expression provided. The
  6815. offset parameter indicates the index of the string to start searching.
  6816. Returns offsets to captured substrings, or 0 if no match is found.
  6817. This command is only available if the server is compiled with the regular
  6818. expressions library enabled.
  6819. ---------------------------------------
  6820. *setfont <font>;
  6821. This command sets the current RO client interface font to one of the
  6822. fonts stored in data\*.eot by using an ID of the font. When the ID
  6823. of the currently used font is used, default interface font is used
  6824. again.
  6825. 0 - Default
  6826. 1 - RixLoveangel
  6827. 2 - RixSquirrel
  6828. 3 - NHCgogo
  6829. 4 - RixDiary
  6830. 5 - RixMiniHeart
  6831. 6 - RixFreshman
  6832. 7 - RixKid
  6833. 8 - RixMagic
  6834. 9 - RixJJangu
  6835. ---------------------------------------
  6836. *showdigit <value>{,<type>};
  6837. Displays given numeric 'value' in large digital clock font on top of
  6838. the screen. The optional parameter 'type' specifies visual aspects
  6839. of the "clock" and can be one of the following values:
  6840. 0 - Displays the value for 5 seconds (default).
  6841. 1 - Incremental counter (1 tick/second).
  6842. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  6843. but overflows.
  6844. 3 - Decremental counter (2 ticks/second). Two digits only, stops
  6845. at zero.
  6846. Except for type 3 the value is interpreted as seconds and formatted
  6847. as time in days, hours, minutes and seconds. Note, that the official
  6848. script command does not have the optional parameter.
  6849. // displays 23:59:59 for 5 seconds
  6850. showdigit 86399;
  6851. // counter that starts at 60 and runs for 30 seconds
  6852. showdigit 60,3;
  6853. ---------------------------------------
  6854. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  6855. Each map cell has several 'flags' that specify the properties of that cell.
  6856. These include terrain properties (walkability, shootability, presence of water),
  6857. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  6858. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  6859. This command lets you alter these flags for all map cells in the specified
  6860. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  6861. The 'type' defines which flag to modify. Possible options see 'src/map/script_constants.hpp'.
  6862. Example:
  6863. setcell "arena",0,0,300,300,cell_basilica,1;
  6864. setcell "arena",140,140,160,160,cell_basilica,0;
  6865. setcell "arena",135,135,165,165,cell_walkable,0;
  6866. setcell "arena",140,140,160,160,cell_walkable,1;
  6867. This will add a makeshift ring into the center of the map. The ring will be
  6868. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  6869. the rest of the map will be marked as 'basilica', preventing observers from
  6870. casting any offensive skills or fighting among themselves. Note that the wall
  6871. will not be shown nor known client-side, which may cause movement problems.
  6872. Another example:
  6873. OnBarricadeDeploy:
  6874. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  6875. end;
  6876. OnBarricadeBreak:
  6877. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  6878. end;
  6879. This could be a part of the WoE:SE script, where attackers are not allowed
  6880. to proceed until all barricades are destroyed. This script would place and
  6881. remove a nonwalkable row of cells after the barricade mobs.
  6882. ---------------------------------------
  6883. *checkcell ("<map name>",<x>,<y>,<type>);
  6884. This command will return 1 or 0, depending on whether the specified cell has
  6885. the 'type' flag set or not. There are various types to check, all mimicking
  6886. the server's cell_chk enumeration. The types can be found in 'src/map/script_constants.hpp'.
  6887. The meaning of the individual types can be confusing, so here's an overview:
  6888. - cell_chkwall/water/cliff
  6889. these check directly for the 'terrain component' of the specified cell
  6890. - cell_chkpass/reach/nopass/noreach
  6891. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  6892. - cell_chknpc/basilica/landprotector/novending/nochat
  6893. these check for specific dynamic flags (their name indicates what they do)
  6894. Example:
  6895. mes "Pick a destination map.";
  6896. input .@map$;
  6897. mes "Alright, now give me the coordinates.";
  6898. input .@x;
  6899. input .@y;
  6900. if ( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  6901. mes "Can't warp you there, sorry!";
  6902. close;
  6903. } else {
  6904. mes "Ok, get ready...";
  6905. close2;
  6906. warp .@map$, .@x, .@y;
  6907. end;
  6908. }
  6909. ---------------------------------------
  6910. *getfreecell "<map name>",<rX>,<rY>{,<x>,<y>,<rangeX>,<rangeY>,<flag>};
  6911. Finds a free cell on the given map and stores the reference to the found cell
  6912. in <rX> and <rY>. Passing <x> and <y> with <rangeX> and <rangeY> allows for
  6913. searching within a specified area on the given map. The <flag> is a bitmask
  6914. and has the following possible values:
  6915. - 1 = Random cell on the map or from <x>,<y> range. (default)
  6916. - 2 = The target should be able to walk to the target tile.
  6917. - 4 = There shouldn't be any players around the target tile (use the no_spawn_on_player setting).
  6918. Examples:
  6919. getfreecell("prontera",.@x,.@y); // Find a random empty cell in Prontera and store it within .@x and .@y
  6920. 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
  6921. ---------------------------------------
  6922. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  6923. *delwall "<name>";
  6924. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  6925. line of the given size in the given direction. The difference with setcell is
  6926. this one update client part too to avoid the glitch problem. Directions are the
  6927. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  6928. ---------------------------------------
  6929. *checkwall "<name>";
  6930. This command will return true if the wall with the given name exists, false otherwise.
  6931. ---------------------------------------
  6932. *readbook <book id>,<page>;
  6933. This command will open a book item at the specified page.
  6934. ---------------------------------------
  6935. *open_roulette( {char_id} )
  6936. Opens the roulette window for the currently attached character or the character
  6937. with the given character id.
  6938. ---------------------------------------
  6939. *naviregisterwarp("<Name of Link>", "<dest_map>", <dest_x>, <dest_y>)
  6940. Only useful when using the map-server-generator. Registers an extra warp from this
  6941. npc to the destination map/x/y for the generated client files.
  6942. ---------------------------------------
  6943. *navihide
  6944. Only useful when using the map-server-generator. Hides this npc and all links from
  6945. this npc in the navigation generation.
  6946. ---------------------------------------
  6947. ========================
  6948. |7.- Instance commands.|
  6949. ========================
  6950. ---------------------------------------
  6951. *instance_create("<instance name>"{,<instance mode>{,<owner id>}});
  6952. Creates an instance for the <owner id> of <mode>. The instance name, along with
  6953. all other instance data, is read from 'db/(pre-)re/instance_db.yml'. Upon success,
  6954. the command generates a unique instance ID, duplicates all listed maps and NPCs,
  6955. sets the alive time, and triggers the "OnInstanceInit" label in all NPCs inside
  6956. the instance.
  6957. Instance Mode options:
  6958. IM_NONE: Attached to no one.
  6959. IM_CHAR: Attached to a single character.
  6960. IM_PARTY: Attached to a party (default instance mode).
  6961. IM_GUILD: Attached to a guild.
  6962. IM_CLAN: Attached to a clan.
  6963. The command returns the instance ID upon success, and these values upon failure:
  6964. -1: Invalid type.
  6965. -2: Character/Party/Guild/Clan not found.
  6966. -3: Instance already exists.
  6967. -4: No free instances (MAX_INSTANCE exceeded).
  6968. ---------------------------------------
  6969. *instance_destroy {<instance id>};
  6970. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  6971. the script is attached to is used. If that fails, the script will come to a halt.
  6972. This will also trigger the "OnInstanceDestroy" label in all NPCs inside the instance.
  6973. ---------------------------------------
  6974. *instance_enter("<instance name>",{<x>,<y>,<char_id>,<instance id>});
  6975. Warps the attached player to the specified <instance id>. If no ID is specified,
  6976. the IM_PARTY instance the invoking player is attached to is used.
  6977. The map and coordinates are located in 'db/(pre-)re/instance_db.yml'.
  6978. The command returns IE_OK upon success, and these values upon failure:
  6979. IE_NOMEMBER: Party/Guild/Clan not found (for party/guild/clan modes).
  6980. IE_NOINSTANCE: Character/Party/Guild/Clan does not have an instance.
  6981. IE_OTHER: Other errors (invalid instance name, instance doesn't match with character/party/guild/clan).
  6982. Put -1 for x and y if want to warp player with default entrance coordinates.
  6983. ---------------------------------------
  6984. *instance_npcname("<npc name>"{,<instance id>})
  6985. Returns the unique name of the instanced script. If no ID is specified,
  6986. the instance the script is attached to is used. If that fails, the script
  6987. will come to a halt.
  6988. ---------------------------------------
  6989. *instance_mapname("<map name>"{,<instance id>})
  6990. Returns the unique name of the instanced map. If no instance ID is specified,
  6991. the instance the script is attached to is used. If that fails, the command
  6992. returns an empty string instead.
  6993. ---------------------------------------
  6994. *instance_id({<instance mode>})
  6995. Returns the unique instance ID of the given mode. By default it returns the
  6996. attached script instance. If <instance mode> is provided then the instance
  6997. of the currently attached player is used. If that fails, the function will return 0.
  6998. Instance Mode options:
  6999. IM_CHAR: Attached to character.
  7000. IM_PARTY: Attached to character's party.
  7001. IM_GUILD: Attached to character's guild.
  7002. IM_CLAN: Attached to character's clan.
  7003. ---------------------------------------
  7004. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  7005. Warps all players in the <instance id> to <map name> to the given coordinates.
  7006. If no ID is specified, the IM_PARTY instance the invoking player is attached
  7007. to is used. If that fails, the script will come to a halt.
  7008. ---------------------------------------
  7009. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  7010. Broadcasts a message to all players in the <instance id> currently residing on
  7011. an instance map. If 0 is specified for <instance id>, the instance the script
  7012. is attached to is used.
  7013. For details on the other parameters, see 'announce'.
  7014. ---------------------------------------
  7015. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  7016. This function checks if a party meets certain requirements, returning 1 if all
  7017. conditions are met and 0 otherwise. It will only check online characters.
  7018. amount - number of online party members (default is 1).
  7019. min - minimum level of all characters in the party (default is 1).
  7020. max - maximum level of all characters in the party (default is max level in conf).
  7021. Example:
  7022. if (instance_check_party(getcharid(1),2,2,149)) {
  7023. mes "Your party meets the Memorial Dungeon requirements.",
  7024. mes "All online members are between levels 1-150 and at least two are online.";
  7025. close;
  7026. } else {
  7027. mes "Sorry, your party does not meet requirements.";
  7028. close;
  7029. }
  7030. ---------------------------------------
  7031. *instance_check_guild(<guild id>{,<amount>{,<min>{,<max>}}})
  7032. This function checks if a guild meets certain requirements, returning 1 if all
  7033. conditions are met and 0 otherwise. It will only check online characters.
  7034. amount - number of online guild members (default is 1).
  7035. min - minimum level of all characters in the guild (default is 1).
  7036. max - maximum level of all characters in the guild (default is max level in conf).
  7037. Example:
  7038. if (instance_check_guild(getcharid(2),2,2,149)) {
  7039. mes "Your guild meets the Memorial Dungeon requirements.",
  7040. mes "All online members are between levels 1-150 and at least two are online.";
  7041. close;
  7042. } else {
  7043. mes "Sorry, your guild does not meet requirements.";
  7044. close;
  7045. }
  7046. ---------------------------------------
  7047. *instance_check_clan(<clan id>{,<amount>{,<min>{,<max>}}})
  7048. This function checks if a clan meets certain requirements, returning 1 if all
  7049. conditions are met and 0 otherwise. It will only check online characters.
  7050. amount - number of online clan members (default is 1).
  7051. min - minimum level of all characters in the clan (default is 1).
  7052. max - maximum level of all characters in the clan (default is max level in conf).
  7053. Example:
  7054. if (instance_check_clan(getcharid(5),2,2,149)) {
  7055. mes "Your clan meets the Memorial Dungeon requirements.",
  7056. mes "All online members are between levels 1-150 and at least two are online.";
  7057. close;
  7058. } else {
  7059. mes "Sorry, your clan does not meet requirements.";
  7060. close;
  7061. }
  7062. ---------------------------------------
  7063. *instance_info("<instance name>",<info type>{,<instance_db map index>});
  7064. Returns the specified <info type> of the given <instance name> from the instance database.
  7065. If the <instance name> is unknown or an invalid <info type> is supplied -1 will be returned.
  7066. Valid info types:
  7067. IIT_ID: Instance database ID as integer.
  7068. IIT_TIME_LIMIT: Instance database total life time as integer.
  7069. IIT_IDLE_TIMEOUT: Instance database timeout time as integer.
  7070. IIT_ENTER_MAP: Instance database enter map as string.
  7071. IIT_ENTER_X: Instance database enter X location as integer.
  7072. IIT_ENTER_Y: Instance database enter Y location as integer.
  7073. IIT_MAPCOUNT: Instance database total maps as integer.
  7074. IIT_MAP: Instance database map name from the given <instance_db map index> as string.
  7075. If the index is invalid an empty string will be returned.
  7076. Example:
  7077. .@name$ = "Endless Tower";
  7078. mes .@name$ + " will be destroyed if no one is in the instance for " + instance_info(.@name$,IIT_IDLETIMEOUT) + " seconds.";
  7079. // Endless Tower will be destroyed if no one is in the instance for 300 seconds.
  7080. ---------------------------------------
  7081. *instance_live_info(<info type>{,<instance id>});
  7082. Returns the specified <info type> of instance attached to the npc or, if
  7083. an instance ID is specified, of that instance.
  7084. Valid <info type>:
  7085. ILI_NAME - Instance Name
  7086. Return the name of the instance or "" if that fails.
  7087. ILI_MODE - Instance Mode
  7088. Return IM_NONE, IM_CHAR, IM_PARTY, IM_GUILD, IM_CLAN or -1 if that fails.
  7089. ILI_OWNER - Owner ID
  7090. Return an ID according to the instance mode of the instance attached/specified or -1 if that fails.
  7091. When the instance mode is IM_NONE, ILI_OWNER will return the npc ID that created the instance,
  7092. IM_CHAR - the owner char ID
  7093. IM_PARTY - the party ID
  7094. IM_GUILD - the guild ID
  7095. IM_CLAN - the clan ID
  7096. Examples:
  7097. // Return the instance name of the instance attached to the npc.
  7098. .@instance_name$ = instance_live_info(ILI_NAME);
  7099. // Return the guild owner ID of the given instance ID.
  7100. .@owner = instance_live_info(ILI_OWNER, instance_id(IM_GUILD));
  7101. ---------------------------------------
  7102. *instance_list(<"map name">{,<instance mode>});
  7103. Creates the array '.@instance_list' with possible instance IDs for the given <map name> and optional <mode>.
  7104. Return '.@instance_list' array size.
  7105. Instance mode options: IM_NONE, IM_CHAR, IM_PARTY, IM_GUILD, or IM_CLAN
  7106. If the instance mode is not provided then it will return all the instance IDs for that map.
  7107. Examples:
  7108. // This example assumes that there are several instances on the map of Prontera.
  7109. .@size = instance_list("prontera");
  7110. for ( .@i = 0; .@i < .@size; ++.@i )
  7111. mes instance_mapname("prontera", .@instance_list[.@i]);
  7112. //the output would be a list of all prontera copies that are active in the server.
  7113. ---------------------------------------
  7114. *getinstancevar(<variable>,<instance id>);
  7115. Returns a reference to an instance variable (' prefix) of the specific instance ID.
  7116. This can only be used to get ' variables.
  7117. Examples:
  7118. // This will set the .@s variable to the value of 'var variable of the specific instance ID.
  7119. set .@s, getinstancevar('var, instance_id(IM_PARTY));
  7120. // This will set the 'var variable of the specific instance ID to 1.
  7121. set getinstancevar('var, instance_id(IM_GUILD)), 1;
  7122. ---------------------------------------
  7123. *setinstancevar(<variable>,<value>,<instance id>);
  7124. This command will set an instance variable to the value that the expression results in.
  7125. See 'set' command for more information.
  7126. Returns the variable reference.
  7127. Examples:
  7128. // This will set the 'var variable of the specific instance ID to 9.
  7129. setinstancevar('var, 9, instance_id(IM_GUILD));
  7130. ---------------------------------------
  7131. =========================
  7132. |8.- Quest Log commands.|
  7133. =========================
  7134. ---------------------------------------
  7135. *questinfo <Icon>{,<Map Mark Color>{,"<condition>"}};
  7136. This command should only be used in OnInit/OnInstanceInit labels.
  7137. Show an emotion on top of a NPC, and optionally, a colored mark in the mini-map like "viewpoint" or "viewpointmap".
  7138. When a user is doing some action, each NPC is checked for questinfo that has been set on the map.
  7139. If questinfo is present, it will check if the player fulfill the condition.
  7140. If he/she does or no condition has been set, the bubble will appear.
  7141. Available <Icon>:
  7142. No Icon : QTYPE_NONE
  7143. ! Quest Icon : QTYPE_QUEST
  7144. ? Quest Icon : QTYPE_QUEST2
  7145. ! Job Icon : QTYPE_JOB
  7146. ? Job Icon : QTYPE_JOB2
  7147. ! Event Icon : QTYPE_EVENT
  7148. ? Event Icon : QTYPE_EVENT2
  7149. Warg : QTYPE_WARG (Only for packetver < 20170315)
  7150. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410 and < 20170315)
  7151. Click Me : QTYPE_CLICKME (Only for packetver >= 20170315)
  7152. Daily Quest : QTYPE_DAILYQUEST (Only for packetver >= 20170315)
  7153. ! Event Icon : QTYPE_EVENT3 (Only for packetver >= 20170315)
  7154. Job Quest : QTYPE_JOBQUEST (Only for packetver >= 20170315)
  7155. Jumping Poring : QTYPE_JUMPING_PORING (Only for packetver >= 20170315)
  7156. <Map Mark Color>, when used, creates a mark in the user's mini map on the position of the NPC,
  7157. the available color values are:
  7158. QMARK_NONE - No Marker (default)
  7159. QMARK_YELLOW - Yellow Marker
  7160. QMARK_GREEN - Green Marker
  7161. QMARK_PURPLE - Purple Marker
  7162. <condition> can be any expression similarly to the <condition> in the 'if' command.
  7163. List of the player's actions to trigger the questinfo condition:
  7164. - Item added to/removed from player inventory
  7165. - Base/Job level change
  7166. - Job change
  7167. - Quest given/erased/completed
  7168. - Quest objective updated (character killed a monster quest target)
  7169. - Warp
  7170. Example:
  7171. izlude,100,100,4 script Test 844,{
  7172. mes "[Test]";
  7173. mes "Hello World.";
  7174. close;
  7175. OnInit:
  7176. // Display an icon if the player has completed the given hunting quest and his/her variable 'unknown_var' is above 0
  7177. questinfo QTYPE_QUEST, QMARK_YELLOW, "checkquest(1001,HUNTING) == 2 && unknown_var > 0";
  7178. //.. or display an icon if the player didn't start the given quest and he/she has one red potion in inventory
  7179. questinfo QTYPE_QUEST, QMARK_YELLOW, "!isbegin_quest(1001) && countitem(501) == 1";
  7180. end;
  7181. }
  7182. ---------------------------------------
  7183. *questinfo_refresh {<char_id>};
  7184. This command refreshes each quest bubble that has been set on the map according
  7185. to the questinfo condition for the attached/given player.
  7186. ---------------------------------------
  7187. *setquest <ID>{,<char_id>};
  7188. Place quest of <ID> in the users quest log, the state of which is "active".
  7189. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  7190. ---------------------------------------
  7191. *completequest <ID>{,<char_id>};
  7192. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  7193. ---------------------------------------
  7194. *erasequest <ID>{,<char_id>};
  7195. Remove the quest of the given <ID> from the user's quest log.
  7196. ---------------------------------------
  7197. *changequest <ID>,<ID2>{,<char_id>};
  7198. Remove quest of the given <ID> from the user's quest log.
  7199. Add quest of the <ID2> to the the quest log, and the state is "active".
  7200. ---------------------------------------
  7201. *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}})
  7202. If no additional argument supplied, return the state of the quest:
  7203. -1 = Quest not started (not in quest log)
  7204. 0 = Quest has been given, but the state is "inactive"
  7205. 1 = Quest has been given, and the state is "active"
  7206. 2 = Quest completed
  7207. If parameter "PLAYTIME" is supplied:
  7208. -1 = Quest not started (not in quest log)
  7209. 0 = the time limit has not yet been reached
  7210. 1 = the time limit has not been reached but the quest is marked as complete
  7211. 2 = the time limit has been reached
  7212. If parameter "HUNTING" is supplied:
  7213. -1 = Quest not started (not in quest log)
  7214. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  7215. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  7216. 2 = you've killed all of the target monsters
  7217. ---------------------------------------
  7218. *isbegin_quest(<ID>{,<char_id>})
  7219. Return the state of the quest:
  7220. 0 = Quest not started (not in quest log)
  7221. 1 = Quest has been given (state is either "inactive" or "active")
  7222. 2 = Quest completed
  7223. ---------------------------------------
  7224. *showevent <icon>{,<mark color>{,<char_id>}}
  7225. Show an emotion on top of a NPC, and optionally,
  7226. a colored mark in the mini-map like "viewpoint" or "viewpointmap".
  7227. This is used to indicate that a NPC has a quest or an event to
  7228. a certain player.
  7229. Available Icons:
  7230. Remove Icon : QTYPE_NONE
  7231. ! Quest Icon : QTYPE_QUEST
  7232. ? Quest Icon : QTYPE_QUEST2
  7233. ! Job Icon : QTYPE_JOB
  7234. ? Job Icon : QTYPE_JOB2
  7235. ! Event Icon : QTYPE_EVENT
  7236. ? Event Icon : QTYPE_EVENT2
  7237. Warg : QTYPE_WARG
  7238. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  7239. Mark Color:
  7240. QMARK_NONE - No Marker (default)
  7241. QMARK_YELLOW - Yellow Marker
  7242. QMARK_GREEN - Green Marker
  7243. QMARK_PURPLE - Purple Marker
  7244. ---------------------------------------
  7245. *open_quest_ui {<quest ID>,{<char ID>}};
  7246. Opens the quest UI for the attached player or the given character ID.
  7247. Use 0 as the quest ID to open the main quest UI. If the quest ID is not 0 then the quest UI is opened to the given quest. If the quest data is not populated in the client LUB then a message will be displayed saying the quest doesn't exist.
  7248. This command requires packet version 2015-12-02 or newer.
  7249. ---------------------------------------
  7250. ============================
  7251. |9.- Battleground commands.|
  7252. ============================
  7253. ---------------------------------------
  7254. *waitingroom2bg_single(<battle group>,{"<map name>",<x>,<y>{,"<npc name>"}});
  7255. Adds the first waiting player from the chat room of the given NPC to an existing battleground group.
  7256. The player will also be warped to the default spawn point of the battle group or to the specified coordinates
  7257. <x> and <y> on the given <map>.
  7258. Note: The map need the mapflag MF_BATTLEGROUND otherwise the player is removed from the Battleground team.
  7259. ---------------------------------------
  7260. *waitingroom2bg("<map name>",<x>,<y>,{"<On Quit Event>","<On Death Event>"{,"<NPC Name>"}});
  7261. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  7262. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  7263. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  7264. If "-" is supplied for <map name> then the player will not automatically respawn after the 1 second delay.
  7265. This allows for better manipulation of <On Death Event>. The player will have to be warped to desired location
  7266. at the end of <On Death Event>.
  7267. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  7268. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  7269. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  7270. Example:
  7271. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  7272. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  7273. end;
  7274. ---------------------------------------
  7275. *bg_create("<map name>",<x>,<y>{,"<On Quit Event>","<On Death Event>"});
  7276. Creates an instance of battleground battle group that can be used with other battleground commands.
  7277. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  7278. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  7279. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  7280. If "-" is supplied for <map name> then the player will not automatically respawn after the 1 second delay.
  7281. This allows for better manipulation of <On Death Event>. The player will have to be warped to desired location
  7282. at the end of <On Death Event>.
  7283. Returns battle group ID on success. Returns 0 on failure.
  7284. ---------------------------------------
  7285. *bg_join(<battle group>,{"<map name>",{<x>,<y>{,<char id>}});
  7286. Adds an attached player or <char id> if specified to an existing battleground group. The player will also be warped
  7287. to the default spawn point of the battle group or to the specified coordinates <x> and <y> on the given <map>.
  7288. Note: The map need the mapflag MF_BATTLEGROUND otherwise the player is removed from the Battleground team.
  7289. Returns true on success. Returns false on failure.
  7290. ---------------------------------------
  7291. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  7292. Updates the respawn point of the given Battle Group to x,y on the same map. <Battle Group ID> can be retrieved
  7293. using getcharid(4).
  7294. Example:
  7295. bg_team_setxy getcharid(4),56,212;
  7296. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  7297. end;
  7298. ---------------------------------------
  7299. *bg_reserve("<battleground_map_name>"{,<ended>});
  7300. Reserves a Battleground map for the Battleground UI System. When a map is booked it prevents another similar
  7301. queue from being created and will allow players to join an active Battlegrounds event.
  7302. If <ended> is true, then the Battleground is marked as over to prevent new players from joining. This state is meant
  7303. for the period where players can get their Badges.
  7304. ---------------------------------------
  7305. *bg_unbook("<battleground_map_name>");
  7306. Removes a Battleground map for the Battleground UI System. When a map is unbooked it allows a queue to be created.
  7307. ---------------------------------------
  7308. *bg_desert({<char_id>});
  7309. Same as 'bg_leave' but slaps the player with a deserter status so they can't enter another queue for the time
  7310. defined in battleground_db (10 minutes by default).
  7311. With the Battleground Queue System, it will also warp the player to their previous position when they joined or
  7312. to their save point if the map had MF_NOSAVE.
  7313. ---------------------------------------
  7314. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  7315. Similar to the 'warp' command.
  7316. Places all members of <Battle Group> at the specified map and coordinates.
  7317. Example:
  7318. //place the battle group one for Tierra Gorge at starting position.
  7319. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  7320. end;
  7321. ---------------------------------------
  7322. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  7323. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  7324. Similar to the 'monster' command.
  7325. Spawns a monster with allegiance to the given Battle Group.
  7326. Does not allow for the summoning of multiple monsters.
  7327. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  7328. Example:
  7329. // It can be used in two different ways.
  7330. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  7331. end;
  7332. // Alternatively, you can set an ID for the monster using "set".
  7333. // This becomes useful when used with the command below.
  7334. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  7335. end;
  7336. ---------------------------------------
  7337. *bg_monster_set_team <GID>,<Battle Group>;
  7338. This command will change the allegiance if a monster in a battle ground.
  7339. GID can be set when spawning the monster via the 'bg_monster' command.
  7340. Example:
  7341. end;
  7342. OnEnable:
  7343. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  7344. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  7345. initnpctimer;
  7346. end;
  7347. OnTimer1000:
  7348. stopnpctimer;
  7349. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  7350. bg_monster_set_team $@Guardian, $@BG_1;
  7351. end;
  7352. ---------------------------------------
  7353. *bg_leave {<char_id>};
  7354. Removes attached player from their Battle Group.
  7355. With the Battleground Queue System, it will also warp the player to their previous position when they joined or
  7356. to their save point if the map had MF_NOSAVE.
  7357. ---------------------------------------
  7358. *bg_destroy <Batte Group>;
  7359. Destroys the Battle Group created for that battle ground.
  7360. ---------------------------------------
  7361. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  7362. Restores a percentage of the maximum HP/SP of players within a defined area.
  7363. This is primarily used in battleground scripts, but is not limited to them.
  7364. Example:
  7365. areapercentheal "bat_a01",52,208,61,217,100,100;
  7366. end;
  7367. ---------------------------------------
  7368. *bg_get_data(<Battle Group>,<type>);
  7369. Retrieves data related to given Battle Group. Type can be one of the following:
  7370. 0 - Amount of players currently belonging to the group.
  7371. 1 - Store GID of players in <Battle Group> in a temporary global array $@arenamembers,
  7372. stores and also returns the amount of players currently belonging to the group in $@arenamemberscount.
  7373. ---------------------------------------
  7374. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  7375. Retrieves the amount of players belonging to the given Battle Group on the given
  7376. map within the specified rectangular area.
  7377. ---------------------------------------
  7378. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  7379. This command will force the update of the displayed scoreboard.
  7380. It is only usable when the map is defined as a Type 2 Battleground:
  7381. mapflag <map name> battleground 2
  7382. ---------------------------------------
  7383. *bg_info("<battleground name>", <type>);
  7384. Retrieves data related to given <battleground name> from the database. Requires feature.bgqueue
  7385. to be enabled. <Type> can be one of the following:
  7386. BG_INFO_ID: Battleground ID.
  7387. BG_INFO_REQUIRED_PLAYERS: Required players to start a battleground (per side).
  7388. BG_INFO_MAX_PLAYERS: Maximum players allowed in a battleground.
  7389. BG_INFO_MIN_LEVEL: Minimum level allowed to join a battleground.
  7390. BG_INFO_MAX_LEVEL: Maximum level allowed to join a battleground.
  7391. BG_INFO_MAPS: Number of maps in a battleground. Stores an array of map names in @bgmaps[] and a count in @bgmapscount.
  7392. BG_INFO_DESERTER_TIME: Amount of time in seconds a player is marked deserter.
  7393. ---------------------------------------
  7394. ====================
  7395. |10.- Pet commands.|
  7396. ====================
  7397. ---------------------------------------
  7398. *bpet;
  7399. *birthpet;
  7400. This command opens up a pet hatching window on the client connected to the
  7401. invoking character. It is used in item script for the pet incubators and will
  7402. let the player hatch an owned egg. If the character has no eggs, it will just
  7403. open up an empty incubator window.
  7404. This is still usable outside item scripts.
  7405. ---------------------------------------
  7406. *pet <pet id>;
  7407. *catchpet <pet id>;
  7408. This command is used in all the item scripts for taming items. Running this
  7409. command will make the pet catching cursor appear on the client connected to the
  7410. invoking character, usable on the monsters with the specified pet ID number. It
  7411. will still work outside an item script.
  7412. If the <pet id> is PET_CATCH_UNIVERSAL the item will attempt to catch the targeted
  7413. monster as long as it is in the pet database and does not have the MD_STATUS_IMMUNE
  7414. monster mode.
  7415. If the <pet id> is PET_CATCH_UNIVERSAL_ITEM the item will attempt to catch the targeted
  7416. monster as long as it is in the pet database and the targeted monster requires the lure
  7417. item used.
  7418. See 'doc/mob_db_mode_list.txt' for more information about monster modes.
  7419. A full list of pet IDs can be found inside 'db/(pre-)re/pet_db.yml'.
  7420. ---------------------------------------
  7421. *makepet <pet id>;
  7422. This command will create a pet egg and put it in the invoking character's
  7423. inventory. The kind of pet is specified by pet ID numbers listed in
  7424. 'db/(pre-)re/pet_db.yml'. The egg is created exactly as if the character just successfully
  7425. caught a pet in the normal way.
  7426. // This will make you a poring:
  7427. makepet 1002;
  7428. Notice that you absolutely have to create pet eggs with this command. If you try
  7429. to give a pet egg with 'getitem', pet data will not be created by the char
  7430. server and the egg will disappear when anyone tries to hatch it.
  7431. ---------------------------------------
  7432. *getpetinfo(<type>{,<char_id>})
  7433. This function will return pet information for the pet the invoking character
  7434. currently has active. Valid types are:
  7435. PETINFO_ID - Pet ID
  7436. PETINFO_CLASS - Pet class number as per 'db/(pre-)re/pet_db.yml' - will tell you what kind of a pet it is.
  7437. PETINFO_NAME - Pet name. Will return "null" if there's no pet.
  7438. PETINFO_INTIMATE - Pet friendly level (intimacy score). 1000 is full loyalty.
  7439. PETINFO_HUNGRY - Pet hungry level. 100 is full hunger.
  7440. PETINFO_RENAMED - Pet rename flag. 0 means this pet has not been named yet.
  7441. PETINFO_LEVEL - Pet level
  7442. PETINFO_BLOCKID - Pet Game ID
  7443. PETINFO_EGGID - Pet egg item ID
  7444. PETINFO_FOODID - Pet food item ID
  7445. PETINFO_INTIMATE can be used with the following constants for checking values:
  7446. PET_INTIMATE_NONE = 0
  7447. PET_INTIMATE_AWKWARD = 1 ~ 99
  7448. PET_INTIMATE_SHY = 100 ~ 249
  7449. PET_INTIMATE_NEUTRAL = 250 ~ 749
  7450. PET_INTIMATE_CORDIAL = 750 ~ 909
  7451. PET_INTIMATE_LOYAL = 910 ~ 1000
  7452. PETINFO_HUNGRY can be used with the following constants for checking values:
  7453. PET_HUNGRY_NONE = 0
  7454. PET_HUNGRY_VERY_HUNGRY = 1 ~ 10
  7455. PET_HUNGRY_HUNGRY = 11 ~ 25
  7456. PET_HUNGRY_NEUTRAL = 26 ~ 75
  7457. PET_HUNGRY_SATISFIED = 76 ~ 90
  7458. PET_HUNGRY_STUFFED = 91 ~ 100
  7459. Example:
  7460. mes "[Vet]";
  7461. mes "Your pet + " getpetinfo(PETINFO_NAME);
  7462. if (getpetinfo(PETINFO_INTIMATE) < PET_INTIMATE_LOYAL)
  7463. mes "has some growing to do on you!";
  7464. else
  7465. mes "seems to love you very much!";
  7466. close;
  7467. ---------------------------------------
  7468. =============================
  7469. |10.1.- The Pet AI commands.|
  7470. =============================
  7471. ---------------------------------------
  7472. These commands will only work if the invoking character has a pet, and are meant
  7473. to be executed from pet scripts. They will modify the pet AI decision-making for
  7474. the current pet of the invoking character, and will NOT have any independent
  7475. effect by themselves, which is why only one of them each may be in effect at any
  7476. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  7477. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport'.
  7478. All commands with delays and durations will only make the behavior active for
  7479. the specified duration of seconds, with a delay of the specified number of
  7480. seconds between activations. Rates are a chance of the effect occurring and are
  7481. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  7482. at the maximum possible.
  7483. The behavior modified with the below mentioned commands will only be exhibited if
  7484. the pet is loyal and appropriate configuration options are set in
  7485. 'battle_athena.conf'.
  7486. Pet scripts in the database normally run whenever a pet of that type hatches
  7487. from the egg. Other commands usable in item scripts (see 'bonus') will also
  7488. happily run from pet scripts. Apparently, the pet-specific commands will also
  7489. work in NPC scripts and modify the behavior of the current pet up until the pet
  7490. is hatched again. (Which will also occur when the character is logged in again
  7491. with the pet still out of the egg.) It is not certain for how long the effect of
  7492. such command running from an NPC script will eventually persist, but apparently,
  7493. it is possible to usefully employ them in usable item scripts to create pet
  7494. buffing items.
  7495. Nobody tried this before, so you're essentially on your own here.
  7496. ---------------------------------------
  7497. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  7498. This command will make the pet give a bonus to the owner's stat in certain
  7499. duration in seconds and will be repeated for certain delay in seconds.
  7500. For a full bonus list, see 'doc/item_bonus.txt'
  7501. NOTE: Currently ONLY supported for bonuses that used by 'bonus' script.
  7502. ---------------------------------------
  7503. *petrecovery <status type>,<delay>;
  7504. This command will make the pet cure a specified status condition. The curing
  7505. actions will occur once every Delay seconds. For a full list of status
  7506. conditions that can be cured, see the list of 'SC_' status condition constants
  7507. in 'src/map/script_constants.hpp'.
  7508. ---------------------------------------
  7509. *petloot <max items>;
  7510. This command will turn on pet looting, with a maximum number of items to loot
  7511. specified. Pet will store items and return them when the maximum is reached or
  7512. when pet performance is activated.
  7513. ---------------------------------------
  7514. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  7515. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  7516. This will make the pet use a specified support skill on the owner whenever the
  7517. HP and SP are below the given percent values, with a specified delay time
  7518. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.yml'.
  7519. It's not quite certain who's stats will be used for the skills cast, the
  7520. character's or the pets. Probably, Skotlex can answer that question.
  7521. ---------------------------------------
  7522. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  7523. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  7524. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  7525. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  7526. These two commands will make the pet cast an attack skill on the enemy the pet's
  7527. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  7528. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  7529. inflicted and the specified number of attacks.
  7530. Value of 'rate' is between 1 and 100. 100 = 100%
  7531. ---------------------------------------
  7532. ===========================
  7533. |11.- Homunculus commands.|
  7534. ===========================
  7535. ---------------------------------------
  7536. *homevolution;
  7537. This command will try to evolve the current player's homunculus.
  7538. If it doesn't work, the /swt emotion is shown.
  7539. To evolve a homunculus, the invoking player must have a homunculus,
  7540. the homunculus must not be the last evolution and
  7541. the homunculus must have above 91000 intimacy with its owner.
  7542. ---------------------------------------
  7543. *morphembryo;
  7544. This command will try to put the invoking player's Homunculus in an
  7545. uncallable state, required for mutation into a Homunculus S. The player
  7546. will also receive a Strange Embryo (ID 6415) in their inventory if
  7547. successful, which is deleted upon mutation.
  7548. The command will fail if the invoking player does not have an evolved
  7549. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  7550. Returns 1 upon success and 0 for all failures.
  7551. ---------------------------------------
  7552. *hommutate {<ID>};
  7553. This command will try to mutate the invoking player's Homunculus into
  7554. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  7555. The command will fail if the invoking player does not have an evolved
  7556. Homunculus at level 99 or above, if it is not in the embryo state
  7557. (from the 'morphembryo' command), or if the invoking player does not
  7558. possess a Strange Embryo. The /swt emotion is shown upon failure.
  7559. If the optional parameter <ID> is set, the invoking player's Homunculus
  7560. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  7561. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  7562. Returns 1 upon success and 0 for all failures.
  7563. ---------------------------------------
  7564. *checkhomcall()
  7565. This function checks if the attached player's Homunculus is active,
  7566. and will return the following values:
  7567. -1: The player has no Homunculus.
  7568. 0: The player's Homunculus is active.
  7569. 1: The player's Homunculus is vaporized.
  7570. 2: The player's Homunculus is in morph state.
  7571. ---------------------------------------
  7572. *gethominfo(<type>{,<char_id>})
  7573. This function will return Homunculus information for the Homunculus of the
  7574. invoking character, regardless of its vaporize state. It returns zero or
  7575. "null" if the player does not own a Homunculus.
  7576. Valid types are:
  7577. 0 - Homunculus ID
  7578. 1 - Homunculus Class
  7579. 2 - Homunculus Name
  7580. 3 - Homunculus friendly level (intimacy score). 100000 is full loyalty.
  7581. 4 - Homunculus hungry level. 100 is completely full.
  7582. 5 - Homunculus rename flag. 0 means this homunculus has not been named yet.
  7583. 6 - Homunculus level
  7584. 7 - Homunculus Game ID
  7585. ---------------------------------------
  7586. *homshuffle;
  7587. This will recalculate the homunculus stats according to its level, of the
  7588. current invoking character.
  7589. ---------------------------------------
  7590. *addhomintimacy <amount>{,<char_id>};
  7591. Increase or decrease a homunculus' intimacy value by the given <amount>. 100000 is full loyalty.
  7592. ---------------------------------------
  7593. ==========================
  7594. |12.- Mercenary commands.|
  7595. ==========================
  7596. ---------------------------------------
  7597. *mercenary_create <class>,<contract time>;
  7598. This command summons a mercenary for a given time (in milliseconds). For a
  7599. list of all available classes, see 'db/mercenary_db.txt'.
  7600. This command is typically used in item scripts of mercenary scrolls.
  7601. ---------------------------------------
  7602. *mercenary_delete {<char id>{,<reply>}};
  7603. This command removes the mercenary from a player.
  7604. The parameter 'reply' can be one of the following values:
  7605. 0 - Mercenary soldier's duty hour is over, faith increased by 1. (default)
  7606. 1 - Your mercenary soldier has been killed, faith decreased by 1.
  7607. 2 - Your mercenary soldier has been fired.
  7608. 3 - Your mercenary soldier has ran away.
  7609. ---------------------------------------
  7610. *mercenary_heal <hp>,<sp>;
  7611. This command works like 'heal', but affects the mercenary of the
  7612. currently attached character.
  7613. ---------------------------------------
  7614. *mercenary_sc_start <type>,<tick>,<val1>;
  7615. This command works like 'sc_start', but affects the mercenary of the
  7616. currently attached character.
  7617. ---------------------------------------
  7618. *mercenary_get_calls(<guild>);
  7619. *mercenary_set_calls <guild>,<value>;
  7620. Sets or gets the mercenary calls value for given guild for currently
  7621. attached character. Guild can be one or the following constants:
  7622. ARCH_MERC_GUILD
  7623. SPEAR_MERC_GUILD
  7624. SWORD_MERC_GUILD
  7625. ---------------------------------------
  7626. *mercenary_get_faith(<guild>);
  7627. *mercenary_set_faith <guild>,<value>;
  7628. Sets or gets the mercenary faith value for given guild for currently
  7629. attached character. Guild can be one or the following constants:
  7630. ARCH_MERC_GUILD
  7631. SPEAR_MERC_GUILD
  7632. SWORD_MERC_GUILD
  7633. ---------------------------------------
  7634. *getmercinfo(<type>{,<char id>});
  7635. Retrieves information about mercenary of the currently attached
  7636. character. If char id is given, the information of that character is
  7637. retrieved instead. Type specifies what information to retrieve and
  7638. can be one of the following:
  7639. 0 - Mercenary ID
  7640. 1 - Mercenary Class
  7641. 2 - Mercenary Name
  7642. 3 - Mercenary faith value for this mercenary's guild, if any
  7643. 4 - Mercenary calls value for this mercenary's guild, if any
  7644. 5 - Mercenary kill count
  7645. 6 - Mercenary remaining life time in msec
  7646. 7 - Mercenary level
  7647. 8 - Mercenary Game ID
  7648. If the character does not have a mercenary, the command returns ""
  7649. for name and 0 for all other types.
  7650. ---------------------------------------
  7651. ======================
  7652. |13.- Party commands.|
  7653. ======================
  7654. ---------------------------------------
  7655. *getpartyname(<party id>)
  7656. This function will return the name of a party that has the specified ID number.
  7657. If there is no such party ID, "null" will be returned.
  7658. Lets say the ID of a party was saved as a global variable:
  7659. // This would return the name of the party from the ID stored in a variable
  7660. mes "You're in the '" + getpartyname($@var) + "' party, I know!";
  7661. ---------------------------------------
  7662. *getpartymember <party id>{,<type>{,<array_variable>}};
  7663. This command will find all members of a specified party and returns their names
  7664. (or character id or account id depending on the value of "type") into an array
  7665. of temporary global variables. There's actually quite a few commands like this
  7666. which will fill a special variable with data upon execution and not do anything
  7667. else.
  7668. Upon executing this,
  7669. $@partymembername$[] is a global temporary string array which contains all the
  7670. names of these party members
  7671. (only set when type is 0 or not specified)
  7672. $@partymembercid[] is a global temporary number array which contains the
  7673. character id of these party members.
  7674. (only set when type is 1)
  7675. $@partymemberaid[] is a global temporary number array which contains the
  7676. account id of these party members.
  7677. (only set when type is 2)
  7678. $@partymembercount is the number of party members that were found.
  7679. The party members will (apparently) be found regardless of whether they are
  7680. online or offline. Note that the names come in no particular order.
  7681. Be sure to use $@partymembercount to go through this array, and not
  7682. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  7683. someone with 7 party members invokes this script, the array would have 7
  7684. elements. But if another person calls up the NPC, and he has a party of 5, the
  7685. server will not clear the array for you, overwriting the values instead. So in
  7686. addition to returning the 5 member names, the 6th and 7th elements from the last
  7687. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  7688. the new guy's party. $@partymembercount will always contain the correct number,
  7689. (5) unlike 'getarraysize()' which will return 7 in this case.
  7690. If 'array_variable' is set, the result will be stored to that variable instead
  7691. using global variable.
  7692. Example 1: list party member names
  7693. // get the party member names
  7694. getpartymember getcharid(1),0;
  7695. // It's a good idea to copy the global temporary $@partymember*****
  7696. // variables to your own scope variables because if you have pauses in this
  7697. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  7698. // another player could click this NPC, trigger 'getpartymember', and
  7699. // overwrite the $@partymember***** variables.
  7700. .@count = $@partymembercount;
  7701. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  7702. // list the party member names
  7703. for (.@i = 0; .@i < .@count; .@i++)
  7704. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  7705. close;
  7706. Example 2: check party count (with a 'next' pause), before warping to event
  7707. .register_num = 5; // How many party members are required?
  7708. // get the charID and accountID of character's party members
  7709. getpartymember getcharid(1), 1;
  7710. getpartymember getcharid(1), 2;
  7711. if ( $@partymembercount != .register_num ) {
  7712. mes "Please form a party of " + .register_num + " to continue";
  7713. close;
  7714. }
  7715. // loop through both and use 'isloggedin' to count online party members
  7716. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  7717. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  7718. .@count_online++;
  7719. // We search accountID & charID because a single party can have multiple
  7720. // characters from the same account. Without searching through the charID,
  7721. // if a player has 2 characters from the same account inside the party but
  7722. // only 1 char online, it would count their online char twice.
  7723. if ( .@count_online != .register_num ) {
  7724. mes "All your party members must be online to continue";
  7725. close;
  7726. }
  7727. // copy the array to prevent players cheating the system
  7728. copyarray .@partymembercid, $@partymembercid, .register_num;
  7729. mes "Are you ready ?";
  7730. next; // careful here
  7731. select("Yes");
  7732. // When a script hits a next, menu, sleep or input that pauses the script,
  7733. // players can invite or /leave and make changes in their party. To prevent
  7734. // this, we call getpartymember again and compare with the original values.
  7735. getpartymember getcharid(1), 1;
  7736. if ( $@partymembercount != .register_num ) {
  7737. mes "You've made changes to your party !";
  7738. close;
  7739. }
  7740. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  7741. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  7742. mes "You've made changes to your party !";
  7743. close;
  7744. }
  7745. }
  7746. // Finally, it's safe to start the event!
  7747. warpparty "event_map", 0,0, getcharid(1);
  7748. ---------------------------------------
  7749. *getpartyleader(<party id>{,<type>})
  7750. This function returns some information about the given party-id's leader.
  7751. When type is omitted, the default information retrieved is the leader's name.
  7752. Possible types are:
  7753. 1: Leader account id
  7754. 2: Leader character id
  7755. 3: Leader's class
  7756. 4: Leader's current map name
  7757. 5: Leader's current level as stored on the party structure (may not be
  7758. current level if leader leveled up recently).
  7759. If retrieval fails (leader not found or party does not exist), this function
  7760. returns "null" instead of the character name, and -1 for the other types.
  7761. ---------------------------------------
  7762. *is_party_leader({<party ID>})
  7763. This command will return true if the player attached to the script is the leader
  7764. of his/her party, or, if a party ID is specified, of that party.
  7765. ---------------------------------------
  7766. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  7767. Organizes a party with the attached or specified character as leader. If
  7768. successful, the command returns 1 and sets the global temporary variable
  7769. "$@party_create_id" to the ID of the party created.
  7770. Additionally, item sharing options can be provided:
  7771. - Item Share: 0-Each Take (default), 1-Party Share
  7772. - Item Share Type: 0-Each Take (default), 1-Even Share
  7773. These values are returned upon failure:
  7774. 0: Unknown error.
  7775. -1: Player not found.
  7776. -2: Player already has a party.
  7777. -3: Party name exists.
  7778. ---------------------------------------
  7779. *party_destroy(<party id>);
  7780. Disbands a party. The command returns 1 upon success and 0 upon failure.
  7781. ---------------------------------------
  7782. *party_addmember(<party id>,<character id>);
  7783. Adds a player to an existing party.
  7784. The command returns 1 upon success, and these values upon failure:
  7785. 0: Unknown error.
  7786. -1: Player not found.
  7787. -2: Player already has a party.
  7788. -3: Party not found.
  7789. -4: Party is full.
  7790. -5: Another character from the same account is already in the party.
  7791. ---------------------------------------
  7792. *party_delmember({<character id>,<party id>});
  7793. Removes a player from his/her party. If no player is specified, the command
  7794. will run for the invoking player. If that player is the only party member
  7795. remaining, the party will be disbanded.
  7796. The command returns 1 upon success, and these values upon failure:
  7797. 0: Unknown error.
  7798. -1: Player not found.
  7799. -2: Party not found.
  7800. -3: Player is not in the party.
  7801. ---------------------------------------
  7802. *party_changeleader(<party id>,<character id>);
  7803. Transfers leadership of a party to the specified character.
  7804. The command returns 1 upon success, and these values upon failure:
  7805. 0: Unknown error.
  7806. -1: Party not found.
  7807. -2: Player not found.
  7808. -3: Player is not in the party.
  7809. -4: Player is already party leader.
  7810. ---------------------------------------
  7811. *party_changeoption(<party id>,<option>,<flag>);
  7812. Changes a party option.
  7813. Valid options are:
  7814. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  7815. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  7816. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  7817. The command returns 1 upon success, and these values upon failure:
  7818. 0: Invalid option.
  7819. -1: Party not found.
  7820. ---------------------------------------
  7821. *opendressroom(<flag>{,<char_id>});
  7822. This will open the Dress Room window on the client connected to the invoking character.
  7823. mes "Close this window to open the Dress Room window.";
  7824. close2;
  7825. opendressroom(1);
  7826. end;
  7827. Valid flag are:
  7828. 1 - Open the Dress Room window
  7829. ---------------------------------------
  7830. *navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
  7831. Generates a navigation for attached or specified character. Requires client
  7832. 2011-10-10aRagEXE or newer.
  7833. The flag specifies how the client will calculate the specific route.
  7834. Valid flags are:
  7835. NAV_NONE - No services
  7836. NAV_AIRSHIP_ONLY - Airship only
  7837. NAV_SCROLL_ONLY - Scroll only
  7838. NAV_AIRSHIP_AND_SCROLL - Airship and Scroll
  7839. NAV_KAFRA_ONLY - Kafra only
  7840. NAV_KAFRA_AND_AIRSHIP - Kafra and Airship
  7841. NAV_KAFRA_AND_SCROLL - Kafra and Scroll
  7842. NAV_ALL - All services
  7843. When flag is not specified, the default value is NAV_KAFRA_AND_AIRSHIP.
  7844. The hide_window specifies whether to display (0) or hide (1) the navigation window.
  7845. By default the window is hidden.
  7846. You can specify the monster_id in combination with a mapname to make the
  7847. navigation system tell you, that you have reached the desired mob.
  7848. Note:
  7849. The client requires custom monster spawns be in the navigation file
  7850. for using the embedded client Navigation feature to work properly. In this
  7851. instance sending the player to the map where the monster spawns is a simpler
  7852. solution rather than sending the map and the monster_id.
  7853. ---------------------------------------
  7854. *hateffect(<Hat Effect ID>,<State>);
  7855. This will set a Hat Effect onto the player. The state field allows you to
  7856. enable (true) or disable (false) the effect on the player.
  7857. The Hat Effect constants can be found in 'src/map/script_constants.hpp' starting
  7858. with HAT_EF_*.
  7859. Requires client 2015-05-13aRagEXE or newer.
  7860. ---------------------------------------
  7861. *getrandomoptinfo(<type>);
  7862. Returns value of an attribute of current random option.
  7863. Valid attributes are:
  7864. ROA_ID - ID of current option
  7865. ROA_VALUE - Value field of current option
  7866. ROA_PARAM - Param field of current option
  7867. This script command is intended for using in random option scripts.
  7868. ---------------------------------------
  7869. *getequiprandomoption(<equipment index>,<index>,<type>{,<char id>});
  7870. Returns value of an attribute of a random option on an equipped item.
  7871. See 'getequipid' for a full list of valid equipment slots.
  7872. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  7873. For valid attribute types, see `getrandomoptinfo` command reference.
  7874. ---------------------------------------
  7875. *setrandomoption(<equipment slot>,<index>,<id>,<value>,<param>{,<char id>});
  7876. Sets <index+1>th random option for equipment equipped at <equipment slot>
  7877. to <id>, <value> and <param>.
  7878. See 'getequipid' for a full list of valid equipment slots.
  7879. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  7880. ID - ID of random option. See db/item_randomopt_db.yml for constants.
  7881. Value - Value of random option
  7882. Param - Parameter of random option
  7883. ---------------------------------------
  7884. *randomoptgroup <random option group ID>;
  7885. This command fills the following arrays with the results of a random option group.
  7886. The random option group IDs are specified in 'db/(pre-)re/item_randomopt_group.yml'.
  7887. Arrays - from index 0 to MAX_ITEM_RDM_OPT-1 :
  7888. .@opt_id[] - array of random option ID.
  7889. .@opt_value[] - array of value.
  7890. .@opt_param[] - array of param.
  7891. Example:
  7892. // Fill the arrays using the random option group ID 5 (group used for Crimson weapons).
  7893. randomoptgroup(5);
  7894. // Create a +9 Crimson Dagger [2] with the Group 5 applied
  7895. getitem3 28705,1,1,9,0,0,0,0,0,.@opt_id,.@opt_value,.@opt_param;
  7896. ---------------------------------------
  7897. *clan_join(<clan id>{,<char id>});
  7898. The attached player joins the clan with the <clan id>. On a successful join,
  7899. true is returned, else false if the join failed.
  7900. If <char id> is specified, the specified player is used rather than the attached one.
  7901. ---------------------------------------
  7902. *clan_leave({<char id>});
  7903. The attached player will leave their clan. On a successful leave, true is returned,
  7904. else false if the leave failed.
  7905. If <char id> is specified, the specified player is used rather than the attached one.
  7906. ---------------------------------------
  7907. ========================
  7908. |14.- Channel commands.|
  7909. ========================
  7910. ---------------------------------------
  7911. *channel_create "<chname>","<alias>"{,"<password>"{<option>{,<delay>{,<color>{,<char_id>}}}}};
  7912. Creates a public channel with <chname> as the channel name. To protect the
  7913. channel, use <password> or write "null" to create it without a password.
  7914. Channel name must start with '#' and cannot be the same as the map or ally
  7915. channel names.
  7916. <alias> will be used to change the channel name when the channel message
  7917. is displayed.
  7918. <option> values are:
  7919. CHAN_OPT_BASE - Default option including CHAN_OPT_ANNOUNCE_SELF|CHAN_OPT_MSG_DELAY|CHAN_OPT_CAN_CHAT|CHAN_OPT_CAN_LEAVE
  7920. CHAN_OPT_ANNOUNCE_SELF - Show info for player itself if player has joined/leaves the channel
  7921. CHAN_OPT_ANNOUNCE_JOIN - Display message when player is joining the channel
  7922. CHAN_OPT_ANNOUNCE_LEAVE - Display message when player is leaving the channel
  7923. CHAN_OPT_MSG_DELAY - Enable chat delay for the channel
  7924. CHAN_OPT_COLOR_OVERRIDE - Player's unique font color will override channel's color
  7925. CHAN_OPT_CAN_CHAT - Player can chat in the channel
  7926. CHAN_OPT_CAN_LEAVE - Player can leave the channel
  7927. CHAN_OPT_AUTOJOIN - Players will auto join the channel at login
  7928. The <delay> is the minimum chat delay in millisecond for a single player before
  7929. the player can chat again in the same channel.
  7930. Use <color> hex code to set the color for this channel, if not defined, default
  7931. channel color will be used.
  7932. If <char_id> is defined, the channel will be a private channel and the player
  7933. will be the the channel owner.
  7934. Returns 1 on success.
  7935. /**
  7936. * This example will shows the message on this channel as
  7937. * [rAthena] Admin : Hello world!
  7938. * instead of
  7939. * #rathena Admin : Hello world!
  7940. **/
  7941. channel_create("#rathena","[rAthena]");
  7942. channel_create("#vip","[VIP]","vipmemberonly");
  7943. ---------------------------------------
  7944. *channel_setopt "<chname>",<option>,<value>;
  7945. Set option for the channel. Use 1 in <value> to set it, or 0 to unset.
  7946. The <option> values are the same as the 'channel_create' options.
  7947. For CHAN_OPT_MSG_DELAY, the delay in millisecond must be sent or use 0
  7948. to remove the delay at <value>.
  7949. Returns 1 on success.
  7950. // Example to set delay
  7951. channel_setopt("#global",CHAN_OPT_MSG_DELAY,5000);
  7952. Only for public and private channel.
  7953. ---------------------------------------
  7954. *channel_getopt "<chname>",<option>;
  7955. Get option value for the channel. The <option> values are the same as the
  7956. 'channel_create' options. Returns true or false except for CHAN_OPT_MSG_DELAY
  7957. which returns an integer.
  7958. // Example to get the delay
  7959. .delay = channel_getopt("#global",CHAN_OPT_MSG_DELAY);
  7960. Only for public and private channel.
  7961. ---------------------------------------
  7962. *channel_setcolor "<chname>",<color>;
  7963. To change channel color.
  7964. <color> uses hex RGB values.
  7965. Returns 1 on success.
  7966. ---------------------------------------
  7967. *channel_setpass "<chname>","<password>";
  7968. To set, unset, or change password of a channel.
  7969. Use "null" to remove the password.
  7970. Returns 1 on success.
  7971. Only for public and private channel.
  7972. ---------------------------------------
  7973. *channel_setgroup "<chname>",<group_id>{,...,<group_id>};
  7974. *channel_setgroup2 "<chname>",<array_of_groups>;
  7975. Set group restriction for a channel. Only player with matching <group_id>
  7976. are allowed to to join the channel.
  7977. By using 0 in the first group channel, the group restriction will be
  7978. removed from the channel config.
  7979. 'channel_setgroup2' receives input for group list as an array.
  7980. Returns 0 on failure, and 1 (or n groups count) on success.
  7981. // Example 1: Remove groups
  7982. channel_setgroup("#event",0);
  7983. // Example 2: Multiple values
  7984. channel_setgroup("#vip",2,5);
  7985. // Example 3: Using array
  7986. setarray .@staffs[0],2,3,4,10,99;
  7987. channel_setgroup("#staff",.@staffs);
  7988. Only for public and private channel.
  7989. ---------------------------------------
  7990. *channel_chat "<chname>","<message>"{,<color>};
  7991. Sends message to the channel.
  7992. Returns 1 on success.
  7993. // Example if channel doesn't have alias
  7994. channel_chat(#rathena,"Hello World!"); // #rathena Hello World!
  7995. // Example if channel has alias
  7996. channel_chat(#rathena,"Hello World!"); // [rAthena] Hello World!
  7997. ---------------------------------------
  7998. *channel_ban "<chname>",<char_id>;
  7999. Ban player from a public or private channel.
  8000. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be banned.
  8001. Returns 1 on success.
  8002. ---------------------------------------
  8003. *channel_unban "<chname>",<char_id>;
  8004. Unban player from a public or private channel.
  8005. Returns 1 on success.
  8006. ---------------------------------------
  8007. *channel_kick "<chname>",<char_id>;
  8008. *channel_kick "<chname>","<char_name>";
  8009. Kick player from a public or private channel.
  8010. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be kicked.
  8011. Returns 1 on success.
  8012. ---------------------------------------
  8013. *channel_delete "<chname>";
  8014. Delete an existing public or private channel. Cannot delete ally or
  8015. local map channel.
  8016. Returns 0 on success.
  8017. ---------------------------------------
  8018. ============================
  8019. |15.- Achievement commands.|
  8020. ============================
  8021. ---------------------------------------
  8022. *achievementadd(<achievement id>{,<char id>})
  8023. This function will add an achievement to the player's log for the attached
  8024. player or the supplied <char id>. The objective requirements are not ignored
  8025. when using this function.
  8026. Returns true on success and false on failure.
  8027. ---------------------------------------
  8028. *achievementremove(<achievement id>{,<char id>})
  8029. This function will remove an achievement from the player's log for the attached
  8030. player or the supplied <char id>.
  8031. Returns true on success and false on failure.
  8032. ---------------------------------------
  8033. *achievementinfo(<achievement id>,<type>{,<char id>})
  8034. This function will return the specified <type> value for an achievement of the
  8035. attached player or the supplied <char id>. If the player doesn't have the
  8036. achievement active (no progress has been made): if the achievement doesn't
  8037. exist -1 will be returned, or -2 will be returned on any other error such as
  8038. an invalid <type>.
  8039. Valid types:
  8040. - ACHIEVEINFO_COUNT1
  8041. - ACHIEVEINFO_COUNT2
  8042. - ACHIEVEINFO_COUNT3
  8043. - ACHIEVEINFO_COUNT4
  8044. - ACHIEVEINFO_COUNT5
  8045. - ACHIEVEINFO_COUNT6
  8046. - ACHIEVEINFO_COUNT7
  8047. - ACHIEVEINFO_COUNT8
  8048. - ACHIEVEINFO_COUNT9
  8049. - ACHIEVEINFO_COUNT10
  8050. - ACHIEVEINFO_COMPLETE
  8051. - ACHIEVEINFO_COMPLETEDATE
  8052. - ACHIEVEINFO_GOTREWARD
  8053. - ACHIEVEINFO_LEVEL (<achievement id> is useless for this)
  8054. - ACHIEVEINFO_SCORE (<achievement id> is useless for this)
  8055. ---------------------------------------
  8056. *achievementcomplete(<achievement id>{,<char id>})
  8057. This function will complete an achievement for the attached player or the supplied
  8058. <char id>. The objective requirements are ignored when using this function.
  8059. Returns true on success and false on failure.
  8060. ---------------------------------------
  8061. *achievementexists(<achievement id>{,<char id>});
  8062. This function will return if the achievement exists on the player or the supplied
  8063. <char id> and is completed.
  8064. Returns true on success and false on failure.
  8065. ---------------------------------------
  8066. *achievementupdate(<achievement id>,<type>,<value>{,<char id>})
  8067. This function will update an achievement's value for an achievement of the attached
  8068. player or the supplied <char id>. If the player does not have the achievement active
  8069. (no progress has been made) it will be added to the player's log first before updating
  8070. the <type> value.
  8071. Returns true on success and false on failure.
  8072. See 'achievementinfo' for valid <type> values.
  8073. - ACHIEVEINFO_COMPLETE, ACHIEVEINFO_COMPLETEDATE, and ACHIEVEINFO_GOTREWARD require the
  8074. specific value returned from 'gettimetick(2)'.
  8075. - Excludes ACHIEVEINFO_LEVEL and ACHIEVEINFO_SCORE.
  8076. ---------------------------------------