-
Posts
163 -
Joined
-
Last visited
-
Days Won
8
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by Hyroshima
-
-
Please explain to me what the script should do normally?
-
Add below after of OnPCLoginEvent:
if(getgroupid() == 99) end;
Ex:
OnPCLoginEvent: if(getgroupid() == 99) end; for( .@i = 13; .@i <= 18; .@i++ )
- 1
-
14 hours ago, Emistry said:
there exists another way for you, in case you afraid to mess up with the index value.
for (.@i = getarraysize(.@tmp_magic_shop) - 1; .@i >= 0; .@i--) if(!.@tmp_magic_shop[.@i]) deletearray .@tmp_magic_shop[.@i],1;
start looping from the end of the array to the front...
OMG, I even thought of doing so, but I was tired and did not reasoned more kkkkk
Thank you ^^
I'm creating an interesting store, i do not know if it already exists, because I've never seen something similar.
I have not been developing anything for a while, sometimes i get stuck in a small complex problem but looking at script_command.txt I'll reminding.
Thanks again ^^
-
54 minutes ago, TARTs said:
prontera,152,184,5 script formNPCTemplate 54,{ .@tmp_magic_shop[0] = 0; .@tmp_magic_shop[1] = 1; .@tmp_magic_shop[2] = 1; .@tmp_magic_shop[3] = 1; dispbottom "Array Value Before: " + getarraysize(.@tmp_magic_shop) + ""; for(.@i = 0; .@i < getarraysize(.@tmp_magic_shop); .@i++) dispbottom "" + .@tmp_magic_shop[.@i] + ""; L_DoItAgain: for(.@i = 0; .@i < getarraysize(.@tmp_magic_shop); .@i++) { if(!.@tmp_magic_shop[.@i]){ deletearray .@tmp_magic_shop[.@i],1; goto L_DoItAgain; } } dispbottom "Array Value After: " + getarraysize(.@tmp_magic_shop) + ""; for(.@i = 0; .@i < getarraysize(.@tmp_magic_shop); .@i++) dispbottom "" + .@tmp_magic_shop[.@i] + ""; end; }
OMG, I forgot that deletearray moves the index.
Thank you very much!!
-
Please give me more information!
-
Hello guys, I'm having a problem which is making me confused. The situation is the deletion of null values of an array, however a null value remains...
dispbottom "Array Value Before: "+getarraysize(.@tmp_magic_shop)+""; for(set .@i,0; .@i<getarraysize(.@tmp_magic_shop); set .@i,.@i+1) { dispbottom ""+.@tmp_magic_shop[.@i]+""; }
Remove null values.
for(set .@i,0; .@i<getarraysize(.@tmp_magic_shop); set .@i,.@i+1) { if(!.@tmp_magic_shop[.@i]) deletearray .@tmp_magic_shop[.@i],1; }
dispbottom "Array Value After: "+getarraysize(.@tmp_magic_shop)+""; for(set .@i,0; .@i<getarraysize(.@tmp_magic_shop); set .@i,.@i+1) { dispbottom ""+.@tmp_magic_shop[.@i]+""; }
OBS:
deletearray .@tmp_magic_shop[0],1; <- remove that value 0
the confusion is why this value It's not removed like the others.
Thank you since now!
-
if(Custom !=1){ -> if(#Custom !=1){
set Custom,1; -> set #Custom,1;
-
@lordfelll iai man, demorou um pouco pq tou ocupado (estudando kkk), script simples pra fazer ^^. (Reciclagem de cards) ver se ficou como esperado, como eu nunca vi esse script fiz de acordo com oq vc explicou ai.
- 1
- 1
-
1 hour ago, sader1992 said:
https://github.com/rathena/rathena/blob/532e043490368eea038a1808a6b35bf7c4fa0e97/doc/script_commands.txt#L678
% - will give you the remainder of the division. 7%2 is equal to 1.
also do you mean out side of rathena ? why is this in general support section ?
Sorry for posting in the wrong section, I'm a little crazy.
I forgot about this basic math question...
Any value divided by 2 that has left over is odd
Thank you!
SOLVED!!
Sorry, i edited and ended up doing another post '-'
-
Hello again
I was searching and there is nothing where I can check if a number is odd or pair.
can not create a function to check because the number may or may not have a high value.
Thank you to all who can help!
By: Hyro~
-
hoho, I have to stop using alt + c & alt + v kk.
I work on a very complete quest script and I think the excess complexity is leaving me with the lack of attention kk
wait for him to answer his code is impeccél! rsrs
-
rdy:
prontera,152,166,5 script Quest KMob 4_M_02,{ if(mob_qt1) { if(QT_MobKill1 < mob_qt1 || QT_MobKill2 < mob_qt2 || QT_MobKill3 < mob_qt3 || QT_MobKill4 < mob_qt4 || QT_MobKill5 < mob_qt5) { mes "You have not completed the mission!"; mes "Kill: ["+QT_MobKill1+"/"+mob_qt1+"] "+strmobinfo(1,mob_id1)+""; if(mob_qt2) mes "Kill: ["+QT_MobKill2+"/"+mob_qt2+"] "+strmobinfo(1,mob_id2)+""; if(mob_qt3) mes "Kill: ["+QT_MobKill3+"/"+mob_qt3+"] "+strmobinfo(1,mob_id3)+""; if(mob_qt4) mes "Kill: ["+QT_MobKill4+"/"+mob_qt4+"] "+strmobinfo(1,mob_id4)+""; if(mob_qt5) mes "Kill: ["+QT_MobKill5+"/"+mob_qt5+"] "+strmobinfo(1,mob_id5)+""; close; } mes "Congratulations, you completed the quest!"; atcommand "@aura 2"; set mob_id1,0; set mob_qt1,0; set mob_id2,0; set mob_qt2,0; set mob_id3,0; set mob_qt3,0; set mob_id4,0; set mob_qt4,0; set mob_id5,0; set mob_qt5,0; close; } mes "Hello, will I now ask you to kill some monsters for me ok?"; if(select("Ok:I do not want...")==2){ close; } next; set mob_id1,1031; //mob_id set mob_qt1,50; //Qty set mob_id2,1002; //mob_id set mob_qt2,150; //Qty set mob_id3,1166; //mob_id set mob_qt3,200; //Qty set mob_id4,1784; //mob_id set mob_qt4,250; //Qty set mob_id5,1095; //mob_id set mob_qt5,300; //Qty mes "Okay, go and kill:", ""+mob_qt1+"x "+strmobinfo(1,mob_id1)+"", ""+mob_qt2+"x "+strmobinfo(1,mob_id2)+"", ""+mob_qt3+"x "+strmobinfo(1,mob_id3)+"", ""+mob_qt4+"x "+strmobinfo(1,mob_id4)+"", ""+mob_qt5+"x "+strmobinfo(1,mob_id5)+""; close; OnNPCKillEvent: if(killedrid == mob_id1){ set QT_MobKill1,QT_MobKill1+1; dispbottom "["+QT_MobKill1+"/"+mob_qt1+"] "+strmobinfo(1,mob_qt1)+""; } if(killedrid == mob_id2){ set QT_MobKill2,QT_MobKill2+1; dispbottom "["+QT_MobKill2+"/"+mob_qt2+"] "+strmobinfo(1,mob_qt2)+""; } if(killedrid == mob_id3){ set QT_MobKill3,QT_MobKill3+1; dispbottom "["+QT_MobKill3+"/"+mob_qt3+"] "+strmobinfo(1,mob_qt3)+""; } if(killedrid == mob_id4){ set QT_MobKill4,QT_MobKill4+1; dispbottom "["+QT_MobKill4+"/"+mob_qt4+"] "+strmobinfo(1,mob_qt4)+""; } if(killedrid == mob_id5){ set QT_MobKill5,QT_MobKill5+1; dispbottom "["+QT_MobKill5+"/"+mob_qt5+"] "+strmobinfo(1,mob_qt5)+""; } end; }
- 1
-
Sorry, I just realized... the way I did this is random, I tried to do the same for 5 but it did not work very well, i can do it for 5 mobs but it will be fixed and not random, can it be?
-
29 minutes ago, AnnieRuru said:
if(QP_Act && killedrid == .mob_id[QP_Val])
I'm sure this condition is wrong
if you use Comparisons conditions ( || == &&), it only return true(1) or false(0)
since you want to make the condition to be true that is in the .mob_id array, you have to loop it
but the question is this, if QP_Act equals 0, so stop, and if 1 then it checks killedrid == .mob_id [QP_Val]
or should it be:
if(QP_Act) { if(killedrid == .mob_id[QP_Val]) }
?
- 1
-
try this:
QuoteSET `pool`=`pool` '-1'
instead of:
QuoteSET `pool` = '-1'
-
6 hours ago, sweetmole said:
hi everyone
can i request a simple script like this
an npc that gives u a quest to kill 5 different mobs with 1000 qty. item requirements. once done the npc will set @aura to a player
Hi...
prontera,152,166,5 script Quest KMob 4_M_02,{ if(QP_Act) { if(QT_MobKill < .mob_qt[QP_Val]) { mes "You have not completed the mission!","Kill: ["+QT_MobKill+"/"+.mob_qt[QP_Val]+"] "+strmobinfo(1,.mob_id[QP_Val])+""; close; } mes "Congratulations, you completed the quest!"; atcommand "@aura 2"; set QP_Act,0; set QT_MobKill,0; close; } mes "Hello, will I now ask you to kill some monsters for me ok?"; if(select("Ok:I do not want...")==2){ close; } next; set QP_Val,rand(1,getarraysize(.mob_id))-1; //Get a random mob_id set QP_Act,1; mes "Okay, go and kill "+.mob_qt[QP_Val]+"x "+strmobinfo(1,.mob_id[QP_Val])+" !"; close; OnNPCKillEvent: if(QP_Act && killedrid == .mob_id[QP_Val]){ set QT_MobKill,QT_MobKill+1; } end; OnInit: setarray .mob_id[0],1031,1002,1166,1784; //Mob ID, limited (0,126) mobs_ids setarray .mob_qt[0], 1, 2, 3, 5; //Qty kills, limited (0,126) mobs_qty end; }
- 1
-
4 hours ago, Nitrous said:
You add all of the numbers, and each item has a rate of number/sum.
sum = 5 + 1 + 14 = 20
Knife = 5 / 20 = 25%
Dagger = 1 / 20 = 5%
Jellopy = 14 / 20 = 70%
Many thanks for responding ^^..
Then, as you explained, did not have repeated numbers, I figured that's repeated values are indebted by of quantity the sum of rates in which it is repeated correctly?
my example below, how I understood ...
Quote1 selects all items in the category.
2 sum all values in `rate`
3 after obtaining the values above, each value in `rate` will be defined based on the total value of the sum of of rates,
and then check each item to see what the value in% is worth of that item in relation to the total value of the sum of rates!
box1
{
607,5
608,1
609,3
610,5
611,10
}
Exp1:picks up all items in (box1), total: 5
Exp2:
sum all rates in (box1), total: 24
Exp3:
then define the value that each item will have a chance:
box1 (defined rate)
{
607 = 20,83%
608 = 4,16%
609 = 12,5%
610 = 20,83%
611 = 41,66%total percent: 99,98
total percent rounded (above of ,5): 100
} -
3 hours ago, AnnieRuru said:
Ty...
But I wanted to understand how it was done to have this rate in% of the examples?
https://github.com/rathena/rathena/blob/master/doc/item_group.txt#L51
Rate: Probability to get the item. Not a percentage value! Examples: IG_MyItemGroup,Knife,5 IG_MyItemGroup,Dagger,1 - Knife has chance 5/6 (83.3%) to be obtained - Dagger has chance 1/6 (16.7%) to be obtained
I created a system in sql:
- id (auto-increment)
- item_id
- item_qtd (amount)
- rate (%)
- cat (would be like the groupid, box ID.)
But the system is basically basic rand (1,100)
set .@rate,rand(1,100); query_sql "SELECT `item_id`,`item_qtd`,`rate` FROM `custom_box` WHERE `rate`>='"+.@rate+"' AND `cat`='"+getarg(0)+"' ORDER BY RAND() LIMIT 1",.@id,.@qtd,.@rt; if(!.@id) query_sql "SELECT `item_id`,`item_qtd`,`rate` FROM `custom_box` WHERE `rate`='100' AND `cat`='"+getarg(0)+"' ORDER BY RAND() LIMIT 1",.@id,.@qtd,.@rt; if(!.@id){ dispbottom "[ Custom Box ]: Houve um erro, por favor informe a um GM!"; end; } getitem .@id,.@qtd; end;
the rand () method does not work well, so I would like to understand how the rate of the items added in a custom box works.
Thank you in advance for your attention!
By: Hyro~
-
44 minutes ago, maken06 said:
ty, but I need to understand what happens!
Pseudocode -
Hello, I would like to understand how the item box system works
Ex:
// Old Card Album Obtainable Items Database // // Structure of Database: // GroupID,ItemID,Rate IG_CardAlbum,4001,10 // Poring Card IG_CardAlbum,4002,10 // Fabre Card IG_CardAlbum,4003,6 // Pupa Card
// Old Blue Box Obtainable Items Database // // Structure of Database: // GroupID,ItemID,Rate IG_BlueBox,501,12 // Red Potion IG_BlueBox,502,12 // Orange Potion IG_BlueBox,503,12 // Yellow Potion IG_BlueBox,504,12 // White Potion
I would like to know which method is being used to calculate the rate or what it is based on.
thank you, by Hyro~
-
5 hours ago, Sindit said:
Então, cara, o erro está aqui:
"+.@qpname$[.@i]+"
Quando você seleciona das tabelas dando apenas um argumento, ele não cria uma array.
Tenta assim:
query_sql "SELECT `account_id`,`MaxQPoints` FROM `login` WHERE `MaxQPoints` > '0' ORDER BY `MaxQPoints` DESC LIMIT 10",.@acid,.@maxqp; for(set .@i,0; .@i<getarraysize(.@acid); set .@i,.@i+1) { query_sql "SELECT `name` FROM `char` WHERE `account_id`='"+.@acid[.@i]+"' AND `QP_CharPref`='1'",.@qpname$; mes " [ "+(.@i+1)+"º ] "+.@qpname$+" ~ "+.@maxqp[.@i]+""; } close;
Nossa mano eu jurava que que a var era uma array, muito obrigado me ajudou bastante ^^.
-
Boa tarde pessoal ^^, então estava adicionando um pequeno ranking (sugestão de um amigo) no sistema de quest que estou finalizando, porem o for() funciona e não ao mesmo tempo.
query_sql "SELECT `account_id`,`MaxQPoints` FROM `login` WHERE `MaxQPoints` > '0' ORDER BY `MaxQPoints` DESC LIMIT 10",.@acid,.@maxqp; for(set .@i,0; .@i<getarraysize(.@acid); set .@i,.@i+1) { query_sql "SELECT `name` FROM `char` WHERE `account_id`='"+.@acid[.@i]+"' AND `QP_CharPref`='1'",.@qpname$; mes " [ "+(.@i+1)+"º ] "+.@qpname$[.@i]+" ~ "+.@maxqp[.@i]+""; } close;
O problema é o seguinte, tenho 2 registro como resultado do .@acid e .@maxqp, o problema é na hora de puxar o nome do char, puxa somente o primeiro, os seguintes só mostra o .@maxqp que é da query fora fo for(), mas a questão é q não mostra o nome mas mostra o valor que o char q não mostrou o nome tem.
O real problema é essa query aqui que só está executando o valor de .@i uma vez:
query_sql "SELECT `name` FROM `char` WHERE `account_id`='"+.@acid[.@i]+"' AND `QP_CharPref`='1'",.@qpname$;
e o resultado é esse:
Como podem ver, o .@i funciona certinho até por quê a ordem de número aparecem normal.
ex aqui as colunas:
ALTER TABLE `char` ADD `QP_CharPref` INT(1) NOT NULL default '0'; ALTER TABLE `login` ADD `MaxQPoints` INT(5) NOT NULL default '0';
Obs: Fiquei um tempo parado então pode ser alguma coisa haver com lógica q estrou me atrapalhando xD
Um amigo sugeriu o seguinte:
query_sql "SELECT `char`.`name`,`login`.`MaxQPoints` FROM `char` LEFT JOIN `login` WHERE `char`.`QP_CharPref` = 1 AND `login`.`MaxQPoints` > 0 ORDER BY `login`.`MaxQPoints` DESC LIMIT 0,10",.@name$,.@value; query_sql "SELECT count(account_id) FROM `login` WHERE `MaxQPoints`>='1' LIMIT 0,10",.@count; for(set .@i,0; .@i< .@count; set .@i,.@i+1) { mes " [ "+(.@i+1)+"º ] "+.@name$[.@i]+" ~ "+.@value[.@i]+""; } close; end;
Porem algo no join não está correto, tentei executar direto no phpmyadmin a parte do sql e deu o mesmo erro.
Se alguém poder explicar pq o meu método não está funcionando me ajudaria muito a compreender ^^, desde já grato Hyro!
-
Hello, sorry to revive the topic... I'm using the latest eAthena rev, manually added without any problem...
The only problem is that tombs do not disappear!
Thank you in advance!
@Edit:
debug show:
[07/Aug/2017 07:30][Warning]: npc_parsename: Duplicate unique name in file 'arse_mob: Unknown mob ID %d (file '%s', line '%d'). ', line'1'. Renaming 'helpony@moc_pryd06' to '1_124_101_85'. [07/Aug/2017 07:30][Debug]: this npc: display name 'Tomb#1511|4039238' unique name 'helpony@moc_pryd06' map=moc_pryd06, x=101, y=85 [07/Aug/2017 07:30][Debug]: other npc: display name 'Tomb#1511|3788501' unique name 'helpony@moc_pryd06' map=moc_pryd06, x=103, y=84
-
Does anyone know how I can get in touch with yommy?
Thank you in advance!~
ITEM_ENCHANTARMS assigned element question
in Scripting Support
Posted · Edited by Hyroshima
^^
script_commands.txt (/map/script.cpp)