Jump to content

Dynamically attaching scripts, is it possible?


bwins95

Recommended Posts

I'm not really sure how to describe what I want, so I'll use skyrim as an example since I know what I'm doing in it.

 

Is their a way to attach a script to an item that would play a shader on it when it is hit by anything. in skyrim I use a quest with reference aliases looking for a specific keyword or formlist. when the keyword is found it fills an alias that has an onhit scripts attached to it and plays a shader.

Link to comment
Share on other sites

Thank you. that is what I wanted.

 

I've just got a small problem. the shader doesn't play when I equip the item. the message box appears for each item that is found.

 

 

scn GlowingItemsTest

ref rCurrentRef

begin OnEquip player
ShowMessage aa
set rCurrentRef to GetFirstRef 27 1 0
Label 10
if rCurrentRef
PlayMagicShaderVisuals fxSearchAndMark
pms fxSearchAndMark 10
set rCurrentRef to Pencil01 ; Prevent apple bug
set rCurrentRef to GetNextRef
ShowMessage aaaa
Goto 10
endif
End

 

Edited by bwins95
Link to comment
Share on other sites

you have to specify the reference to play the shader on.

rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark

and for the second part

rCurrentRef2.PlayMagicShaderVisuals fxSearchAndMark
Link to comment
Share on other sites

 

you have to specify the reference to play the shader on.

rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark

and for the second part

rCurrentRef2.PlayMagicShaderVisuals fxSearchAndMark

Thank you.

 

I got it mostly working. What I need is for it apply the shader to more then one item. right now it only affects one item and after the shader wears off it doesn't apply it to the one item or anything else.

 

 

 

scn GlowingItemsTestref rCurrentRefref rCurrentRef2Begin OnEquip player	set rCurrentRef to GetFirstRef 24 1 0 ; Actors	Label 10	if rCurrentRef		rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark 5		set rCurrentRef to Pencil01 ; Prevent "apple" bug with GetNextRef		set rCurrentRef to GetNextRef	endif	set rCurrentRef2 to GetNextRef 40 1 0 ; Actors	if rCurrentRef2		rCurrentRef2.PlayMagicShaderVisuals fxSearchAndMark 5		set rCurrentRef2 to Pencil01 ; Prevent "apple" bug with GetNextRef		set rCurrentRef2 to GetNextRef		Goto 10	endifEnd

 

 

Edited by bwins95
Link to comment
Share on other sites

You can't REF walk over two different form types within the same loop. Try this:

scn	GlowingItemsTest

ref	rCurrentRef

begin OnEquip player

	set rCurrentRef to GetFirstRef 24 1 0
	Label 1
	if IsFormValid rCurrentRef
		rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark 5
		set rCurrentRef to Pencil01
		set rCurrentRef to GetNextRef
		GoTo 1
	endif

	set rCurrentRef to GetFirstRef 40 1 0
	Label 2
	if IsFormValid rCurrentRef
		rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark 5
		set rCurrentRef to Pencil01
		set rCurrentRef to GetNextRef
		GoTo 2
	endif

end
Link to comment
Share on other sites

 

You can't REF walk over two different form types within the same loop. Try this:

scn	GlowingItemsTest

ref	rCurrentRef

begin OnEquip player

	set rCurrentRef to GetFirstRef 24 1 0
	Label 1
	if IsFormValid rCurrentRef
		rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark 5
		set rCurrentRef to Pencil01
		set rCurrentRef to GetNextRef
		GoTo 1
	endif

	set rCurrentRef to GetFirstRef 40 1 0
	Label 2
	if IsFormValid rCurrentRef
		rCurrentRef.PlayMagicShaderVisuals fxSearchAndMark 5
		set rCurrentRef to Pencil01
		set rCurrentRef to GetNextRef
		GoTo 2
	endif

end

Thank you. this is just what I was looking for.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...