Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Field Researcher
Original Poster
#1 Old 13th Apr 2023 at 3:59 AM
Default How would I go about making a condition based on Whether a sim has a specific career and specific career level.
Hello, I was wondering how I could go about making a condition based on whether a sim has a certain career or not. As well as make a condition checking the level of the career that the target sim has. Any help would be appreciated.
Advertisement
Field Researcher
Original Poster
#2 Old 13th Apr 2023 at 6:41 AM Last edited by MonocoDoll : 13th Apr 2023 at 6:55 AM.
Found out how to make a condition based on whether a sim has a specific career and is in a specific career level. Here is my code incase anyone needs this in the future.
Code:
public static bool simIsACop(Sim sim)
        {
            
            if (sim != null)
            {
                CareerManager careerManager = sim.CareerManager;
                if(careerManager != null)
                {
                    Occupation occupation = careerManager.Occupation;
                    int level = occupation.Level;
                    if (careerManager.Occupation is LawEnforcement && level >=5)
                    {
                        StyledNotification.Show(new StyledNotification.Format("Target Sim is a Lieutenant Officer", StyledNotification.NotificationStyle.kDebugAlert));
                    }
                    else if (careerManager.Occupation is Military)
                    {
                        StyledNotification.Show(new StyledNotification.Format("Target Sim is a Soldier", StyledNotification.NotificationStyle.kDebugAlert));
                    }
                    else if (careerManager.Occupation is LawEnforcement)
                    {
                        StyledNotification.Show(new StyledNotification.Format("Target Sim is a Cop", StyledNotification.NotificationStyle.kDebugAlert));
                    }
                }
            }
            return false;
        }
Back to top