Whell, this is a little hard to explain, but I have a door who should open only if the player first uses inv. item 1 and then inv. item2 (and only in that order)
on a certain hotspot.
I've tried to use the "Conditional-if inv. item was used" option but I just don't can't make it work.
Please make the help easy to understand since I'm totaly new on this...
Try nesting the conditional statements like:
Conditional - If inv. item was used (INVITEM1)
|-> Conditional - If inv. item was used (INVITEM2)
|-> (open door)
If you know what I mean... I don't use the interaction editor unless I have to to create a function, so I don't know what exactly you would put to open the door.
The problem with nesting them like that, is it looks for both items to be used at the same time which is impossible.
The easiest way I can see would be to use a variable to track whether you'd already used Item1.
Assuming you want to use Interaction Editor commands, you would:
Create the variable 'door' (or whatever you want to name it). Select the Conditional - If variable is a certain value command, click the Change button, next to 'Variable:', Edit Variables, select the 'Room' checkbox, New Variable, and name it door. OK back to the editor screen.
The command tree should look something like this:
Conditional - If inventory item was used (1) <-- Fairly obvious.
Conditional - If variable is a certain value (door, 0) <-- If you use Item 1 first, set 'door' to 1.
Game - Set variable value (door, 1)
Conditional - If variable is a certain value (door, 1) <-- If you try to use Item 1 again, reset 'door'.
Game - Set variable value (door, 0) <-- (i.e. Have to start again. This bit is optional.)
Conditional - If inventory item was used (2) <-- Fairly obvious.
Conditional - If variable is a certain value (door, 1) <-- If you've used Item 1 first, unlock the door
Game - (Unlock door stuff)
If you want to use scripting, the code would look something like (depending on what version you're using):
This is 2.6 script:
// room script
int door;
// Put this at the top of the room script, OUTSIDE ALL FUNCTIONS
//Use Inv script
//Copy-Paste this into a 'Run Script' command in the Door's 'Use inv on' command
if (player.activeinv == ITEM1) { // Replace ITEM1 with the number of item 1
if (door == 0) door = 1;
}
if (player.activeinv == ITEM2) {// Replace ITEM2 with the number of item 2
if (door == 1) {
//Unlock door stuff
}
}
else door = 0; // If you use the wrong item at the wrong time, reset the puzzle
And this is 2.7 (sort of):
// room script
int door;
// Put this at the top of the room script, OUTSIDE ALL FUNCTIONS
//Use Inv script
//Copy-Paste this into a 'Run Script' command in the Door's 'Use inv on' command
if (player.ActiveInventory == iItem1) { // Replace iItem1 with the Script-o-name for item 1
if (door == 0) door = 1;
}
if (player.activeinv == iItem2) { // Replace iItem2 with the Script-o-name for item 2
if (door == 1) {
//Unlock door stuff
}
}
else door = 0; // If you use the wrong item at the wrong time, reset the puzzle
Thank you guys, that was just the help I needed ;D
QuoteAnd this is 2.7 (sort of):
Code:
Replace "int door;" with "bool door;" that way it can't be set to 2 or -1 or anything.