OK, I think I am in a good way. I managed to make my scripts compile. The companion spawned, which in turn means that Initialization worked. However, she didn't follow out of the area, and when I entered again. she was not there, but re-spawned to her location. I guess it's one thing at a time.
It seems I am in a good direction, and start understanding more things about how the code works. Not just in these particular scripts, but generally in this language.
I also don't know how I did it, but when I opened the roster UI, she was grey and non selectable for removing. It could be a good thing, since I prefer them to be added just by a conversation.
And Colors, my big modified scripts like mod_load etc, are all named andy_mod_load etc

.
Was mentioned in your guide about the wandering monsters.
In any case, this is the modified kinc_companion from MotB. It compiles, and initializes.
I just commented out or deleted the influence parts. is the part between the resrefs and tags constants, which is the companion string_resrefs:
Probably important thing commented out:const int STR_REF_SAFIYA = 185138;
const int STR_REF_GANN = 185442;
const int STR_REF_OKKU = 184853;
const int STR_REF_DOVE = 185506;
const int STR_REF_ONEOFMANY = 185443;
And this is the script that compiles anyway.#include "ginc_henchman"
#include "ginc_companion"
#include "ginc_object"
#include "ginc_ipspeaker"
//-------------------------------------------------
// Constants
//-------------------------------------------------
// Companion ResRefs
const string RR_ADOWARD = "adoward";
const string RR_LEOKUL = "leokul";
const string RR_WALORIN = "walorin";
const string RR_NILEE = "nilee";
const string RR_JARFED = "jarfed";
// we'll always use tag as the roster name
const string TAG_ADOWARD = "adoward";
const string TAG_LEOKUL = "leokul";
const string TAG_WALORIN = "walorin";
const string TAG_NILEE = "nilee";
const string TAG_JARFED = "jarfed";
// Companion add/remove
// --------------------------------------------------------------
void AddCompanionsToRoster();
void SpawnCompanion(string sTag, string sResRef);
void SpawnCompanions();
int RemoveAllCompanions( object oPC , int bDespawn = TRUE);
// adds all companions to the roster
// members in roster must still be added to party
void InitializeCompanions()
{
InitializeCompanion(TAG_ADOWARD, TAG_ADOWARD, RR_ADOWARD);
InitializeCompanion(TAG_LEOKUL, TAG_LEOKUL, RR_LEOKUL);
InitializeCompanion(TAG_WALORIN, TAG_WALORIN, RR_WALORIN);
InitializeCompanion(TAG_NILEE, TAG_NILEE, RR_NILEE);
InitializeCompanion(TAG_JARFED, TAG_JARFED, RR_JARFED);
}
// spawn all NX1 companions at their hangout
void SpawnCompanionRosterMembersAtHangout()
{
// tags also serve as the roster name.
SpawnNonPartyRosterMemberAtHangout(TAG_ADOWARD);
SpawnNonPartyRosterMemberAtHangout(TAG_LEOKUL);
SpawnNonPartyRosterMemberAtHangout(TAG_WALORIN);
SpawnNonPartyRosterMemberAtHangout(TAG_NILEE);
SpawnNonPartyRosterMemberAtHangout(TAG_JARFED);
}
// Success should return 0, or remaining number of companions on failure
int RemoveAllCompanions( object oPC , int bDespawn = TRUE)
{
RemoveRosterMemberFromParty( TAG_ADOWARD, oPC, bDespawn );
RemoveRosterMemberFromParty( TAG_LEOKUL, oPC, bDespawn );
RemoveRosterMemberFromParty( TAG_WALORIN, oPC, bDespawn );
RemoveRosterMemberFromParty( TAG_NILEE, oPC, bDespawn );
RemoveRosterMemberFromParty( TAG_JARFED, oPC, bDespawn );
//return GetNumHenchmen( oPC );
return (0);
}
This is just the first attempt. Was done really quick. But as I said, one step at a time

.
The last thing I need to say, is that my Companions are campaign blueprints/recourses. Is that an issue? I have no idea. Also, every time I design a new one, I should go back to this script and add his strings etc I guess.
Modifié par andysks, 09 novembre 2013 - 05:01 .