Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Changing Default Use Item Page

10 years ago
I'm guessing this isn't possible, but here's what I'd like to do:

I have an item (a cell phone). When it is used in Chapter 1, I would like one default page (so it can be used anywhere). However, when the reader gets to Chapter 2, I'd like a different default page (in case the reader keeps it and decides to use it somewhere in Chapter 2).

Is there any way to do this simply, other than setting the page manually on every single page in Chapter 2?

Changing Default Use Item Page

10 years ago

I think I might have a solution that involves a little scripting. Not sure if it'll work, so I'm double checking it.

Edit: Haven't checked my original scripting idea, but this might be better. 

1) Make two items identical, but one going going to the first default page and the second going to the other default page.

2) On the link switching to a new chapter, put this in. (If you have other items, the ID number may be different) This automatically drops one item and picks up another. Drop the first default item, pick up the second one. The player shouldn't notice the change unless you put something different in the descritpion/title.

$ITEMSTATE01 := 0

$ITEMSTATE02 := 1

Edit-edit: Yeah, no. My original idea didn't work out so well, but the one above works just fine.

Changing Default Use Item Page

10 years ago

@Ogre11

Changing Default Use Item Page

10 years ago
Oh hey, that's a neat idea, that will work! Thanks a million!

Changing Default Use Item Page

10 years ago
You can't drop/pick up items in link scripts. You can do it in page scripts though, which is just as unnoticeable.

Changing Default Use Item Page

10 years ago
Go to the item's script and type in this:

IF $CHAPTERID = 1 THEN $DEST := @P14
ELSE IF $CHAPTERID = 2 THEN $DEST := @P58

And continue for all the different chapters. Change 14/58 to whatever number the page in each chapter is.

Changing Default Use Item Page

10 years ago
Hmmm... that sounds good, but will that override individual pages? In other words, does the item script fire even if the item has a specific page (non-default) page to go to?

Changing Default Use Item Page

10 years ago
It will, but you can script the individual pages as well, so it's not as though you lose functionality.

What does the item currently do (be specific)?

Changing Default Use Item Page

10 years ago
In Chapter 1, the item has only 1 page where it can be used. All other pages have a default entry (but not the default pop-up "You can't use it here"). Then, when the reader gets to Chapter 2, nearly the same situation exists -- except here there are two specific pages where the item can be used, and when it gets used, it gets destroyed. If you're not on either of those two pages, it would go to a default page (where the item would not get destroyed).

Specific enough?

(And as of this moment, I haven't written Chapters 3-6, so I'm not completely sure if it would be used there as well, but I suspect it will be, if it hasn't been destroyed).

Changing Default Use Item Page

10 years ago
IF $CHAPTERID = 1 THEN
BEGIN
IF $PAGEID = 7 THEN $DEST := @P16
ELSE $DEST := @P14
END
ELSE IF $CHAPTERID = 2 THEN
BEGIN
IF $PAGEID = 27 THEN $DEST := @P86
ELSE IF $PAGEID = 28 THEN $DEST := @P87
ELSE $DEST := @P94
END

This is what the script would look like. Obviously all the page numbers are wrong right now, but apart from that it should be what you need.

As for destroying the item, you can only remove items in page scripts (an odd bug), so on whatever page you'd want the item to be destroyed on, put in $ITEMSTATE03 := 0 (where 03 is the item number). That will remove the item when the player reaches that page.

Makes sense?

Changing Default Use Item Page

10 years ago
That does make sense (and should be better than having to change items). This script would go in the item script code, yes?

Changing Default Use Item Page

10 years ago
It would, and dropping the item would go in the page script (of the page you want to drop it on).

Changing Default Use Item Page

10 years ago
Perfect, thanks so much!