Remove Light Scipt

Old and generally outdated discussions, with the rare hidden gem. Enter at your own risk.

Moderators: Haplo, Lead Developers

Locked
User avatar
BethesdaLove
Member
Posts: 23
Joined: Mon Aug 17, 2009 9:39 pm
Location: Essex, England, Under the Stairs
Contact:

Remove Light Scipt

Post by BethesdaLove »

Hey, here is my newest question.

I am VERY new to scripting, and I was wondering if I could, and if so how, could I script a removal of a light when picking up an item.

So, there is a luminated object, and it would look weird if it's lumination persisted after it was removed.

Cheers.
Evil Eye
Developer
Posts: 64
Joined: Sun May 03, 2009 7:27 pm

Post by Evil Eye »

Quite possible.
The cleanest way to do it would probably be to check the "References Persist" box on your light and then apply this script to your object:

Code: Select all

Begin ScriptName

short doOnce

if ( OnActivate == 1 )
	if ( doOnce == 0 )
		IDofYourLightHere->Disable
		set doOnce to 1
	endif
endif

end
User avatar
BethesdaLove
Member
Posts: 23
Joined: Mon Aug 17, 2009 9:39 pm
Location: Essex, England, Under the Stairs
Contact:

Post by BethesdaLove »

Evil Eye wrote:Quite possible.
The cleanest way to do it would probably be to check the "References Persist" box on your light and then apply this script to your object:

Code: Select all

Begin ScriptName

short doOnce

if ( OnActivate == 1 )
	if ( doOnce == 0 )
		IDofYourLightHere->Disable
		set doOnce to 1
	endif
endif

end
Well, the script removes the light, but stops me from picking up the object. Illumination gone, source remains.

Thanks for the speedy and effective reply though, works fine, just if anybody knows how to iron out this crease.
Evil Eye
Developer
Posts: 64
Joined: Sun May 03, 2009 7:27 pm

Post by Evil Eye »

Oops forgot a line there.

Code: Select all

Begin ScriptName 

short doOnce 

if ( OnActivate == 1 ) 
   if ( doOnce == 0 )
      Activate
      IDofYourLightHere->Disable 
      set doOnce to 1 
   endif 
endif 

end
This'll fix your problem.
User avatar
BethesdaLove
Member
Posts: 23
Joined: Mon Aug 17, 2009 9:39 pm
Location: Essex, England, Under the Stairs
Contact:

Post by BethesdaLove »

Brilliant, thank you very much. I really must get to grips with this scripting milarky.
Locked