Greetings all,
I am currently trying to set the value of a bool variable (from True to False or vice-versa) and it is hard for me.
This Youtube example shows the perfect way to change the value of an Int variable:
But the bool variable is different.
Can someone help me ?
Thanks for your attention.
Phil
Hi!
You can also directly set state for boolean
Hi philUnreal,
if you want to set bool variables, there is a small checkbox of the value you want to set it to (checked = true)
I start from there thanks. When key prssed set to true and when release set to false. I got that. Now, i dont know how i link the result to the variable. I will add another comment for more details about what i am doing. Thanks .
alt text
This is the initial situation: when player got in the pyramid, it changes color: that part works fine: (view 1st attachment “part1.jpg”)
Now, rules change. When the player is near the pyramid, he must press C key to makes it change color. So I start to change the blueprint script by adding the “Is Key Pressed” Boolean variable and it’s default value is true (checkbox is checked on). (View 2nd attachment “part2.jpg”)
The pyramid changes color when the default value is true or keep the initial color when the default value it’s false. Which is fine.
Now, I want the “Is Key Pressed” change and link the result to the branch condition. How can I link the result ?
View lasrt attachment “Part3.jpg”
Thanks for your attention.
Greetings.
Im sorry, but im not sure what you are asking for?
The 3rd Blueprint should already do what you want, isnt it?
The pyramid should turn blue if you are holding the key while entering it.
Thanks for your answer. Hpwever (i am very new on Unreal) i see that your Set node has 2 red dots, mine has only one (view attachment file). How you did this ?
This feature got added in version 4.7 I guess. Be sure you have the newest version of the Engine.
This feature is however not needed for functionality. You can just drag another wire from the != Node if you need the result somewhere else, as well
Sorry to make you confuse and thanks for taking your time to answer me. The 3rd blueprint doesn’t work: it is a question not a script".
I am trying to link the result (by pressing and release the C key) to the bool variable.
The main scenario is when i get close to the payramid and press C key, it changes color. I have no problem to change color. I just have a problem to make the result of pressing C key to the condition.
So my question is, how you would do the script ?
Because the Begin/End Overlap Events are only fireing once (whe player enters/leaves) i would use the bool to store if there is a player in the box.
When Key is pressed you only need to check if this variable is true.
The Blueprint above should do what you where asking for.
PS: The casts have to be adjusted to your Character Blueprint class
Thank you so much! I very appreciate it!
Hi ,
I wish to have your talent in Unreal. Indeed Switching from Unity to Unreal it’s not easy. All your answers help me a lot … but i still have a last question for you:
- I tried many time to find the node "Cast To Player
" and i got “Cast To Player Controller”, “Cast To Player Start”, “Cast To Player (toher thing)” but i have never found “Cast To Player” alone.
From new project Third Person i went to the “Third Person Character” blueprint, i wasn’t able to find your node. I did the same thing to “PhysicsBallBP” from a new project RollingBPExampleMap .
In the first attachment image you will see what i got from my screen comprate to what you got in yout screen.
About “OnComponentBeginOverlap”, when i tried to create a 2nd one, the application focus to the 1st node i create.
I am pretty sure that i did something wrong. I just don’t know what. At least i feel that i am on the right path.
Thank you so much for your attention.
Greetings.
Hi,
sorry for confusing you there, i just threw this together realy fast and did not notice that “Player” is a Blueprint i created already in that project.
You can just cast to “Character”, or if you have created your own Character-Blueprint cast to that class.
So please adjust “Cast to Player” for example to:
To your 2nd Question: There can only be one Event-Node per Type to a Component. If you want additional things to be done, just attach it.
Thank you so muc Mr. . You just save my life!
I did it different way but i mainly got inspired from the info you gave me.
Have yourself a great week end.