Hi
I would like script to check for multiple inv items to allow character to go to another room
from a region.
The player has to have 4 keys in his inventory to allow go to another room when on region.
I have this script enquires if player has an inventory item
if (player.ActiveInventory ==chair) {
player.Say("Perfect Match");
Look up Character.HasInventoryItem and Character.InventoryQuantity instead.
thanks monkey
but each key is a different inv item not 4 of the same item
barefoot
Theres probably a cleaner way to do this, but something as simple as this would work:
if(player.HasInventory(iKey1) && player.HasInventory(iKey2) && player.HasInventory(iKey3) && player.HasInventory(iKey4))
{
Display("You insert all 4 keys into their various locks and you hear the door unlock!");
player.ChangeRoom(3);
}
Thanks Divon
that was a big help...
so far i have this and it works fine......
// room script file
function ochair_Interact()
{
object[2].Visible = true;
cRedpants.AddInventory(chair);
object[2].Visible = false;
}
function bird_Interact()
{
object[1].Visible = true;
cRedpants.AddInventory(obird);
object[1].Visible = false;
}
function wheel_Interact()
{
object[0].Visible = true;
cRedpants.AddInventory(owheel);
object[0].Visible = false;
}
function star_Interact()
{
object[3].Visible = true;
cRedpants.AddInventory(ostar);
object[7].Visible = false;
}
function room_Load()
{
object[0].Visible = true;
object[1].Visible = true;
object[2].Visible = true;
object[3].Visible = true;
object[4].Visible = true;
object[5].Visible = true;
object[6].Visible = true;
object[7].Visible = true;
}
function chair2_UseInv()
{
if (player.ActiveInventory ==chair) {
player.Say("Perfect Match");
cRedpants.AddInventory(Key);
cRedpants.LoseInventory(chair);
}
else {
player.Say("Does not match.");
}
}
function obird2_UseInv()
{
if (player.ActiveInventory ==obird) {
player.Say("Perfect Match");
cRedpants.AddInventory(redkey);
cRedpants.LoseInventory(obird);
}
else {
player.Say("Does not match.");
}
}
function owheel2_UseInv()
{
if (player.ActiveInventory ==owheel) {
player.Say("Perfect Match");
cRedpants.AddInventory(bluekey);
cRedpants.LoseInventory(owheel);
}
else {
player.Say("Does not match.");
}
player.Say("Perfect Match");
}
function ostar2_UseInv()
{
if (player.ActiveInventory ==ostar) {
player.Say("Perfect Match");
cRedpants.AddInventory(greenkey);
cRedpants.LoseInventory(ostar);
}
else {
player.Say("Does not match.");
}
}
function region1_WalksOnto()
{
if(player.HasInventory(Key) && player.HasInventory(redkey) && player.HasInventory(bluekey) && player.HasInventory(greenkey))
{
Display("You have solved all the math puzzles and have collected all 4 Keys. Now you must return to Yolander the Mermaid for the Amulet!");
player.ChangeRoom(20, 417, 283);
}
}
function region1_Standing()
{
game.skip_display = 0;
if(player.HasInventory(Key) && player.HasInventory(redkey) && player.HasInventory(bluekey) && player.HasInventory(greenkey))
{
Display("You have solved all the math puzzles and have collected all 4 Keys. Now you must return to Yolander the Mermaid for the Amulet!");
player.ChangeRoom(20, 417, 283);
}
}
Thanks to everyones help...
barefoot
happy to be of service :)