User picks up item
Item count goes up 1
If item count is 3 or more
Tell user they are heavy
I don't understand why this won't work. It makes sense to me!
pick_up()
set src in oview(1)
set category = "Object"
loc = usr.contents
item_count ++
if(item_count >= 3)
usr << "Heavy"
The var for item_count is already declared as obj/var/item_count = 0
What exactly am I doing wrong here? I've tried item_count +=1, item_count = item_count + 1 and now I'm trying item_count ++
item_count +=1, item_count = item_count + 1 and now I'm trying item_count ++
All these are equivalent. They're all right too.
Your problem is, each object has individual item_count. You pickup Object1, and it changes Object1.item_count to 1. Then you take Object2 and it Object2.item_count to 1. Now you have two objects with item_count == 1.
You need to change players variable, if you want to limit his inventory (usr.item_count in this case).