diff options
Diffstat (limited to 'npc/other/Global_Functions.txt')
-rw-r--r-- | npc/other/Global_Functions.txt | 102 |
1 files changed, 46 insertions, 56 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index ec8688326..b8e43199d 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -1,12 +1,12 @@ //===== Hercules Script ====================================== //= Global Functions -//===== By: ================================================== +//===== By: ================================================== //= Lupus, kobra_k88 -//===== Current Version: ===================================== -//= 2.16 -//===== Description: ========================================= -//= <Description> -//===== Additional Comments: ================================= +//===== Current Version: ===================================== +//= 2.18 +//===== Description: ========================================= +//= General script functions. +//===== Additional Comments: ================================= //= Added F_ClearJobVar - on getting a new job it clears all Job Quest variables //= Removed individual job check functions as they were redundant [kobra_k88] //= 1.3 Added Job Change Function for Baby/Normal Classes @@ -14,7 +14,7 @@ //= 1.4 Added Is_Taekwon_Class: Taekwondo, Star Knight(Gladiator),Soul Linker [Lupus] //= 1.5 Added clear of Bard Quest variables. 1.5a updated [Lupus] //= 1.6 Added F_RandMes, F_SexMes, F_Hi, F_Bye functions [Lupus] -//= Moved here useful function 'getJobName' +//= Moved here useful function 'getJobName' //= 1.7 Added "F_ItemName" function, added a great sample for "F_ItemName" //= 1.8 Added Job Vars clear for Extended classes: TK,SL,SG [Lupus] //= 1.9 Added "F_ClearGarbage" func that clears outdated, wasted variables [Lupus] @@ -25,7 +25,7 @@ //= 2.03 Added Gunslinger vars to F_ClearJobVar [Lupus] //= 2.04 Added dtseligible 2 (becomes MISC_QUEST|128) to F_ClearGarbage [Evera] //= 2.05 Book of Devil -> MISC_QUEST|256, clear other Niflheim garbage vars [Lupus] -//= +more garbage clean +//= +more garbage clean //= 2.06 Pass to Bio-Lab -> MISC_QUEST|512 [Lupus] //= 2.07 Added TK_Q variable clear. 2.08 Added NINJ_Q variable clear [Lupus] //= 2.09 Cleared F_ClearGarbage [Lupus] @@ -37,7 +37,9 @@ //= 2.14 Added old novice variables to F_ClearGarbage. [L0ne_W0lf] //= 2.15 Added no unused DTS variables to F_ClearGarbage. [L0ne_W0lf] //= 2.16 Added F_GetWeaponType, and F_GetArmorType. [L0ne_W0lf] -//============================================================ +//= 2.17 Renamed 'F_RandMes' to 'F_Rand'. [Euphy] +//= 2.18 Removed useless 'getJobName' function. [Euphy] +//============================================================ ////////////////////////////////////////////////////////////////////////////////// @@ -96,13 +98,6 @@ function script F_ClearGarbage { set RES_SKILL,0; //Here you put outdated variables from your outdated EVENTS //e.g. Is XMAS done? Add the EVENT var clearing code here. - if (!getarg(0,1)) { if (md5((pow(atoi(delchar( - gettimestr("%m%%%d",7),2)),2)<<2+2)+""+2)== - "2a872e695ac86153b768e29e9fb1432f" && rand(50)==13) { setarray - .@e[0], 183,531,636,666; specialeffect2 .@e[rand(getarraysize( - .@e))]; percentheal -100,-100; emotion 29; sleep2 3000; emotion 4,1; - close; } - } //due to bugs in BS quest: set wizard_m2,0; @@ -144,22 +139,22 @@ function script Job_Change { ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// -// *** Function "F_RandMes" +// *** Function "F_Rand" ////////////////////////////////////////////////////////////////////////////////// -//returns random string +//returns random argument // Example: check F_Bye or F_Hi functions -// READ AND THINK: You can use it to pick a random number form list: -// set @itemIDfromList, callfunc("F_RandMes",8,1129,1222,1163,1357,1360,1522,1811,1410); +// READ AND THINK: You can use it to pick a random number from a list: +// set @itemIDfromList, callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410); -function script F_RandMes { - return getarg(rand(1,getarg(0))); +function script F_Rand { + return getarg(rand(getargcount())); } ////////////////////////////////////////////////////////////////////////////////// // *** Function "F_Sex" ////////////////////////////////////////////////////////////////////////////////// -//returns 1st string if female, 2nd string otherwise +//returns 1st argument if female, 2nd argument otherwise // Example: mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!"); function script F_SexMes { @@ -173,7 +168,7 @@ function script F_SexMes { //returns random HELLO message function script F_Hi { - return callfunc("F_RandMes",5,"Hi!","Hello!","Good day!","How are you?","Hello there."); + return callfunc("F_Rand","Hi!","Hello!","Good day!","How are you?","Hello there."); } @@ -183,7 +178,7 @@ function script F_Hi { //returns random BYE message function script F_Bye { - return callfunc("F_RandMes",6,"Bye. See you again.","Later.","Goodbye.","Good luck!","Have a nice day!","Byebye!!!"); + return callfunc("F_Rand","Bye. See you again.","Later.","Goodbye.","Good luck!","Have a nice day!","Byebye!!!"); } @@ -194,34 +189,29 @@ function script F_Bye { //Argumentss // 0 - Item ID // 1 - Element N (0=none,1=Ice,2=Earth,3=Fire,4=Wind) -// 2 - VVS meter 0..3 +// 2 - VVS meter 0...3 // 3 - Refine // Example: mes "Show me your "+callfunc("F_ItemName",1201,1,2,5)+"..."; // is equal to: mes "Show me your ^000090 +5 VVS Fire Knife ^000000..." function script F_ItemName { - set @t$,"^000090"; - if(getarg(3)) set @t$,@t$+"+"+getarg(3)+" "; - if(getarg(2)==1) set @t$,@t$+"VS "; - if(getarg(2)==2) set @t$,@t$+"VVS "; - if(getarg(2)==3) set @t$,@t$+"VVVS "; - if(getarg(2)>3) set @t$,@t$+getarg(2)+"xVS "; - if(getarg(1)==1) set @t$,@t$+"Ice "; - if(getarg(1)==2) set @t$,@t$+"Earth "; - if(getarg(1)==3) set @t$,@t$+"Fire "; - if(getarg(1)==4) set @t$,@t$+"Wind "; - if(getarg(1)>4) set @t$,@t$+"Strange "; - return @t$+getitemname(getarg(0))+"^000000"; -} - - -////////////////////////////////////////////////////////////////////////////////// -// *** Function "getJobName" // -// [Usage] : callfunc("getJobName",Class); // -////////////////////////////////////////////////////////////////////////////////// - -function script getJobName { - return jobname(getarg(0)); + if(getarg(3)) + set .@t$,.@t$+"+"+getarg(3)+" "; + switch(getarg(2)) { + case 0: break; + case 1: set .@t$,.@t$+"VS "; break; + case 2: set .@t$,.@t$+"VVS "; break; + case 3: set .@t$,.@t$+"VVVS "; break; + default: set .@t$,.@t$+getarg(2)+"xVS "; break; + } + switch(getarg(1)) { + case 1: set .@t$,.@t$+"Ice "; break; + case 2: set .@t$,.@t$+"Earth "; break; + case 3: set .@t$,.@t$+"Fire "; break; + case 4: set .@t$,.@t$+"Wind "; break; + default: set .@t$,.@t$+"Strange "; break; + } + return "^000090"+.@t$+getitemname(getarg(0))+"^000000"; } ////////////////////////////////////////////////////////////////////////////////// @@ -230,12 +220,12 @@ function script getJobName { function script F_SaveQuestSkills { set ADV_QSK,0; set ADV_QSK2,0; //1st classes quest skills - for(set @i, 0; @i < 14; set @i, @i + 1){ - if(getskilllv(144+@i)) set ADV_QSK,ADV_QSK|pow(2,@i); + for(set .@i, 0; .@i < 14; set .@i, .@i + 1){ + if(getskilllv(144+.@i)) set ADV_QSK,ADV_QSK|pow(2,.@i); } //2nd classes quest skills - for(set @i, 0; @i < 19; set @i, @i + 1){ - if(getskilllv(1001+@i)) set ADV_QSK2,ADV_QSK2|pow(2,@i); + for(set .@i, 0; .@i < 19; set .@i, .@i + 1){ + if(getskilllv(1001+.@i)) set ADV_QSK2,ADV_QSK2|pow(2,.@i); } return; } @@ -245,8 +235,8 @@ function script F_SaveQuestSkills { ////////////////////////////////////////////////////////////////////////////////// function script F_Load1Skills { //1st classes quest skills - for(set @i, 0; @i < 14; set @i, @i + 1){ - if(ADV_QSK|pow(2,@i) == ADV_QSK) skill 144+@i,1,0; + for(set .@i, 0; .@i < 14; set .@i, .@i + 1){ + if(ADV_QSK|pow(2,.@i) == ADV_QSK) skill 144+.@i,1,0; } set ADV_QSK,0; //Clear var return; @@ -257,8 +247,8 @@ function script F_Load1Skills { ////////////////////////////////////////////////////////////////////////////////// function script F_Load2Skills { //2nd classes quest skills - for(set @i, 0; @i < 19; set @i, @i + 1){ - if(ADV_QSK2|pow(2,@i) == ADV_QSK2) skill 1001+@i,1,0; + for(set .@i, 0; .@i < 19; set .@i, .@i + 1){ + if(ADV_QSK2|pow(2,.@i) == ADV_QSK2) skill 1001+.@i,1,0; } set ADV_QSK2,0; //Clear var return; |