[City of Thebes] HeroChar_BP > SetTrap

  • Exposure: public
  • UE Version: 4.17


July 27, 2018, 11:13 pm

<hr>#### Setting TrapsA function in HeroChar_BP, the character class that governs both player-driven characters and computer-controlled hero opponents, used to place traps on the ground in front of them.It works by calculating a goal point a set distance in front of the character, and then running a line trace from the character's waist to that location. If the hit result is a walkable surface, the trace returns that location and checks if that location is a null zone (player-created locations where traps cannot be placed) or an existing trap that cannot mix with the one being laid down. If these conditions are passed, the trap is given a pseudo-random rotation and checks the cost of the trap against the player's current scrap count, then spawns a trap of the appropriate variety and deducts the cost from the player's scrap.

Click the button above, it will automatically copy blueprint in your clipboard. Then in Unreal Engine blueprint editor, paste it with ctrl + v