Lance Harrington - Milestone 2 Part 1: Preparing For a Questing System
There is a lot that goes into a questing system so there will be multiple dev-logs to keep track of it. For getting the quest system started I need to have the player be able to interact with something to pick up the quest. Then, I need to have some way to keep track of what quests I’m on. Finally, I will need to complete the quests and be able to turn it in for a reward. Being still in the beginning stages of development, some of this will be hard to complete, but I can set it up in a way that allows it to be easily expanded upon in the future.
Starting with our first task of being able to interact with something to get the quest, I had just the lines of code to use:
Just want to say for now, I am using the EnemyStateMachine to interact with, because we currently don’t have an NPC yet, but is coming soon. In order to use this code, I needed to go into the PlayerFreeLook from the player state machine and add these methods. The first method simply gets a list of ray cast targets by calling Physics.SphereCastAll. I pass in the starting position, which is the players position, a radius for the sphere, a direction to go, and how far we want it to go. The second method takes in a list of ray cast hits, cycles through the hits, and returns the first EnemyStateMachine that it hits. If it doesn’t find one, it simply returns null.
Now that it is set up, we just need to implement it with these methods. So off course we make another method:
The method calls our two methods to get a state machine target. If the target is not equal to null, we switch to the PlayerDiologState, passing in the target we just got and exiting this state. At the top of the method, you will see how we handle our input. It was done based on events with another script. I unsubscribe from the interact event while I’m interacting and resubscribe if the if statement isn’t complete. I added this so we don’t have a bunch of loops going off at once if the player spams the interact button.
Now that we have the player in an interacting/dialog state, the next step will be to create the NPCStateMachine, so we don’t have to keep using the enemy state machine for testing. This will be my next mission toward completing the questing part of the milestone. Luckily it will be based off the enemy state machine, but with its own custom states. More on the enemy state machine can be found in my other dev-log Milestone 1 Part 1: Enemy A.I.. In my next dev-log entry I will go a little bit into the NPC state machine and start on the actual questing scripts.
Get Iron Echos: Zenith's Uprising
Iron Echos: Zenith's Uprising
A Robotic Wanderer "Zenith" With corrupted memories hiding their past, they embark on a journey looking for answers
Status | In development |
Authors | Strayife, JohnIsDecent, WickedSomeone, logan21113, Xexem |
Genre | Action |
More posts
- Milestone 4: Finalizing UI Assets6 days ago
- Seth Kolb: Milestone 4 - Graphical Tweaks and Post Processing8 days ago
- Seth Kolb: Milestone 4 - Outline Shader8 days ago
- Logan Milestone 3/410 days ago
- Milestone 2: John's Healthbar and Minimap11 days ago
- Lance Harrington: Modeling for the Semester13 days ago
- Seth Kolb: Milestone 3 - Refactoring Weapon System13 days ago
- Seth Kolb: Milestone 3 - Level Design for Playtest13 days ago
- Lance Harrington - Milestone 3 Part: Enemies and Portals17 days ago
- Lance Harrington - Milestone 3 Part 1: Save System22 days ago
Leave a comment
Log in with itch.io to leave a comment.