Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: terahleen on August 18, 2011, 11:30:43 AM
-
Hi everybody,
I'm new to the forum and the Wintermute Engine, I've read many topics searching for a solution for my problem but I couldn't find any...
So, I have a script on an entity that plays a certain music and trigger a "cut-scene" the first time you click on the hotspot, the FIRST time you visit the scene.
well, that should be the right behavior, instead every time I exit the scene and re-enter it, the script become active again.
Here, I'm telling you what I tried to do to solve the problem:
1) modify the entity script this way: (just after the on "LeftClick" event line, before the other instructions )
global StateOutside;
if (StateOutside.Visited == true){
gargoyle.DetachScript("\scenes\Outside\scr\gargoyleworm.script",true);
}
the detached script is the same that is running...
more over, as a test I also made this thing in the scene_init.script:
if(!StateOutside.Visited)
{
StateOutside.Visited = true;
Game.Msg("state is true now");
}
but it didn't print anything on screen...
where am I making mistakes?
thank you!
-
I actually resolved the problem using a global variable to check if the script has ever been triggered, however I still don't understand why it didn't work earlier so please, tell me! thank you! :)
-
I think simply using global variables and not call the code is always better than shuffling with scripts.
However, I'd guess your original approach didn't work because of the path ("\scenes\Outside\scr\gargoyleworm.script"). The first backslash shouldn't be there.
-
oops, I didn't notice the slash! :)
thank you!