Max Volume/Volume Question [SOLVED]

Anonynn
20 May 2016, 06:23So I was wondering if it was possible for the game NOT to count items among that limit when they have "0" volume.
For the record, I have unlimited inventory allowance, so I'm not sure what's going on. Here's the coding.
maxvolume 3
changedmaxvolume
if (player.maxvolume < 0) {
player.maxvolume = 0
}
Go Modified Command
if (GetBoolean (player, "immobilized")) {
if (HasString(player, "immobilizedmessage")) {
msg (player.immobilizedmessage)
}
else {
msg ("<br/>You cannot move! <br/>")
}
}
else if (player.maxvolume < ListCount(GetDirectChildren(player))) {
msg ("<br/>{random:You're carrying too much to move!:You're juggling too many items!:You cannot move, things are literally dropping out of your arms with every motion you make!} {once:You'll need to find a container or to drop some of your current items.} <br/>")
}
else if (exit.locked) {
msg (exit.lockmessage)
}
else if (HasScript(exit, "script")) {
do (exit, "script")
}
else {
if (exit.lookonly) {
msg ("You can't go there.")
}
else {
player.parent = exit.to
}
}
The Pixie
20 May 2016, 06:51else if (player.maxvolume < ListCount(GetDirectChildren(player))) {
You look like you are comparing the maxvolume to the number of items carried, and the number of items carried is not important, is it?
I think if I was doing it I would create a function that adds up the volume carried, CalcVolume. Here is some code; it assumes a volume of 1 if there is none set for an object.
vol = 0
foreach (o, GetDirectChildren(player)) {
if (HasInt(o, "volume"))
vol = vol + o.volume
}
else {
vol = vol + 1
}
}
return (vol)
Then compare the calculated volume with the maximum.
else if (player.maxvolume < CalcVolume())) {
Only change player.maxvolume if the player picks up or puts down a bag.

Anonynn
20 May 2016, 18:34I think if I was doing it I would create a function that adds up the volume carried, CalcVolume. Here is some code; it assumes a volume of 1 if there is none set for an object.
This would ordinarily be a great idea! But I have certain things like "clothing" and "keys" for example, that do not have volume, that way when the player wears something it doesn't count against their inventory capacity.
Only change player.maxvolume if the player picks up or puts down a bag.
I have items with volume subtract from the total of the max carry, so that the player can just look at their description and see how much space they have left. Containers increase that max carry amount

Starting Player has a Max Carry Capacity of 3.
Player picks up clothing or a key. MCC still 3.
Player pick up item with "1" volume. MCC drops to 2.
Player drops that item with "1" volume. MCC increases to 3.
Player picks up "Container". MCC increases to 6
And so on. Make sense?
else if (player.maxvolume < ListCount(GetDirectChildren(player))) {
So what should I do with this, if I don't want it counting "0" or nothing? Since "0" isn't an option after unchecking the limited inventory thing in the game.object under Features.
The Pixie
20 May 2016, 18:47Anonynn wrote:This would ordinarily be a great idea! But I have certain things like "clothing" and "keys" for example, that do not have volume, that way when the player wears something it doesn't count against their inventory capacity.
That should be fine; give the keys or whatever a volume of zero.
I have items with volume subtract from the total of the max carry, so that the player can just look at their description and see how much space they have left. Containers increase that max carry amount
It actually works really good! It works like this....
Starting Player has a Max Carry Capacity of 3.
Player picks up clothing or a key. MCC still 3.
Player pick up item with "1" volume. MCC drops to 2.
Player drops that item with "1" volume. MCC increases to 3.
Player picks up "Container". MCC increases to 6
That is what I thought. What I suggest is:
Starting Player has a Max Carry Capacity of 3. Carried volume is 0.
Player picks up clothing or a key. MCC still 3. Carried volume is 0, because they have a volume of 0.
Player pick up item with "1" volume. MCC still 3. Carried volume is now 1.
Player drops that item with "1" volume. MCC still 3. Carried volume is 0.
Player picks up "Container". MCC increases to 6.

Anonynn
20 May 2016, 20:23Starting Player has a Max Carry Capacity of 3. Carried volume is 0.
Player picks up clothing or a key. MCC still 3. Carried volume is 0, because they have a volume of 0.
Player pick up item with "1" volume. MCC still 3. Carried volume is now 1.
Player drops that item with "1" volume. MCC still 3. Carried volume is 0.
Player picks up "Container". MCC increases to 6.
So...What should I change then? Confused @_@ Aside from not subtracting anything from the MCC.
I ask because that doesn't really solve the problem. The game is counting "0" as "1". So if the player carries "3" items that have "0" volume, they still get overburdened and can't move.
I was thinking of changing player.maxvolume to player.maxweight --- so nothing gets associated with the game's built-in volume. I dunno.
The Pixie
20 May 2016, 22:48vol = 0
foreach (o, GetDirectChildren(player)) {
vol = vol + o.volume
}
return (vol)
Change this:
else if (player.maxvolume < ListCount(GetDirectChildren(player))) {
... to this (I had an extraneous bracket before, by the way):
else if (player.maxvolume < CalcVolume()) {
Make sure all your zero volume items have volume set to zero. When I tried it it works, except that the built in system will not let you even pick up stuff that would take you over the maximum.
I was thinking of changing player.maxvolume to player.maxweight --- so nothing gets associated with the game's built-in volume. I dunno.
Good idea. You will need to delete the maxvolume attribute on the player. I would add one called maximumvolume, then use the built-in volume attribute of the objects. The line in Go becomes:
else if (player.maximumvolume < CalcVolume()) {
