Aller au contenu

Photo

AddCompanionsToRoster() or InitializeCompanion()


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Jezla

Jezla
  • Members
  • 173 messages
I'm trying to figure out how the companion system works.  I've been perusing the companion and roster scripts, as well as the scripts the OC uses for handling companions, and I have a question about something.

In the mod load script, "k_mod_load" there is a line which reads AddCompanionsToRoster().  I can't find this exact function in the list.  There is a function AddCompanionToRoster()  (note the difference).  My question is does the AddCompanionsToRoster() function automatically add all creature blueprints in the Companions category to the roster?  Could I use this function for my custom companions, or would I be better off using the InitializeCompanion() function for each one? 

#2
Morbane

Morbane
  • Members
  • 1 883 messages
I think it is a matter of preference - try it out either way and make a note of the difference in the way the engine handles the add companion event - or it may be a difference in how complex the whole script will end up being.

Experiment ;)

#3
kevL

kevL
  • Members
  • 4 078 messages
- been looking into this too.

AddCompanionToRoster()
is in 'ginc_companion' and adds a creature-blueprint/creature-instance to the Roster, ready to be selected by player.
( note that at the top of this #include there Obsidian gives a rundown of how they like the companion-system to work )

AddCompanionsToRoster()
is in 'kinc_companion' (OC Campaign #include) and iterates only the OC Companions, using AddCompanionToRoster().
( it sets each as a "CampaignNPC" meaning they are not visible in the player's RosterList but they are in fact there )


InitializeCompanion()
is in 'ginc_companion' and uses AddCompanionToRoster(), then sets the "CampaignNPC" switch, and assigns a "hangout spot"


An involved system but it seems well done and well described. (sry if I got something wrong, just learnin ;)

#4
Jezla

Jezla
  • Members
  • 173 messages
Kev, thanks that explains it. I didn't know there was a kinc_companion.