-
Posts
2,407 -
Joined
-
Last visited
-
Days Won
49
Community Answers
-
Capuche's post in [Basic-to-experts] Ways to call a "function" in another npc. was marked as the answer
- script DualControl -1,{
OnInit:
bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";// create @test command for the sample
.whiteList$ = "2000000,2000001,2000002,2000003";
end;
OnAtcommand:
[email protected]_result = query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE "+
"login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1 and account_id != "+ getcharid(3), [email protected]_id;
if ( [email protected]_result > 0 && compare( .whiteList$,getcharid(3) +"" ) == 0 )// not in the list
dispbottom "there is "+ [email protected]_result +" people with the same ip than you";
end;
}
-
Capuche's post in getd/getarg() and arrays was marked as the answer
getelementofarray( getarg(0),<index> ) should work
-
Capuche's post in Script help was marked as the answer
prontera,150,150,5 script Sample 89,{
if ( gettimetick(2) > .timer ) {
query_sql "SELECT `cards`,`card_name`,`points`,`id` FROM `cards` WHERE `id` = "+ rand(1,494) +" limit 1", .ccards, .cnames$, .cpoints, .card_index;
.timer = gettimetick(2) + 5 *60;
}
mes "I'm missing a " + .cnames$ + ". I can offer " + .cpoints + " premium points in return. # "+ .card_index;
close;
}
-
Capuche's post in "getarraysize" need to be closed after use? was marked as the answer
Well getarraysize return the size of an array. No need to do something else to use it
-
Capuche's post in query_sql("UPDATE `char` SET `mvp_point` = 'mvp_point+1' WHERE char_id = '"+escape_sql( getcharid(0) )+"'"); was marked as the answer
Maybe because of the quotes 'mvp_point+1' ?
query_sql("UPDATE `char` SET `mvp_point` = mvp_point+1 WHERE char_id = '"+ getcharid(0) +"'"); -
Capuche's post in Where to get job changer with kagerou but rebellion is disabled was marked as the answer
He searchs a job changer Emistry
Try to replace
if (Class == Job_Ninja || Class == Job_Gunslinger) by
if (Class == Job_Ninja) setarray [email protected][0], ( Sex ? Job_Kagerou : Job_Oboro ), 70; -
Capuche's post in Requesting a dynamic shop with skull_points was marked as the answer
poring_w02,177,176,5 pointshop Mvp Points Trader 112,#monster_points,7539:1 remove the 116 number (what is it about?)
-
Capuche's post in Wrong Eden Equipment rewards in very recent revision was marked as the answer
That's weird but official..
-
Capuche's post in Shop NPC with waiting room was marked as the answer
- shop Custons Grátis 714,1750:1,1770:2,1751:3,1752:3;
prontera,146,192,3 script Custons Grátis 714,{
callshop "Custons",1;
end;
OnInit:
waitingroom "Custons Grátis!",0,"",0;
}
-
Capuche's post in How do I make "boss type" not to be thorn trapped? was marked as the answer
case UNT_THORNS_TRAP: is a part of a big switch( )
just put before the switch
struct mob_data *md = BL_CAST(BL_MOB, bl); -
Capuche's post in Warp to savepoint when respawn within certain coordinates was marked as the answer
Wait why did I use a function?!
//5x5 area around the npc prtg_cas04,160,150,1 script gmwarpouttreasure -1,6,6,{ OnTouch: if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strcharinfo(3),1 ) ) != getcharid(0)) mes "You are not a Guild Master of this Castle"; else if (getgmlevel() > 1 && getgmlevel() <= 98) mes "GAME MASTER, you are not allowed here."; else end; close2; warp "SavePoint",0,0; end; } prtg_cas05,281,176,1 duplicate(gmwarpouttreasure) gmwarpouttreasure2 -1,6,6 // others duplicate for other castle -
Capuche's post in Force duplicated npc to use a label was marked as the answer
It does and it will run your loop every duplicate, only
OnInit: getmapxy [email protected]$, [email protected], [email protected], 1; unitwarp 0, [email protected]$, -1, -1; end; is needed
-
Capuche's post in Loop variables was marked as the answer
Each player talking to the npc run an unique instance. 2 players talking to a npc don't share their scope variable. When a player stop talking the script end and the scope variable - attached the instance- are deleted from memory (no need to keep them in memory isn't it? otherwise it's a waste of memory).
-
Capuche's post in Novice potion support npc was marked as the answer
or like
prontera,150,150,1 script dfh 56,{ if (BaseLevel > 100) [email protected]_id = 504;// white potion else [email protected]_id = 501 + (BaseLevel -1) / 25; if ( ( getiteminfo([email protected]_id,6) + Weight ) < ( MaxWeight/2 ) ) { [email protected] = ( MaxWeight /2 - Weight ) / getiteminfo([email protected]_id,6);// 50% maxweight - my weight / item weight if ( ( getiteminfo([email protected]_id,6) * [email protected] + Weight ) >= ( MaxWeight/2 ) )// weight at exactly 50% [email protected]; getitem [email protected]_id, [email protected]; } end; } Stolao care about the lvl > 100 for 501 + Baselevel / 25
-
Capuche's post in Fusion Item was marked as the answer
My bad.. you're right
and I forgot to delete the requirement
mes "[ Fused Card ]"; mes "-- Fused Phreeoni Card --"; next; setarray [email protected][0], 501, 505, 503, 504; setarray [email protected][0], 1, 1, 1, 1; mes "-- Requirements --"; for ( [email protected] = 0; [email protected] < 4; [email protected]++ ) { if ( countitem([email protected][[email protected]]) >= [email protected][[email protected]] ) { [email protected]++; [email protected]$ = "^0000ff1"; } else [email protected]$ = "^ff00000"; mes "x"+ [email protected]$ +"/"+ [email protected][[email protected]] +" "+ getitemname([email protected][[email protected]]); } next; mes "-- New Effect --"; mes "HIT +150"; mes "Add a 5% chance of auto casting Stone Curse status when hit by enemy."; next; mes "-- Success Rate --"; mes "90% Fail and 10% success."; if ( [email protected] == 4 ) { next; if ( select( "Do it", "Bye" ) == 1 ) { if ( rand(1,100) <= 10 ) { mes "Success !"; getitem <your item>,1; } else { mes "Failed"; } for ( [email protected] = 0; [email protected] < 4; [email protected]++ ) delitem [email protected][[email protected]],[email protected][[email protected]]; } } close; I added the an array for the amount
-
Capuche's post in Storage npc was marked as the answer
Try
SELECT `account_id`,COUNT( `nameid` ) AS `total` FROM `storage` GROUP BY `account_id` HAVING `total` >= 400 ORDER BY `total` DESC -
Capuche's post in query sql was marked as the answer
Ho okay I misread your update function
need to replace -3 by 3
set [email protected]_id,getcharid(3); updatePoints( [email protected]_id,3 ); // dispbottom "Relogue para ter seu VIP ativado."; -
Capuche's post in Add gunslinger,ninja in script line was marked as the answer
Add the condition for your class
if ( ( [email protected] & EAJL_UPPER || Class == 24 || .... ) && BaseLevel == 99 ) { -
Capuche's post in bonus2 bAddRace,Race_ALL,7; bonus bAspdRate,10; was marked as the answer
http://irowiki.org/wiki/ASPD#ASPD_Formula
The final aspd formula is divided into 3 parts.
bonus bAspdRate,10; only impact on the Base ASPD Equip ASPD % part (Equip ASPD Mod)
Basically it's
final aspd = [ part1 + part2 + (part3 revised with the bonus) ]
it's not 10% of the final aspd
Edit : misread
-
Capuche's post in Explode into an Integer not a String was marked as the answer
Maybe make a loop to convert the string to int with atoi command
explode( [email protected]_string$, "1,2,3,4", "," ); [email protected] = getarraysize( [email protected]_string$ ); for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) [email protected]_int[[email protected]] = atoi( [email protected]_string$[[email protected]] ); (or use bitwise operator)
-
Capuche's post in NPC gives buffs for zeny was marked as the answer
https://github.com/rathena/rathena/blob/master/npc/custom/healer.txt
-
Capuche's post in Gachapon npc help with set.array was marked as the answer
You got a lot of items of item 9 because the last setarray overwrite the value of .Items array starting to index 9
//Gachapon NPC// prontera,156,196,5 script Gachapon Valkyrie#1 403,{ //Items Available through Gachapon NPC// setarray [email protected][0],7081,7075,7074,5075,501,520,521,522,523,525,526,528,529,530,2433,2424,2423,2291,2295,2289,2288,2299,19816,19820,19828,19824,19819,19816,19839,19825,19827,19830,19831,19832,19833,19836,19837,19839,19840,19843,19847,19848,19851,19852,7835,2261,2262,2263,2264,2265,2266; setarray [email protected][0],7073,7090,20002,502,2423,2424,2423,2301,2302,2304,2305,2307,19801,19802,19806,19807,19812,19814,19891,19893,19896,19900,19897,19885,19871,19837,19861,19859,19891,19896,19810,19815,19834,19838,19850,19868,19879,19883,19887,19888,2287,2288,2289,2365,2366,2367,2368,2369,2370,2371,2381; setarray [email protected][0],4008,503,2395,2396,2398,2399,4067,4075,4094,4098,4097,4100,4134,4147,4148,4144,4143,4142,4141,4139,4165,4145,4146,4138,4137,4135,4168,4169,4198,4200,4199,4174,4276,4302,4318,4346,4353,4342,4357,4360,4359,4356,4363,4361,4365,4366,4365,4367,4374,4375,4372,4386,4388,4389; setarray [email protected][0],4008,504,4403,4404,4405,4406,4407,4408,4419,4420,4424,4425,4425,4425,4426,7837,7838,7830,12102,12103,12104,12105,12106,12107,12108,12110,12111,12112,12113,12114,12115,12116,12117,12118,12119,12120,12122,12123,12124,19803,19804,19808,19809,19811,19813,19817,19818,19821,19822; setarray [email protected][0],4008,505,19845,19846,19849,19854,19860,19862,19866,19870,19872,19874,19876,19877,19878,19880,19881,19892,19884,19895,19898,19899,20000,20005,20006,20009,20008,20011,20017,20018,20019,20021,20023,20024,20028,7080,20030,20029,20039,20045,20046,20047,20048,20049,20051,20057,20058,20056; setarray [email protected][0],4008,7082,7083,20090,20091,20092,20093,20094,20095,20097,20098,20099,20102,20104,20105,20108,20109,20110,20111,20112,20115,20116,20117,20119,20123,20125,20128,20130,20133,20134,20137,20140,20141,20142,20143,20147,20150,20151,20153,20154,20155,20156,20157,20158,20159,20174,20161; setarray [email protected][0],4008,20169,20170,20171,20172,20177,20178,20179,20180,20184,20186,20187,20189,20190,20191,20199,20200,7086,7089,20202,20203,20205,20216,20217,20219,20221,20222,20224,20225,20226,20227,20233,20235,20236,20239,20240,20243,20245,7076,20249,20250,20251,20252,20254,20255,20257,20260; setarray [email protected][0],4008,20284,20288,20290,20294,20296,20299,7079,7078,7092,7088,7091,20322,20323,20324,20325,20326,20327,20329,20330,20331,20332,20335,20336,20337,20343,20344,20346,20347,20349,20350,20352,20353,20354,20355,20359,20354,20369,20386,20387,20389,20388,20392,20391,20368,20395,20393; setarray [email protected][0],7835,7836,7837,7838,7830,7831,7832,7833,7834,7080,7081,7082,7083,7084,7085,7086,7089,7075,7074,7073,7077,7076,7079,7078,7090,7092,7088,7091,20413,20414,20415,20416,20418,20419,20420,20423,20486,20487,20488,20489,20499,20501,20504,20505,20507,20510,20511,20514; setarray [email protected][0],7835,7836,7837,7838,7830,7831,7832,7833,7834,20010,20012,20026,20041,20052,20053,20070,20080,20083,20085,20097,20100,20101,20103,20214,20149,20167,20106,20513,20535,20550,20558,20879,20884,20001,20002,20003,20004,20007,20013,20014,20015,20020,20022,20025,20027,20031,20032,20034,20035,20036; mes "[Gachapon Valkyrie]"; mes "Hello, you can earn 1 random item of the following:"; mes "God Item Ingredients, Rare Equipments, Cards, Wings or Junks if you give me the following items."; next; mes "1 Special Exchange Ticket"; next; mes "Do you have the items?"; switch(select("-Yes, i have them:-No, let me go fot them")) { case 1: mes "Alright, let's see..."; if(countitem(6153) <1){ mes "You don't have them, go for them and then comeback..."; } else { mes "Alright, seems like you have them, here you go, good luck!"; set [email protected]_array, rand(10); set [email protected]_index, rand(getarraysize( getd( "[email protected]"+ [email protected]_array ) )); getitem getd( "[email protected]"+ [email protected]_array +"["+ [email protected]_index +"]" ), 1; delitem 6153,1; } close; case 2: mes "Alright, good luck on the hunting."; close; } } -
Capuche's post in How to convert number when max int was marked as the answer
you can use insertchar to insert something in the string
insertchar(<string>,<char>,<index>)
like this
function format_number; mes format_number( "100000", "," );// display 100,000 close; function format_number { [email protected]$ = getarg(0); [email protected]$ = getarg(1); [email protected] = getstrlen( [email protected]$ ); for ( [email protected] = ( [email protected]%3 ? [email protected]%3 : 3 ); [email protected] < [email protected]; [email protected] += 4 ) { [email protected]$ = insertchar( [email protected]$, [email protected]$, [email protected] ); [email protected]++; } return [email protected]$; }
I forgot the function in the main repo..
////////////////////////////////////////////////////////////////////////////////// // Returns a number with commas between every three digits. // -- callfunc "F_InsertComma",<number> // Examples: // callfunc("F_InsertComma",7777777) // returns "7,777,777" ////////////////////////////////////////////////////////////////////////////////// function script F_InsertComma { set [email protected]$, getarg(0); for (set [email protected],getstrlen([email protected]$)-3; [email protected]>0; set [email protected],[email protected]) set [email protected]$, insertchar([email protected]$,",",[email protected]); return [email protected]$; } it's better D:
-
Capuche's post in Command '@question' problem/doubt was marked as the answer
You're welcome!
I forgot, the source doesn't create a chat if the player doesn't have basic skill lvl 4 too, is near a npc or is mute