Levers control door-puzzle help

Started by plebeo, Wed 16/03/2005 14:11:06

Previous topic - Next topic

plebeo

Hi to everybody!
I'm plebeo, italian user of AGS!
First I wanna say sorry for my english!!!

I'm programming an adventure with AGS but now I have a little problem!!

I have a room in which there is a closed door and three levers!

We can move each levers up and down!!

To open the door, the first lever must be up, the second down and the third up!!

If there isn't this combination the door will NOT open!

How can I do this event?

Kinoko

There are a few ways, but one would be to create a GlobalInt, say #5, and say that (ifGetGlobalInt(5)==3) then OpenDoor... whatever script you use for that.

Then, if lever 1 is up, +1 to the GlobalInt. If it's down, -1.
If lever 2 is down, +1, if it's up, -1.
If lever 3 is up, +1, if down, -1.

This should ensure that GlobalInt(5) can ONLY equal 3 when all levers are in the right place. Of course, doing it this way, you'll have to take into account where the levers are at the beginning, eg. If lever 1 begins up, GlobalInt should already equal 1.

Er, there's probably a simpler way, but that's the first thing that came to mind. If it's all contained within the Global script, you don't need to use a GlobalInt either, just an int like 'levers' would do.

Scummbuddy

welcome to the boards. youre english is pretty good. hey, please use descriptive topics in the future. "I need a little help" really doesnt tell us what it is. we like to have them descriptive so people who do searches before posting can easily find what they are looking for.

oh, and also try to not post in ALL CAPS. it comes across as screaming.

let us know if you can get that script, that Kinoko gave you, working.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

plebeo

Ok Scummbuddy!
The next topic I will follow your instructions!!

The script of Kinoko works well!

Thanks to everybody!!

:D

uswin

mr kinoko  umm i have a little problem with implementation of this lever puzzle script..can u help me about this add and substract value from global int...could u show me what is the csript looks like ??? sorry..cause i'am a newbie !!

i'm not use this add/substract method but i use  this if((GetGlobalInt()==0) && (GetGlobalInt()==1) && (GetGlobalInt()==0)){ codes }

and now i really want to know about your method please ?

SMF spam blocked by CleanTalk