Skip to content

ApplyEffectAtLocation facing direction.

I'm trying to improve this little script @Zephirius made. You get stopped when you enter a trigger and Bigby's Interposing Hand pops up in front. If that effect gets applied to an object, it spins around like normal. If it gets applied at a location is does not spin, but it's facing away from the trigger.
I've tried rotating the object and nothing changes.
Aside from remaking the area with north changed to south, is there any way I can manipulate the location to get the hand to face another direction?


Here's the most basic version of the script:
void main()
{
    object oScanner = GetObjectByTag("SCANNER");
    location lLoc = GetLocation(oScanner);
    effect eScan = EffectVisualEffect(VFX_DUR_BIGBYS_INTERPOSING_HAND);
    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eScan, lLoc, 6.0);
}
The SCANNER object is placed north of the trigger.

Comments

  • TerrorbleTerrorble Member Posts: 179
    Maybe have the trigger assign the ApplyEffectAtLocation() to another object that is south of the trigger.

    AssignCommand(oObjectSouthOfTrigger,ApplyEffectAtLocation())
  • ForSeriousForSerious Member Posts: 466
    edited August 9
    I don't think that's an option.
    There is fire-only-once-per-player logic in the full script. You can only ever enter the trigger from the south. The stopping hand needs to appear in front of the player entering the trigger.

    Maybe I should not have been so hesitant. The Rotate Area function in the toolset works flawlessly and did yield the result I wanted.

    So, because I have only one Hand facing one direction, I can do this. If I wanted to have multiple hands facing different directions though, I'm still out of luck—unless someone knows something else.
  • MelkiorMelkior Member Posts: 203
    The "location" variable type contains a "facing" variable. If you need the hand to always face a particular direction, then you need to build a new location variable with the facing already in it. If you just need the hand to face 180 degrees away from where it's currently facing, then you should reverse the facing by adding 180 degrees if it's below 180 or subtracting 180 degrees otherwise. There's a function in x0_i0_position to do this for you.
    #include "x0_i0_position"
    void main()
    {
        object oScanner = GetObjectByTag("SCANNER");
        location lLoc = GetLocation(oScanner);
        float fFace=GetFacingFromLocation(lLoc);
        fFace=GetOppositeDirection(fFace);
        location lLoc = Location(GetAreaFromLocation(lLoc),GetPositionFromLocation(lLoc),fFace);
        effect eScan = EffectVisualEffect(VFX_DUR_BIGBYS_INTERPOSING_HAND);
        ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eScan, lLoc, 6.0);
    }
    
    Alternatively, if the object tagged "SCANNER" can be rotated by 180 degrees, that would also solve the problem.
    Or, a second alternative, make the reference object be something invisible such as a waypoint, so you can orient it whatever way is most convenient.
    If the above doesn't work properly for you, then you can try substituting the angles 0.0, 90.0, 180.0 or 270.0 when you build the location, to make the hand face one of the compass points.
    Or, you can get the location of the entering PC as well then extract and use the "opposite facing" of the PC, combined with the position where you want the hand to appear.
    (I haven't had a chance to check any of the above code, but it should work. If not, I'll make a test module and see if I can figure out how to make it work)
  • ForSeriousForSerious Member Posts: 466
    Thanks @Melkior,
    That is the type of help I was hoping for.
    Unfortunately, none of your suggestions change the result.

    I think what's going on is that this effect does not use the facing value because it usually rotates.
    The only other direction I can think to go is to somehow change the appearance of an object to be the model for the effect.
  • ForSeriousForSerious Member Posts: 466
    edited August 14
    I found it!
    I just needed to read the details of EffectVisualEffect.
    "effect EffectVisualEffect(int nVisualEffectId, int nMissEffect=FALSE, float fScale=1.0f, vector vTranslate=[0.0,0.0,0.0], vector vRotate=[0.0,0.0,0.0])"
    So when I define it like this
    effect eScan = EffectVisualEffect(VFX_DUR_BIGBYS_INTERPOSING_HAND, FALSE, 1.0, [0.0,0.0,0.0], [180.0,0.0,0.0]);
    
    it works.

    (That was so much easier than trying to do json object manipulations.)
  • MelkiorMelkior Member Posts: 203
    I didn't think of looking at the EffectVisualEffect function. Thanks for letting me know. Now I know how to do it if I ever need it.
  • ZephiriusZephirius Member Posts: 419
    Cool. Glad to see it through to fruition.
Sign In or Register to comment.