Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: How would i go about this?  (Read 2939 times)

0 Members and 1 Guest are viewing this topic.

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 351
    • View Profile
    • Jyujinkai's WME Development Blog
How would i go about this?
« on: June 18, 2008, 10:39:31 AM »

My limited programming skills need some help :)

I basically have a room that is like the hollo-deck in startrek. Where there is a object that will run a ogg file that morphs the entire room into a new room.

Anyways....

How would i go about making walking areas and clickable things that are only active when the  correct background is displayed?
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: How would i go about this?
« Reply #1 on: June 18, 2008, 10:49:25 AM »

Simply set Active to true or false. Let's say you have in your 10 different regions called "A1", "A2" ... "A10"

var tmp;
switch (CurrentRoom) // variable containing the state of the morph
{
case 1:
  tmp = Scene.GetNode("A1");
  tmp.Active = true;
  tmp = Scene.GetNode("A2");
  tmp.Active = false;
  // etc... etc...
  break;
case 2:
  tmp = Scene.GetNode("A2");
  tmp.Active = true;
  tmp = Scene.GetNode("A1");
  tmp.Active = false;
  // etc... etc...
  break;
}

So you'll have the variable CurrentRoom changing together with scene morph and call some code like this to adapt the room to current condition.

Hope this helps.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 351
    • View Profile
    • Jyujinkai's WME Development Blog
Re: How would i go about this?
« Reply #2 on: June 18, 2008, 11:15:43 AM »

thanks Morph... i am still not really sure....

so the "tmp" variable = 1 means case 1?

and i just add all the nodes in the case?

Say i have A1-A3... and then a room switch using B1-B3 for the regions......

Code: WME Script
  1. var tmp;
  2. switch (CurrentRoom) // variable containing the state of the morph
  3. {
  4. case 1:
  5.   tmp = Scene.GetNode("A1");
  6.   tmp.Active = true;
  7.   tmp = Scene.GetNode("A2");
  8.   tmp.Active = true;
  9.   tmp = Scene.GetNode("A3");
  10.   tmp.Active = true;
  11.   tmp = Scene.GetNode("B1");
  12.   tmp.Active = flase;
  13.   tmp = Scene.GetNode("B2");
  14.   tmp.Active = flase;
  15.   tmp = Scene.GetNode("B3");
  16.   tmp.Active = flase;
  17.   break;
  18. case 2:
  19.   tmp = Scene.GetNode("B1");
  20.   tmp.Active = true;
  21.   tmp = Scene.GetNode("B2");
  22.   tmp.Active = true;
  23.   tmp = Scene.GetNode("B3");
  24.   tmp.Active = true;
  25.   tmp = Scene.GetNode("A1");
  26.   tmp.Active = flase;
  27.   tmp = Scene.GetNode("A2");
  28.   tmp.Active = flase;
  29.   tmp = Scene.GetNode("A3");
  30.   tmp.Active = flase;
  31.   break;
  32. }

Then setting "tmp" to 1 will do case "1" and "2" will do case 2?

(i know i am a lame programmer)
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Daniel

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 124
  • I'm *not* a llama!
    • View Profile
Re: How would i go about this?
« Reply #3 on: June 18, 2008, 11:54:40 AM »

If I recall correctly, you can create separate layers for each morph case and then enable/disable entire layers so that you don't have to go through all regions in the layer and enable/disable them one by one.

And to your question, Jyujinkai, the variable you have to change is CurrentRoom and not tmp. tmp is just a temporary variable to use during the enabling/disabling of the scene objects.
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: How would i go about this?
« Reply #4 on: June 18, 2008, 12:06:10 PM »

it depends of course on the fact how much the screen changes during each morph.

Daniel is correct about the Layer approach:

var tmp = Scene.GetLayer("SomeLayer");
tmp.Active = true;

would ease your life a bit in case you have many regions for each change. The logic remains the same though.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.042 seconds with 24 queries.