ChatGPT can code in blueprints and C++ for you!

Here from my log on openai.com:

can you program in unreal engine?

Yes, I can write code in C++ and Blueprints, the two primary programming languages used in Unreal Engine. I can help you with creating game logic, developing custom functionality, and troubleshoot your existing code. However, my knowledge on Unreal Engine is limited to the version that was current till 2021 and I might not be aware of the latest updates or features. Can you give me more details on what you need help with in Unreal Engine?

write me a blueprint for a flickering light in unreal engine

Sure, here is a blueprint for a flickering light in Unreal Engine:

  1. Create a new blueprint from the Actor class, and name it “FlickeringLight.”
  2. In the Components panel, add a Point Light component to the Actor.
  3. In the Event Graph, create a new custom event named “Flicker.”
  4. Create a new variable named “MinBrightness” and “MaxBrightness” of type “float” and set the values to desired minimum and maximum brightness levels.
  5. Create a new variable named “FlickerSpeed” of type “float” and set the value to the desired flicker speed.
  6. In the “Flicker” event, add a “Set Brightness” node, and connect the Point Light component to it.
  7. Connect a “Random Float in Range” node to the “Brightness” input of the “Set Brightness” node, with the “MinBrightness” and “MaxBrightness” variables as the input for the range.
  8. Connect a “Delay” node to the output of the “Set Brightness” node, with the “FlickerSpeed” variable as the input for the delay time.
  9. Connect the output of the “Delay” node to the “Flicker” event, creating a loop that causes the light to flicker.

This blueprint will cause the Point Light to flicker between the specified minimum and maximum brightness levels at the specified flicker speed. Please note that this blueprint is just an example and you may need to adjust the variables and settings according to your specific use case.

what will trigger the custom event?

In the example blueprint I provided, the custom event “Flicker” is triggered by connecting the output of the “Delay” node to the input of the “Flicker” node, creating a loop. This means that once the blueprint is activated, the “Flicker” event will be called repeatedly, causing the light to flicker.

However, you can also trigger the “Flicker” event by other means, such as:

  • Using a “Begin Play” event to start the flickering as soon as the blueprint is spawned in the level.
  • Using a button press or key press event to start or stop the flickering.
  • Using a timeline node to control the flickering over time.
  • Using a collision event to start the flickering when another actor collides with the FlickeringLight actor.

You can use any of the above methods to trigger the event based on your requirement in the game. Please let me know if you have any further questions.

1 Like

Guys Where should I paste the C++ code from Chat? Into a new C++ class?

Ask ChatGPT, but yeah, you probably should

1 Like