ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

WornbyWho not updating

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

WornbyWho not updating

Postby FancyThat » Mon Jan 15, 2018 4:03 am

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.
User avatar
FancyThat
 
Posts: 2
Joined: Sat Jan 13, 2018 11:44 pm
Location: Alaska
Points: 10

Re: WornbyWho not updating

Postby Denk » Mon Jan 15, 2018 5:17 pm

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. :(
-----------------------------------------------------------------------------------------
Out now: The Royal Puzzle, The Way Home & The Dragon Diamond
-----------------------------------------------------------------------------------------
Denk
 
Posts: 86
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 11

Re: WornbyWho not updating

Postby ice_wanted » Tue Jan 16, 2018 1:47 am

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.
ice_wanted
 
Posts: 84
Joined: Thu Aug 22, 2013 1:12 am
Points: 10

Re: WornbyWho not updating

Postby saabie » Tue Jan 16, 2018 6:54 am

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
saabie
 
Posts: 864
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia
Points: 10

Re: WornbyWho not updating

Postby FancyThat » Tue Jan 16, 2018 3:26 pm

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.
User avatar
FancyThat
 
Posts: 2
Joined: Sat Jan 13, 2018 11:44 pm
Location: Alaska
Points: 10


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 3 guests

cron