Jump to content

Skorm

Forum Moderator
  • Posts

    1268
  • Joined

  • Last visited

  • Days Won

    33

Community Answers

  1. Skorm's post in [Item Script] Low HP Trigger was marked as the answer   
    autobonus2 "{ if( Hp <= MaxHp * 5 / 10 && @item_cooldown <= gettimetick(0) ){ set @item_cooldown, gettimetick(0) + 300000; percentheal 100,0; sc_start SC_KYRIE,6000000,10; } }",1000,1,BF_SHORT|BF_LONG,"{ specialeffect2 EF_FIRESPLASHHIT; }"; I had to use temporary character variables for the cooldown as the effect is triggered 100% of the time but with the condition that the players hp <= 50% of maxhp. So it is triggered but not activated. What this means is the cooldown will persist even after the player dies.
  2. Skorm's post in Timer Pub for woe was marked as the answer   
    @hikashin-rae You're lucky I was randomly browsing google to see if people were able to find the woe timer I made for Euphy's WOE Setter and found your post.
    http://upaste.me/a34345394862f242d
  3. Skorm's post in Understanding Simple Sample Dynamic Shop was marked as the answer   
    It took me a bit to understand dynamic shops when I was first learning too. This is the npc I used to understand dynamic shops but I added a bunch of comments hopefully it helps. ( Disclaimer: This npc is old and doesn't have all the necessary weight checks and mumbo-jumbo I'm providing it as an example because it's simple. )
     
    - shop custom_seller2 -1,501:20 // Create our dummy shop. prontera.gat,95,99,5 script WoE Shop 100,{ // This code runs when the user clicks our npc. mes "I will sell you items for " + getitemname(.CoinID) + "."; // Let the user know about our shop. callshop "custom_seller2",1; // Summon our dummy shop filled with custom items. npcshopattach "custom_seller2"; // Attach the shop to this npc. end; // This code runs when a user purchases an item from our shop. OnBuyItem: .@len = getarraysize(.customs); // Get the number of customs we've added. .@b_len = getarraysize(@bought_nameid); // Get the number of purchased items. for( set @i, 0; @i < .@len; set @i, @i+1 ) { // Loop through all our custom items. for( set @d,0; @d < .@b_len; set @d, @d+1 ) { // Loop through all the purchased items. if( @bought_nameid[@d] == .customs[@i] ) { // Check if the purchased item equals our custom item. if( countitem(.CoinID) >= .Price[@i] * @bought_quantity[@d] ) { // Check if the user has the correct funds. delitem .CoinID,.Price[@i]*@bought_quantity[@d]; getitem @bought_nameid[@d],@bought_quantity[@d]; } } } } deletearray @bought_quantity, getarraysize(@bought_quantity); // Remove the array. deletearray @bought_nameid, getarraysize(@bought_nameid); // Remove the array. close; // This code runs first. When the server is started. OnInit: setarray .customs[0],12103,607,678; // An array of our custom items. set .CoinID,7227; // Currency used for the transaction. setarray .Price[0],20,40,300; // The amount of coins needed for our items. (For example: Item 12103 = 20 coins) npcshopitem "custom_seller2",0,0; // Remove all items from our dummy shop. for( set .@i, 0; .customs[.@i]; set .@i, .@i+1 ) // Loop through our custom items. npcshopadditem "custom_seller2",.customs[.@i],.Price[.@i]; // Add our custom items to the cleared dummy shop. end; }  
  4. Skorm's post in Adding multiple SQL Values using insert was marked as the answer   
    query_sql("INSERT INTO `event_rewards` ( `account_id`, `event_name`, `id`, `amount`, `value` ) VALUES ( "+.@account_id[.i]+", '"+.@eventname$+"', "+.@prize[.j]+", "+.@pamount[.k]+", 0) ");  
  5. Skorm's post in Petloot directly in Inventory was marked as the answer   
    Find line 1179 in pet.c should look something like this.
    } else { // Item Targeted, attempt loot if (!check_distance_bl(&pd->bl, target, 1)) { // Out of range if(!unit_walktobl(&pd->bl, target, 1, 1)) // Unreachable target. pet_unlocktarget(pd); return 0; } else { struct flooritem_data *fitem = (struct flooritem_data *)target; Comment out this part.
    if(pd->loot->count < pd->loot->max) { memcpy(&pd->loot->item[pd->loot->count++],&fitem->item,sizeof(pd->loot->item[0])); pd->loot->weight += itemdb_weight(fitem->item.nameid)*fitem->item.amount; map_clearflooritem(target); } add below.
    if (!pc_additem(sd, &fitem->item, fitem->item.amount, LOG_TYPE_PICKDROP_PLAYER)) { map_clearflooritem(target); }  
  6. Skorm's post in Item Inventory Position Help was marked as the answer   
    quiz_00,17,124,4 script Katonai 821,{ mes .npc$; mes "Hello there!"; mes "I can enchant your items,"; mes "for a small fee of "+.pric+"z."; emotion e_no1,0; next; if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; } if(Zeny<.pric) { mes .npc$; mes "I'm sorry you don't have enough Zeny, please come back later."; close; } mes .npc$; mes "Which item would you like to enchant?"; next; for( .@a = 0; .@a < .e_len; .@a++ ) { if(getequipid(.equiploc[.@a])>-1) { set .@menu$, .@menu$+.eqp$[.@a]+"- [^0000FF"+getitemname(getequipid(.equiploc[.@a]))+"^000000]:"; } else { set .@menu$, .@menu$+"^adb4be"+.eqp$[.@a]+"- [Empty]^000000:"; } } select(.@menu$); set .@eq_loc, .equiploc[@menu-1]; set .@eq_itm, getequipid(.@eq_loc); if(.@eq_itm<0) { mes .npc$; mes "Hmm, I don't think you have anything equipped there."; close; } set .@menu$, ""; set(.@eq,(getiteminfo(.@eq_itm,2)==4?4:.@eq_loc)); for(set(.@b,0);.@b<getarraysize(getd(".itm"+.@eq));set(.@b,.@b+1)) { set(.@items,getd(".itm"+.@eq+"["+.@b+"]")); if(getiteminfo(.@items,2)>-1) if(set(.@c,countitem(.@items))) { set .@menu$, .@menu$+getitemname(.@items)+" x"+.@c+":"; set .@b,.@b+1; set .@item[.@b], .@items; } } if(.@menu$=="") { mes .npc$; mes "Hmm, you don't seem to have any enchantment orbs for that equipment."; close; } mes .npc$; mes "Please, select an enchantment from the menu."; next; select(.@menu$); set .@itm, .@item[@menu]; set .@menu$, ""; set .@a, 0; while((set(.@a,.@a+1)-1)<4) { setd(".@crd"+.@a, getequipcardid(.@eq_loc,.@a-1)); if(getequipcardid(.@eq_loc,.@a-1)) set .@menu$, .@menu$+.@a+.crd_c$[.@a-1]+" Slot- [^a92435"+getitemname(getequipcardid(.@eq_loc,.@a-1))+"^000000]:"; else set .@menu$, .@menu$+.@a+.crd_c$[.@a-1]+" Slot- [^30ad25Empty^000000]:"; } mes .npc$; mes "Select a slot."; next; set(.@slot,select(.@menu$)-1); set .@eqrf, getequiprefinerycnt(.@eq_loc); if(getequipcardid(.@eq_loc,.@slot)) { mes .npc$; mes "Would you like me to remove this card?"; next; if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; } getitem getequipcardid(.@eq_loc,.@slot),1; delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; setd(".@crd"+(@menu+1), 0); getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; } if(rand(101)>.perc[.@slot]) { mes .npc$; mes "I'm sorry but I've failed you!"; misceffect 155; emotion e_sob,0; set Zeny,Zeny-.pric; close; } set Zeny,Zeny-.pric; delitem .@itm,1; delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; setd(".@crd"+(@menu+1), .@itm); getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4; misceffect .efet; emotion e_no1,0; mes .npc$; mes "All done!"; equip .@eq_itm; close; //NPC Constants OnInit: //=-=-=-=-=-=-=Configuration=-=-=-=-=-=-= set .npc$ , "[^0000FFEnchant Expert^000000]"; // NPC Name set .pric , 1000000; // Price set .efet , 154; // Effect Number setarray .perc , 100,80,50,10; // Percent slot setarray .crd_c$, "st", "nd", "rd", "th"; // Count setarray .itm32 , 4760; // Sheilds setarray .itm16 , 4761; // Armor setarray .itm4 , 4762; // Garment setarray .itm64 , 4763, 4764; // Footgear setarray .itm128 , 4765; // Accessory1 setarray .itm10 , 4766; // Accessory2 setarray .itm2 , 4765; // Weapon setarray .itm1 , 4766; // Low Headgear setarray .itm512 , 4767; // Mid Headgear setarray .itm256 , 4767; // Upper Headgear setarray .eqp$ , "Upper Headgear", "Mid Headgear", "Low Headgear", "Armor", "Left Hand", "Right Hand", "Garment", "Shoes", "Accessory1", "Accessory2"; setarray .equiploc, EQI_HEAD_TOP, EQI_HEAD_MID, EQI_HEAD_LOW, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R; set .e_len , getarraysize(.eqp$); //=-=-=-=-=-=-=-=-Skorm-=-=-=-=-=-=-=-=-= } Working version.
  7. Skorm's post in @request News NPC was marked as the answer   
  8. Skorm's post in Woe countdown timer was marked as the answer   
    There were a few problems when trying to use it with Euphy's WOE controller also I hadn't thought about the fact that 0 actually means something in this script. So getarraysize didn't work correctly when sunday was the last day in your list. To fix that I had to change the days from 1 ~ 7 instead of 0 ~ 6... That on its own was pretty easy but Euphy's script still uses 0 ~ 6 so I had to do a bunch of arbitrary junk to still keep it a standalone npc yet compatible with Euphy's script.
     
    Firstly don't remove credits. ( Seriously I can't stress that enough. ) Uhh... So I didn't have a lot of time tonight. I will make an integrated version with Euphy's WOE controller but there are a few things with his script that I wanted to change/add. Alternatively you could just put this npc on the same location as his npc but make it invisible with sprite number 139.

    Anyways here is a working standalone version that is compatible with Euphy's WOE Controller. ( Sorry @neXus it's the version with Days, Minutes, Seconds. I'll make it easier to change that or something.  )
     
    //Skormie's WOE Waitingroom Timer v1.03 //Should natively work with Euphy's WOE Controller. prontera,151,193,5 script Woe Time 100,{ end; OnInit: function s; function woe_update; // CONFIG // ...If you're not using Euphy's Woe Controller. setarray .@start_day, 5, 1; //Day of the week WOE Starts on. (1 for Sunday, 7 is Saturday) setarray .@start_hour, 20, 0; //rAthena works on a 24 hour clock. .auto_update = 60; //Auto update timer in seconds. .woe_len = getarraysize( .@start_day ); for( .@i = 0; .@i < .woe_len; .@i++ ) { .woe_day[ .@i * 4 ] = .@start_day[ .@i ] -1; .woe_day[ (.@i * 4) + 1 ] = .@start_hour[ .@i ]; } .woe_len = ( ( .woe_len ) * 4 ); woe_update(); while ( 1 ) { if( !( gettimetick(2) % .auto_update ) ) woe_update(); .@woe_tick = .woe_time[.current] - gettimetick(2); .@day = .@woe_tick / 86400; .@hour = .@woe_tick % 86400 / 3600; .@min = .@woe_tick % 3600 / 60; .@sec = .@woe_tick % 60; .@mes$ = ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" minute"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" second"+ s( .@sec, 1 ) : "" ); delwaitingroom strnpcinfo(0); waitingroom ( .woe_len ? ( agitcheck() ? "WOE is Active!" : .@mes$ ) : "WOE is Disabled!" ), 0; sleep 1000; } end; OnAgitEnd: woe_update(); end; function s { return ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ); } function woe_update { if( getnpcid( 0, "WOE_CONTROL" ) ) { .@Euphy_Len = getarraysize( $WOE_CONTROL ); copyarray .woe_day, $WOE_CONTROL, .@Euphy_Len; .woe_len = .@Euphy_Len; } for( .@a = 0; .@a < .woe_len; .@a += 4 ) { .@woe_day[.@a] = ( .woe_day[.@a] - gettime(4) + 7 ) % 7 * 86400; .@woe_hour[.@a] = ( .woe_day[.@a+1] * 3600 ) - gettimetick(1); .woe_time[.@a] = gettimetick(2) + .@woe_day[.@a] + .@woe_hour[.@a]; if(gettimetick(2) > .woe_time[.@a]) .woe_time[.@a] = .woe_time[.@a] + 7 * 86400; if( .woe_time[.@a] <= .woe_time[.current] ) .current = .@a; } } }  
  9. Skorm's post in Someone can help me with my script was marked as the answer   
    change 
    callfunc("F_RandMes", 7, 969, 1002, 757, 756); to
    callfunc("F_RandMes", 4, 969, 1002, 757, 756);  
    For other people reading this post F_RandMes was changed to F_Rand sometime in 2014 the new format is like...
    callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410);  
  10. Skorm's post in Script to check items and auto kick if item not present was marked as the answer   
    In the unequip_script of your rental item add.
    if( strcharinfo(3) == "geffen" && !( countitem(501) -1 ) ) warp "prontera",156,191; And of course replace geffen with your map and 501 with your rental itemid.
  11. Skorm's post in R> Can someone try this? was marked as the answer   
    sc_start4 SC_ARMOR_ELEMENT,3600000,10,10,10,10; https://github.com/rathena/rathena/blob/master/doc/status_change.txt#L425-L430
     
  12. Skorm's post in Customized Hourly Points was marked as the answer   
    ...
    - script hourly_point_main -1,{ OnInit: .max_hour = 5; .duration = 3600; .npc_name$ = strnpcinfo(3); bindatcmd "hourly", .npc_name$ + "::OnCheck"; end; OnClock0000: deletearray $@hourly_tick; OnUpdate: .@aid = getcharid(3) & 0xFFFF; deltimer .npc_name$+"::OnUpdate"; $@hourly_ticks[.@aid]++; #reward += $@hourly_ticks[.@aid] * 10; OnPCLoginEvent: .@aid = getcharid(3) & 0xFFFF; if ( $@hourly_ticks[.@aid] < .max_hour ) { @timer = gettimetick(2) + .duration; addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate"; } else { dispbottom "[ Hourly Rewards ] You've reached the daily maximum of "+.max_hour+" hours played, well done!",0x9ae2d7; end; } if ( #reward && $@hourly_ticks[.@aid] ) dispbottom "[ Hourly Rewards ] " + $@hourly_ticks[.@aid] + "/" + .max_hour + " hours played, "+#reward+" point(s)!",0x9ae2d7; end; OnCheck: .@min = (@timer - gettimetick(2))/60; .@sec = (@timer - gettimetick(2))%60; dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " + ((.@min)? "[ " + .@min + " ] minute" + ((.@min > 1)?"s":""):"") + ((.@min && .@sec)? " and ":"") + ((.@sec)? "[ " + .@sec + " ] second" + ((.@sec > 1)?"s":""):"") + "!",0x9ae2d7; end; }  
  13. Skorm's post in Loop Special effect on when card is Compounded on Item was marked as the answer   
    The command Emistry picked out won't work the way you want, according to it's description it reads all cards even the ones that are equipped in your inventory, but isequipped should work fine for identifying equipped cards. ( Unless you're running some old server where it doesn't. )
    (These kinds of changes are probably best done in src but whatever.)
    Run these in your SQL DB... You might want to make a backup first though. I tried running it through a script to make the changes less permanent but that didn't work. So this is what you get.
    UPDATE `item_db_re` SET `script` = CONCAT( `script`, ' if( getrefine() > 9 && !@loop && isequipped(4035) ) { @loop = 1; while( @loop ) { specialeffect2 487; sleep2 1500; } }' ) WHERE `refinable` IS TRUE AND (`equip_locations` & 2 OR `equip_locations` & 16); UPDATE `item_db_re` SET `unequip_script` = CONCAT( `unequip_script`, ' @loop = 0;' ) WHERE `refinable` IS TRUE AND (`equip_locations` & 2 OR `equip_locations` & 16);  
    In case you feel like remove it...
    UPDATE `item_db_re` SET `script` = REPLACE( `script`, ' if( getrefine() > 9 && !@loop && isequipped(4035) ) { @loop = 1; while( @loop ) { specialeffect2 487; sleep2 1500; } }', '' ) WHERE `refinable` IS TRUE AND (`equip_locations` & 2 OR `equip_locations` & 16); UPDATE `item_db_re` SET `unequip_script` = REPLACE( `unequip_script`, ' @loop = 0;', '' ) WHERE `refinable` IS TRUE AND (`equip_locations` & 2 OR `equip_locations` & 16);  
  14. Skorm's post in request blacklist item script was marked as the answer   
    Before " IgnoreCheck: " in the script add.
    if( compare( .blacklist$, "|"+getequipid(.@part)+"|" ) ) { mes "[ Keitenai ]"; mes "It looks like I can't enhance that item."; close; } After price " set .Price,10000000; // Prize of random option " in the script add.
     
    set .blacklist$, "|1599|2199|512|"; Just follow my formatting to add more items.
  15. Skorm's post in Welcome Prontera Messege was marked as the answer   
    The reason your example script didn't work is because for the navigation to correctly work you have to target a valid cell.
    - script NaviMT -1,{ OnPCLoadMapEvent: if( strcharinfo(3) != "prontera" || #job_master || @delay > gettimetick(2) ) end; @delay = gettimetick(2) + 60; message strcharinfo(0),"Welcome to HallowRO the job master is located at 128 221."; navigateto "prontera",118,222,NAV_ALL,1; end; } prontera mapflag loadevent Then when talking to the job master just set #job_master = 1;
  16. Skorm's post in "@" variable problem. Please help was marked as the answer   
    I just wanted to add on Akky's answer a little. I don't necessarily recommend either of these options because if your server has lots of players it can create stress. You should always remove the variable from the script that originally assigned it after it's done being used. With that said here are two ways of removing a variable/array when players enter a specific map.

    Method one OnPCLoadMapEvent:
    - script delete_var_123 -1,{ OnPCLoadMapEvent: if( strcharinfo(3) == "prontera" ) { deletearray player_array; // You can remove arrays with this command. player_variable = 0; // As Akky said remove variables by setting them to zero. } } prontera mapflag loadevent  
    Method two OnTouch:
    prontera,1,1,1 script delete_var_111 111,1111,1111,{ OnTouch: deletearray player_array; // You can remove arrays with this command. player_variable = 0; // As Akky said remove variables by setting them to zero. }  
  17. Skorm's post in need help creating a random picking item box was marked as the answer   
    You need to add  IG_LPumpkinBox to your db/const.txt file like.
    IG_LPumpkinBox 5555 IG_LPumpkinBox,57002,2 getrandgroupitem(IG_LPumpkinBox,1);  
    Alternatively you can just declare an ID instead of a variable in the item_group_db.txt as well like.
    5555,57002,2 Then call it with getrandgroupitem like.
    getrandgroupitem(5555,1); This helps when trying to keep everything in an import file.
  18. Skorm's post in Spawn monsters with despawn time was marked as the answer   
    You can try the summon command just be sure to run it from an npc that isn't attached to the player.
    *summon "monster name",<monster id>{,<Time Out>{,"event label"}};  
    Some other methods...
    .mob_id = monster("<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>}); startnpctimer; end; OnTimer<time>: unitkill .mob_id; stopnpctimer; end;  
    You could do the same thing as above but with killmonster instead.
    monster("<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"NPC::OnBlahbanditded",<size>,<ai>}); startnpctimer; end; OnTimer<time>: killmonster "<map name>","NPC::OnBlahbanditded"; stopnpctimer; end; OnBlahbanditded: end;  
  19. Skorm's post in OnPCDieEvent: - Monster Only? was marked as the answer   
    Just adding to @Nitrous's answer here...
    - script Mob Death -1,{ OnPCDieEvent: if( killerrid > 100000000 ) { getunitdata( killerrid, .@killerrid ); if( getarraysize(.@killerrid) == 49 ) dispbottom "You were killed by "+getmonsterinfo( .@killerrid[13], MOB_NAME )+"."; } }  
  20. Skorm's post in Looking for only the guild name and all players get buff~ was marked as the answer   
    prontera,184,177,5 script Guild Buffer 100,{ setarray .@sc_effect, SC_INCREASEAGI, SC_BLESSING, SC_ANGELUS; setarray .@skil_txt$, "Increase Agility", "Blessing", "Angelus"; setarray .@ticks , 200000, 200000, 200000; setarray .@skil_num , 29, 34, 33; setarray .@levels , 10, 10, 10; .@len = getarraysize(.@sc_effect); if( !strcmp( strcharinfo(2), "Emperor" ) ) { for( .@a = 0; .@a < .@len; .@a++ ) { misceffect 253; skilleffect .@skil_num[.@a], .@levels[.@a]; sc_start .@sc_effect[.@a], .@ticks[.@a], .@levels[.@a]; message strcharinfo(0),"Buff ["+.@skil_txt$[.@a]+"] Added."; } } end; }  
    If you mean one person clicks the buffer and entire guild gets buffed... I limited it to just the guild master and only once per minute...
     
  21. Skorm's post in Event that spawns a monster every 6 hours was marked as the answer   
    There are many ways to do something like this here's one.
     
    - script Event_Spawn -1,{ // The NPC. OnEvent: // The event label. atcommand "@doom"; // The atcommand. sleep 1000 * 60 * 60 * 6; // The timer. OnInit: // The start of the server. setarray .@maps$, "prontera", "geffen", "izlude"; // An array of maps. .@map$ = .@maps$[rand(getarraysize(.@maps$))]; // Shuffle maps. (Thanks Tokei) monster .@maps$,0,0,"--ja--",1115,1,"Event_Spawn::OnEvent"; // The monster. } // The curly.  
  22. Skorm's post in if mvp is dead = pvp off was marked as the answer   
    Comment out the old Eddge spawn in npc/pre-re/mobs/fields/payon.txt
    Like:
    //pay_fild11,0,0,0,0 boss_monster Eddga 1115,1,7200000,600000,1 And add this npc.
    - script Eddga_Spawn_PVP -1,{ OnOffPVP: removemapflag "pay_fild11",mf_pvp; sleep rand(600000,7200000); OnInit: setmapflag "pay_fild11",mf_pvp; monster "pay_fild11",0,0,"Eddga",1115,1,"Eddga_Spawn_PVP::OnOffPVP"; }  
  23. Skorm's post in WoE Reward when kill someone was marked as the answer   
    You're missing a curly at the end?
    - script kjbfksjhfkd -1,{ OnPCKillEvent: if (killerrid != getcharid(3)) if (( agitcheck() || agitcheck2() ) && compare(strcharinfo(3),"g_cas")) getitem 512,3; end; }  
  24. Skorm's post in Walkable Emperium was marked as the answer   
    This has nothing to do with Euphy's script and has more to do with the monster database. Find the Emperium in the monster database I think it's 1288 changing the mode from 352 to 353 should make it walk around.
    You can see a full explanation of all the monster modes in server/doc/mob_db_mode_list.txt.
     
    I'm moving this to DB support.
  25. Skorm's post in Request:Refine ticket trader was marked as the answer   
    Cool idea... Untested but it should work. Let me know if you have any problems.
    http://upaste.me/391d36830c5d5ecf5
×
×
  • Create New...