Hello all.Ã, I am doing a 'stealth' screen where the player needs to sneak by a guard.Ã, The are where the guard can't see the player is a region.Ã, On this region, the player needs to sneak to get by.Ã, Walking will be too loud.Ã, To do this, I have the following code:
GlobalInt 10 is the mode for walking.Ã, 1=Walk, 2=Sneak
GlobalInt 11 is the 'how many steps taken' variable.
-----------------
if ((character[8].walking != 0) && (GetGlobalInt(10)==1)){ //If in walking mode and moving on region
SetGlobalInt(11, 1);
if (GetGlobalInt(11)==1){
Display("The sentry suddenly appears alert, as if searching the darkness of the sewers.");
DisplaySpeech(1, "What was that?");
StopMoving(8);
SetGlobalInt(11, 2);
}
if (GetGlobalInt(11)==2){
Display("Your footstep again splashes in the sewage.Ã, You see the sentry put his hand to his dagger as he continues to peer into the darkness.");
StopMoving(8);
SetGlobalInt(11, 3);
}
if (GetGlobalInt(11)==3){
DisplaySpeech(1, "AHA!");
Display("The sentry finally sees you in the dimness and throws his dagger.Ã, You are dead before you hit the ground.Ã, You should've been more quiet.");
NewRoom(916);
}
}
The problem is that nothing happens.Ã, The character can walk around on the region with no consequences.
Not sure why nothing's happening. GlobalInt(10) not set? Is character[8].walking actually 0 when false (could it be null)? Is it really character 8?
When you do get that fixed, you'll have another problem - all three of your inner if clauses will execute and your guy will die on the first step. You can fix that by adding 'else's or by reversing the order of the inner if clauses.
But then, your second and third clauses will never execute because you're setting GlobalInt(11) to 1 just before you run those tests.
Change that to:
SetGlobalInt(11,GetGlobalInt(11)+1);
Silly question, but WHEN, exactly, are you running this check? "Character stands in region"? Just for completeness sake.
Arhmm...
Well...
It was "Player Walks Onto Region"...
It works great on "Stands On Region" :)
The else statements were needed too.
Thanks!