
When the player enters/exits this Trigger, we will call the Events in the ThirdPersonCharacter Blueprint. Open the Blueprint_Effect_Fire Blueprint located in the Content/StarterContent/Blueprints folder.Ĭlick the Add Component button and add a Box shape and call it Trigger. We are not displaying Health Bars in this example however this will show us that the Health Value is indeed decreasing. Off the Set node, add a Print String then Control drag in PlayerHealth and connect it to the Print String. We used a Random Integer in Range node with Min (1) and Max (4) values, however you can enter a damage value if you wish. Hold down Control and drag in the PlayerHealth variable as well.ĭrag off the PlayerHealth variable and add an Integer - Integer node, then off the 0 pin, add a Random Integer in Range node. Inside the FireDamage Function, while holding down the Alt key, drag the PlayerHealth variable into the graph. The Time entered is the interval in which the Function Name Function will be called (every 0.75 seconds).Ĭreate a new Integer variable called PlayerHealth, click Compile, then set the Default Value to 100. On the Set Timer, set the Time to 0.75 and check the Looping box.Ĭonnect the Return Value pin of the Set Timer by Function Name node to the Handle pin of the Clear Timer by Handle node. This Function will be called over time by the Timer and will apply the damage.ĭrag off the PlayerInFire Event and add the Set Timer by Function Name node.ĭrag off the PlayerNotInFire Event and add the Clear Timer by Handle node.įor Set Timer by Function Name, set the Function Name to FireDamage.

In the MyBlueprint window, add a new Function called FireDamage. Right-click in the graph and add two Custom Events called PlayerInFire and PlayerNotInFire. Inside your project, open the ThirdPersonCharacter Blueprint. For this example, we are using the Blueprint Third Person Template and will be causing fire damage to the player over time.
