ID:268605
 
        verb
Get()
set category = "Item Commands"
set src in oview(0)
if(usr.Weight > usr.MaxWeight)
src.Weight_Drop()
usr << "You're carrying too much!"
else
usr.Weight += src.Weight
src.Move(usr)
usr << "You pick up a [src]."
Drop()
if(usr.Righthand == src)
usr << "This item is equiped! Unequip it to drop it([usr.Righthand])"
else
set category = "Item Commands"
src.Move(usr.loc)
usr.Weight -= src.Weight
usr << "You drop a [src]."

Weight_Drop()
src.Move(usr.loc)


Okay, I can pick up an item even if it surpasses my weight. :(
I tried to fix it, but can't...
Help will be appreciated...
Hell Ramen wrote:
>       verb
> Get()
> set category = "Item Commands"
> set src in oview(0)
> if(usr.Weight > usr.MaxWeight)
> src.Weight_Drop()
> usr << "You're carrying too much!"
> else
> usr.Weight += src.Weight
> src.Move(usr)
> usr << "You pick up a [src]."
> Drop()
> if(usr.Righthand == src)
> usr << "This item is equiped! Unequip it to drop it([usr.Righthand])"
> else
> set category = "Item Commands"
> src.Move(usr.loc)
> usr.Weight -= src.Weight
> usr << "You drop a [src]."
>
> Weight_Drop()
> src.Move(usr.loc)

Okay, I can pick up an item even if it surpasses my weight. :(
I tried to fix it, but can't...
Help will be appreciated...

what does src.Weight_Drop() do?
Also, you are checking the weight before adding the weight of the src. maybe try :

if((usr.Weight+src.Weight) > usr.MaxWeight)

you may want to have the verb run a check of what usr.Weight is at that point in time to see what the value is before you pick up the object and after.
In response to Jik
Thanks :D, I got it.
=/
Weight_Drop is so when yo-- nevermind, I could add that in weightchecker and stuff. >_>
But it saves time.
But, it makes it so you don't lose the items weight when dropping it.
In response to Hell Ramen
You have to be very careful when doing this, so that you don't accidentally remove something while keeping weight the same. I'd suggest using Enter(), Entered(), and Exited(). They work for mobs the same as they work for turfs, so when you Move() an item into contents, Enter() is called, if it returns 1, Entered() is called. Thus:
mob
Enter(atom/movable/A)
if(istype(A, /item/))
var/item/I = A
if(you can pick it up)
return ..()
else
return 0
Entered(atom/movable/A)
if(istype(A, /item/))
Add its weight to your limit
Exited(atom/movable/A)
if(istype(A, /item/))
Remove its weight from your limit

item
parent_type = /obj
//Now it's an obj with the path /item
//Just like how an obj is a datum/atom/movable/obj with the path /obj

verb
Get()
set src in oview(1)
if(Move(usr))
usr << "You pick up [src]"
else
usr << "You can't pick up [src]"
In response to Garthor
_>
I might use Garthor's system, I don't want any bugs.
I think I am. :D
Thanks Garthor