Hey, I'm working on a vampire game, and I was wondering how I could make the vampire die when it goes into sunlight.
Any ideas?
Any ideas?
var DominantDirectionalLight MyDomDirRef; simulated function PostBeginPlay() { local DominantDirectionalLight D; super.PostBeginPlay(); foreach AllActors ( class'DominantDirectionalLight', D) // only do this here as a temporary thing, best would be to store a ref one time in gamereplicationinfo or something as this function is all kinds of slow { MyDomDirRef = D; } `log('FOUND AND STORED A REF TO THE SUN TO SAVE CALLING ALLACTORS CONTINUALLY'@MyDomDirRef) } simulated function Tick(float DeltaTime) { super.Tick(DeltaTime); if(FastTrace(Location, Location - 10000*vector(MyDomDir.Rotation)) // change 10k to whatever suits best, trace should be as short as possible { TakeDamage(Blah); // whatever you want to do here } }
Comment