Author Topic: Summoned NPC won't act like follower  (Read 454 times)

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« on: June 13, 2014, 12:51:22 am »


               

Hello,


 


I'm trying to create an item that summons an NPC to fight with you, like a summoned monster would, with a dialogue resembling a familiar.  I created the NPC and conversation, assigned the typical henchmen scripts to her, and created the scripted item to summon her.  However, she stays right at the spot she is summoned, won't move, and won't take commands.  Her conversation seems to work correctly, identifying the person who used the summoned item as her master, and I can dismiss the summon as well, but she's just not responsive.  Is there something I'm missing here?



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #1 on: June 13, 2014, 09:39:23 am »


               

In order to give the summoned creature henchman type interactions through the radial menu, it needs to use a specific script set.


 


I believe these are the scripts I use


 


If you are using nwnx, then you can use nwnx_funcs to set these programatically at runtime.


However if you are not using nwnx, these must be set on the creature in toolset.


 


 


OnBlocked: nw_ch_ace

OnCombatRoundEnd: nw_ch_ac3

OnConversation: nw_ch_ac4

OnDamaged: nw_ch_ac6

OnDeath: nw_ch_ac7

OnDisturbed: nw_ch_ac8

OnHeartbeat: nw_ch_ac1

OnPerception: nw_ch_ac2

OnPhysicalAttacked: nw_ch_ac5

OnRested: Leave Blank

OnSpawn: nw_ch_ac9

OnSpellCastAt: nw_ch_acb

OnUserDefined: nw_ch_acd

               
               

               
            

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #2 on: June 13, 2014, 09:56:01 am »


               

Thanks for the reply, but I did say in my above post that I did give the typical Henchmen scripts to her, which match the ones you gave.



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #3 on: June 13, 2014, 10:09:01 am »


               

Ok, you say that she identifies the user as the master.


That would be via


GetMaster() ? right?


 


It shouldnt matter, but are you sure the creature is not secretly hostile to the owner?


 


Eg: Being master / summon does override hostility, but I've observed in the past that strange behaviour can happen if they are secretly hostile due to faction conflicts when summoned.


Have you tried setting its faction to something neutral or player aligned?



               
               

               
            

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #4 on: June 13, 2014, 07:20:16 pm »


               

Right, GetMaster().


 


According to the toolset, she is of the Commoner faction.



               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #5 on: June 13, 2014, 09:45:48 pm »


               

Can you post the script you're using to summon her?



               
               

               
            

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #6 on: June 13, 2014, 10:46:07 pm »


               

The summoning code is a pretty simplistic affair:


 


void main()
{
object oPC;
 
oPC = GetItemActivator();
 
effect eEffect;
eEffect = EffectSummonCreature("aniser_yp", VFX_FNF_SUMMON_UNDEAD, 1.0);
 
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
 
}

               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #7 on: June 14, 2014, 01:11:33 am »


               After creating the companion, you need to run a hiring script IIRC. Not at my desk right now, but worth checking other summoning scripts.
               
               

               
            

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #8 on: June 15, 2014, 01:45:57 am »


               

A hiring script?  What would that entail?  The way the summon is written now, the NPC automatically appears in the party, no hiring required.  Or so I thought.



               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #9 on: June 15, 2014, 02:10:54 am »


               

The henchman commands on the radial issue shouts to the subject.  So in order for them to respond they first and foremost have to be listening.  Second they have to have a suitable script in their OnConversation  event to handle the request. 



               
               

               
            

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #10 on: June 15, 2014, 07:00:50 am »


               

Well, what would I have to do in particular that I'm not doing right now?  I mean, for all intents and purposes, she summons in exactly like a Summon Spell or a premade summoning item would.  So what lines of script would I need to put where?



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #11 on: June 15, 2014, 08:57:31 am »


               OK now I'm back at my desk, I see a hiring script is not necessary. Apologies.

However, according to the Lexicon, "The creator of the effect (the caller of the script) will be the master - not who it is targeted on". The caller for OnActivateItem is the module, so, implicitly, you're saying that the module is the master. I'd try

AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC));

               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #12 on: June 15, 2014, 03:37:06 pm »


               

If that is indeed the issue you will need to do it like this I believe:



AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSummonCreature("aniser_yp", VFX_FNF_SUMMON_UNDEAD, 1.0), oPC));

Or make a function to have the PC make the effect and apply it.  The effect creator is the one who executes the EffectSummonCreature not the ApplyEffectToObject.


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #13 on: June 15, 2014, 10:38:38 pm »


               I knew there was a reason why I always use effects inline, without declaring them... thanks for the correction.
               
               

               
            

Legacy_Zephyrys

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Summoned NPC won't act like follower
« Reply #14 on: June 17, 2014, 12:56:48 am »


               

This did not fix the issue.  The NPC in question still does not follow, or respond to commands.


 


Script now looks like:


void main()
{
object oPC;
 
oPC = GetItemActivator();
 
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSummonCreature("aniser_yp", VFX_FNF_SUMMON_UNDEAD, 1.0), oPC));
 
}