Creating Events & Targeting System
- Roland Thomas

- Dec 22, 2023
- 2 min read
Early in the project, I implemented a targeting system that I had developed for a prior project, with plans to adjust it in future. At the moment it works based on proximity, cycling through targetable pawns and prioritising the closest first. It then creates an arrow above the targeted pawn. The aim is to have a camera-based targeting system that passively targets whatever the camera is looking at, with additional features like lock-on, but for now, I used the existing system as is with some minor tweaks to the system that allow a player to target actors, not just pawns. This way it will work with any actors with the 'Interactable' interface that I add to the game moving forward.
I then got to work creating a base actor blueprint for events. Adding the interactable interface, I also made them perform a few checks to check whether the player is a Hero or a Villain, and if they are in range. This allows me to specify events for Heroes or Villains if necessary.
I added visible text above the base object for visual testing of results server-&-client-side, and the first test event would be a Hero event that adds 5 Hope once, and then is marked complete, so it can't be activated again. I learned quite quickly that objects placed in the world are owned by the server, but as long as their relevant variables are set to replicate, the client should see any changes. It also makes them easy to interact with using server RPCs.
With this I was able to create a base event that worked completely as expected, and a mix of multicasts and repNotifies were used to replicate the necessary changes required for the event to the client. The amount of Paradigm Points rewarded on completion and a boolean dictates whether it is a Hero or Villain event. I will be able to create Neutral events if I wish in future, by performing checks on completion/activation, instead of when they are spawned or added to the world.






Comments