Salk Posted June 13, 2021 Posted June 13, 2021 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! Quote
Thor110 Posted June 13, 2021 Posted June 13, 2021 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 1 Quote
Salk Posted June 13, 2021 Author Posted June 13, 2021 Thanks for your suggestion, Thor110. I will see if I can figure something out by looking at the impact script. 1 Quote
DarthParametric Posted June 13, 2021 Posted June 13, 2021 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. 1 Quote
Salk Posted June 13, 2021 Author Posted June 13, 2021 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? 1 Quote
DarthParametric Posted June 13, 2021 Posted June 13, 2021 Is the guy with the shield the DLG owner? Quote
Salk Posted June 13, 2021 Author Posted June 13, 2021 Yes, it is. The code in the first post works and it uses OBJECT_SELF. Quote
DarthParametric Posted June 13, 2021 Posted June 13, 2021 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. Quote
Salk Posted June 13, 2021 Author Posted June 13, 2021 It's as you say. But even after combat begins Jagi won't activate the shield. The Mandalorian thug instead will. Weird. Quote
DarthParametric Posted June 13, 2021 Posted June 13, 2021 Maybe something in their UTC or OnSpawn. Quote
DarthParametric Posted June 13, 2021 Posted June 13, 2021 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. Quote
Salk Posted June 13, 2021 Author Posted June 13, 2021 I had edited jagi001.utc rather than g_jagi.utc. The shield activation inside the cutscene works correctly now. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.