Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

How do you take back an item

9 years ago

I give up. I can't figure it out. How can you make it so that the player can take back an item. I created a cage item the player can use on a page and the variable %TRAPSET is set to $PAGEID. On the page script of every page, if it detects TRAPSET is equal to the page number of the page you are on, then a new link will appear, "Check trap". Going into that page it'll tell you if you caught something but if it's empty, the player has the option to pick up the trap. I made a link where it takes you to the original page where you got your trap because I read that setting $ITEMSTATE# to 0 will return the item to that page. However, I also read that you can't change those variables in the link scripts so I went with the page script of the page where you get your cage to check if you want the cage back. When you click on the link "Take back trap", it sets TRAPSET to 999 in the link script and when it reaches the page where you get your trap, that page script has the following code:

IF %TRAPSET = 999 THEN
BEGIN
$ITEMSTATE1 := 0
%TRAPSET := 0
END

However, while TRAPSET goes to 0, the cage does not reappear as an item to pick up. At first I accidentally set $ITEMSTATE# to 1 thinking that was the problem, but by that logic I should've gotten the cage again automatically, which is what I should probably do, but neither work.

How do you take back an item

9 years ago

Based on the order of scripts, it probably won't work in the page script, and since a link script would cause an error, you either need to find some logical earlier place to put it or forgo that and just use a link to pick up the item instead.

How do you take back an item

9 years ago

just use a link to pick up the item instead.

Can you clarify on that. I can't figure out what you mean.

How do you take back an item

9 years ago

A link that sets $ITEMSTATE1 to 1 again.

How do you take back an item

9 years ago
You may need to change $ITEMUSED01 := 0 in order to pick it up again.

How do you take back an item

9 years ago

That didn't work either.

How do you take back an item

9 years ago

AH! I did it!

I added $ITEMUSED# and set it to 0 and set $ITEMSTATE# to 1 and I automatically get the item. I guess it was $ITEMUSED# that was needed... but... I don't understand what I just did!

How do you take back an item

9 years ago
It surely is a mystery to us all.