Is it possible to have a idle veiw for the main character that is randomly selected between three or more veiws, like in DOTT? If yes, then how?
I think you could do something like the following:
#define IDLE_VIEW 7
#define IDLE_DELAY 10
int IdleTmr=IDLE_DELAY;
repeatedly_execute() {
IdleTmr--;
if (IdleTmr<) {
Character.SetIdleView(FIRST_VIEW+Random(5));
IdleTmr = IDLE_DELAY;
}
}
I think that's for the 2.7 version but what about 2.62 version?
CharacterSetIdleView();
You mean "SetCharacterIdle". You're not telling me the full code for the 2.62 Version, only the SetCharacterIdle bit. Please, tell me the whole code.
Sorry Mats for the confusion. I thought that would have been enough. Anyway here is the entire code snippet for AGS 2.62. It assumes that there IDLE_NUMBER_OF_VIEWS idle views consecutively numbered with the first one being given by the constant IDLE_VIEW. The constant IDLE_DELAY determines how often the selection is changed. You can set these constants to whatever numbers that give the best results in your opinion.
#define IDLE_NUMBER_OF_VIEWS 5
#define IDLE_VIEW 7
#define IDLE_DELAY 10
int IdleTmr=IDLE_DELAY;
repeatedly_execute() {
IdleTmr--;
if (IdleTmr<) {
CharacterSetIdle(EGO,FIRST_VIEW+Random(IDLE_NUMBER_OF_VIEWS));
IdleTmr = IDLE_DELAY;
}
}
You need to be careful with Random().
If you call Random(5), it returns one of 6 possible values 0..5.
So, in that code you should use Random(IDLE_NUMBER_OF_VIEWS-1).