Jump to content

Tyrfing

Members
  • Posts

    86
  • Joined

  • Last visited

  • Days Won

    1

Tyrfing last won the day on May 27 2018

Tyrfing had the most liked content!

2 Followers

Profile Information

  • Gender
    Male

Recent Profile Visitors

3710 profile views

Tyrfing's Achievements

Poring

Poring (1/15)

  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

21

Reputation

6

Community Answers

  1. Been very busy and I'm not really very active in rAthena (or any other RO community) anylonger, but I had some spare time so here you go. /////////////////////////////////////////////////////// // ___________ _____.__ // \__ ___/__.__.________/ ____\__| ____ ____ // | | < | |\_ __ \ __\| |/ \ / ___\ // | | \___ | | | \/| | | | | \/ /_/ > // |____| / ____| |__| |__| |__|___| /\___ / // \/ Scripts \//_____/ // //===================================================== // Name: Race to Max Level (v2) // // Description: // This NPC allows for Game Masters to set rewards to // be given to the first player of each 2nd class that // reaches the maximum level (base and class). // // Changes relative to v1: // - Support for multiple rewards in two categories // (rare and common). // - Support for setting rewards by name in-game // (requires SQL item_db). Otherwise, specify item ID. // - Support for setting the rare rates in-game. // // Additional info: // - Remember to change .@sql_item_db to 1 if you use // a SQL item_db. //===================================================== /////////////////////////////////////////////////////// prontera,147,180,5 script Race to Max Level 58,{ // GM level required to change the reward set .@gm_level, 99; // Set this to 1 if you are using SQL item_db. set .@sql_item_db, 0; // The item_db SQL table name. set .@item_db_table$, "item_db_re"; // Base and job levels required set .@maxbase, 99; set .@maxjob, 50; // The default/initial percentage for rare items. set .@rare_chance, 30; // Rewards. Remember, you can change these in-game too! setarray .@default_rare_rewards[0], 510, 511, 512, 513, 514; setarray .@default_common_rewards[0], 510, 511, 512, 513, 514; if ($r99_rare_chance == 0) $r99_rare_chance = .@rare_chance; if (getarraysize($rare_rewards) == 0) copyarray $rare_rewards[0], .@default_rare_rewards[0], getarraysize(.@default_rare_rewards); if (getarraysize($common_rewards) == 0) copyarray $common_rewards[0], .@default_common_rewards[0], getarraysize(.@default_common_rewards); setarray .@rewardablejobs[0], Job_Knight, Job_Alchemist, Job_Assassin, Job_Bard, Job_Blacksmith, Job_Crusader, Job_Dancer, Job_Hunter, Job_Monk, Job_Priest, Job_Rogue, Job_Sage, Job_Wizard; function SelectFromArray; function ListRewards; Begin: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Hello, " + ((getgmlevel() >= .@gm_level) ? "master! What do you want to do today?" : "are you here for your reward?"); if (getgmlevel() >= .@gm_level) { .@select$ = "Change rare item chance:Update rewards:Restart race:Test reward:View explanation:Show rewarded players:Cancel"; switch(select(.@select$)) { case 1: goto ChangeRate; case 2: goto UpdateRewards; case 3: goto RestartRace; case 4: goto GetReward; case 5: goto ExplainRace; case 6: goto ShowRewarded; default: end; } } else { .@select$ = "YES!:...What reward?:Who was rewarded?:Cancel"; switch(select(.@select$)) { case 1: goto GetReward; case 2: goto ExplainRace; case 3: goto ShowRewarded; default: end; } } ChangeRate: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "The rare item rate is currently set to ^0099cc" + $r99_rare_chance + "%^000000."; mes "What do you want to change it to?"; input .@new_rate; set $r99_rare_chance, .@new_rate; mes "Done!"; next; goto Begin; // TODO: Provide a means to update the rewards arrays UpdateRewards: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Choose which rewards you want to review or update."; switch (select("Rare rewards:Common rewards:Cancel")) { case 1: goto UpdateRareRewards; case 2: goto UpdateCommonRewards; default: end; } // mes "The reward is " + getitemname($reward) + " (ID: " + $reward + ")."; // mes "Do you want to change it?"; // if (select("Yes:No") == 1) { // clear; // mes "[ ^0099ccRace to Max Level^000000 ]"; // mes "Please enter the new reward item ID."; // input .@rewardid; // clear; // mes "[ ^0099ccRace to Max Level^000000 ]"; // mes "Set " + getitemname(.@rewardid) + " as the reward?"; // if(select("Yes:No") == 1) { // set $reward, .@rewardid; // } // } goto Begin; UpdateRareRewards: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "These are the rare rewards:"; ListRewards($rare_rewards); if (select("Change reward:Cancel") == 1) { clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Which reward do you want to change?"; .@selected_reward = SelectFromArray($rare_rewards); clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Ah, the ^0099cc" + getitemname($rare_rewards[.@selected_reward - 1]) + "^000000."; if (.@sql_item_db == 1) { mes "What do you want to change it to? (Item name)"; input .@new_reward$; .@sql$ = "SELECT id from `"+ .@item_db_table$ +"` WHERE name_japanese LIKE '%"+ escape_sql(.@new_reward$) +"%'"; query_sql(.@sql$, .@sql_results); .@selected = SelectFromArray(.@sql_results); .@selected = .@sql_results[.@selected - 1]; } else { mes "What do you want to change it to? (Item ID)"; input .@selected; } clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Update to ^0099cc" + getitemname(.@selected) + "^000000?"; if (select("Yes:No") == 1) { clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Item updated."; $rare_rewards[.@selected_reward - 1] = .@selected; next; } } goto Begin; UpdateCommonRewards: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "These are the common rewards:"; ListRewards($common_rewards); if (select("Change reward:Cancel") == 1) { clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Which reward do you want to change?"; .@selected_reward = SelectFromArray($common_rewards); clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Ah, the ^0099cc" + getitemname($common_rewards[.@selected_reward - 1]) + "^000000."; if (.@sql_item_db == 1) { mes "What do you want to change it to? (Item name)"; input .@new_reward$; .@sql$ = "SELECT id from `"+ .@item_db_table$ +"` WHERE name_japanese LIKE '%"+ escape_sql(.@new_reward$) +"%'"; query_sql(.@sql$, .@sql_results); .@selected = SelectFromArray(.@sql_results); .@selected = .@sql_results[.@selected - 1]; } else { mes "What do you want to change it to? (Item ID)"; input .@selected; } clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Update to ^0099cc" + getitemname(.@selected) + "^000000?"; if (select("Yes:No") == 1) { clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Item updated."; $common_rewards[.@selected_reward - 1] = .@selected; next; } } goto Begin; RestartRace: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Are you sure you want to restart the race?"; if (select("Yes:No") == 1) { for (.@i = 0; .@i < getarraysize(.@rewardablejobs); .@i++) { set $rewarded$[.@rewardablejobs[.@i]], ""; } announce "The Race to Max Level has begun! Claim a reward once you reach " + .@maxbase + " base and " + .@maxjob + " class!", bc_all; } goto Begin; GetReward: mes "Let's see... " + strcharinfo(0) + ", huh?"; set .@competitioner, 0; for (.@i = 0; .@i < getarraysize(.@rewardablejobs); .@i++) { if (Class == .@rewardablejobs[.@i]) { set .@competitioner, 1; if (BaseLevel < .@maxbase || JobLevel < .@maxjob) { mes "I'm sorry, but you still need to level a bit more."; } else if ($rewarded$[Class] == strcharinfo(0)) { mes "You have already claimed your reward."; } else if ($rewarded$[Class] != "") { mes "Too late!"; mes "The reward for " + jobname(Class) + " was already claimed by " + $rewarded$[Class] + "."; } else goto GiveReward; } } if (.@competitioner == 0) mes "You need to change your job."; close; GiveReward: set $rewarded$[Class], strcharinfo(0); clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Congratulations! You were the first " + jobname(Class) + " to reach " + .@maxbase + " base and " + .@maxjob + " class!"; // Choose item category based on probability set .@itemCategory, 0; set .@chance, rand(100); if (.@chance < $r99_rare_chance) { set .@itemCategory, 1; } if (.@itemCategory == 0) { set .@reward, $common_rewards[rand(getarraysize($common_rewards))]; .@type$ = "Common"; } else { set .@reward, $rare_rewards[rand(getarraysize($rare_rewards))]; .@type$ = "Rare"; } getitem .@reward, 1; announce strcharinfo(0) + " (" + jobname(Class) + ") reached Max. Level and received " + getitemname(.@reward) + " ("+ .@type$ +") !", bc_all; close; ExplainRace: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; mes "Yes! When you reach the maximum level for your class, talk to me and you'll be rewarded with a special item."; if ($r99_rare_chance > 0) { mes "There is ^0099cc" + $r99_rare_chance + "%^000000 of chance that you'll get a rare item!"; mes "Possible rare items:"; set .@length, getarraysize($rare_rewards); for (.@i = 0; .@i < .@length; .@i++) { set .@item, $rare_rewards[.@i]; mes " - " + getitemname(.@item); } } mes "Possible common items:"; set .@length, getarraysize($common_rewards); for (.@i = 0; .@i < .@length; .@i++) { set .@item, $common_rewards[.@i]; mes " - " + getitemname(.@item); } next; goto Begin; ShowRewarded: clear; mes "[ ^0099ccRace to Max Level^000000 ]"; for (.@i = 0; .@i < getarraysize(.@rewardablejobs); .@i++) { mes jobname(.@rewardablejobs[.@i]) + ": " + (($rewarded$[.@rewardablejobs[.@i]] != "") ? "^0055ff" + $rewarded$[.@rewardablejobs[.@i]] + "^000000" : "^999999Nobody^000000"); } next; goto Begin; function SelectFromArray { .@size = getarraysize(getarg(0)); .@rewards_s$ = ""; for (.@i = 0; .@i < .@size; .@i++) { .@rewards_s$ = .@rewards_s$ + getitemname(getelementofarray(getarg(0), .@i )) + ":"; } return select(.@rewards_s$); } function ListRewards { .@rewards = getarg(0); .@size = getarraysize(getarg(0)); for (.@i = 0; .@i < .@size; .@i++) { mes .@i + 1 + ". " + getitemname(getelementofarray(getarg(0), .@i)); } } } It would probably take me longer to make a version that supports transcendental classes, which I can't really afford to do now.
  2. Greetings, Sorry for the late reply. I saw you updated your answer. Unfortunately, I tried suggesting what I thought could fix it, based on my knowledge of C and on my intuition. I'm not an expert on Gepard Shield, so you'll have to wait for Functor. Tyrfing
  3. bonus bAtkRate, (MaxHp * percentage_of_maxhp) / 100; This will increment the ATK by the specified percentage of the max hp. I'm sure this is not what you want, but it is what you requested. If MaxHp is 500, and percentage is 1, then this will add a bonus of 500 * 1 / 100 = 5% to ATK. If you find that this is too much (you probably will), you can multiply the denominator by a constant which better suits your needs. In my opinion, this will never be an interesting bonus, unless you make it non-linear, so that the bonus gets smaller as the MaxHp increases.
  4. https://github.com/thervingi/VIP-Ticket/tree/master/Translated/pt-br Instruções https://github.com/thervingi/VIP-Ticket/blob/master/Translated/pt-br/LEIAME.md
  5. Sorry, you don't have to downgrade. I thought you were using 5.6. You need to Switch from innodb to myisam before importing your SQL files. Or change the collation to some other type. Try utf8_general_ci. Please refer to this link
  6. In MySQL version 5.7 and upwards this limit has been increased to 3072 bytes. https://stackoverflow.com/a/36405914 So, make sure you are using MySQL 5.7.
  7. Please post your code.
  8. Greetings, Try changing the lines 1772, 1916, 1269 that call login_log() to call login_gepard_log() instead. If this doesn't work, then undo these modifications and duplicate each of these lines. After that, update the second line of each so that they call login_gepard_log() instead of login_log(). Then, remove the first argument of the calls to login_log() on the line above. Tyrfing
  9. You can apply a patch automatically using Git (download the installer at www.git-scm.com). Here is the manual for doing that: https://git-scm.com/docs/git-apply There's also this video, which is for Drupal, but it's the same technique for any patch file.
  10. Greetings Nuckelavee, Have you set up 192.168.1.64 as a static IP address for your computer on your router? This is necessary for the Port Fowarding to work, since you are redirecting incoming requests on your router to a local IP address. Your char_athena.conf should have your LAN IP on login_ip and your WAN IP/NO-IP domain on char_ip. Your map_athena.conf should have your LAN IP on char_ip and your WAN IP/NO-IP domain on map_ip. If your ISP uses NAT, it might be that your router in fact has an external IP address that is not your real (WAN) IP address. In this case, you might want to try this suggestion regarding your NO-IP configuration. You said that Port Check Tool wouldn't yield a definitive result regarding the state of your router's 5121, 6121, 6900, 3306 and 80 ports. This is indicative that either your ISP or your Router's Firewall is not redirecting incoming connections to your machine. Your router's port forwarding configuration is correct, though. Your ISP might have changed its contractual clauses between 2015 and 2018 to block any connections on non-trivial (i.e. other than 80, 443, 21, 22, etc) ports. Summarizing Your issue seems to come down to allowing connections on your Windows Firewall, on your Router Firewall and, perhaps, on your ISP's Firewall. It might be that other running applications are competing for the same ports used by VertrigoServ. Please provide the contents of login_athena.conf, char_athena.conf, map_athena.conf as well as subnet_athena.conf for further support. Sincerely, Tyrfing
  11. Also, for instructive purposes: From rA\doc\script_commands.txt: *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; This command will remove a specified amount of items from the invoking/target character. See 'getitem2' for an explanation of the expanded parameters. On the script excerpt you provided, the delitem2 argument you request an explanation for (the number zero) occupies the 5th position, that of the <attribute> parameter. The delitem2 command explanation forwards us to getitem2 for explanation on these parameters. From rA\doc\script_commands.txt: identify - Whether you want the item to be identified (1) or not (0). refine - For how many pluses will it be refined. It will not let you refine an item higher than the max refine. attribute - Whether the item is broken (1) or not (0). card1,2,3,4 - If you want a card compound to it, place the card ID number into the specific card slot. Here is your explanation for that parameter. Now, regarding the use of getd, let's first take a look at this command at rA\doc\script_commands.txt: *getd("<variable name>") Returns a reference to a variable, the name can be constructed dynamically. Refer to 'setd' for usage. In order for you to properly understand getd, you need to first understand how to use basic variables and arrays (skip the spoiler if you do). Assuming that you already understand how basic variables and arrays really work, this is the magic of getd: It allows you to choose which variables you want to set/read WHILE the script is executing. When you use basic variables and arrays, you're saying exactly where to place or to find the data you're looking for (e.g.: "I want to set the character's name to the variable named .@player_name$." or "I want to set [501, 502, 503, 504, 505] to the array named .@item_list."). This is fixed: after the server's loaded the script, you can't open an input and ask the player: "Hey, tell me the name of the variable you want me to store this amount of Jellopies in:". With getd you actually can do that (even though you shouldn't! ). That certainly is not the only use for getd, nor the most common: it is often used to make scripting simpler, and although I will refrain from attempting to document all occasions when its use would be beneficial, I'll provide you with an example which I find both instructive and simple enough. Let's say you have a Treasure Chest NPC, and whenever the player interacts with it, you want to give him a set of items. You have 5 different set of items, represented by 5 different arrays, and you want your script to randomly choose which set of items to reward the lucky player. So, you have something like this: setarray .@rewards1[0], 501, 502, 503; setarray .@rewards2[0], 620, 630, 640, 650; setarray .@rewards3[0], 711, 722, 733, 744, 755; setarray .@rewards4[0], 888, 999, 1010, 1111, 1212, 1313; setarray .@rewards5[0], 1010, 1111, 1212, 1313, 1414, 1515, 1616; How do you randomly select one of these arrays to reward the player with its items? Sure, you're definitely going to use the rand() function to generate a number that is in the range of [1, 5]. vvvv But, please, don't do this. vvvv With getd, you can simply do the following: set .@picked_reward, rand(1,5); // The number of the picked reward // Rewards array name set .@chosen_rewards, ".@rewards" + .@picked_reward; // How many of each item inside the rewards list to give the player set .@amount_per_item, 1; for (.@i = 0; .@i < getarraysize(getd(.@chosen_rewards)); .@i++) { giveitem getd(.@chosen_rewards + "[" + .@i + "]"), .@amount_per_item; } Line 1 picks a random number from 1 to 5 to identify which array of items it wants to give to the player. Line 4 effectively adds the string ".@rewards" to the picked number, so ".@rewards" + 4, for example, yields ".@rewards4" and stores that in .@chosen_rewards. Line 7 sets how many of each item in the rewards list to reward the player with. Line 9 is where getd is first used. When you use the getd() function providing a string, you're effectively dealing with the value of the variable whose name is the provided string. So, in case the picked reward was number 4, you're actually dealing with .@rewards4, which is an array, hence why we're measuring it's size with getarraysize(). Line 10 concatenates the array's name with it's element so that we can actually access each of the array's elements. In case the picked reward was number 4, it concatenates the string ".@rewards4" and "[.@i]", with .@i being repeatedly replaced by numbers from 0 to x, where x is getarraysize(.@rewards4) - 1. So it goes over the array, item by item, giving the defined amount to the invoking character. So, this is pretty much all there is to it. I hope this is as instructive as it is exhausting.
  12. This topic should actually be on Scripting Support. Greetings immortalis, If you haven't already added a new quest ID to your rathena\db\[pre-re|re]\quest_db.txt file, open it and follow the instructions and the provided format to add a new quest ID. Once you've created a new quest in your quest_db.txt file, simply call setquest <quest_id> at the desired moment of your NPC script. Once the quest is complete, call completequest <quest_id>, or, if you would like to erase a quest from the user's log, call erasequest <quest_id>. If you'd like your script to display that "Quest!" bubble icon, create a new OnInit label on your NPC script (as shown below), or modify your current OnInit label to add the questinfo command: OnInit: questinfo <quest_id>, QTYPE_QUEST; end; You can see the full documentation, including more detailed explanations for the above commands, at doc/script_commands.txt. Below I provide only the script_commands.txt information concerning the manipulation of the quest log: ========================= |8.- Quest Log commands.| ========================= --------------------------------------- *questinfo <Quest ID>,<Icon>{,<Map Mark Color>{,<Job Class>}}; This is esentially a combination of checkquest and showevent. Use this only in an OnInit label. For the Quest ID, specify the quest ID that you want checked if it has been started yet. For Icon, use one of the following: No Icon : QTYPE_NONE ! Quest Icon : QTYPE_QUEST ? Quest Icon : QTYPE_QUEST2 ! Job Icon : QTYPE_JOB ? Job Icon : QTYPE_JOB2 ! Event Icon : QTYPE_EVENT ? Event Icon : QTYPE_EVENT2 Warg : QTYPE_WARG Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410) Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC, the available color values are: 0 - No Marker (default) 1 - Yellow Marker 2 - Green Marker 3 - Purple Marker When a user shows up on a map, each NPC is checked for questinfo that has been set. If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear. Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class. Example izlude,100,100,4 script Test 844,{ mes "[Test]"; mes "Hello World."; close; OnInit: questinfo 1001, QTYPE_QUEST, 0, Job_Novice; end; } --------------------------------------- *setquestinfo_level <quest_id>,<min_level>,<max_level>; Add level range criteria for quest info with quest id 'quest_id'. This command must be used after 'questinfo'. --------------------------------------- *setquestinfo_req <quest_id>,<req_quest_id>,<state>{,<req_quest_id>,<state>,...}; Add 'req_quest_id' as requirement for quest info with quest id 'quest_id'. Value os 'state' are: 0: Player doesn't started 'req_quest_id'. 1: Player has 'req_quest_id' (state is either "inactive" or "active"). 2: Player has 'req_quest_id' completed This command must be used after 'questinfo'. --------------------------------------- *setquestinfo_job <quest_id>,<job_id>{,<job_id>...}; Add job criteria for quest info with quest id 'quest_id'. The job criteria may more than one job_id. This command must be used after 'questinfo'. --------------------------------------- *setquest <ID>{,<char_id>}; Place quest of <ID> in the users quest log, the state of which is "active". If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set. --------------------------------------- *completequest <ID>{,<char_id>}; Change the state for the given quest <ID> to "complete" and remove from the users quest log. --------------------------------------- *erasequest <ID>{,<char_id>}; Remove the quest of the given <ID> from the user's quest log. --------------------------------------- *changequest <ID>,<ID2>{,<char_id>}; Remove quest of the given <ID> from the user's quest log. Add quest of the <ID2> to the the quest log, and the state is "active". --------------------------------------- *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}}) If no additional argument supplied, return the state of the quest: -1 = Quest not started (not in quest log) 0 = Quest has been given, but the state is "inactive" 1 = Quest has been given, and the state is "active" 2 = Quest completed If parameter "PLAYTIME" is supplied: -1 = Quest not started (not in quest log) 0 = the time limit has not yet been reached 1 = the time limit has not been reached but the quest is marked as complete 2 = the time limit has been reached If parameter "HUNTING" is supplied: -1 = Quest not started (not in quest log) 0 = you haven't killed all of the target monsters and the time limit has not been reached. 1 = you haven't killed all of the target monsters but the time limit has been reached. 2 = you've killed all of the target monsters --------------------------------------- *isbegin_quest(<ID>{,<char_id>}) Return the state of the quest: 0 = Quest not started (not in quest log) 1 = Quest has been given (state is either "inactive" or "active") 2 = Quest completed --------------------------------------- *showevent <icon>{,<mark color>{,<char_id>}} Show an emotion on top of a NPC, and optionally, a colored mark in the mini-map like "viewpoint". This is used to indicate that a NPC has a quest or an event to a certain player. Available Icons: Remove Icon : QTYPE_NONE ! Quest Icon : QTYPE_QUEST ? Quest Icon : QTYPE_QUEST2 ! Job Icon : QTYPE_JOB ? Job Icon : QTYPE_JOB2 ! Event Icon : QTYPE_EVENT ? Event Icon : QTYPE_EVENT2 Warg : QTYPE_WARG Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410) Mark Color: 0 - No Mark 1 - Yellow Mark 2 - Green Mark 3 - Purple Mark --------------------------------------- Let me know if you have any additional questions. Tyrfing
  13. Have you compiled your server with the appropriate PACKETVER?
  14. As I have responded in rA's Discord, this font is Volkswagen Serial Heavy.
  15. Tyrfing

    counitem

    Or, if you have a list os many items, you can store their IDs in an array: setarray .@items[0], 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245; Then, if you want to make sure that the player has at least X of each item, you iterate over the array: set .@requiredAmount, X; set .@hasAllItems, 1; for (.@i = 0; .@i < getarraysize(.@items); .@i++) { if (countitem(.@item[.@i]) < .@requiredAmount) { set .@hasAllItems, 0; break; } } if (.@hasAllItems) { // Player has at least X items of every ID } else { // Player does not have X items of every ID } Or, if you'd like to specify different quantities for each item, you can also do: setarray .@items[0], 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245; setarray .@requiredAmount[0], 10, 10, 5, 5, 10, 10, 5, 6, 7, 10, 50, 100; set .@hasAllItems, 1; for (.@i = 0; .@i < getarraysize(.@items); .@i++) { if (countitem(.@item[.@i]) < .@requiredAmount[.@i]) { set .@hasAllItems, 0; break; } } if (.@hasAllItems) { // Player has the required amount of items of every ID } else { // Player does not have the required amount of items of every ID } You can also unite the two arrays together: setarray .@item_and_amount[0], 1234, 10, 1235, 10, 1236, 5, 1237, 5, 1238, 10, 1239, 10, 1240, 5, 1241, 6, 1242, 7, 1243, 10, 1244, 50, 1245, 100; /* The above array holds pairs of values, where the first value is the item ID and the second value is the required amount */ set .@hasAllItems, 1; for (.@i = 0; .@i < getarraysize(.@item_and_amount) - 1; .@i = .@i + 2) { if (countitem(.@item_and_amount[.@i]) < .@item_and_amount[.@i+1]) { set .@hasAllItems, 0; break; } } if (.@hasAllItems) { // Player has the required amount of items of every ID } else { // Player does not have the required amount of items of every ID }
×
×
  • Create New...