Stop clothing contributing to inventory limit when worn

I have a volume limit on my inventory (you can carry as much as you like, except for one item that is so heavy you have to drop everything else).

I have limted inventory volume to 100, the really heavy item has a volume of 100, all other items have volume of 1.

I want clothing to not contribute to the volume when worn (volume =0) but have volume = 1 when carried but not worn.

There is probably a way easier way of doing this!

Thanks,
ND


I want clothing to not contribute to the volume when worn (volume =0) but have volume = 1 when carried but not worn.

<changedworn type="script">
  if (this.worn) {
    this.volume = 0
  }
  else {
    this.volume = 1
  }
</changedworn>

Note that this doesn't stop you picking up the big item, and then removing the items you're wearing, to end up carrying more than the inventory limit. You could copy some code from CoreCommands to make it check for that, if you really care:

<changedworn type="script">
  if (this.worn) {
    this.volume = 0
  }
  else {
    this.volume = 1
    if (Contains (game.pov, this)) {
      totalvolume = 0
      foreach (obj, GetAllChildObjects(game.pov)) {
        if (HasInt(obj, "volume")) {
          totalvolume = totalvolume + obj.volume
        }
      }
      if (totalvolume > game.pov.maxvolume) {
        msg ("Your inventory is full. You can't carry the " + GetDisplayAlias(this) + ".")
        DoDrop (this)
      }
    }
  }
</changedworn>

Log in to post a reply.

Support

Forums