Reducto Posted May 7, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 231 Reputation: 9 Joined: 12/16/11 Last Seen: August 10, 2016 Share Posted May 7, 2013 Hello I need a npc script for this. Before opening the box it will check first the weight of the character to get the item. 12920,Enriched_Elunium_Box,Enriched Elunium Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 7619,10; },{},{} Quote Link to comment Share on other sites More sharing options...
1 Deleted User Posted May 8, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 235 Reputation: 55 Joined: 12/02/11 Last Seen: February 26, 2021 Share Posted May 8, 2013 (edited) Fixed: (Version) 12920,ENRICHED_ELUNIUM_BOX,Enriched Elunium Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if(((Weight*100)/MaxWeight) > 49) { getitem 31985,1; message strcharinfo(0), "You are overweight! You cannot open the box."; end; } else { getitem 7619,10; } },{},{} Edited June 17, 2017 by Kaze 1 Quote Link to comment Share on other sites More sharing options...
Emistry Posted May 7, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 6 hours ago Share Posted May 7, 2013 if( checkweight( 7619,10 ) ) getitem 7619,10; Quote Link to comment Share on other sites More sharing options...
Reducto Posted May 7, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 231 Reputation: 9 Joined: 12/16/11 Last Seen: August 10, 2016 Author Share Posted May 7, 2013 I mean if the player is above 50% weight. When he try to open the box. There will be a message like. "You are overweight, you cannot open the box." Quote Link to comment Share on other sites More sharing options...
Jaburak Posted May 7, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted May 7, 2013 I mean if the player is above 50% weight. When he try to open the box. There will be a message like. "You are overweight, you cannot open the box." Try this; 12920,Enriched_Elunium_Box,Enriched Elunium Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if (((Weight*100)/MaxWeight) > 49) { message strcharinfo(0), "You are overweight, you cannot open the box!"; getitem 12920,1; } if (((Weight*100)/MaxWeight) < 49) { getitem 7619,10; } },{},{} Quote Link to comment Share on other sites More sharing options...
Jaburak Posted May 8, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted May 8, 2013 I mean if the player is above 50% weight. When he try to open the box. There will be a message like. "You are overweight, you cannot open the box." Try this; 12920,Enriched_Elunium_Box,Enriched Elunium Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if (((Weight*100)/MaxWeight) > 49) { message strcharinfo(0), "You are overweight, you cannot open the box!"; getitem 12920,1; } if (((Weight*100)/MaxWeight) < 49) { getitem 7619,10; } },{},{} Hi, Anakid! i have tested it works fine, however, if the player is overweight the giftbox will be delitem? how to make this one that cannot delitem? only if the player is non-overweight will be deducted the gift box or delitem. Just change the getitem ItemID. Quote Link to comment Share on other sites More sharing options...
Deleted User Posted May 8, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 235 Reputation: 55 Joined: 12/02/11 Last Seen: February 26, 2021 Share Posted May 8, 2013 I mean if the player is above 50% weight. When he try to open the box. There will be a message like. "You are overweight, you cannot open the box." Try this; 12920,Enriched_Elunium_Box,Enriched Elunium Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if (((Weight*100)/MaxWeight) > 49) { message strcharinfo(0), "You are overweight, you cannot open the box!"; getitem 12920,1; } if (((Weight*100)/MaxWeight) < 49) { getitem 7619,10; } },{},{} Hi, Anakid! i have tested it works fine, however, if the player is overweight the giftbox will be delitem? how to make this one that cannot delitem? only if the player is non-overweight will be deducted the gift box or delitem. Just change the getitem ItemID. Excuse me? what do you mean change the getitem ltemID.? My concern is, if a player is overweight the giftbox should not be delitem, unless if a player gets the reward and the giftbox will be deleted. Quote Link to comment Share on other sites More sharing options...
Jaburak Posted May 8, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted May 8, 2013 I mean if the player is above 50% weight. When he try to open the box. There will be a message like. "You are overweight, you cannot open the box." Try this; 12920,Enriched_Elunium_Box,Enriched Elunium Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if (((Weight*100)/MaxWeight) > 49) { message strcharinfo(0), "You are overweight, you cannot open the box!"; getitem 12920,1; } if (((Weight*100)/MaxWeight) < 49) { getitem 7619,10; } },{},{} Hi, Anakid! i have tested it works fine, however, if the player is overweight the giftbox will be delitem? how to make this one that cannot delitem? only if the player is non-overweight will be deducted the gift box or delitem. Just change the getitem ItemID. Excuse me? what do you mean change the getitem ltemID.? My concern is, if a player is overweight the giftbox should not be delitem, unless if a player gets the reward and the giftbox will be deleted. Excuse me? I think you haven't tried it yet. Quote Link to comment Share on other sites More sharing options...
Deleted User Posted May 8, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 235 Reputation: 55 Joined: 12/02/11 Last Seen: February 26, 2021 Share Posted May 8, 2013 (edited) Excuse me? I think you haven't tried it yet. 29600,PACKAGE,Package,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if (((Weight*100)/MaxWeight) > 49) { message strcharinfo(0), "You are overweight, you cannot open the box!"; } if (((Weight*100)/MaxWeight) < 49) { getitem 501,10; } },{},{} If the player is overweight when i clicked the box, the box will be delitem (>,<) How do i fix this one? if a player opens a box without overweight the box will be delitem. Edited May 8, 2013 by Kaze Quote Link to comment Share on other sites More sharing options...
Jaburak Posted May 8, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted May 8, 2013 Excuse me? I think you haven't tried it yet. 29600,PACKAGE,Package,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if (((Weight*100)/MaxWeight) > 49) { message strcharinfo(0), "You are overweight, you cannot open the box!"; } if (((Weight*100)/MaxWeight) < 49) { getitem 501,10; } },{},{} If the player is overweight when i clicked the box, the box will be delitem (>,<) How do i fix this one? if a player opens a box without overweight the box will be delitem. Did you try it in your server or no? It works fine in my test server, the box should return to your inventory if you're overweight. -.- Quote Link to comment Share on other sites More sharing options...
Deleted User Posted May 8, 2013 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 235 Reputation: 55 Joined: 12/02/11 Last Seen: February 26, 2021 Share Posted May 8, 2013 My Bad >,< btw? Possible to add additional items? getitem,501,10,502,10???? Thanks again! Quote Link to comment Share on other sites More sharing options...
Jaburak Posted May 8, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted May 8, 2013 My Bad >,< btw? Possible to add additional items? getitem,501,10,502,10???? Thanks again! Yes, just add it. Quote Link to comment Share on other sites More sharing options...
Lighta Posted May 8, 2013 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 737 Reputation: 216 Joined: 11/29/11 Last Seen: December 20, 2020 Share Posted May 8, 2013 It would be better to use checkweight for this but yeah checkweight wont check if you have more then 50% of weight but just if with the news items you'll be overweight. right now you may have some issue : - you checking if you are at 50% but not the itemweight nor the quantity : let say my maxweight = 1000 I'm at 300 (30%); my itemweight is = 10; by using your script I could have items but if I try to have more the 7 I,d be overweight wich ain't check by this. gettiem,myitem,8; => boom I'm overweight item at drop on floor if possible. - you're not checking empty slot. let say your maxinventory = 100; and you have 100item on yourself. getitem,myitem,1; => boom that will fail once again if that item wasn't stackable or we didn't have this id yet into our inventory list yet. -you're not checking overamount: this case apply only stackable item. let say you already have 32K arrow. getitem,arrow,1; => boom will fail once again we already reach the max amount of this arrow we could have into our inventory.All those case are being check by checkweight and you could provide a list of argument so it stack the conditions togeter. Your 50% check right now isn't best like I demonstrate but you still could use a combinaison of checkweight and are we 50% under to have something more correct. (Even if current state taht doesn't mean after getting the item you'll still be under 50%). Quote Link to comment Share on other sites More sharing options...
Question
Reducto
Hello I need a npc script for this. Before opening the box it will check first the weight of the character to get the item.
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.