Jump to content
  • 0

Check Weight


Reducto

Question


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  231
  • Reputation:   9
  • Joined:  12/16/11
  • Last Seen:  

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; },{},{}

 

 

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

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 by Kaze
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


if( checkweight( 7619,10 ) ) getitem 7619,10;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  231
  • Reputation:   9
  • Joined:  12/16/11
  • Last Seen:  

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."

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1125
  • Reputation:   236
  • Joined:  07/30/12
  • Last Seen:  

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; } },{},{}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1125
  • Reputation:   236
  • Joined:  07/30/12
  • Last Seen:  

 

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

 

 

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1125
  • Reputation:   236
  • Joined:  07/30/12
  • Last Seen:  

 

 

 

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

Excuse me? I think you haven't tried it yet.

 

/hmm

 

 

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 by Kaze
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1125
  • Reputation:   236
  • Joined:  07/30/12
  • Last Seen:  

Excuse me? I think you haven't tried it yet.

 

/hmm

 

 

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. -.-

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

My Bad >,< btw? Possible to add additional items? getitem,501,10,502,10????

 

 

Thanks again!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1125
  • Reputation:   236
  • Joined:  07/30/12
  • Last Seen:  

My Bad >,< btw? Possible to add additional items? getitem,501,10,502,10????

 

 

Thanks again!

 

Yes, just add it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

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%).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...