Surrendering Companion
#1
Posté 22 février 2014 - 09:40
I was creating a random encounter today, where some group ambushes the PC and his party. I was thinking, that the leader of the bandits will surrender when low and offer to join the party, for many reasons. Anyway.
I have done this before. But not on potential companions. I used the gb_surrender_sp as the OnSpawn script, and this one as the user defined. Thanks for Brandon Belina for it.
http://pastebin.myrr....php?v=db1-2664
Since this uses a spot on OnSpawn, and given the delicate "get low speak" method, I don't know if I can use this, or if this thing is even possible.
I have thought of an altenative method though.
Just a hostile creature that surrenders when low, fade to black, destroy this creature, spawn the companion one which is a duplicate with the companion scripts and jump to conversation.
So, all I ask is if there is an easier way?
Thanks.
#2
Posté 22 février 2014 - 01:50
#3
Posté 22 février 2014 - 03:09
This way, if possible would be much better. The other one got complicated.
#4
Posté 22 février 2014 - 10:21
#5
Posté 22 février 2014 - 10:39
// Brock H. - OEI 03/28/06 -- These must match the values in NWN2_ScriptSets.2da int SCRIPTSET_INVALID = -1; int SCRIPTSET_NOAI = 0; int SCRIPTSET_PCDOMINATE = 1; int SCRIPTSET_DMPOSSESSED = 2; int SCRIPTSET_PLAYER_DEFAULT = 3; // These are the default scripts that are loaded onto the player character int SCRIPTSET_COMPANION_POSSESSED = 4; // The scripts that are applied on the player when he is controlled by int SCRIPTSET_NPC_DEFAULT = 9; // The default scripts for generic NPCs int SCRIPTSET_NPC_ASSOCIATES = 10; // The default scripts for NPC associates (summoned creatures, henchmen, etc) /////////////////////////////////////////////////////////////////////////////// // SetCreatureScriptsToSet /////////////////////////////////////////////////////////////////////////////// // Created By: Brock Heinz - OEI // Created On: 09/23/05 // Modified: 12/19/05 // Description: Reassign all of the creature's scripts to a set specified by // the entry in the NWN2_ScriptSets.2DA file. If the creature // is not running his default scripts (for example, he is being // possessed by a DM), he won't start running the scripts from // the new set until he goes back to his default state /////////////////////////////////////////////////////////////////////////////// void SetCreatureScriptsToSet( object oCreature, int nScriptSet );
you can define additional scriptsets in Nwn2_scriptsets.2da, which can then be referenced by row# (tho a switch from NPC to companion would be #9, already set, to #3 )
#6
Posté 22 février 2014 - 10:58
#7
Posté 23 février 2014 - 08:33
I try to spawn her now using the surrender scripts and hostile, but she will refuse to spawn. I guess it's the gb_comp_spawn... maybe it's necessary to use with my companion functions and library. Maybe I should spawn her with the companion scripts, then shift for the battle and shift again for joining.
#8
Posté 23 février 2014 - 07:37
Regards
#9
Posté 23 février 2014 - 11:34
#10
Posté 23 février 2014 - 11:57
#11
Posté 25 février 2014 - 01:22
I tried some diferent aproaches, and it turned out the problem is on the companion for the time being. Once I fix it, and she decides to spawn, then I'll see if hostile or gb_comp_spawn are also a problem.
#12
Posté 27 février 2014 - 02:11
Solved the problem, it was something completely diferent. A saved game was causing trouble to the module load script. After this got solved, the companion spawned, even hostile and with the two custom scripts attached. When got low, surrendered as supposed, and also as Dann said she didn't follow when joined. I only need to figure out how to set the listening patterns now an matter is closed. Thanks for the help and info.
#13
Posté 27 février 2014 - 02:51
The easiest way is to force the default companion OnSpawn script to run on the creature in question.
http://nwn2.wikia.co...i/ExecuteScript
#14
Posté 27 février 2014 - 04:24
ie, the script to execute is 'gb_comp_spawn' i believe.
These are the pertinent calls:
// Sets up the special henchmen listening patterns (gb_setassociatelistenpatterns) SetAssociateListenPatterns(); // Set standard combat listening patterns (x0_i0_spawncond) SetListeningPatterns(); // Set additional henchman listening patterns (x0_inc_henai) bkSetListeningPatterns();
'gb_comp_spawn' includes several niceties, like setting a follow-distance, etc. etc.
#15
Posté 27 février 2014 - 05:19
#16
Posté 27 février 2014 - 06:23
The whole thing worked out perfectly. Thanks for the info on how this works. Really valuable information.
Recap: A companion will spawn even with a custom spawn script attached. He will spawn even on hostile faction. All in all, he will spawn no matter what. After that it was a matter of attaching the surrendering script and changing script sets and executing the gb_comp_spawn.
One thing to note, even if I was calling all hostile creatures to hide during the cutscene, the companion was visible. I had to hide him separately on the first node with a ga_scripthidden. I don't know why... I won't search further
.





Retour en haut






