How do I simply code in variables such as Health and other variables I would need in several blueprints. Casting is getting old and cant be preferable. I don’t know how to code, but I just want to get a C++ script I can just type in a new variable and define what type it is. Is there any examples on how it should look like and, where and how.
I assume you want to tackle basic game / player states?
Why dont you want to do it in Blueprints? If you’re no coder you make it a bit harder than necessary if you do it in c++. Also, there are a few good tutorials up on Youtube on how to do this in BP.
Introduction to Programming video by UnrealEngine on youtube covers this and would be an excellent start
Oh btw, in the old Unreal, Pawn class had a Health variable. I didnt get a chance to check the source for it in this one. Make sure neither Character or Pawn has it. Assuming they do not well then this is a very good opportunity to subclass Character in your plugin DLL and add a Health float. However, in your blues (BP), you will still have to cast a Pawn into your subtype and lookup the Health variable.
This is as simple as I can make it I think. Check the C++ wiki it might help you as well.
A much easier way is to just stick to blues like the poster above me says. You subclass Character, etc from a blue and add your Health there.
I have a lot of expereince with C++ myself but I put the majority of my work in Blueprints. they are a god given blessing. Use them!!!
I mostly only use C++ for stubbing out my Classes. Only a small portion of my logic is in C++ and only where I must use it
 Alright, even easier, you would just add the Health variable to Pawn.h which is probably waht you were asking. But if you update your Unreal sources at any point then you will need to make sure you merge in your changes. I don’t do this which is why I didn’t think to mention
Alright thanks sandboxgod! I’ll check it out. What I want is just a simpler way of getting to variables that are used throughout a bunch of different blueprint, because casting for it all the time for all the different variables that need to go to different places seems to be a bad idea in the long run. The easiest way atm Is to use the game state I guess, but you still have to cast to and from it.
In case you’re still hung up on this. I would recommend the most basic of basic c++ coding which means you should start with consoles. But i’ll go ahead and answer your questions and provide you a few links that might help you out.
First of all for Health, let’s assume you want 100 HP for a character and a bullet can do 15 damage each. At the VERY basic level you’d want to set the variables up like this.
Here you’ve created the type as an integer and created a variable named HP and assigned it to 100. You’ve also created an integer type named Damage_Bullet and assigned it to 15.
I hope you found this useful!