Page 1 of 1

WornbyWho not updating

PostPosted: Mon Jan 15, 2018 4:03 am
by FancyThat
I'm trying to make a task that checks if the player is wearing a specific selection of items, then a value would increase so long as the player is still wearing it. An example expression I'm using is as follows...
adrift Code: Select all
if(Item.WornByWho = %Player%, 5, 0)


It works somewhat in that before the player wears the item, the value would would not increase as intended. When the item is worn, the value increases - again as intended. The issue is that if the item is removed, the value would still increase because the item still identifies itself as being worn by the player.

Essentially it produces as follows...
Item.WornByWho = Player Before wearing item (good)
Player = Player While wearing item (good)
Player = Player After wearing item (Not intended)


Is there a different way I should be checking this? Or is there something about the item functions that I'm not getting? I'm trying to avoid bloating up tasks with restrictions, in hopes of having a single task with multiple actions.

Re: WornbyWho not updating

PostPosted: Mon Jan 15, 2018 5:17 pm
by Denk
Unfortunately, %item%.WornByWho only works when the %item% is worn by somebody. You could say that the function remembers who was wearing it last until somebody else puts on the item. So I do not think you can avoid using restrictions for what you are trying to do, sorry. :(

Re: WornbyWho not updating

PostPosted: Tue Jan 16, 2018 1:47 am
by ice_wanted
I had a similar issue. I ended up creating an object property (of type SelectionOnly) and turning it on/off when the player is wearing/removing the garment. A simple check "player.[property id]>0" allows you to identify if any of the garment are worn with the object property turned ON.

Re: WornbyWho not updating

PostPosted: Tue Jan 16, 2018 6:54 am
by saabie
There are two other possibilities here. The item functions DynamicLocation and Parent.

Item.DynamicLocation = "Worn By Character" if it is being worn (and Item.WornByWho is valid)
Item.DynamicLocation = "Held By Character" if somebody is holding it
Item.DynamicLocation = "In Location" if it is dropped on the floor
Item.DynamicLocation = "On Object" if it is put on top of a surface

Item.Parent = The object, character or location that is currently holding, wearing or supporting the object

Re: WornbyWho not updating

PostPosted: Tue Jan 16, 2018 3:26 pm
by FancyThat
saabie wrote:There are two other possibilities here. The item functions DynamicLocation and Parent.

Item.DynamicLocation = "Worn By Character" if it is being worn (and Item.WornByWho is valid)
Item.DynamicLocation = "Held By Character" if somebody is holding it
Item.DynamicLocation = "In Location" if it is dropped on the floor
Item.DynamicLocation = "On Object" if it is put on top of a surface

Item.Parent = The object, character or location that is currently holding, wearing or supporting the object


The Parent Function doesn't work the way as I want since the item is considers a child of the Player regardless of held or worn. The Item.DynamicLocation though, I'll try this out later today and come back with the results. Thanks for the tip.