Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Restrict Item if Variable Set

6 years ago

How to make it so that if a variable is set to a certain number, than you can't pick up an item?

Restrict Item if Variable Set

6 years ago
You don't. If an item is on a page they can pick it up.

Restrict Item if Variable Set

6 years ago

I imagine you could have two pages, one where you can pick up the item (this is the page you set its pick up location to) and another one where you cannot pick up the item. Then just have the two links together, one restricted to having the certain number for the variable and the other to NOT having that certain number.
Have the one with the certain number leading to the page with the item.

~

Another option, for if you don't mind some scripting, is to use ITEMSTATES. Here is an article regarding this (and some more things): http://chooseyourstory.com/help/articles/article.aspx?ArticleId=66

Basically items have ITEMSTATES which means you can give players items without them clicking on a picture on the bottom of the screen to pick it up, which means you can restrict item pick ups to certain links, rather than them just being on the page.

I feel like just letting them automatically get an item when selecting a link isn't too hard to script, so I encourage you to read the article. Seems to just be a line of script (albeit in the right place) and a variable restriction on the link with the script.

"%ITEMSTATE2 = 1
This sets the item with the ID of 2 to one, meaning it is in your inventory."
Combine that with a restriction regarding the variable you want (or more scripting!) and you can have the thing set up as you want.

As you can see scripting means you don't have to have two pages, which is nice if the page text is gonna be exactly the same regardless of whether or not the player gets the item, not to mention you could have different text on the page depending on the variable (with on page variable text thing, I think it counts as scripting [tho it doesn't use $ but %],) anyways.

TL;DR
Read the first paragraph. I think you can do it but not exactly the way you are asking.

P.S. This is all assuming I understand what you mean.

Restrict Item if Variable Set

6 years ago

Yeah, that's what I meant. I don't mind that stuff, I'd just rather not. I've been using it in a shop though, so players can't just pick up all the items, but they get it automatically once they pay.

Restrict Item if Variable Set

6 years ago
It would take a lot of pages, but that could be done by making individual items avaliable each on their own page. So clicking a link to buy an item brings you to that item's page, where the player can only pick it and only it up.

Restrict Item if Variable Set

6 years ago

Also, how do I use scripting to change a variable to a random number, 50-100? I thought I saw it somewhere....

EDIT: Nvm, found it.