Problem with time puzzle

Started by Mats Berglinn, Sat 02/07/2005 11:31:59

Previous topic - Next topic

Mats Berglinn

For my Caribbean Mysteries there will be a puzzle where you have to trick an old man by tossing a coin to the ground, the old man will walk over to the coin, stand still for 10 seconds then come back to the place he was. While he is going for the coin you have to snatch a pendlum from his desk or you have to redo it. Now the problem is that the man does go to the coin to pick it up and which means you can take the pendlum but he doesn't return back to his place which means you've got all time in the world to get it (which is needlessly to say is not the point).

Here's the script for the puzzle:
Code: ags

MoveCharacter(EGO,798,265);
FaceLocation(EGO,600,265);
ObjectOn(3);
MoveCharacter(EGO,815,265);
DisplaySpeech(EGO,"Say, isn't that a coin lying on the ground?");
DisplaySpeech(HYP,"A coin? Where?");
FaceLocation(HYP,798,265);
DisplaySpeech(HYP,"Ah, there!");
MoveCharacter(HYP,798,265);
int timer=0;
distract = 1;
SetTimer(1,400);
if (IsTimerExpired(1)==1){
distract = 0;
ObjectOff(3);
DisplaySpeech(HYP,"Must be my lucky day.");Ã,  

if (GetGlobalInt(11) ==1){

DisplaySpeech(HYP,"Hey, where did my pendlum go?");
}
}



What have I missed? Please help!

Candle

I see you move him to MoveCharacter(HYP,798,265); but where do you have him come back ?
But then I'm not that great of a coder so it could be there and I can't see it . lol

Mats Berglinn

Oh, sorry I forgot to tell that I haven't added the move back yet because character HYP isn't placed on the right height but even if I wait he doesn't say the line when the time is up.

Sinitrena

I think the the problem is the line: if (IsTimerExpired). This one (and the code between the{}) has to be in repetedly_execute. Otherwise the script checks if the timer is expired right after you set it. At this time, the timer isn't expired and the script goes on.

SMF spam blocked by CleanTalk