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: Referencing entities within a scene.  (Read 2231 times)

0 Members and 1 Guest are viewing this topic.

DocBass

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 136
    • View Profile
Referencing entities within a scene.
« on: August 22, 2006, 08:33:00 AM »

I am currently defining global vars in base.inc which makes them visible in all scripts in the game. These global vars are then set to specific items that need to be turned on and off through the game. For example if I have an apple that can be placed on a desk, and the apple is an item. I can use apple on desk. In the apple script I set some global var that could be named AppleRef to "this', i.e. AppleRef = this; within the apple script. Therefore since the apple is off by default when I am in desk.script and I use the apple, in on "apple" I can do AppleRef.Active = true; and the apple would appear (this is hypothetical and not the actual situation I'm using in game but the example is basically the same).

Is there a better way of doing this rather than tracking everything through global vars? I have not found anything in the documentation to suggest there is an easier way to do this. I imagine I could use paths such as "scenes\testcene\apple.entity" if there was such a thing but I have found nothing to suggest this. Just want to know if this is on the right track or if there is a better way. Thanks again!
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: Referencing entities within a scene.
« Reply #1 on: August 22, 2006, 10:58:13 AM »

somewhere in the script

var apple = Scene.GetNode("Apple");

did you mean something like that?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

DocBass

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 136
    • View Profile
Re: Referencing entities within a scene.
« Reply #2 on: August 22, 2006, 05:48:26 PM »

Yep...that would probably do it I imagine. :-)

That's good because I can keep everything local. Thanks!
Logged
 

Page created in 0.035 seconds with 18 queries.