Hi,
In script I'm using "factionMember.SetPersonalAffinity(factionID, 0f)", to set a relationship with a NPC that the player meets in the game. But when I use factionMember.faction.relationships.Count to loop through all relationship the player has, the new relationship is not included. How can I solve this issue?
(I can see in the Unity Editor that the relationship is establised under the player/faction member - NPC added to the relationship, but the relationsship is not updated in the FactionDatabase.)
Setting Personal Affinity - but database not updated
Re: Setting Personal Affinity - but database not updated
Hi,
Here are a few things to check:
- Are there any errors or warnings in the Console window?
- Does your scene have a GameObject with a FactionManager component?
- Is your faction database assigned to the FactionManager component?
- Is a valid faction assigned to the FactionMember component associated with your factionMember variable?
Here are a few things to check:
- Are there any errors or warnings in the Console window?
- Does your scene have a GameObject with a FactionManager component?
- Is your faction database assigned to the FactionManager component?
- Is a valid faction assigned to the FactionMember component associated with your factionMember variable?
Re: Setting Personal Affinity - but database not updated
Hi,
Thank you for the reply - feedback on the queries:
- Are there any errors or warnings in the Console window? Answer: No errors in the Console window
- Does your scene have a GameObject with a FactionManager component? Answer: yes, I have
- Is your faction database assigned to the FactionManager component? Answer: yes, the factiondatabase is assinged to the FactionManager
- Is a valid faction assigned to the FactionMember component associated with your factionMember variable? Answer: Yes, a valid faction is assigned to the FactionMember component
Thank you for the reply - feedback on the queries:
- Are there any errors or warnings in the Console window? Answer: No errors in the Console window
- Does your scene have a GameObject with a FactionManager component? Answer: yes, I have
- Is your faction database assigned to the FactionManager component? Answer: yes, the factiondatabase is assinged to the FactionManager
- Is a valid faction assigned to the FactionMember component associated with your factionMember variable? Answer: Yes, a valid faction is assigned to the FactionMember component
Re: Setting Personal Affinity - but database not updated
Hi,
Is "factionID" (the subject faction) valid?
In a copy of Love/Hate's Example scene, I added a test script with this method to the Princess GameObject:
When I start the scene, the Princess's relationships look like this:
After I press [F1], it looks like this:
If that doesn't help, can you send a reproduction project to tony (at) pixelcrushers.com?
Is "factionID" (the subject faction) valid?
In a copy of Love/Hate's Example scene, I added a test script with this method to the Princess GameObject:
Code: Select all
void Update()
{
if (Input.GetKeyDown(KeyCode.F1))
{
var subjectID = FactionManager.instance.GetFactionID("Player");
GetComponent<FactionMember>().SetPersonalAffinity(subjectID, 69);
}
}
When I start the scene, the Princess's relationships look like this:
After I press [F1], it looks like this:
If that doesn't help, can you send a reproduction project to tony (at) pixelcrushers.com?
Re: Setting Personal Affinity - but database not updated
Thanks for the reply.
I get the same behaviour as you describes - the new relationship is added as you show, but the problem is that when I use factionMember.faction.relationships.Count the new relationship is not included. Do you know why?
I get the same behaviour as you describes - the new relationship is added as you show, but the problem is that when I use factionMember.faction.relationships.Count the new relationship is not included. Do you know why?
Re: Setting Personal Affinity - but database not updated
Is it maybe an issue with where you're checking Count?
I set the test Update method to this:
And it prints this to the Console:
In other words, the Princess has 3 relationships before adding the relationship to the Player, and 4 relationships after.
I set the test Update method to this:
Code: Select all
void Update()
{
if (Input.GetKeyDown(KeyCode.F1))
{
var member = GetComponent<FactionMember>();
Debug.Log(member.faction.relationships.Count);
var subjectID = FactionManager.instance.GetFactionID("Player");
member.SetPersonalAffinity(subjectID, 69);
Debug.Log(member.faction.relationships.Count);
}
}
Code: Select all
3
4
Re: Setting Personal Affinity - but database not updated
Thanks for the help - I see now what caused my problem. I set the relation in one script and do the count in another script. When I do the count in the same script as I set the relation, the count is correct.
Re: Setting Personal Affinity - but database not updated
Hi,
I'm glad you found the issue. Thanks for posting an update to let me know.
I'm glad you found the issue. Thanks for posting an update to let me know.