Now what happens with my current code is that he takes one decision and then never take another one.
The problem doesn't appear to be my switch (see down there). Well, at least the syntaxe seems ok and if the NPC is taking a decision to begin with, it means it works fine.
I even added debug message in order to know when the NPC is actually taking a decision.
Next guess was that it was my alarm that is supposed to reset the right of takig a decision. Here's it's just a bool and I didn't make any typo or syntaxe error.
So right now I am pretty flabergasted. Why does my NPC takes only one decision and then never again??
Here's the step event of the NPC:
if(InTalk==false)&&(NewDecision==true)
then
{
NextAction=irandom_range(0,10);
switch(NextAction)
{
case 0:
hspeed=1;
NewDecision=false;
Alarm[0]=120;
show_debug_message("decided right")
break;
case 1:
hspeed=-1;
NewDecision=false;
Alarm[0]=120;
show_debug_message("decided left")
break;
default:
hspeed=0;
NewDecision=false;
Alarm[0]=120;
show_debug_message("decided stop")
break;
}
}
And in the Alarm[0] I got:
NewDecision=true;
what gives? :/
Edited by RangerX, 12 March 2012 - 01:31 AM.











