Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: scene_init.script problem  (Read 1517 times)

0 Members and 1 Guest are viewing this topic.

terahleen

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
scene_init.script problem
« 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!

Logged

terahleen

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Re: scene_init.script problem
« Reply #1 on: August 18, 2011, 11:46:02 AM »

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! :)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 39
  • Offline Offline
  • Gender: Male
  • Posts: 5667
    • View Profile
    • Dead:Code Site
Re: scene_init.script problem
« Reply #2 on: August 20, 2011, 09:15:26 AM »

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.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

terahleen

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Re: scene_init.script problem
« Reply #3 on: August 20, 2011, 12:08:57 PM »

oops, I didn't notice the slash! :)
thank you!
Logged
 

Page created in 0.144 seconds with 17 queries.