Jump to content

Winterfox

Members
  • Content Count

    403
  • Joined

  • Last visited

  • Days Won

    10

Reputation Activity

  1. Upvote
    Winterfox got a reaction from Lord Ganja in How to get the index of an array variable?   
    @@Lord Ganja
     
    Depends on what you want to do. If you wan't to use the index to check for a specific value you could do it like this:
    setarray .@mob_ids, 1002, 1003, 1004, 1005;.@mob_id = 1004;for(.@i=0; .@i < getarraysize(.@mobIds); .@i++) {   .@blacklist[.@mobIds[.@i]] = 1;}if(!.@blacklist[.@mob_id]) { // Do something} But thats only worth if you want to have some kind of black/white list. Since if you iterate trough it depending on what you store you will get a pretty high index and will have to iterate over tons of empty values.

    You also could do something like this:
    setarray .@mob_ids$, 1002, 1003, 1004, 1005;.@mob_id$ = 1004;if(strcmp(":" + .@mob_id$ + ":", implode(.@mob_ids$, ":")))  {   // Do something.} If you really want a way to easily get the index to a value you would need to do it like that i guess:
    setarray .@mob_ids, 1002, 1003, 1004, 1005;.@mob_id = 1005;for(.@i=0; .@i < getarraysize(.@mob_ids); .@i++) {   .@mob_ids_lookup[.@mob_ids[.@i]] = .@i;}mes getmonsterinfo(.@mob_ids[.@mob_ids_lookup[.@mob_id]], 0);close;
  2. Upvote
    Winterfox got a reaction from mrlongshen in A clickable item to zeny and some command   
    @@mrlongshen
     
    Add this NPC:
    - script ZENY_TO_MITHRIL_COIN -1,{ OnInit: bindatcmd("convert", "ZENY_TO_MITHRIL_COIN::OnConvert"); end; OnConvert: if( Zeny < 10000000 ) { dispbottom "You need atleast 10.000.000z to get Mithril Coins."; end; } .@coinCount = Zeny / 10000000; Zeny -= .@coinCount * 10000000; getitem Mithril_Coin, .@coinCount;}function  script  convert  {  .@coinCount = countitem(Mithril_Coin);  if( !.@coinCount ) {    dispbottom "You need atleast 1 Mithril Coin to get 10.000.000z.";    end;  }      delitem Mithril_Coin, .@coinCount;  Zeny += .@coinCount * 10000000;} afterwards make Mithril Coin usable and use this as item script:
    callfunc("convert");
  3. Upvote
    Winterfox got a reaction from mrlongshen in All monster drops specific item with blacklist mobs   
    @@mrlongshen
     
    - script GLOBAL_LOOT -1,{ OnInit: // Config // // ItemID, Rate ( [1:10000], Example: 1000 = 0,1%, 100 = 1%... ) setarray .drops, Poring_Coin, 100 , TCG_Card, 100; .blacklist$ = "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235," + "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299," + "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313," + "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974," + "1975,1976,1977,1978,1979"; .dropCount = getarraysize(.@drops); // Main Code while( sleep( 500 ) ) { .@rc = query_sql("SELECT ID FROM `mob_db` WHERE ID NOT IN( " + .blacklist$ + " ) LIMIT " + .@currentOffset + ", 128", .@MobIds ); for( .@i = 0; .@i < .@rc; .@i++ ) { for( .@y = 0; .@y < .dropCount; .@y += 2 ) addmonsterdrop( .@MobIds[.@i], .drops[.@y], .drops[(.@y + 1)] ); } if( .@rc < 128 ) break; .@currentOffset += .@rc; } end;}
  4. Upvote
    Winterfox got a reaction from tmav94 in Ways to convert script to function   
    @@tmav94
     
    - script whiteList -1,{ OnWhisperGlobal: mes "Lista Atualizada"; $whiteList$ = "2000000,2000794,2000839,2000637,2000624,2000016,2004000,2003933,2003884"; mes $whiteList$; close;}function script restrictedCode { .@query_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", .@account_id); if ( .@query_result > 1 && compare( $whiteList$, getcharid(3) ) == 0 ) { mes "[WARNING]"; mes "Access Denied"; close; }}prontera,166,206,5 script Example 405,{ callfunc( "restrictedCode" ); mes "Access granted!"; close;}prontera,164,200,5 script Example2 405,{ callfunc( "restrictedCode" ); mes "Access granted!"; close;}
  5. Upvote
    Winterfox got a reaction from Kaminitsu in [REQ] New Donation System   
    @@rector
     
    prontera,166,207,4 script Flux Point Shop 4_M_YOUNGKNIGHT,{ openshop; end; OnInit: setarray .@itemIds,501, 502, 503; setarray .@itemPrices, 1, 1, 1; tradertype( NST_CUSTOM ); for( .@i = 0; .@i < getarraysize( .@itemIds ); .@i++ ) sellitem .@itemIds[ .@i ], .@itemPrices[ .@i ]; end; OnCountFunds: query_sql "SELECT balance FROM cp_credits WHERE account_id = " + getcharid( 3 ), .@balance; setcurrency( .@balance ); end; OnPayFunds: query_sql "SELECT balance FROM cp_credits WHERE account_id = " + getcharid( 3 ), .@balance; if( .@balance < @price ) end; query_sql "UPDATE cp_credits SET balance = balance - " + @price + " WHERE account_id = " + getcharid( 3 ); purchaseok(); end;}
  6. Upvote
    Winterfox got a reaction from minx123 in [REQ] New Donation System   
    @@rector
     
    prontera,166,207,4 script Flux Point Shop 4_M_YOUNGKNIGHT,{ openshop; end; OnInit: setarray .@itemIds,501, 502, 503; setarray .@itemPrices, 1, 1, 1; tradertype( NST_CUSTOM ); for( .@i = 0; .@i < getarraysize( .@itemIds ); .@i++ ) sellitem .@itemIds[ .@i ], .@itemPrices[ .@i ]; end; OnCountFunds: query_sql "SELECT balance FROM cp_credits WHERE account_id = " + getcharid( 3 ), .@balance; setcurrency( .@balance ); end; OnPayFunds: query_sql "SELECT balance FROM cp_credits WHERE account_id = " + getcharid( 3 ), .@balance; if( .@balance < @price ) end; query_sql "UPDATE cp_credits SET balance = balance - " + @price + " WHERE account_id = " + getcharid( 3 ); purchaseok(); end;}
  7. Upvote
    Winterfox got a reaction from zhaosin in Error language ( chane to chinese ) !   
    @@zhaosin
     
    Opensetup: http://nn.nachtwolke.com/dev/opensetup/
  8. Upvote
    Winterfox got a reaction from OverLord in Get Guild Level on Script   
    @@OverLord
     
    There is no actual function to do this but you could create one on your own like this:
    function script getGuildLvl { .@res = query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '" + getarg( 0 ) + "'", .@guild_lv; if( .@res ) return .@guild_lv; return 0;}
  9. Upvote
    Winterfox got a reaction from Creek in Ajuda com DEBUG   
    @@Creek
     
    I didn't open it, since the error was clear. It was just hard to find where the variable is used. In line 388.
    getmapxy(getd(".m$"+strnpcinfo(3)),getd(".x"+strnpcinfo(3)),getd(".y"+strnpcinfo(3)),1); getd gets a reference to a variable based on a string, so you can construct the variable name dynamically.
    In this case getd(".m$"+strnpcinfo(3)) is the same as getd(".m$pacporing1"), so you can add the $ like this:
    getmapxy(getd(".m$"+strnpcinfo(3)+"$"),getd(".x"+strnpcinfo(3)),getd(".y"+strnpcinfo(3)),1);
  10. Upvote
    Winterfox got a reaction from Stein in New Prontera Question   
    @@Stein
     
    The easiest way seems to be https://rathena.org/board/topic/53424-weemapcache/.
    But that won't fix the position of the NPCs only the walkpath.
  11. Upvote
    Winterfox got a reaction from JulioCF in Ajuda com DEBUG   
    @@Creek
     
    I didn't open it, since the error was clear. It was just hard to find where the variable is used. In line 388.
    getmapxy(getd(".m$"+strnpcinfo(3)),getd(".x"+strnpcinfo(3)),getd(".y"+strnpcinfo(3)),1); getd gets a reference to a variable based on a string, so you can construct the variable name dynamically.
    In this case getd(".m$"+strnpcinfo(3)) is the same as getd(".m$pacporing1"), so you can add the $ like this:
    getmapxy(getd(".m$"+strnpcinfo(3)+"$"),getd(".x"+strnpcinfo(3)),getd(".y"+strnpcinfo(3)),1);
  12. Upvote
    Winterfox got a reaction from Stein in New Prontera Question   
    @@Stein
     
    http://herc.ws/board/files/file/182-old-prontera/
  13. Upvote
    Winterfox got a reaction from JulioCF in Ajuda com DEBUG   
    @@Creek
     
    Add the postfix $ at the end of the .m$pacporing variables.
  14. Upvote
    Winterfox got a reaction from JulioCF in Ajuda com DEBUG   
    @@Creek
     
    The script function getmapxy atleast uses 4 parameters of which 3 get filled by the function to return results of the search.
     
    The first parameter is a string of the map in your case it should be named .m$pacporing1, .m$pacporing2 and .m$pacporing3 but since they omit the $ at the end of their name they are for integer variables and are not for string content which is returned by getmapxy.
     
    Therefore to work properly you need to change them to: .m$pacporing1$, .m$pacporing2$ and .m$pacporing3$.
  15. Upvote
    Winterfox got a reaction from Sephus in Passing npc array variable to function?   
    - script testnpc 123,{ OnWhisperGlobal: setarray .test[0],1,12,123; callfunc "abc"; end;}function script abc { copyarray .@test, getvariableofnpc(.test,"testnpc"), getarraysize( getvariableofnpc(.test,"testnpc") ); return;}
  16. Upvote
    Winterfox got a reaction from thor1009 in Black tiles with lightmap   
    @newbieppl 
     
    Did you diff patch your client for increased zoom or similiar?
  17. Upvote
    Winterfox got a reaction from eKoh in I want to make a command @bghappy 20 <- 20% bonus   
    I think holding the state if happy hour is enabled or not shouldn't be handled by a temporary character variable.
    I would go for a on and off command build instead of a toggle.
     
    But it doesn't really do what was requested anyway.
    - script bghappy_1 -1,{ OnInit: bindatcmd "bghappy", strnpcinfo( 3 ) + "::OnBGHappyhour", 40, 99; end; OnBGHappyhour: .@rate = atoi( .@atcmd_parameters$[ 0 ] ); setbattleflag "bg_reward_rates", 100 + .@rate; if( .@rate ) { .@ranked = 1; dispbottom "Battlegrounds Happyhour +" + .@rate + "% mode is ON."; } else { .@ranked = 0; dispbottom "Battlegrounds Happyhour mode is OFF."; } setbattleflag "bg_ranked_mode", .@ranked; end;}
  18. Upvote
    Winterfox got a reaction from jaBote in Concerns about function that checks if a given element is in an array   
    @@jaBote
     
    Upon reading it again i realized i could have made it even a bit shorter.
    function script PVPLP_revertLevel { setarray .@maps$, "izlude", "pvp2", "pvp3"; if( !compare( implode( .@maps$, ":" ), strcharinfo( PC_MAP ) ) ) end; atcommand "@blvl " + (PVPLP_TRUE_LEVEL - BaseLevel);} To the Topic:
     
    A native in_array function would be a really great addition.
     
    What also would be really good would be if getarraysize would return the real array size and not the highest index and a way to loop  trough a array via function instead of a index to make things like this possible:
    ... mes "There are " + getarraysize( .demoSpecialMobIds ) + " which currently give you a special bonus."; mes "These mobs are the following: "; while( .@mobId = next_element( .demoSpecialMobIds ) ) mes getmonsterinfo( .@mobId, MOB_NAME ); close;end;OnNPCKillEvent:if( !.demoSpecialMobIds[ killedrid ] ) end;... do some specialstuff for special mob ...end;OnInit: .demoSpecialMobIds[ 1000 ] = 1; .demoSpecialMobIds[ 1004 ] = 1; .demoSpecialMobIds[ 1006 ] = 1;end;... I just realized that this ".array[ idIndex ]" approach is a workaround for a lacking in_array function especially for integers except you want to extensivly utilize atoi. The benefit is like the solution with implode, it may be better performance wise.
     
    Maybe a in_array function could solve both cases to make it more readable at all.
    A next_element or phplike foreach loop would still be great though.
     
    Such a kind of function would be great for functions which should work with integer and string values. I could imagine things like this:
     
    for( .@i = 0; .@i < getarraysize( getarg( 1 ) ); .@i++ ) mes getmonsterinfo( next_element( getarg( 0 ) ), next_element( getarg( 1 ) ) ); It would make it possible to either use the string constant or the number of specific informations to loop trough it via a function that doesn't care if it is a string or a number.
  19. Upvote
    Winterfox got a reaction from Noil in How do you make Ragnarok Graphics   
    @@Noil
     
    I think it is a thing of practice.
    Using original sprites, modding them to get a feel for the style and practicing to create own things free hand afterwards.
  20. Upvote
    Winterfox got a reaction from universalserialbus in Card Gambler Girl   
    Hey guys,
     
    i once again want to share a little script i did.
     
    It's a card gambler that works like this:
     
    You pick how many rounds you want to play and which card you want.
    The Card Gambler Girl picks 5 random cards and puts the card you want at the bottom of the pile.
    If you don't like her random picked cards you can get her to pick new ones for a little extra free as long as you can afford it.
     
    Afterwards she throws 3 dice and if atleast 2 share the same number, you get the according card on the pile.
    She does that till you run out of paid rounds or won one card.
     
    You can find the source here: https://github.com/Reilaen/NPC-Releases/blob/master/card_gambler_girl.txt
     
    NOTES: Since i get ridiculously accused of "get rich quick schemes" by Emistry for using a linbucks link to get a little bit of money for each click so you the community and i have both something of this free release, please consider donating me a small amount if you really like this npc.   I will only will fix bugs that are issued on github. Custom changes are only done for pay based on my service conditions that are described here.
  21. Upvote
    Winterfox got a reaction from Aurora in Client won't open   
    @@Aurora
     
    You are welcome. 
  22. Upvote
    Winterfox got a reaction from RagnarokOnline2015 in Exe   
    @@RagnarokOnline2015
     
    2014-10-22
  23. Upvote
    Winterfox got a reaction from mrlongshen in REQ >On max level   
    @@mrlongshen
     
    You also can use the according number. EQI_HEAD_TOP is a constant that is replaced with the according number anyway.
  24. Upvote
    Winterfox got a reaction from mrlongshen in REQ >On max level   
    @@mrlongshen
    if( BaseLevel == 255 && JobLevel == 120 ) unequip <equipment slot>; <equipment slot> has to be the slot where the equipment is applied.
     
    Possible slots are:
    EQI_HEAD_TOP (1) - Upper head gearEQI_ARMOR (2) - Armor (Where you keep your Jackets and Robes)EQI_HAND_L (3) - What is in your Left hand.EQI_HAND_R (4) - What is in your Right hand.EQI_GARMENT (5) - The garment slot (Mufflers, Hoods, Manteaus)EQI_SHOES (6) - What foot gear the player has on.EQI_ACC_L (7) - Accessory 1.EQI_ACC_R (8) - Accessory 2.EQI_HEAD_MID (9) - Middle Headgear (masks and glasses)EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks)EQI_COSTUME_HEAD_LOW (11) - Lower Costume HeadgearEQI_COSTUME_HEAD_MID (12) - Middle Costume HeadgearEQI_COSTUME_HEAD_TOP (13) - Upper Costume HeadgearEQI_COSTUME_GARMENT (14) - Costume GarmentEQI_SHADOW_ARMOR (15) - Shadow ArmorEQI_SHADOW_WEAPON (16) - Shadow WeaponEQI_SHADOW_SHIELD (17) - Shadow ShieldEQI_SHADOW_SHOES (18) - Shadow ShoesEQI_SHADOW_ACC_R (19) - Shadow Accessory 2EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
  25. Upvote
    Winterfox got a reaction from REKT in Hi Adding Checkweight from script.   
    @@Vlync
     
    prontera,142,169,5 script Lira 811,{ function checkw; mes .npc$; mes "As l can see you, found your way to me ^0000ff"+strcharinfo(0)+"^000000."; mes "although they require many rare ^FF0000jewels^000000 to make."; mes " "; mes "What can l mix for you?"; next; switch( select( " - mix ^AA6A04Mjolnir^000000: - mix ^AA6A04Sleipnir^000000: - mix ^AA6A04Brisingamen^000000: - mix ^AA6A04Gleipnir^000000: - mix ^AA6A04Megingjard^000000" ) ) { case 1: mes .npc$; mes ( (.ShowID ) ? "(20030) " : "" ) + "^3355FFMjolnir^000000 is the mighty Hammer of Thor."; mes " "; setarray .@Items[0],20030,1531,2,984,20,985,5,969,40,7074,2,7075,4,7078,5,7087,5,7089,5; break; case 2: mes .npc$; mes ( (.ShowID ) ? "(20029) " : "" ) + "^3355FFSleipnir^000000 are boots made after Odin's War Horse."; mes " "; setarray .@Items[0],20029,2406,2,984,1,969,20,985,10,7076,3,7079,5,7083,3,7086,3; break; case 3: mes .npc$; mes ( (.ShowID ) ? "(2630) " : "" ) + "^3355FFBrisingammen^000000 is the magical Necklace of Freyja, goddess of Beauty."; mes " "; setarray .@Items[0],2630,2603,1,726,2,722,3,727,10,723,5,969,20,7073,4,7077,4,7088,3,7090,3,7092,3; break; case 4: mes .npc$; mes ( (.ShowID ) ? "(7058) " : "" ) + "The ^3355FFGleipnir^000000 is a light yet strong rope required to make ^3355FFMegingjard^000000"; mes " "; setarray .@Items[0],7058,7080,4,7081,5,7082,4,7084,3,7085,3; break; case 5: mes .npc$; mes ( (.ShowID ) ? "(20021) " : "" ) + "The ^3355FFMegingjard^000000 is the powerful Belt of Thor."; setarray .@Items[0],20021,7058,1,2601,1,969,10,726,10,984,5; break; } set .@nr, 0; mes "^FF0000The ltems i need are as follows:^000000"; for(set .@i, 1; .@i <= getarraysize( .@Items ); set .@i, .@i + 2 ) { set .@color$, "72E300"; set .@itemCount, countitem( .@Items[ .@i ] ); if ( .@itemCount < .@Items[ .@i + 1 ] ) { set .@nr, 1; set .@color$, "FF0000"; } mes "^" + .@color$ + .@Items[.@i + 1] + " x " + ( (.ShowID ) ? "(" + .@Items[ .@i ] + ") " : "" ) + getitemname( .@Items[ .@i ] ) + " " + .@itemCount + "/" + .@Items[ .@i + 1 ] + "^000000"; } if (.@nr) close; next; mes .npc$; mes "Do you want " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF" + getitemname( .@Items[ 0 ] ) +" ^000000?"; next; if(select(" - Yes, Please: - No, Thanks")== 2) { mes .npc$; mes "Very well then, please go back, if you change your mind."; close; } checkw .@Items[0]; mes .npc$; mes "Here is your " + ( ( .ShowID ) ? "(" + .@Items[ 0 ] + ") " : "" ) + "^3355FF"+getitemname(.@Items[0])+"^000000."; mes "lt may serve you well."; for( set .@i, 1; .@i <= getarraysize( .@Items ); set .@i,.@i + 2 ) delitem .@Items[ .@i ], .@Items[ .@i + 1 ]; getitem .@Items[0],1; close; end; OnInit: set .npc$, "^0099CCLira - Godlike Creator^000000"; set .ShowID,1; end; function checkw { if( !checkweight( getarg(0), 1) ) { mes .npc$; mes "Your weight is too high!"; close; } return; }}
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.