Sign in to follow this  
Salk

Shield activation via script

Recommended Posts

Hello!

I want to have an NPC activate a shield during a cutscene.

My code was:

void main() {

  ActionPauseConversation();

  ActionUseTalentOnObject(TalentSpell(104), OBJECT_SELF);

  DelayCommand(3.0, ActionResumeConversation());

}

Problem is: unlike what I see when I encounter enemies that use an energy shield, in my version the NPC doesn't use the ACTIVATE animation but rather the HAND animation, as if it was a Force Power. I guess it is because that is the animation assigned in SPELLS.2DA but then how does the game make NPC use the correct one?

Thanks!

Share this post


Link to post
Share on other sites
31 minutes ago, Salk said:

Problem is: unlike what I see when I encounter enemies that use an energy shield, in my version the NPC doesn't use the ACTIVATE animation but rather the HAND animation, as if it was a Force Power. I guess it is because that is the animation assigned in SPELLS.2DA but then how does the game make NPC use the correct one?

scroll along spells.2da and take a look "conjanim", there is also a "castanim" as well as an impact script that comes into play.

This is set to hand for the conjure animation and self for the cast animation on #104

There is also an impact script which contains the following. ( below is part of the script that references 104 )

Spoiler

    else if(nIndex == 104)
    {
        nShield = SHIELD_MANDALORIAN_POWER;
        nIcon = 50;
    }

After the if/else statements is this

Spoiler

effect eShield = EffectForceShield(nShield);
eShield = SetEffectIcon(eShield, nIcon);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eShield, GetSpellTargetObject(), fDuration);

It could be worth taking a look at the impact script, or trying the above effect instead of the talent you are applying.

I am not sure why the hand animation is used, but it could be that the above overrides it by the time it has begun playing, I am not 100% certain but thought I would have a look into it quickly for you.

Thor110

spells.png

  • Like 1

Share this post


Link to post
Share on other sites

The conjanim column will likely be referring to the VFX hook (handconjure in this case), not the animation.

If you want them to activate a shield, it's probably easier to just fire the anim (ANIMATION_FIREFORGET_ACTIVATE) and then apply the shield VFX.

Edit: Ah, there's an include function for it - GN_ActivateForceField().

    Organic Shields are 99 to 107
    Droid shields are 110 to 115

    Scans through all of the shield talents to
    see if the target has a shield to use. If the
    shield is used then the person will never use
    another one. Party members will never use this
    function.

 

  • Like 1

Share this post


Link to post
Share on other sites

In theory, this should work but in practice it doesn't.

#include "k_inc_generic"

void main() {

  ActionPauseConversation();

  GN_ActivateForceField();

  DelayCommand(3.0, ActionResumeConversation());

}

I equipped the NPC (g_jagi001.utc) with a Mandalorian Power Shield (g_i_frarmbnds06) but it does not activate it.

I tested other energy shields but still no go.

Any advice?

  • Like 1

Share this post


Link to post
Share on other sites

If it's Jagi then I assume this is during the Dune Sea showdown?

I've never used the function myself, so I have no particular insights to it. At a guess, I'd assume it only functions after combat has been initiated. If you want a fancy cutscene, you're probably better off just doing what I said above and faking it.

Share this post


Link to post
Share on other sites

I had a quick look and didn't seen anything noteworthy. The mooks use the generic global scripts, and Jagi just has an OnDeath event that pops the journal update. The UTCs don't show anything obvious either.

If you haven't tried AssignCommand for Jagi like you would have done for the mooks then I would try that. Otherwise nothing else immediately springs to mind.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this