In Portal there are energy balls that reflect off of any surface in a perfect reflection. So, if they hit the floor coming in at 90 degrees, they will reflect back perfectly vertical as well. If they come in at 45 degrees, they'll reflect at the opposite 45 degrees. This is what I'm trying to create. Since obviously I can't make projectiles actually do this (at least, I haven't thought of a way) I've resorted to making the spell cast itself upon impact.
I have an ImpactData with a Hazard spawning set to Projectile Reflection. Then I have a spawned object that does the following: (creates an XMarker in a vector at the same angle as the Hazard, and then fires the same spell from the hazard to the xmarker)
Scriptname PCKP_Script_BounceSpell extends ObjectReference Hazard Property HazMat autoSpell Property OwnSPell autoStatic Property XMArker autoevent OnLoad() ObjectReference TheHaz = Game.FindClosestReferenceOfTypeFromRef(HazMat, self, 200) float XAng = TheHaz.GetAngleX() float ZAng = TheHaz.GetAngleZ() ObjectReference NewTarget = TheHaz.PlaceAtMe(XMarker) NewTarget.SetPosition(TheHaz.GetPositionX() + (200 * (Math.sin(TheHaz.GetAngleZ()))), TheHaz.GetPositionY() + (200 * (Math.cos(TheHaz.GetAngleZ()))), TheHaz.GetPositionZ() + (200 * (Math.cos(TheHaz.GetAngleX())))) OwnSpell.Cast(TheHaz, NewTarget) NewTarget.Disable() NewTarget.Delete() Disable() Delete()endEvent
Now unfortunately, this seems to work only sometimes. Sometimes it does a perfect reflection, sometimes it reflects at weird angles, and other times it doesn't reflect at all. I dunno why.