Hi
I am looking for a condition that when certain Objects are NOT visible a condition can be run such as change room... (Opposite condition of below code)
'After killing an Object it is switched off (visible true/false).. I have 3 objects.'
if ((oMobster1Dead.Visible) && (oMobster2Dead.Visible) && (oMobster3Dead.Visible)) {
Display("You have killed the 3 Mobsters and it's now safe to pass")
player.ChangeRoom(23, 55, 371);
}
I have looked but not found the answer yet.
All help appreciated
barefoot
if (!oMobster1Dead.Visible && !oMobster2Dead.Visible && !oMobster3Dead.Visible) {
Thanks so much Khris
You helped me big time
cheers
barefoot
There's another method that will let you use the same code over and over again for each room. Especially when you have too many objects in a room, and doing the if(!object[0].Visible && !object[1] && .......
function GetVisibility()
{
int counter = 0;
int false_count = 0;
while(counter <= Room.ObjectCount)
{
if(!object[counter].Visible) false_count++;
}
if(false_count == Room.ObjectCount) return true;
else return false;
}
You have to stop the iteration at Room.ObjectCount - 1; object numbering starts at 0.
Quote from: Khris on Tue 16/02/2010 18:09:40
You have to stop the iteration at Room.ObjectCount - 1; object numbering starts at 0.
yes, I know it starts at 0, and if you have all 40 objects in a room, that loop should stop when counter hits 39
You have
while(counter <= Room.ObjectCount)
So at the last iteration, counter == Room.ObjectCount.
Plus - just saw that - you aren't incrementing counter.