max breath is what is counting down , set to 45.obviously the first one is an issue , not complete. if I could get the "player get damage " event there , then it all would be off the character and I could set different timer amounts when putting multiple timer bps on the level.
this is the event I been tryin to get there. Players Health is another variable on the character I was using…
Hi, you just need to Apply Damage to an Actor, when you apply any damage >0 the event AnyDamage inside your characterblueprint will be automatically called.
So you can open your character blueprint and right click on eventgraph and search for Event AnyDamage, after that you can kill your character/actor or do what you like, if there is something i’m missing about let me know.
I have uploaded my project so you can test it out and if i didn’t understand something you need let me know.
EDIT:
now i understand, if you need to call that Player Get Damage Event that you created you don’t need to reference player controller, just right click on the eventgraph and search for **Player Get Damaged or drag and drop it from left side to event graph and click on CALL
EDIT2:
Sorry i see now that you have that dispatcher on your character blueprint, let me check.**
Connect the True to the Cast node please and will work
funny thing is the widget counter is not counting down , it just sits at 45. but the print string is counting down and disappears when it hits zero.but both are on the screen.
About the widget have you binded the text? if you don’t bind him then the value will never change
ok so with it connected to the cast node , when the print string counts down to zero , the character starts taking damage as I can see blood splatter and character flinch. but it just keeps going and my health on the hud does not go down. so he don’t die.
Is pretty hard to understand why is not going down/die, seeing what happens when that Player Get Damaged is called surely help, that is probably the problem.
I had it bound originally but let me set the widget nodes like you got them right quick.
ok so having some trouble with widget, recreated it , not showing up on screen now, let me look it over.
I got it to show only a white box now, the text numbers are in , but under “appearance " in the widget, there’s no " opacity and color” option. its just missing in the widget. >>>>>>>>>>>>>>>> With this , i got in a hurry and grabbed the text box into the graph instead of the text itself.
ok I got it all back and working now , the widget counter and the print string counting down , when i end overlap it all disappears. re enter overlap and timer starts from 45 , which it should. so that is all good . you been a tremendous help , i appreciate it , thanks for your time on this. only issue now is it doing damage but not losing health. it was working before at one point , it may be because i had the players health variable in front of “player get damage”. But this is when the logic was on the character bp. i’ll have to check. i’m still relatively new with the engine so its is tough. Is there a way i can get the “players health” variable from the character bp into the timer bp as well?Moving stuff between blueprints is tricky for me. thanks again
i’m glad you solved, you can get the players health at the same way you’ve called the macro previously, cast to BP_TPPCharacter but this time Get or Set the players health instead.
Remember that:
- you can access any events, function, macro and variable from other blueprints, for example if from timer you want to know something or do something on your BP_TPPCharacter you can cast to it with the Cast To node, cast to is like: “i need to have access to that blueprint because I need something from there but I’m not there, I’m actually in another place”, in this case you’re in the timer blueprint, but you need to get the health value that is stored on your character blueprint, so you’re performing a cast.
- if you need to access to Actor component (like timer) you can use Get all Actors from Class
it will take some time to understand cast to, is normal don’t worry about it, but I think you start to understand what Cast To do and what Get all Actors from Class do.
allright man, it kills character now at zero. in the" player get damage" node on timer , the damage value was set to zero. so it was damaging him but at zero , all i had to do was put a value in there and it worked, thanks a lot man.
ok , still left with one thing. i put another timer out on the level and set it for 10 seconds max breath. and it works , he dies after 10 seconds on that timer and 45 seconds on the original timer we worked with. only thing is , on the second timer i put out , the widget counter still shows 45 seconds and does not count down but he still dies in 10 seconds as i can see with the print string counting down. Do i have to create a new widget setup for each timer i put on the level?I didn’t see any option to reference the second timer in the widget or anywhere. even though it shows as Timer2 on the level. it counts down fine on the first timer on the level.
Hi Razmaz, that happens because i didn’t take in consideration that you will spawn more than one instance of timer on the level, i’ve just changed MaxBreath name with PlayerBreath for convenience, but you can use MaxBreath.
I’ve also added two new Variable, the first one called DefaultMaxBreath, this is for reset the timer at default value when player leaves, so you can set a different number for each timer you place, the second one is a Boolean called Active.
The last step is set the Active boolean to false if the player die.
With this setup it will work, tested.
ok so , in the widget when I binded the text it always default to “get text 0 " or get text 1” , I could not figure how to get both update breath value and return node as a function node like that in same window , unless I rename " get text 0" to Update Breath Value . so my widget nodes look like in pic. but it works. In your pic of the nodes in the timer widget ,it is different than before in the sense that there is no “To Text” node and there is a branch in there now.Is this a different , new added set of nodes in the timer widget , or the original setup altered? i figure the “Active” boolean variable is unchecked by default in the settings area? T
hanks