Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Selling Items

one year ago
Hi there.

I'm fiddling about with Items and trying to do something weirdly specific. Basically, I want a reader to be able to pick up or buy a weapon, use it a few times to kill stuff and then sell it. I'm stuck on the selling it / getting rid of the Item part. I can see how to drop the item on any page and how to use it x amount of times until it runs out of ammo or breaks or whatever, but I can't see how a reader could get rid of an item on a specific page, apart from spam clicking and using it a large number of times until it vanishes. Is there any way to get rid of an Item on a particular page apart from this or making it a 1-use item that can only be used on that page (which would mean the reader couldn't use it to kill stuff earlier in the story)?

Many thanks.

Selling Items

one year ago
$ITEMSTATE is what you're looking to change. It CANNOT be changed in a link script or the page will throw a runtime error.

You can set $ITEMSTATE[itemID] := 0 to get rid of the item from the players inventory.

$ITEMSTATE is a binary system variable, where 1 is in-inventory and 0 is not-in-inventory.

Selling Items

one year ago
Thanks Ford, can I set this Script to a specific Item Effect (fifth Item Effect, page 100-101 for example) without it affecting the other Item Effects?

I thought of another way to get past this is just have a weapon item break or run out of ammo after x amount of uses and just making Items that affect other Variables (such as Life) buyable and sellable.

Selling Items

one year ago
If the effect is the only one active on use, I would presume it to work; but CYS has its quirks. Might require some testing.

Selling Items

one year ago
Yeah, I've never scripted and have been known to mess up even with items and variables :D I'll give it a whirl though, thanks for your help.

Edit: I think I've figured out a way to do it. Use the item on a certain page (Shop) to get to an individual page for that item (Sell Weapon). Click a link (sell) that returns you to the earlier page (Shop) while having a Drop Item and Modify Variable (Cash Addition) selected. The item gets dropped and the cash increases. Just using the item is useless because it won't get rid of it (unless it is one-use) but having this two-step process means the individual item can be dropped after multiple uses and the variable changed. I'll keep fiddling with it, but it seems to work.

Selling Items

one year ago

You might already be doing this differently, but when I want an item to only have a scripting impact on a specific page, I add IF $DEST = @(page) THEN .... to affect whatever variable. (That might not be the exact correct grammar, but the gist is the same.) Good luck!

Selling Items

one year ago
Thanks for the heads-up and help :)

Selling Items

one year ago
https://chooseyourstory.com/help/articles/article.aspx?ArticleId=66

Ancient article by October still has the goods if you need further explanation on item states.

Gryphon's got a longer one on an equipping system too.

Selling Items

one year ago
Thanks :)

Selling Items

one year ago
So, in Koi Koi I manage a bunch of items that represent cards and abilities. Like others have said, "$ITEMSTATE1:= 0" will drop an item, only if you do this from a page script.

A way to get around manipulating this was I used a variable to represent if the player had said item or not, then checked that to determine if I should give them the item/drop it.

The "Number of Uses" also refreshes if you give them the item manually with $ITEMSTATE1:= 1. At least that was my experience when the number of uses was set to 1.

The super lazy way to implement this is to have a link that does something along the lines of:

%HASITEM1 = 0

When you want to sell item 1, then in your global page script do:

IF %HASITEM1 = 0 THEN BEGIN
$ITEMSTATE1:= 0
END

And continue for all the items. Alternatively, take the logic in the global page script and only apply it to the pages where the user could be returned to after selling an item, which if you only have 1 shop page is probably equally as easy.

Selling Items

one year ago
Thanks a lot, this sounds like a clever way of doing what I'm trying to do. Thanks for your help :D