Jump to content

Make a Semi-Transparent NPC?


Recommended Posts

So I'm trying to attach this script to an NPC so that they spawn semi-transparent, but nothing happens.

ScriptName GhostInvis1 extends Actor
Function SetAlpha(float afTargetAlpha, bool abFade = false) native
		float afTargetAlpha = 0.1

Can anyone tell me what I'm doing wrong?

 

Normally you can set an npc semi-transparent with SetActorAlpha <value> using console commands, I don't know how to accomplish this with papyrus though because I am not a scripter.

Link to comment
Share on other sites

ScriptName GhostInvis1 extends Actor

Event OnLoad()
 float afTargetAlpha = 0.1
 Self.SetAlpha(afTargetAlpha, abFade = false)
End Event

 

It fails to compile

GhostInvis1.psc(6,4): no viable alternative at input 'Event'No output generated for GhostInvis1, compilation failed.

Edit: Nevermind, thanks it was 'EndEvent' not 'End Event'

Edited by skyrimsasuke
Link to comment
Share on other sites

Messy, dont want to spawn too many of these. Looping scripts like this can get out of control to cause lag leading to CTD so be careful.

ScriptName GhostInvis1 extends Actor

Event OnLoad()
 MakeInvisible()
EndEvent

Function MakeInvisible()
If (Self.IsDead() == False) && (Self.IsDisabled() == False)
 Self.SetAlpha(afTargetAlpha = 0.1, abFade = false)
 StartTimer(5) ;in seconds
EndIf
EndFunction 

Event OnTimer(Int iTimer)
If (Self.Is3dLoaded() == True) 
 MakeInvisible()
EndIf
EndEvent 

Event OnUnload()
 CancelTimer()
EndEvent
Edited by SKK50
Link to comment
Share on other sites

  • Recently Browsing   0 members

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