I'm pretty sure there's a way to do this, but I can't figure it out or find it in the manual for the life of me. Right now I'm working on my opening cutscene and it goes back to the same rooms multiple times. So far I've just been making new rooms for the old rooms to make the new events happen, but this is making the game take up way too much space. So how can I make it so a new event happens in the same room depending on how many times you've visited there? Thanks for helping this confused newbie.
You could use SetGlobalValue(1) for this. (this could be any number)
Every time you want in your cutscene to load the room with it's specified actions for that moment, you could change the global value.
Like the first time to 1, second time to 2 etc. etc... (check the helpfile within ags, for more info on setglobalvalue.
Then in the room script :
if (GetGlobalValue(1) == 1) {
YOUR ACTION HERE;
}
if (GetGlobalValue(1) == 2) {
YOUR ACTION HERE;
}
if (GetGlobalValue(1) == 3) {
YOUR ACTION HERE;
}
That should work!
I can't find anything about GetGlobalValue in the help file and whenever I try to save it, it says it's "undefined." Do you mean GetGlobalInt?
And hey, while I have your attention, how do you make a wait for a dialog? You know, like you can have While(character[CHARID]animating.)Wait(1);? How can you set this for a dialog?
But thanks for all your help so far and sorry for not grasping this as quick as we all would like, but my most advanced scripting before this was HTML ;)
It is SetGlobalInt and GetGlobalInt. You can get confused with them...
But I don't quite understand the wait for a dialog question... Dialogs automatically block the game, AFAIK... But if you have a RunDialog command in a script, the dialog will be ran when the current script function is finished. So, it won't matter wheather you put the RunDialog in the beginning or the end of a script, it will be run as the last command.
To get around this, you must use run-script x dialog command and dialog_request global function. The manual gives more information about these.
Well thanks for the help, but it seems I can't do anything right. AGS keeps prompting me with a parse error after the "1." What am I doing wrong here? I put this in the global script like it said in the manual:
function dialog_request (1) {
FaceLocation (MYSTERY, 49, 222);
}
I thought it was a very simple script- what am I doing wrong?
Are you sure you've placed this script outside of any other "}" ?
And if it is, and still not working, then try to add another "}" above or underneath
Still giving me trouble. Garr.
TheQisSilent: I think the problem is that
function dialog_request (1) {
FaceLocation (MYSTERY, 49, 222);
}
is supposed to be
function dialog_request (X, or int X don't remember) {
if (X==1) {
FaceLocation (MYSTERY, 49, 222);
}
}
ant use run-script 1
X can be anything you wan tas long as it's consistent within the function.
Well yeah, that was it. Thanks for all your help, guys.