Referencing Actors and fields in custom script
Posted: Tue Jun 22, 2021 2:09 pm
Hello again!
This time I'm working on a notification system for the map screen if the player has a conversation they can have with an NPC ready.
The thing I'm stuck on is figuring out what coding to use to pull Actor field data from the manager in the script.
I have two actor fields I added in the database, RelLvl that increases or decreases as you interact normally with NPCs, and TalkLvl that increases after you have a specific conversation with them. It's set up so that every ten points unlocks a new conversation, as long as the previous has already been activated.
This is what I have set up, I just don't know how to fill in the blanks to get the data from the manager synced up.
Thank you in advance!
This time I'm working on a notification system for the map screen if the player has a conversation they can have with an NPC ready.
The thing I'm stuck on is figuring out what coding to use to pull Actor field data from the manager in the script.
I have two actor fields I added in the database, RelLvl that increases or decreases as you interact normally with NPCs, and TalkLvl that increases after you have a specific conversation with them. It's set up so that every ten points unlocks a new conversation, as long as the previous has already been activated.
This is what I have set up, I just don't know how to fill in the blanks to get the data from the manager synced up.
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
using System.Security.Cryptography.X509Certificates;
public class charalert : MonoBehaviour
{//Alert notification to display on map screen
public GameObject AlertNotif;
void Start()
{
//what I assume pulls actor data from the manager)
var NPCconvos = Code to pull Actor data;
//cycling through each actor component)
foreach (Actor in NPCconvos)
{//Look to see if the level of relationship matches the conversation level player is on
if ((RelLvl*10)+1 >= TalkLvl)
{//display altert notification on map screen
Actor.GetComponent<charalert>().AlertNotif.SetActive(true);
}
}
}