mmdestiny Posted June 5, 2018 Posted June 5, 2018 (edited) (EDIT: Problem Solved! I will post the solution below for anyone who may have the same question) Hi guys,I'm scratching my head here. I feel like this should be a real simple solution and I'm just missing it. Is there a way to reference the explosion that an ActiveMagicEffect is attached to within the AME script? I need to get the x,y,z of the explosion to continue. I've got an enchanted explosion, and I'm putting a script on the ActiveMagicEffect that will take into consideration the distance from the explosion to calculate how to do things. I tested my AME code first on a gun with the distance from akCaster (me) to the target and the code worked fine.However, when switching the AME to an explosion, the code in it's previous state didn't work as intended - akCaster still has to be an actor, so the effects were basing off of distance to me, not the explosion. I've tried placing a marker with self.PlaceAtMe thinking that self would be the origin of the AME, but get the following errors, so I assume "self" is not a valid type in this case.(19,18): PlaceAtMe is not a function or does not exist(19,1): type mismatch while assigning to a objectreference (cast missing or types unrelated) Here is the relevant code:Scriptname MMD_GravityWell extends activemagiceffect Float Property Magnitude Auto Const STATIC Property XMarkerHeading Auto ObjectReference Property refScript Auto int distance int myX int myY int myZ int targetX int targetY int targetZ ObjectReference Epicenter Event OnEffectStart(Actor akTarget, Actor akCaster) Epicenter = self.PlaceAtMe(XMarkerHeading, 1, false, true) ;do fun stuff Edited June 6, 2018 by mmdestiny
mmdestiny Posted June 6, 2018 Author Posted June 6, 2018 I found the solution. I used the explosive form's ability to place something at the explosion location - I chose a moveable static. I then put a script on that and passed it's coordinates to a global variable, and read the global variable into the ActiveMagicEffect for calculating the targets' vectors to and distance from the explosion. Works like a charm!
Recommended Posts