Views, Objectives and Objects problem, i need help

Started by Jakerpot, Mon 04/05/2009 00:17:57

Previous topic - Next topic

Jakerpot

Hey there, i have a problem: I want a objective system to my game, every time the objective is updated you can see your diary and see the current objective. I`m using an object as the objective (the text) in a room, which is the diary. Well, to update the objective, i make something like this:

Code: ags

if (ObjectiveNumber == 1){
   oObjectives.SetView(20, 1);
   oObjectives.Move(5, 235, 300, eBlock, eAnywhere);
 }
 else if (ObjectiveNumber == 0){
   oObjectives.SetView(20, 0);
 }
 else if (ObjectiveNumber == 2){
  oObjectives.SetView(20, 2);
  oObjectives.Move(13, 220,  300, eNoBlock, eAnywhere);
}


It works well on the first two objectives, but on the third there is a problem: When you open the objectives, ok, here it is, the current objective number 2, but when you close it and open it again, the objective shown is number 0. WHY? I thought that the object could face down, so it would use the loop 0, than i changed the loop 2 for loop 8, that is for not specified purposes, it doesn`t worked. I tryed to put the objective number 0 as the loop 8, so it would not return to the down view, i was wong, it continues changing to objective number 0, but just when objective is number 2, when it is 1 it doesn`t change to 0... why the hell is that happening?

NOTE: when we go back to the objective screen (when objective is 2) the objective continue on the same position, 13, 220, as i putted before, and if i add
Code: ags
oObjectives.Move(5, 235, 300, eBlock, eAnywhere);
it will go to 235,300, so what i can concluse is that there is something that is turning the global variable ObjectiveNumber into 0 when i quit the screen, but there is no command that says ObjectiveNumber = 0. I just setted the 0 as default number of the variable and added the condition to if it is 0. Nothing more. Can you help me young people? Thank you.



Khris

Did you declare the variable outside of any function?

Jakerpot

its a global variable, i dont have to declare it have i? And if i should, it shouldn`t work should it?



Trent R

What's your room number? Have you tried adding some Display checks so you know what the variable is at that point?

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Jakerpot

the room is 29. And i don't what you are talking about  :-X

PS: the PM was about the paint shop pro ;)



SMF spam blocked by CleanTalk