Quote from: theoneelectronic on Tue 17/09/2013 15:14:08
I'm trying to make the background change when the player has an object in the inventory but without success.
player.ActiveInventory checks selected item.
To check existing items, use player.HasInventory:
function room_AfterFadeIn()
{
if (player.HasInventory(iSpanner))
{
SetBackgroundFrame(1);
}
else
{
SetBackgroundFrame(0);
}
}
But in your case I'd suggest to use global variable instead to keep "generator state". Presence of inventory item is generally irrelevant, from the game design perspective. For example, later in game player may loose the spanner or give it away - this will turn the lights off again, although generator is still working.