hi!
First, i begin to believe, AGS is the most addictived "game" i've ever played...(laugh)
ok, i need player change room throug region only at two situations:
1.-when player have a object (no problem with that)
2.-when a specific NPC's loop have been run.
i use a conditional into function region_walkOnto
function region1_WalksOnto()
{
if (player.HasInventory(isello))
{
player.ChangeRoom(7, 150, 550);
}
else if (character[cPortero].loop==8)// This is what i don't know
{
player.ChangeRoom(7, 150, 550);
}
else
{
cPortero.LockView(3);
cPortero.Animate(2, 3, eOnce, eNoBlock);
cPortero.Say("EH! TU!...SI NO PAGAS NO ENTRAS");
player.Walk(468, 495, eBlock);
player.FaceCharacter(cPortero);
}
}
[\code]
thanks for answering!(roll)
Use a variable:
//Define the variable somewhere
bool loop_has_run=false;
//Whenever the loop has run:
loop_has_run=true;
//In your condition:
if(loop_has_run)
{
player.ChangeRoom(7, 150, 550);
}
thnks for answer!
sorry, but don't know to script, even a little, im triying to learn.
i have been watching ur scipt for a minuts and i don't understand clearly
i want ask u some else:
firstly, where can i spicify wich loop be considered? (ex. loop 1)
where can i define the variables.?
i search "bool" in the manual but i didn`t find this.
Where can i search about all of that?
regards!;)
when i talked about "loop" i mean loop's view.
thnks
Okay if you want the valiable to be accessible from anywhere then open you GlobalScript.asc and type on top of it:
bool loop_has_run=false; //bool is a type of variable which can take 2 values (true or false)
export loop_has_run; //This is necessary to make the variable globally accessible
Now open your GlobalScript.ash and type:
import bool loop_has_run; //This is also necessary to make the variable globally accessible
Then, I guees you have some script to make your NPC to animate and run the aforenamed loop. For example:
cNPC.Animate(whatever_loop.....);
//THEN I set here the loop_has_run variable to true so that if I want to know in a future if the loop has run I will just check this variable
loop_has_run=true;
Then in your code:
function region1_WalksOnto()
{
if (player.HasInventory(isello))
{
player.ChangeRoom(7, 150, 550);
}
else if(loop_has_run==true)//else if (character[cPortero].loop==8)// This is what i don't know
{
player.ChangeRoom(7, 150, 550);
}
else
{
cPortero.LockView(3);
cPortero.Animate(2, 3, eOnce, eNoBlock);
cPortero.Say("EH! TU!...SI NO PAGAS NO ENTRAS");
player.Walk(468, 495, eBlock);
player.FaceCharacter(cPortero);
}
}
BTW: don't double post. Use the modify button.
so, simple!:X
function region1_WalksOnto()
{
if (player.HasInventory(isello))
{
player.ChangeRoom(7, 150, 550);
}
else if (cPortero.Loop==8)//this is that i wanted
{
player.ChangeRoom(7, 150, 550);
}
else
{
cPortero.LockView(3);
cPortero.Animate(2, 3, eOnce, eNoBlock);
cPortero.Say("EH! TU!...SI NO PAGAS NO ENTRAS");
player.Walk(468, 495, eBlock);
player.FaceCharacter(cPortero);
}
}
Well, thnks to Joe...you've driven me crazy but i started to learn about variables (laugh]
i think Joe it was a misunderstanding:
i meant Loop into a View... Not loop for repeat a script
wasn't it?
but thnks for the explanation, i will try to use all of this!
;-D
Quote from: Papyrus on Thu 26/06/2014 13:30:10
i think Joe it was a misunderstanding:
i meant Loop into a View... Not loop for repeat a script
wasn't it?
It was not a misunderstanding. I understood what you meant because I read everything you typed. Not like you, since I said "Dont double post, use modify button" and you double posted again...
Sorry is the only text i didn't read, but i didn't tell u " u don't understand me or u don't read me".
i only try to understand why i have to insert variables on code if only with one line i can do that.
There are no malice in my words.
Sorry, today it's not my best day.
Of course your code solves the problem and, since you are the game creator, you will decide if that solution is good enough or not. I used the variable because I'm not the game creator and I don't know if your NPC will animate again at some point in the game alterating his loop so it won't be 8 anymore and the "if" condition will become useless.
That the only reason I'm using a boolean variable. But if the NPC is not animating anymore then that change might be a good (but not elegant) solution.
Quote from: Joe on Thu 26/06/2014 19:38:04
Sorry, today it's not my best day.
Of course your code solves the problem and, since you are the game creator, you will decide if that solution is good enough or not. I used the variable because I'm not the game creator and I don't know if your NPC will animate again at some point in the game alterating his loop so it won't be 8 anymore and the "if" condition will become useless.
That the only reason I'm using a boolean variable. But if the NPC is not animating anymore then that change might be a good (but not elegant) solution.
Thanks you very much for your explanation and your effort.
I have not explained well at all, english isn't my native lenguage. Sure i will use all this information in future, very usufull.
My best wishes for u.
Greeting :)