Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: michaelwwswr on October 21, 2012, 08:15:18 PM

Title: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 21, 2012, 08:15:18 PM
Hello--- Are there any tutorials on setting up the enemy to shoot at and damage or kill the player?
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on October 22, 2012, 03:29:10 AM
Hi,

 maybe not tutorials as is as far as I know, but I have worked on a very powerful solution, called targetPro. it might be something you would be interested in. I have created a playmaker set of custom actions and proxies for you to work with this system right within playmaker.

https://hutonggames.fogbugz.com/default.asp?W993 (https://hutonggames.fogbugz.com/default.asp?W993)

This will give you already 99% of what you need to set up shoots, damage, ennemy detections and firing behaviors. It's very impressive.

Bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 22, 2012, 04:22:30 AM

Hi,Jean

I saw TargetPro That's not what i need I am working on a fps with third person characters that will be shooting handguns , rifles and rocket launcher at the player.

thanks
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on October 22, 2012, 12:37:21 PM
I sort of did that when starting with Playmaker. Some tips:

Store the player GameObject reference in a global var.

Health: Create a manager that handles that issue, only for player (therefore, player HP should be a global var). Each foe should manage it's own HP.

Shoot: I made 3 states for my foes: Idle, Following, Attacking. When in 'atk' state, they SmoothLookAt the player and instantiate a bullet object, applying velocity on Z axis. Obviously, the look at action will proceed as well while in 'follow' state.

Dealing damage: Have the bullet tell the manager how much damage it'll deal to the player. Detect collision between player and bullet, and send events as needed to deal the damage (that's why the player HP being global is useful). If player is intended to damage, and kill, foes, the same. I'd recommend having a bullet prefab that deals damage only to player, and one only to any foe. I had problems using a shared bullet.

Note that you, most surely, will need about 4 FSM on each character.

Hope that helps you.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 25, 2012, 04:35:58 AM
DARK_ETERNAL Thanks but do you have a screen shot of your FSM  setup
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on October 25, 2012, 11:00:11 AM
I'll make them for you. Since my foe and player FSM setup is similar, I'll only pass you my player's Setup. You should be able to adapt the foe's from it. Just give me a second.
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on October 25, 2012, 11:16:39 AM
Here you go. I added screenshots for my player setup, 4 FSM in total, managing position update (so foes know how near are from it), shooting and such things; the health manager that will reduce player health if hit, and a game manager that will response if player kills all foes or gets killed. Any questions, feel free to ask.
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on October 25, 2012, 11:21:48 AM
Nope. Foe's FSM is lightly different from Player's, so let me add screenshots for my setup. Again, feel free to ask anything you don't get from it, although I don't think those screenshots are self-explanatory by themselves, but you'll do better if you try to figure out the FSM flow from them.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 26, 2012, 04:47:28 PM
Thanks.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 27, 2012, 09:07:59 PM
 Thanks DARK_ETERNAL  I am new to playmaker I see your flow charts but I cant figure ot the actuall set up.
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on October 29, 2012, 01:51:06 AM
Hi michaelwwswr

The turret example of targetpro might be misleading indeed for your case.  It's totally capable of doing any kind of shooting, be it your ennemies firing anything to your player. You simply define targets, firing entities, you also define what they fires and how it damages affect the target when hit, etc etc. I would strongly suggest you get in touch with targetPro guys and ask about your needs.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 29, 2012, 10:35:21 AM
Thanks Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on October 29, 2012, 11:25:25 AM
Hello, michaelwwswr.

Basically, the foe FMS has this flow:

You might not be able to catch from it, because I didn't send the state actions. Take these references to set up your foe, have a player dummy and make, at least, the distance thing work. If you still don't get this, do come back and I'll prepare an export of my scene so you have complete access to the events, actions and such things. Be warned, this logic is based in sending events through FSMs, so, if you follow this approach, you WILL use pretty often the 'Send Event' action with Broadcast All or GameObject FSM targets.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 30, 2012, 06:48:44 AM
Thanks,  DARK_ETERNAL Jean told me about target pro I checked it out , it's a good product. But I would like to use playmaker this is why I purchased playmaker to avoid buying more shooting assets. I can set up the Idle and all the Animations. I searched every where for shooting tutorials on the Foe set up there are none.  I got the distance and follow. I see your fsm set up, I do not know what variables, you used though.

are these events or variables -CompareDistEv, ApplyDmgEv,
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on October 30, 2012, 04:13:10 PM
Events. I use a convention that, everything that is an event, should have an "Ev" suffix. Variable names don't really matter, as long as you understand where are needed. I use a follow distance and an attack distance variable to tell how NEAR should be the player from the foe to follow/attack it. Those vars are local to each foe instance, so you can create different patterns.

Maybe you would rather having me to prepare an export of my scene?
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 30, 2012, 09:02:50 PM
No you do not have to do that, I am thinking about purchasing  TargetPro. it would be good if there were more tutorials. What about a youtube Tutorial I know a lot of people are having the same problem look at the views.
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on October 31, 2012, 01:46:46 AM
Hi,

 there are not screencasts of tutorials per say right now, but the port I did is covered by a working sample, that is a good starting point for you to get acquainted with target pro.

 as always, do not hesitate to come back on this forum to get help, I'll happily answer all your questions if you have problem with targetpro port to PlayMaker.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 31, 2012, 07:23:45 AM
Thanks Jean

I am going to Purchase the Action Game kit it has all the Features I need and more.
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on October 31, 2012, 07:30:41 AM
Hi,

 you mean targetPro right? Excellent move. Be sure to get in touch with the guys at path-o-logical, they are very helpful if you have any questions about feasibility and patterns with the tool itself, then for playmaker implementation, do not hesitate to ask question on this forum, I'll make sure to reply and help you.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on October 31, 2012, 07:16:37 PM
No Jean ,I mean Action Game kit with AI it seem to offer more than TargetPro.
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on November 01, 2012, 01:41:55 AM
Hi,

 ok, Indeed it sounds packed with features! tell us how it goes with this, always interesting.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 01, 2012, 09:30:11 PM
Jean I decided to just use C# For Shooting.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 09, 2012, 01:52:36 AM
Hey,DARK_ETERNAL 

do you have any tutorials on you tube?
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on November 09, 2012, 09:47:01 AM
I don't, unfortunately. What I did I did based on Hutong tutorials, then I just remade an old project I worked in with Playmaker, and I would take a long time to prepare a video, for now, since I'm finishing my studies for this term... May I help you some other way until I can prepare a video?
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 09, 2012, 10:37:02 AM
 Dark_Eternal  I recall you mentioning a example of your scene.
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on November 09, 2012, 04:10:46 PM
Ah, yeah, an export. Let me prepare it. I will include only the scene and such things, so I don't have to include Playmaker, which I suppose you already have. Give me this weekend so I can separate it from another tests I've been doing lately and you'll get that next week.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 10, 2012, 08:42:07 PM
Thanks  Dark_Eternal
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 11, 2012, 06:03:10 AM
Hi, Jean I just realized that you had made custom actions for Targetpro, I missed it in your reply . I am going to purchase Targetpro

Thanks
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on November 11, 2012, 07:11:54 AM
Hi,

 Don't forget to use the special PlayMaker coupon on the targetpro wiki page.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on November 13, 2012, 03:59:40 PM
Hey, michaelwwswr.

I've got your port "ready". And I mean "ready", because I've got this issue: When I make an export, I lose every reference to public variables and events. I would have a txt with the names of the vars and public events so you can quickly setup my export. This week I'll be doing this and posting it to you. Note that you will need to have Playmaker already imported in your project.

Greetings.
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 13, 2012, 04:52:37 PM
Thanks,  DARK_ETERNAL

My playmaker is already loaded and updated to version 1.4.4
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on November 14, 2012, 02:23:16 AM
Hi,

 for global vars, you have to first use "PlayMaker/Export Globals" and include the new asset created and include it in your package, but for global events it should all be there.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on November 14, 2012, 10:25:41 AM
Thanks Jean. Will try that. I actually had a painful time exporting a test scene to one of my coworker because of that.
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on November 15, 2012, 05:21:43 PM
I'm having troubles uploading the package. Any email I can send you that?
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 15, 2012, 05:34:48 PM
m
Title: Re: Enemy Shooting And Damage to Player
Post by: mickman on November 18, 2012, 06:29:00 AM
 Hi all,  
Just thought I'd add a quick note:  I purchased Target Pro last night... it's a great tool.  
I'm also interested in hit points, health etc.. so am following along as I hope to gain some insight.

The following AI video tutorials really help in regards to line of sight, cone of vision & hit points.
http://www.youtube.com/playlist?list=PL64E6680ACC6040EB&feature=plcp


Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 18, 2012, 09:17:29 AM
mickman keep us posted
Title: Re: Enemy Shooting And Damage to Player
Post by: jeanfabre on November 19, 2012, 12:02:53 AM
Hi,

 yes, keep us informed of your progress, and don't hesitate to come back on this forum if something in TargetPro is not available within my port. I'll happily do my best to cover it.

bye,

 Jean
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on November 21, 2012, 06:49:25 PM
Dark_Eternal I used javascript to have the enemy shoot player.
Title: Re: Enemy Shooting And Damage to Player
Post by: DARK_ETERNAL on November 22, 2012, 02:27:19 PM
That's a quicker way, I think, since I'm a programmer.
Setting the FSM is quite difficult. Or rather than setting the FSM, taking all the logic to an FSM. As an algorithm it should be easier to understand for a programmer, I think
Title: Re: Enemy Shooting And Damage to Player
Post by: michaelwwswr on December 04, 2012, 06:43:49 PM
Hey mickman how's things going with target pro