Inventory Problem Redeux...[Solved]

Anonynn
Ugh. I'm sorry. There's one more problem I need to address.

In my game I have a container object on the player object where all the "worn" clothing goes to be stored so that it doesn't clutter up the player's inventory. When removed, it returns to the player's inventory. The problem is, if that container is "closed" the player can wear several items of the same layer (like two shirts for example) or two pairs of pants. Is there a way for Quest to recognize that whether the "worn" object is opened or closed, it still can't allow the player to wear two of the same clothing layer?

When it's opened it works btw! Only when it's closed does it not.

UPDATE
This thread is solved. My modified Do Wear and Do Remove were interfering with the new Wearables Libraries over-rides!

HegemonKhan
you're probably going to have to change how the 'worn' scripting is done, I'm not sure how "closed containers+their child objects" work, but I'm guessing that maybe your/Chase's 'worn' scripting might use 'GetDirectChildren' (which those child objects are blocked off when the container is closed), whereas if you use 'GetAllChildren', it may bypass that the container is closed... or maybe it doesn't... and Pixie or who'ever will have to dig deeper and figure out how to get it to work... if it can work...

or...

maybe you'd just need to add in a check/if scripting and use the built-in 'isopen' Boolean Attribute, and then maybe also you'd have to temporarily open the container and then close it when you're done, to deal with not allowing it to allow you to have two objects worn at the same layer)... meh

The Pixie
It probably uses a Scope function, ScopeInventoryReachable or something? That would then check if containers are open. Try using GetAllChildObjects(player) instead inside both DoWear and DoRemove (is that what they are called?).

Anonynn

It probably uses a Scope function, ScopeInventoryReachable or something? That would then check if containers are open. Try using GetAllChildObjects(player) instead inside both DoWear and DoRemove (is that what they are called?).



So I change these to your suggestion?

else if (not ListContains(ScopeInventory(), object)) {

foreach (item, ScopeReachableInventory())

Here's the:
Do Wear

player.toobigforitem = false
if (HasScript(object, "testplayersize")) {
do (object, "testplayersize")
}
if (player.toobigforitem) {
if (HasString(object, "toobigtowearmsg")) {
msg (object.toobigtowearmsg)
}
else {
msg ("You try to put on the " + GetDisplayName(object) + " but it just won't fit!")
}
}
else if (not HasAttribute(object,"worn")) {
msg (DynamicTemplate("WearUnsuccessful", object))
}
else if (object.parent = player and GetBoolean(object, "worn")) {
msg (DynamicTemplate("AlreadyWearing", object))
}
else if (not ListContains(ScopeInventory(), object)) {
msg (DynamicTemplate("WearUnsuccessful", object))
}
else {
isLayerProblem = false
conflictedItem = null
if (HasAttribute(object,"wear_slots")) {
foreach (item, ScopeReachableInventory()) {
if (HasAttribute(item,"wear_slots")) {
if (GetBoolean(item, "worn")) {
foreach (itemSlot, item.wear_slots) {
if (ListContains(object.wear_slots,itemSlot)) {
if (object.wear_layer < item.wear_layer) {
conflictedItem = item
isLayerProblem = true
}
else if (object.wear_layer = item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if (conflictedItem = null) {
object.worn = True
object.original_drop = object.drop
object.original_alias = object.alias
object.drop = false
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
if (object.wearmsg = null) {
msg (DynamicTemplate("WearSuccessful",object))
}
else {
msg (object.wearmsg)
}
// do after
if (HasScript(object, "onafterwear")) {
do (object, "onafterwear")
}
else if (HasString(object, "onafterwear")) {
msg (object.onafterwear)
}
}
else if (isLayerProblem = true) {
msg (DynamicTemplate("CannotWearOver",conflictedItem))
}
else {
msg (DynamicTemplate("CannotWearWith",conflictedItem))
}
}


Do Remove---------------------

if (not object.parent.parent = player or not GetBoolean(object, "worn") or not GetBoolean(object, "removeable")) {
if (object.removemsg = null) {
msg (DynamicTemplate("RemoveUnsuccessful",object))
}
else {
msg (object.removemsg)
}
}
else {
conflictedItem = null
// check if we are wearing anything over it
if (HasAttribute(object,"wear_slots")) {
[b]foreach (item, ScopeReachableInventory())[/b] {
if (HasAttribute(item,"wear_slots")) {
if (GetBoolean(item, "worn")) {
foreach (itemSlot, item.wear_slots) {
if (ListContains(object.wear_slots,itemSlot)) {
if (object.wear_layer < item.wear_layer) {
conflictedItem = item
}
}
}
}
}
}
}
if (conflictedItem = null) {
if (object.removemsg = null) {
msg (DynamicTemplate("RemoveSuccessful",object))
}
else {
msg (object.removemsg)
}
object.worn = false
object.drop = object.original_drop
object.alias = object.original_alias
object.original_drop = null
object.original_alias = null
object.display = null
// do after
if (HasScript(object, "onafterremove")) {
do (object, "onafterremove")
}
else if (HasString(object, "onafterremove")) {
msg (object.onafterremove)
}
}
else {
msg (DynamicTemplate("RemoveFirst", conflictedItem))
}
}

Anonynn
Does anyone know :D ?

The Pixie
Sorry, I missed that you had posted. I am a little worried that it uses ScopeInventory in one place and ScopeReachableInventory in another. Did he have a good reason for that? If he did, what I suggested might break it. So, with that in mind...

Yes, do that

But then test very carefully (i.e.,not just the stuff works, but also that stuff does not work if it should not).

Anonynn
Not sure if it matters or not, but one of these is in the "Remove" and the other is in the "Wear". Does that matter?


Wear
else if (not ListContains(ScopeInventory(), object)) {

Remove
foreach (item, ScopeReachableInventory())

But I'll make a backup and give what you suggested a try. Before I do though, I paste it in like this?

else if (not ListContains(GetAllChildObjects(player), object)) {

and

foreach (item, GetAllChildObjects(player))

HegemonKhan
those are indeed the correct conversions

Anonynn

else if (not ListContains(GetAllChildObjects(player), object)) {

and

foreach (item, GetAllChildObjects(player))



Unfortunately, neither of these seemed to work. The same problem happens, things can be double layered. I noticed outfits do it as well even though they are designed not to do so.

Any other ideas?

The Pixie
Could you attach the library to a post. I think you are using a modified version of the wearables library?

Anonynn
Will do!

The Pixie
Try this:


It was a bit more complicated than I was guessing.

Anonynn
Nope! xD

Things can still be double worn when the container is closed, darn it!

BTW I appreciate all your help so far Pix and HK! Together, we can solve the mystery of the mysterious double-wear yet!

We could always try what HK suggested, auto-opening the container as something is "worn". But that is an option as well if we can get this to work.

The Pixie
It works for me, if I understand the problem correctly. I set up a test game with a backpack on the player (a container that can be opened and closed and starts off open). In the same room is a cap and a hat. Here is a transcript:


> take cap
You pick it up.

> put cap in backpack
Done.

> take hat
You pick it up.

> wear hat
You put it on.

> wear cap
You cannot wear that while wearing a hat.

> close backpack
You close it.

> wear cap
I can't see that.

> open backpack
You open it.

> remove hat
You take it off.

> wear cap
You put it on.

> wear hat
You cannot wear that while wearing a cap.

> close backpack
You close it.

> wear hat
You cannot wear that while wearing a cap.

Anonynn
Maybe I installed incorrectly.

What I did was, I added your "wearables01" to the folder with the original "wearables" installed. I removed the original wearables, saved reloaded. Added yours saved and reloaded and then tested it and it was having the same problem. Should I do it differently?

I also changed these back to how they were before. Should I have left them as well?

else if (not ListContains(GetAllChildObjects(player), object)) {

and

foreach (item, GetAllChildObjects(player))

The Pixie
So my one is named wearables01.aslx, right? Go into code view, and check the list of libraries. It is right at the top, from the second or third line onwards, with Core.aslx and English.aslx first. Check you have wearables01.aslx in the list, and not wearables.aslx.

Changing those lines should make no odds as you are not using that file now.

Anonynn

So my one is named wearables01.aslx, right? Go into code view, and check the list of libraries. It is right at the top, from the second or third line onwards, with Core.aslx and English.aslx first. Check you have wearables01.aslx in the list, and not wearables.aslx.

Changing those lines should make no odds as you are not using that file now.



Sorry about the delayed response. I was camping for the last couple of days and wanted to take a break from everything involving the game and life xD. But yes, I always double check that the libraries are added in code view if I install something new. It says wearables01.aslx --- and isn't working. Player's can still wear two shirts when the "Worn Object" is closed.

Should I email you the current copy of the game?

The Pixie
Yes.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums