Forum rules - please read before posting.

Need some advice on NPC giving Items to Player

Hi!

I need help on how to approach a type of gameplay feature I desire. To give some context about my game, I am developing a security guard simulator-type game. Basically, the aim of the game is to check NPC's identification to make sure they're valid. So far, currently, each NPC has a unique look and unique name. The names come from an Asset Menu where it randomly pulls out a name and assigns it to the NPC. Now the hard part is to have a dynamic Identification card that they hand to the security guard, that shows the NPC's name, face, birthday, etc. The type of look I'm after is similar to the link below.

https://ibb.co/nMWC4jH

There are two screens, the top is the main game camera, and the bottom is a type of "inventory" camera, where u can grab and drag the ID'd around ( as seen in the link provided above). can you please recommend the best way to tackle this? I know AC has a Split screen camera, is that the best way?

Whats the best way to create a dynamic ID card?

Thank you so much.

Comments

  • You could rely on split-screen, or just have a Menu take up half of the screen. If you wanted the Menu to "zoom in" on a part of the scene (or even some portion not visible in the main camera view), you could rely on a Raw Image component showing a Render Texture provided by a separate camera.

    For the ID card, you'd probably use a single Inventory item whose Texture can be changed dynamically at runtime. Using inventory items means you'd be able to rely on AC's "Drag and drop inventory" features.

    For NPC data, you could either attach a Variables component to your NPC and define each stat as a separate Variable (String for Name, Unity Object for Face texture etc), or a custom script, e.g.:

    using UnityEngine;
    
    public class NPCStats : MonoBehaviour
    {
    
        public string name;
        public string birthday;
        public Texture2D faceTex;
    
    }
    

    This would naturally rely on another custom script to process, but you'd need to rely on custom scripting anyway in order to apply e.g. the "Face texture" variable onto the ID card inventory item, e.g.:

    AC.Variables npcVariables = GetComponent<AC.Variables> ();
    Texture2D faceTex = (Texture2D) npcVariables.GetVariable ("FaceTexture").UnityObjectValue;
    AC.KickStarter.inventoryManager.GetItem ("ID card").tex = faceTex;
    

    I would imagine that this'd just be the start of the custom scripting you'd be facing for gameplay like this, as this isn't the kind of gameplay that AC itself is intended for. If you're familiar with scripting and know your way around AC it would be feasible, but for gameplay this unique and tightly-controlled I would personally tackle the project entirely with code written specifically for it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.