PDA

View Full Version : Newbie needing help part 2


crono_cloud
2003-07-04, 12:03 AM
well i got another problem now.. i know how to give a NPC a item but how do u make the NPC know if u have or not for example:

if i had a guard blocking a gate and he would only let me pass if i gave him the key but when i tried this he let me pass but i didnt have the item on me...how do i fix this?

if u can help me it would be great :D

BlueCube
2003-07-04, 03:43 PM
Got it. Okay, you can do this in 2 ways:

______________________________

First Method: Set "Item" as a precondition.

Just like Switches can be used as a precondition, you can use a "Item" precondition. It'll check to see if you have that item, and then run the script.

In this case, you'll need 2 pages.

------
Page 1:
Precondition: None

<>Message: "You may not pass without a key!"

-------
Page 2:
Precondition: PassKey held

<>Message: "So, you finally got the PassKey, eh? Go on through..."
<>Move Event: This Event, Move Up, Face Down


______________________________

Second method: Forking

Forking is the same as an IF-THEN statement in programming - it allows you to branch off based on a condition, in the middle of code. If you use branching, you only need 1 page for this.

Make sure the option at the bottom ("Execute Custom Handler if Condition Not Met") is checked if you want something different to happen if the condtion isn't met. (That's what the "Else Handler' is there for.) This can be useful if you have a conversation where bits and pieces are changed depending on whether you have an item or not. ("Oh, you already have the Large Crystal That Does Something!" as opposed to "Well, in order to get the Large Crystal That Does Something you'll need to.. etc.")

-------
Page 1:
Precondition: None

<>Branch if PassKey Possessed
<>Message: "The PassKey? How did you get THAT??
<>Move Event: This Event, Move Up, Face Down
:<>Else Handler
<>Message: "You can't get through without the PassKey!"
:<>End