• 0
Hyllok

Random Skill System - Problems with blank skills

Question

Hello there!
I'm relatively new to programming/scripting.
I'm developing a NPC for a PRE-RE server that grants 6 permanent random skills to the player.
Briefly, how players will win the skills will be based on randomness and not on the traditional skill tree (idea based on a private WoW server).

My problem is:
When selecting random results from arrays, sometimes not all skills are shown in the skilltree, even though the range of IDs is in accordance with db\pre-re\skill_db.txt
I know I may be doing something wrong with the arrays. 
I have tried to read a lot of documentation, but due to my lack of experience I can not locate the problem.

prontera,150,150,4	script	Nevasca	78,{

//Checking if player has already confirmed the skills
If(SkillsIniciais) { 
mes "[ Alita ]";
mes "Voce ja confimou suas skills iniciais!";
end;
}

//Starting conversation
mes "[ Alita ]";
mes "Boas vindas ao Sistema Aleatorio de Skills!";
mes "Eu irei invocar ^FF0000 6 skills aleatorias^000000 para seu personagem.";
mes "Essas skills serao ^0000FFpermanentes em seu personagem.^000000";
next;
menu "Rolar as skills!",Roll,"Mais Informacoes",Info,"Cancelar",Sair;

//Informations about the Random Skills System
Info:
mes "[ Alita ]";
mes "Nesse sistema, voce recebe 6 skills iniciais aleatorias de qualquer classe.";
mes "As skills iniciam no nivel 1 e conforme seu personagem for evoluindo, voce recebe pontos para aprimora-las.";
mes "Em certos niveis, voce recebe mais skills para utilizar.";
close;
end;

//Rollling System
Roll:

/*
Ending up any buffs, reseting skills and removing any skill points before go!
*/

sc_end_class;
ResetSkill;
set SkillPoint,0;

/*
Setting the desired Skill IDs from db/pre-re/skill_db.txt of each pack
*/

setarray [email protected],rand(27,28);
setarray [email protected],rand(36,53);
setarray [email protected],rand(55,81);
setarray [email protected],rand(83,157);
setarray [email protected],rand(210,238);
setarray [email protected],rand(248,313);

/*
Giving to player the six random skills selected above
*/

skill [email protected],1,0;
skill [email protected],1,0;
skill [email protected],1,0;
skill [email protected],1,0;
skill [email protected],1,0;
skill [email protected],1,0;

specialeffect2 104,0;

/*
Asking for confirmation
*/

mes "ATENCAO!";
mes "Se houver ^008080menos de 6 skills^000000 na aba ETC de sua arvore de habilidades, ^FF0000NAO CONFIRME A ROLAGEM!^000000";
next;
mes "^FF0000Apos a confirmacao, elas se tornarao permanentes em seu personagem.^000000";
mes "Deseja confirmar as skills?";
switch( prompt("Rolar Novamente:Confirmar Skills") ){

//Re-roll
Case 1:
goto Roll;
end;

//Confirming the skills
Case 2:

/*
Preventing abuse
*/
if( !SkillsIniciais ){
set SkillsIniciais,1;

specialeffect2 68,0;
next;
mes "Skills confirmadas com sucesso!";
mes "Boa sorte em sua jornada, aventureiro.";
break;
}

//Preventing "Cancel button" abuse
Case 255:
sc_end_class;
ResetSkill;
set SkillPoint,0;
specialeffect2 235,0;
mes "Operacao Cancelada.";
break;
}
close;

//Ending conversation
Sair:
mes "Adeus!";
close;
end;
}

Mirror: https://pastebin.com/raw/3FY9maCQ

 

screenHyllokRO001.jpg

Edited by Hyllok
Changed font, updated mirror

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 1
setarray .allSkillId[0],2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,243,244,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,378,379,380,381,382,383,384,385,386,387,388,389,390,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,446,445,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,572,573,574,575,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,697,698,706,708,709,711,715,716,717,718,720,727,728,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2019,2020,2201,2202,2203,2204,2205,2206,2207,2208,2209,2210,2211,2212,2213,2214,2215,2216,2217,2218,2219,2220,2221,2222,2223,2224,2226,2227,2228,2229,2231,2232,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2050,2051,2052,2053,2054,2055,2056,2057,2515,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2290,2291,2292,2293,2294,2295,2296,2297,2298,2299,2300,2301,2302,2303,2304,2307,2308,2309,2310,2311,2312,2313,2314,2315,2316,2317,2318,2319,2320,2321,2322,2323,2324,2325,2519,2520,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335,2336,2337,2338,2339,2340,2341,2342,2343,2344,2345,2346,2347,2348,2517,2518,2350,2351,2352,2381,2382,2383,2412,2413,2414,2415,2416,2417,2418,2419,2420,2421,2422,2423,2424,2425,2426,2427,2428,2429,2430,2431,2432,2433,2434,2516,2444,2445,2446,2447,2448,2449,2450,2451,2452,2453,2454,2455,2456,2457,2458,2459,2460,2461,2462,2463,2464,2465,2466,2467,2468,2474,2475,2476,2477,2478,2479,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495,2496,2497,2498,2533,2534,2535,2536,2537,2544,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,2586,2587,2588,2589,2590,2591,2592,2593,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3031,3032,3033,3034,3035,5001,5002,5003,5004,5005,5006,5007,5008,5009,5010,5011,5012,5013,5014,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,5040,5041,5042,5043,5044,5045,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,5056,5063,5064,5065,5067,5072,5073,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,10000,10001,10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016;
	

 

Use array above to check that's all available skill id in rAthena.

Edited by Start_

Share this post


Link to post
Share on other sites
  • 1

The only way to achieve what you want is to use 

skill id_here,level_here,3;

And it gets really messy with you want to reroll because the skills just don't get removed that easily. You have to do a SQL query to remove the skills, and it's tricky to have the skills removed even with that.

Share this post


Link to post
Share on other sites
  • 0

Thanks @Start_ and @Hijirikawa for your answers!
On my testings, I have discovered that the issue actually is when the random skill is a passive skill.

I have inserted a debug that returns the ID of the drawn skill, and everytime that a passive skill is given, the skilltree ETC tab becames blank.

 

mes "Rolando!";
skill .@rdsk1,1,0;
mes "Skill 1: "+.@rdsk1+"";
next;

mes "Rolando!";
skill .@rdsk2,1,0;
mes "Skill 2: "+.@rdsk2+"";
next;

mes "Rolando!";
skill .@rdsk3,1,0;
mes "Skill 3: "+.@rdsk3+"";
next;

mes "Rolando!";
skill .@rdsk4,1,0;
mes "Skill 4: "+.@rdsk4+"";
next;

mes "Rolando!";
skill .@rdsk5,1,0;
mes "Skill 5: "+.@rdsk5+"";
next;

mes "Rolando!";
skill .@rdsk6,1,0;
mes "Skill 6: "+.@rdsk6+"";

Is it any kind of configuration on server side or it is a source sided modification?

Oh, and I was wondering if there is a way to prevent repeated numbers for the six arrays on my code, this way it will not give duplicated skills, messing with the code again.

 

Thanks in advance! 😉

Edited by Hyllok

Share this post


Link to post
Share on other sites
  • 0

Updating:

I have solved this issue and developed a system that allow to reroll permanent skills, as they are commited in db only when the player logs off.

prontera,156,189,4	script	Nevasca	78,{

//Checando se as Skills Iniciais já foram confirmadas pelo jogador, se sim não permite prosseguir
/*
If(SkillsIniciais) { 
mes "[ Alita ]";
mes "Voce ja confimou suas skills iniciais!";
end;
}
*/

//Iniciando o diálogo
mes "[ Alita ]";
mes "Boas vindas ao Sistema Aleatorio de Skills!";
mes "Eu irei invocar ^FF0000 6 skills aleatorias^000000 para seu personagem.";
mes "Essas skills serao ^0000FFpermanentes em seu personagem.^000000";
next;
menu "Rolar as skills!",Roll,"Mais Informacoes",Info,"Cancelar",Sair;

//Informacoes sobre o Sistema Randomico de Skills
Info:
mes "[ Alita ]";
mes "Nesse sistema, voce recebe 6 skills iniciais aleatorias de qualquer classe.";
mes "As skills iniciam no nivel 1 e conforme seu personagem for evoluindo, voce recebe pontos para aprimora-las.";
mes "Em certos niveis, voce recebe mais skills para utilizar.";
close;
end;

//Sistema Randomico de Skills
Roll:

/*
Removendo qualquer buff, skill ou ponto de skill antes de iniciar
*/

sc_end_class;
ResetSkill;
set SkillPoint,0;

/*
Setando o ID das skills com base no arquivo db/pre-re/skill_db.txt de cada uma das 6 rolagens
*/

setarray .@RandomSkill1[0],2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60;
set .Random1, rand( getarraysize( .@RandomSkill1 ) );

setarray .@RandomSkill2[0],61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99;
set .Random2, rand( getarraysize( .@RandomSkill2 ) );

setarray .@RandomSkill3[0],300,301,302,303,304,305;
set .Random3, rand( getarraysize( .@RandomSkill3 ) );

setarray .@RandomSkill4[0],400,401,402,403,404,405;
set .Random4, rand( getarraysize( .@RandomSkill4 ) );

setarray .@RandomSkill5[0],406,407,408,409,410,411;
set .Random5, rand( getarraysize( .@RandomSkill5 ) );

setarray .@RandomSkill6[0],412,413,414,415,416,417;
set .Random6, rand( getarraysize( .@RandomSkill6 ) );

/*
Concedendo ao jogador as 6 skills aleatórias
*/
skill .@RandomSkill1[ .Random1 ],1,3;
skill .@RandomSkill2[ .Random2 ],1,3;
skill .@RandomSkill3[ .Random3 ],1,3;
skill .@RandomSkill4[ .Random4 ],1,3;
skill .@RandomSkill5[ .Random5 ],1,3;
skill .@RandomSkill6[ .Random6 ],1,3;

specialeffect2 104,0;
next;

/*
Solicitando confirmação
*/
mes "[ Alita ]";
mes "ATENCAO!";
mes "Se houver ^008080menos de 6 skills^000000 na aba ETC de sua arvore de habilidades, ^FF0000NAO CONFIRME A ROLAGEM!^000000";
next;
mes "[ Alita ]";
mes "^FF0000Apos a confirmacao, elas se tornarao permanentes em seu personagem.^000000";
mes "Deseja confirmar as skills?";
switch( prompt("Rolar Novamente:Confirmar Skills") ){

//Rolando novamente, apagando as skills anteriores
Case 1:
skill .@RandomSkill1[ .Random1 ],0,0;
skill .@RandomSkill2[ .Random2 ],0,0;
skill .@RandomSkill3[ .Random3 ],0,0;
skill .@RandomSkill4[ .Random4 ],0,0;
skill .@RandomSkill5[ .Random5 ],0,0;
skill .@RandomSkill6[ .Random6 ],0,0;
goto Roll;
end;

//Confirmando as skills
Case 2:

/*
Previnindo abuso de rolagem após confirmação
*/
if( !SkillsIniciais ){
set SkillsIniciais,1;

specialeffect2 68,0;
next;
mes "Skills confirmadas com sucesso!";
mes "Voce sera deslogado para finalizacao do processo!";
mes "Boa sorte em sua jornada, aventureiro.";
atcommand "@kick " + strcharinfo(0);
break;
}

//Previnindo abuso ao clicar no botão "Cancel", que possibilita o jogador não confirmar as skills e ainda possuí-las
Case 255:
sc_end_class;
ResetSkill;
set SkillPoint,0;
skill .@RandomSkill1[ .Random1 ],0,0;
skill .@RandomSkill2[ .Random2 ],0,0;
skill .@RandomSkill3[ .Random3 ],0,0;
skill .@RandomSkill4[ .Random4 ],0,0;
skill .@RandomSkill5[ .Random5 ],0,0;
skill .@RandomSkill6[ .Random6 ],0,0;
specialeffect2 235,0;
mes "[ Alita ]";
mes "Operacao Cancelada!";
break;
}
close;

//Finalizando o diálogo
Sair:
mes "[ Alita ]";
mes "Adeus!";
close;
end;
}

https://pastebin.com/raw/eLS60c0j

 

Thank you all, this thread can be closed!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...