Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Attaching a script to a 3d actor  (Read 2841 times)

0 Members and 1 Guest are viewing this topic.

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Attaching a script to a 3d actor
« on: August 23, 2009, 01:17:48 AM »

Hello

I have some questions about attaching a script to a 3d actor.

This is the situation. I have a global loaded 3d actor. In one scene I attach a script to the actor, which then generates a particle from the actor - the particle appears in that scene. Once the scene has changed the particle stops, as I expected and wanted

When returning to the scene the same scripts run again and it attaches the script to the actor to create the particle.

However, my questions are...  is the script already/still attached to the globally loaded actor, even though I attached the script from within a scene script?

Do I need to detach the script from the global actor when leaving the scene with the particle?

Will I end up with repeats of the same script attach to the 3dactor if the player returns time and time again to the scene?

Should I be attaching the script to the actor3D file and triggering the script in the scene itself?

Many Thanks
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Attaching a script to a 3d actor
« Reply #1 on: August 23, 2009, 09:26:43 AM »

The script stays attached as long as the actor exists. It doesn't matter in what scene you attach it.
If you attempt to attach the same script multiple times, you'll get a warning message in the log.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Re: Attaching a script to a 3d actor
« Reply #2 on: September 22, 2009, 02:35:41 PM »

Hello, Thanks for the reply. If I am using Game.UnloadObject(actor); and then loading a new actor, I assume then that any attached scripts will have been removed?

Many Thanks

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Attaching a script to a 3d actor
« Reply #3 on: September 22, 2009, 03:12:12 PM »

Yes, if you remove some object, its scripts get removed as well.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.045 seconds with 21 queries.