Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Dr Fred Rubacant Edison on Sun 26/11/2006 22:38:10

Title: Locked door in game will not lock right Solved HEHE
Post by: Dr Fred Rubacant Edison on Sun 26/11/2006 22:38:10
SetDoorStrings ("That's a door.", "The door is locked.", "I cannot open the door with that item"); 

if (any_click_on_door_special (27, 0, 152, 80, DIR_UP, 28, 172, 118, DIR_DOWN, 72, 44, 1, 2) == 0)
Unhandled ();


I can open the door one time then i close it then it will be locked

in the code what dose the 27 and the 0 do.   

72, 44 are sounds. 1 is the item use to unlock it  2) == 0)  should this be 2 I'm not sure i want to make it you can only open it with a key
Title: Re: Locked door in game will not lock right
Post by: Ashen on Sun 26/11/2006 23:38:41
Again this isn't a standard AGS command, it's part of the Maniac Mansion Mania template. You'd really need to talk to the designer to figure it out. Or, you know, use the translated scripting tutorial (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=29075.msg370217#msg370217) YOU posted.

But, from what I can make out (using your translations):

'27' refers to the number of the GlobalInt that will store the state on the door (closed, open, locked). Is 27 the right GI to use? I don't know - are you using it for anything else? If not, it's probably safe to stick with it. Why did you pick it in the first place?

The first '0' is the number of the object that represents the open door (e.g. a black rectangle over the 'closed' door background). The '== 0' means 'if there was nothing set to happen when you click the door', e.g. you used a mode other than Open, Close, UseInv or Look At. It then passes over to the Unhandled function - which I guess is like unhandled_event.

The last parameter I think determines whether the door relocks when you close it (you have to use the key every time), or just closes. '2' seems to mean relocking every time.

And, of course, it would help to know what it is/isn't doing that make you say it doesn't 'lock right'.
Title: Re: Locked door in game will not lock right
Post by: Dr Fred Rubacant Edison on Sun 26/11/2006 23:45:23
Never mind i did i got it to work

I had to add this

  // script for Room: First time player enters room
if (GetGlobalInt (27) != 1)
{
SetGlobalInt (27, 2);
//PlaySound (44);
init_object (27, 0);



HEHE