How to change enemy colour based on level?
Is it possible to change the colour of an enemy AI based on the level?
asked Aug 02 '17 at 02:11 AM in Blueprint Scripting
Inside the material of the Enemy AI, create a vector parameter, make sure you name it like "AIColor", (this is important because you'll need to use this later) and multiply the white pin from this node by whatever is goes into the final 'Base Color' of the material.
Then inside the AI, on BeginPlay, get the AI's mesh, Create Dynamic Material Instance and add the AI's mesh to the Target, Element Index is what material you're going to change. If he only has 1 material, keep the index at 0. Get the AI Mesh and Get Material and plug that into Source Material. Drag off from Return Value and Set Vector Parameter Value. Change the Parameter Name to AIColor , or whatever you called the Vector Parameter in the Material.
Next create a new variable and change the Variable Type to Linear Color and add elements to this array in the Details panel, changing the colors to whatever you want. Make this variable an array, drag it into the blueprint it and get it, drag off from it and search 'Get'.
You'll need to have some sort of level counter that plugs into the Integer pin in the 'Get' node to change the color each level. Changing this 0 manually to a different index should now result in your AI changing color.
Let me know if this helps! :)
answered Aug 02 '17 at 03:03 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here