Select Page

So far I manage to code a simple script to do a primitive actions.

Here is a video for the demonstration of how the script work.

First the script detects if the player character standing nearby the NPCs and then trigger a guide button which I put statically;

Trigger Enter - Stay

Press E to talk.

The green boxy guidelines are the box collider in Unity that used as a trigger detector.

Press E to talk.

Show Robot Kyle dialogue.

After the player press E, the script then trigger a functions to show the subtitle and play the speech.

Show Alexis dialogue

I can make the subtitle to be dynamically inserted through the Unity editor but I think in future this won’t be enough. I was thinking to add a feature where I can add another line of subtitle dynamically, as well as the speech audio file. Currently the script only show 1 line of subtitle and play the attached audio clip. Will add more feature soon.

Using dynamic variable

Only 1 script to handle these 4 situations

Play audio attached to the game object.

When player moving away, the script trigger another function to dismiss the subtitle and the guide button.

Trigger ExitI’m now working towards to make an inventory so the player can pickup, use, drop and keep an items and money. Not yet in the programming stage but still deciding on the flowchart.

%d bloggers like this: