January 1, 2023 at 4:06 pm #34956
Hi Royal Allen first time at the community.
Anyways my question is how do I send damage to my Ufps chacter. I have my Rain Ai rig, waypoint, Detects, and Attack all set up. I have a script to do damage. So how do I do damage with mecanim or custom scripts?January 3, 2023 at 7:10 am #34976
I’m not familiar enough with UFPS to answer the question. How do UFPS characters typically receive damage?January 3, 2023 at 5:10 pm #34980
Gives you some info about how the damage handler works in ufps.
Tells you how to setup an animation event.
You could use this to send a message to the player damage handler to deduct a specified amount of health.
I will be doing something similar myself in my own project soon in the next week so if you need any more help give me a shout and I will do my bestJanuary 3, 2023 at 5:13 pm #34981
There is also this thread
Which may or may not help you in conjunction with the ufps event system. I haven’t had a chance to experiment with it yet.
Good luckJanuary 5, 2023 at 3:30 pm #34987
@Prime They are handled through the Damage Handler for the Ufps. But I was following the Rain Ufps tutorial on YouTube. But I am not quite sure how to code it in the custom script. But ufps manual states to do damage to player you write
thishitObject.SendMessage(“Damage”, 1.0f, SendMessageOptions.DontRequireReceiver);January 5, 2023 at 3:39 pm #34988
Thanks for the links. I’m not using legacy animations so its alot different. But I been trying to go that route. I learned mecanim events are sent when you setting animation there’s a little button to add an event. But I get lost on trying to send damage through mecanim animation state.
January 6, 2023 at 9:10 am #34993
- This reply was modified 11 months, 2 weeks ago by Royal Allen.
What exactly are you trying to accomplish? When/where are you sending the damage? Is this happening when the AI performs some action? When an animation plays? When an animation gets to a certain frame? Who is receiving the damage?
Typically the process is simple, as the
thishitObject.SendMessage(“Damage”, 1.0f, SendMessageOptions.DontRequireReceiver);
Some object will have a monobehavior with a Damage method that receives a float parameter. Are you trying to send the message via RAIN, or receive the message on an AI?January 9, 2023 at 6:30 pm #35033
I am trying to send damage through Rain AI to my target being my player.
But I am not coder so I seem to break it by trying to send it through a custom action.
I wanted to try and send an event through the Mecanim animation.
But instead I am trying to it through a custom Action.
So after the animation plays he shoots at the player.
Rifleman(AI) I want to send damage to my player(Target).
I been trying to code into the script. I am go take a look at the api.
Thus I am lost :/.January 9, 2023 at 6:32 pm #35034
CustomAction(Sends damage to the player through script.)January 10, 2023 at 4:08 pm #35036
Okay I sort of got concept with bigfiregames links and I didn’t break anything lol.
Just exprimenting around till I get it. I appreciate the help.January 11, 2023 at 8:17 am #35045
Typically you won’t do anything different in a custom action vs what you would do in any other Unity script. You probably want to do the SendMessage or similar as I suggested. The only tricky part is knowing which object to send the message to. However, if you are sending damage to the player, then you probably detected the player in a Detect node and have the object in ai memory. If so, then your Execute code will simply be:
GameObject tPlayer = ai.WorkingMemory.GetItem<GameObject>("player"); //assuming you store the player object in a variable called player tPlayer..SendMessage(“Damage”, 1.0f, SendMessageOptions.DontRequireReceiver); //assuming you do 1.0 damageOctober 1, 2022 at 11:12 am #39263
Did you ever get this to work?
I’m considering UFPS, but its ability to integrate with RAIN (and AWAI) are pivotal.
Like your work on RA_Missions.
MarkOctober 1, 2022 at 12:33 pm #39265
Hi Mark I have actually didn’t finish working with this. But at that time, I didn’t know how to program. But now I do. I will look into it. Thanks about RA_Mission glad you find it useful. I might upgrade it soon. Since Im way better at programming now.
You must be logged in to reply to this topic.