-
Posts
2044 -
Joined
-
Last visited
-
Days Won
51
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Everything posted by AnnieRuru
-
prontera,155,180,5 script test item reward#2 100,{ .@rand = rand( 17 + 33 + 50 ); // total 100 if ( .@rand < 17 ) { // /17/100 ... about 1/6 * 100% getitem 503, 1; getitem 504, 1; announce "Poring Catcher : We have a winner, "+ strcharinfo(0) +". - won a prize3",0; } else if ( .@rand < 33 ) { // 33/100 ... about 1/3 * 100% getitem 501, 1; announce "Poring Catcher : We have a winner, "+ strcharinfo(0) +". - won a prize2",0; } else { // the rest is 50/100, which is 1/2 * 100% getitem 502, 1; // Cool FB Hat announce "Poring Catcher : We have a winner, "+ strcharinfo(0) +". - won a prize1",0; } end; } if you want make it 100%, then make the variable total up to 100 ...
-
you seriously asking to spoon feed <.< move to script request post the link on which battleground script you using, I make the edit
-
yeah, I also forgotten I posted that lol however I think its better to use something like getwaitingromlist BUILDIN_FUNC(getwaitingroomlist) { struct npc_data* nd = script_hasdata(st,2) ? npc_name2id( script_getstr(st,2) ) : (struct npc_data *)map_id2bl(st->oid); struct chat_data* cd = (struct chat_data *)map_id2bl(nd->chat_id); if ( nd && cd ) { int i; for ( i = 0; i < cd->users; i++ ) mapreg_setreg( reference_uid( add_str("$@waitingroomaid"), i ), cd->usersd[i]->status.account_id ); mapreg_setreg( add_str("$@waitingroomcount"), cd->users ); } return 0; } BUILDIN_DEF(getwaitingroomlist, "?"), prontera,155,187,5 script dsasda 100,{ getwaitingroomlist; for ( .@i = 0; .@i < $@waitingroomcount; .@i++ ) dispbottom rid2name( $@waitingroomaid[.@i] ); end; OnInit: waitingroom "abcd", 3, strnpcinfo(0) +"::Onaaa", 1; end; Onaaa: getwaitingroomlist; announce rid2name( $@waitingroomaid[ $@waitingroomcount -1 ] ) +" has join this waitingroom", 0; end; }
-
moveable / placeable NPC is it possible ?
AnnieRuru replied to sorax's question in Scripting Support
the npc CAN move outside the map with unitwarp + getnpcid prontera,155,187,5 script dsasda 100,{ .@map$ = strnpcinfo(4); npctalk "I am currently in "+ .@map$; sleep 1000; if ( .@map$ == "prontera" ) unitwarp getnpcid(0), "morocc",156,93; else if ( .@map$ == "morocc" ) unitwarp getnpcid(0), "prontera", 156,191; end; } move to script support btw -
- script dshfkdsfjhksfj -1,{ OnPCKillEvent: .@origin = getcharid(3); attachrid killedrid; if ( !getcharid(2) ) end; query_sql "select count(1) from guild_member where guild_id = "+ getcharid(2), .@count; if ( .@count < 10 ) end; if ( getguildmasterid( getcharid(2) ) == getcharid(0) ) getitem 7227, 20, .@origin; else getitem 7227, 10, .@origin; end; } doing like this doesn't feel right better grap this source modification - script dshfkdsfjhksfj -1,{ OnPCKillEvent: .@origin = getcharid(3); attachrid killedrid; if ( !getcharid(2) ) end; getguildmember getcharid(2); if ( $@guildmembercount < 10 ) end; if ( getguildmasterid( getcharid(2) ) == getcharid(0) ) getitem 7227, 20, .@origin; else getitem 7227, 10, .@origin; end; }
-
for creating guild, atcommand "@guild <name>"; can do it but for disbanding guild, need to create a new script command for it hope you don't mind if this is source modification related
-
ahem, I thought I marked this as [Outdated], because @ToastOfDoom beats me in this use this one http://rathena.org/board/topic/57378-toastys-warper/
-
interesting idea, but sadly all these script are very easy to write 1. prontera,152,187,5 script kjdhfkdsjfhks 100,{ if ( countitem(582) >= 2 ) { delitem 582, 2; // Orange getitem 668, 1; // Red packet } mes "Gong Xi Fa Cai"; close; OnNPCKillEvent: if ( rand(1000) < 25 ) // 2.5% drop getitem 582, 1; // getting an orange end; OnInit: // 1.5% chance getting gold coin , else get random money of 100,1000,10000,100000,1000000 setitemscript 668, "{ if ( rand(1000) < 15 ) getitem 671, 1; else zeny = zeny + callfunc( \"F_RandMes\", 5, 100, 1000, 10000, 100000, 1000000 ); }"; end; } you didn't say what are the custom item2. search for hourly point script ... 3. - script ksfjhsdkfhs -1,{ OnInit: monster "prontera", 0,0, "--ja--", 1514, 100, strnpcinfo(0) +"::Onaaa", 2; end; Onaaa: monster "prontera", 0,0, "--ja--", 1514, 1, strnpcinfo(0) +"::Onaaa", 2; end; OnNPCKillEvent: if ( killedrid == 1418 ) getitem 501, 1; // get extra red pot ? end; } PS: just do something to kill time... but yeah, I also started RO since BETA in my country, even before the xmas map release I still remember I joined small guild that couldn't able to conquer any castle when gravity release woe that was so long ago
-
Warping player(s) from a map after a set time
AnnieRuru replied to Gimj's question in Scripting Support
set TimeUsed, gettimetick(2) + 5; // 86400 is one day in seconds. this is just deny usage to warp them out after a set of time, use addtimer http://rathena.org/board/topic/73649-warp-in-warp-out/#entry153373 -
prontera,152,187,5 script kjdhfkdsjfhks 100,{ end; OnInit: waitingroom "test", 3, strnpcinfo(0)+"::Onaaa", 1; end; Onaaa: if ( getwaitingroomstate(0) < 2 ) { announce "a player has join waitingroom", 0; end; } announce "event start", 0; getmapxy .@map$, .@x, .@y, 1; warpwaitingpc .@map$, .@x, .@y, 2; end; } if you want to display the names of those who had join waitingroom, you have to do source modification
-
prontera,152,187,5 script kjdhfkdsjfhks 100,{ atcommand "@kami a\"sdas\"fafs"; atcommand "@kami asdasfafs"; end; } use \ symbol to escape a string
-
reviving this topic -> http://www.eathena.ws/board/index.php?showtopic=183485 add this into SVN BUILDIN_FUNC(getguildmember) { struct guild *g = guild_search( script_getnum(st,2) ); int i, j = 0, c = 0, type = 0; if ( script_hasdata(st,3) ) type = script_getnum(st,3); if ( g ) { for ( i = 0; i < MAX_GUILD; i++ ) { if ( g->member[i].account_id ) { switch ( type ) { case 1: mapreg_setreg( reference_uid( add_str("$@guildmembercid"), j ), g->member[i].char_id ); break; case 2: mapreg_setreg( reference_uid( add_str("$@guildmemberaid"), j ),g->member[i].account_id ); break; case 3: break; default: mapreg_setregstr( reference_uid( add_str("$@guildmembername$"), j ), g->member[i].name ); break; } j++; } } if ( type != 3 ) { mapreg_setreg( add_str("$@guildlv"), g->guild_lv ); mapreg_setreg( add_str("$@guildconnected"), g->connect_member ); mapreg_setreg( add_str("$@guildmax"), g->max_member ); mapreg_setreg( add_str("$@guildexp"), (int)g->exp ); mapreg_setreg( add_str("$@guildmembercount"), j ); } else { for ( i = 0; i < MAX_GUILDALLIANCE; i++ ) { if ( g->alliance[i].guild_id > 0) { mapreg_setreg( reference_uid( add_str("$@guildallianceid"), j ), g->alliance[i].guild_id ); mapreg_setregstr( reference_uid( add_str("$@guildalliancename$"), j ), g->alliance[i].name ); c++; } } mapreg_setreg( add_str("$@guildallianccount"), c ); } script_pushint(st,1); } else { mapreg_setreg( add_str("$@guildmembercount"), 0 ); mapreg_setreg( add_str("$@guildallianccount"), 0 ); script_pushint(st,0); } return 0; } BUILDIN_DEF(getguildmember,"i?"), credit to GodLesZ
-
nude ?
-
prontera,160,180,5 script portal 45,2,2,{ if ( quest_done & 1 << 0 ) warp "guild_vs2",0,0; else // warp "prontera", 27,40; warp "prontera",156,191; end; } prontera,152,180,5 script npc1 100,{ if ( quest_done & 1 << 0 ) { mes "now you can access the dungeon"; close; } else if ( quest == 3 ) { mes "ok now you can access the dungeon"; quest_done = quest_done | 1 << 0 ; quest = 0; // save memory; close; } else if ( quest == 1 || quest == 2 ) { mes "please talk to npc2"; close; } mes "want to go in xxx dungeon ?"; next; mes "talk to npc2"; quest = 1; close; } prontera,156,180,5 script npc2 100,{ if ( quest == 2 ) { if ( kill_poring_count < 10 ) { mes "kill not enough poring"; close; } mes "well done, go talk to npc1"; quest = 3; kill_poring_count = 0; close; } else if ( quest == 1 ) { mes "then go kill 10 poring"; quest = 2; close; } mes "lalalala~~"; close; OnNPCKillEvent: if ( quest == 2 && killedrid == 1002 && kill_poring_count < 10 ) dispbottom "poring killed ["+ kill_poring_count++ +"/10]"; end; } reset kill_poring_count into 0 when done
-
its not by 100% percent, but per-total 1/16 chance get prize3 5/16 chance get prize2 10/16 chance get prize1 16 is the total of 1+5+10
-
yeah I just realized my getitemname2 function was outdated so I just made a new one its 700 lines script btw ...
-
these are mostly unpopular scripts that probably not getting a lot of replies more popular ones will be in separated topics getitemname2 function for the moment use version 2.4 Global Function PS: why am I getting rep even before I make any release ? O.O
- 9 replies
-
- 24
-
-
the above script should be a daily script oh well the configuration part might be confusing I made it in-game configuration then daily_quest_0.3.txt
-
ok ... just made a pinned topic prontera,155,180,5 script test item reward#2 100,{ .@rand = rand( 1 + 5 + 10 ); // total 16 if ( .@rand < 1 ) { // 1/16 getitem 503, 1; getitem 504, 1; announce "Poring Catcher : We have a winner, "+ strcharinfo(0) +". - won a prize3",0; } else if ( .@rand < 1+5 ) { // 5/16 getitem 501, 1; announce "Poring Catcher : We have a winner, "+ strcharinfo(0) +". - won a prize2",0; } else { // the rest getitem 502, 1; // Cool FB Hat announce "Poring Catcher : We have a winner, "+ strcharinfo(0) +". - won a prize1",0; } end; }
-
I make a continuation of this topic this topic mainly concern about unpopular but useful scripting techniques ... should wiki this up someday Randomize item reward Method 1: use F_Rand function. Method 2: use temporary variables. Method 3: use array. Method 1: use F_Rand function Method 2: use temporary variables Method 3: use array sigh ... I seriously need someone to make the english better, my explanation always sux any staff member here feels like can make this topic better, please do so
- 2 replies
-
- 11
-
-
-
// ~~~~~ show time left in days, hours, minutes and seconds ~~~~~ function script timeleft__ { if ( ( .@left = getarg(0) ) <= 0 ) return getarg(0); .@day = .@left / 86400; .@hour = .@left % 86400 / 3600; .@min = .@left % 3600 / 60; .@sec = .@left % 60; if ( .@day ) return .@day +" day "+ .@hour +" hour"; else if ( .@hour ) return .@hour +" hour "+ .@min +" min"; else if ( .@min ) return .@min +" min "+ .@sec +" sec"; else return .@sec +" sec"; } - script lasdlkasdla -1,{ OnInit: .page = 2; bindatcmd "list_premium", strnpcinfo(0)+"::Onaaa", 99, 100; end; Onaaa: query_sql "select count(1) from global_reg_value where str = '#PremiumUser'", .@total; while (1) { .@nb = query_sql( "select account_id as a, ( select name from `char` where account_id = a limit 1 ), value from global_reg_value where str = '#PremiumUser' limit "+ .page +" offset "+ .@currentpage * .page, .@aid, .@name$, .@value ); mes "current page no."+( .@currentpage +1 )+". total "+ ( .@total / .page +1 ) +" pages"; for ( .@i = 0; .@i < .@nb; .@i++ ) mes ( .@currentpage * .page + .@i +1 ) +". "+ .@name$[.@i] +" ["+ .@aid[.@i] +"] -> "+ callfunc( "timeleft__", .@value[.@i] - gettimetick(2) ) ; next; if ( select( "next", "previous" ) == 1 ) { if ( .page * ( .@currentpage +1 ) < .@total ) .@currentpage++; else { mes "end of page"; close; } } else { if ( .@currentpage ) .@currentpage--; else { mes "start of the page"; close; } } } close; // doesn't reach } to be honest ... that Time2Str is made after my timeleft__ function ... my timeleft__ function made together with itemlist function made 4 years ago but Time2Str function only added 2 years ago and its display method doesn't suit my taste ( I think it display according to official ? ) if the .@Time_Left is at 86402 my timeleft__ function display "1 day 0 hour" Time2Str display "1 day, 2 seconds", without telling anything about hour or minute
-
I wonder this is npc1, npc2 or ... 3rd npc ?let's see ... npc 1 if ( quest_done ) { warp "dungeon", 0,0; end; } else if ( quest == 3 ) { mes "ok now you can access the dungeon"; quest_done | 1 << 0 ; quest = 0; // save memory; close; } else if ( quest == 1 || quest == 2 ) { mes "please talk to npc2"; close; } mes "want to go in xxx dungeon ?"; next; mes "talk to npc2"; quest = 1; close; npc 2 if ( quest == 2 ) { if ( kill_poring_count < 100 ) { mes "kill not enough poring"; close; } mes "well done, go talk to npc1"; quest = 3; close; } else if ( quest == 1 ) { mes "then go kill 100 poring"; quest = 2; close; } mes "<insert some text here>"; close; OnNPCKillEvent: if ( quest == 2 && killedrid == 1002 && kill_poring_count < 100 ) dispbottom "poring killed ["+ kill_poring_count++ +"/100]"; end; nostalgic ... I used to love to write this kind of quest script 6 years ago
-
sleep 3600000 + rand(3600000); // 1 hour + random minutes within 1 hour I thought mine already comply your request ?
-
sry I didn't test the script throughly yesterday // ~~~~~ show time left in days, hours, minutes and seconds ~~~~~ function script timeleft__ { if ( ( .@left = getarg(0) ) <= 0 ) return getarg(0); .@day = .@left / 86400; .@hour = .@left % 86400 / 3600; .@min = .@left % 3600 / 60; .@sec = .@left % 60; if ( .@day ) return .@day +" day "+ .@hour +" hour"; else if ( .@hour ) return .@hour +" hour "+ .@min +" min"; else if ( .@min ) return .@min +" min "+ .@sec +" sec"; else return .@sec +" sec"; } prontera,167,178,1 script Player Promoter 436,{ set .@name$,"^228B22[ Player Promoter ]^000000"; mes .@name$; if ( getgmlevel() == 99 ) { mes "Hi Admin, do you want to distribute ^00CC00Player Promoter Cards^000000 with your name on it ?"; next; for ( .@i = 1; .@i <= .total_group; .@i++ ) .@menu$ = .@menu$ +"Distribute "+ getitemname( .group_idreq[.@i] ) +":"; .@s = select( .@menu$ ); getitem2 .group_idreq[.@s], 1,1,0,0, 254, 0, getcharid(0) % ( 1 << 16 ), getcharid(0) >> 16; close; } else if ( getgmlevel() > 1 ) { mes "Only Admin can use me"; close; } for ( .@i = 1; .@i <= .total_group; .@i++ ) .@menu$ = .@menu$ +( ( getgroupid() < .@i && countitem( .group_idreq[.@i] ) )? "upgrade to "+ .group_name$[.@i] : "" )+":"; if ( getstrlen( #pp_accupgrade$ ) ) { sscanf #pp_accupgrade$, "%d %d", .@id, .@time; mes "Your account is currently a ^00CC00"+ .group_name$[.@id] +"^000000. You still have ^0000FF"+ callfunc( "timeleft__", .@time - gettimetick(2) )+"^000000."; if ( getstrlen( .@menu$ ) == .total_group ) close; } else if ( getstrlen( .@menu$ ) == .total_group ) { mes "Make a donation and you can upgrade your account to become Super Players ^^"; close; } mes "Do you want to upgrade your account ?"; next; .@s = select( .@menu$ ); delitem .group_idreq[.@s], 1; #pp_accupgrade$ = .@s +" "+( gettimetick(2) + 604800 ); // 1 week atcommand "@adjgroup "+ .@s; mes .@name$; mes "Your account has successfully upgraded to "+ .group_name$[1]; sc_start sc_expboost, 2147483647, 300; // sc_start sc_itemboost, 2147483647, 100; close; OnPCLoginEvent: if ( getgmlevel() > 1 ) #pp_accupgrade$ = ""; if ( !getstrlen( #pp_accupgrade$ ) ) { sc_end sc_expboost; sc_end sc_itemboost; end; } sscanf #pp_accupgrade$, "%d %d", .@id, .@time; .@left = .@time - gettimetick(2); if ( .@left > 0 ) { atcommand "@adjgroup "+ .@id; if ( .@left >= 2147483 ) { sc_start sc_expboost, 2147483647, 300; // sc_start sc_itemboost, 2147483647, 100; } else { addtimer .@left *1000, strnpcinfo(0) +"::Ondemote"; sc_start sc_expboost, .@left *1000, 300; // sc_start sc_itemboost, .@left *1000, 300; } end; } Ondemote: atcommand "@adjgroup 0"; sc_end sc_expboost; sc_end sc_itemboost; message strcharinfo(0), "Your account has demoted to normal player"; #pp_accupgrade$ = ""; end; OnInit: // setarray .group_<definition>, <group ID 1>, <group ID 2>, <group ID 3>; ... must follow the sequence in 1,2,3,4,5 ... setarray .group_idreq[1], 31002; setarray .group_name$[1], "Super Player"; .total_group = 1; end; }
-
/* create table log.gm_item_giver ( id int(11) not null auto_increment primary key, `time` datetime, gm_give varchar(23), receiver varchar(23), nameid smallint(6), amount smallint(6), refine tinyint(4), card0 smallint(6), card1 smallint(6), card2 smallint(6), card3 smallint(6) ) engine = archive; */ // ~~~~~ show time left in days, hours, minutes and seconds ~~~~~ function script timeleft__ { if ( ( .@left = getarg(0) ) <= 0 ) return getarg(0); set .@day, .@left / 86400; set .@hour, .@left % 86400 / 3600; set .@min, .@left % 3600 / 60; set .@sec, .@left % 60; if ( .@day ) return .@day +" day "+ .@hour +" hour"; else if ( .@hour ) return .@hour +" hour "+ .@min +" min"; else if ( .@min ) return .@min +" min "+ .@sec +" sec"; else return .@sec +" sec"; } prontera,155,184,4 script dksfjskjf 100,{ if ( getgmlevel() < .eventgmlevel ) end; mes "input the player name"; next; if ( input( .@name$, 4, 23 ) ) close; else if ( !( .@aid = getcharid(3, .@name$) ) ) { mes "player not exist or not online"; close; } else if ( .@aid == getcharid(3) ) { mes "that's you ... baka"; close; } .@name$ = rid2name(.@aid); mes "select the item to give"; next; .@s = select( .menu$ ) -1; if ( getd( "#gm_give_"+ .itemid[.@s] ) + .delay[.@s] * 60 > gettimetick(2) ) { mes "you still can't give this prize to players"; mes "time left: "+ callfunc( "timeleft__", getd( "#gm_give_"+ .itemid[.@s] ) + .delay[.@s] * 60 - gettimetick(2) ); close; } mes "input amount to give."; mes "max = "+ .maxamount[.@s]; next; if ( input( .@amount, 1, .maxamount[.@s] ) ) close; mes "input refine"; next; if ( input( .@refine, 0, 100 ) ) close; for ( .@i = 0; .@i < 4; .@i++ ) { mes "input card "+ ( .@i +1 ); if ( input( .@card[.@i], 0, 32767 ) ) close; else if ( !.@card[.@i] ) ; else if ( getitemname( .@card[.@i] ) == "null" ) { mes "no such item exist"; close; } else if ( getiteminfo( .@card[.@i], 2 ) != 6 ) { mes "the input itemID is not a card"; close; } } next; mes "are you sure want to give"; .@itemid = .itemid[.@s]; mes .@name$ +" "+ .@amount +" "+ callfunc( "getitemname2", .@itemid, 1, .@refine, 0, .@card[0], .@card[1], .@card[2], .@card[3] ) +" ?"; next; if ( select ( "Yes", "No" ) == 2 ) close; else if ( !isloggedin(.@aid) ) { mes "player suddenly log off"; close; } .@origin = getcharid(3); attachrid .@aid; if ( !checkweight( .itemid[.@s], .@amount ) ) { attachrid .@origin; mes "player is currently overweight"; close; } getitem2 .itemid[.@s], .@amount, 1, .@refine, 0, .@card[0], .@card[1], .@card[2], .@card[3]; attachrid .@origin; announce strcharinfo(0) +" give "+ .@name$ +" "+ .@amount +" "+ callfunc( "getitemname2", .@itemid, 1, .@refine, 0, .@card[0], .@card[1], .@card[2], .@card[3] ), 0; setd "#gm_give_"+ .itemid[.@s], gettimetick(2); query_logsql "insert into gm_item_giver values ( null, now(), '"+ escape_sql( strcharinfo(0) ) +"', '"+ escape_sql(.@name$) +"', "+ .itemid[.@s] +", "+ .@amount +", "+ .@refine +", "+ .@card[0] +","+ .@card[1] +","+ .@card[2] +","+ .@card[3] +")"; close; OnInit: .eventgmlevel = 60; // event gm level setarray .itemid, 501, 502, 1201, 1101; // the only item id to give setarray .maxamount, 1000, 100, 1, 1; // maximum amount of item to give. this is give 1000 red pot maximum setarray .delay, 1, 2, 1, 1; // delay in minute // can give red potion , max 1000, delay 1 minute // can give orange potion, max 100, delay 2 minute .@size = getarraysize( .itemid ); for ( .@i = 0; .@i < .@size; .@i++ ) .menu$ = .menu$ + getitemname( .itemid[.@i] ) +":"; end; }