08-07-2009, 06:22 AM | #1 |
[MP2] AI Melee Combat
Actuly i do it kinda like this:
::Mesh_02::Enemy_00->AI_EnablePerceiving(false); ::Mesh_02::Enemy_00->AI_AddCommand(Run, AIM, "Player"); ::Mesh_02::Enemy_00->AI_AddCommand(DODGEFORWARD, NOTHING, ""); ::Mesh_02::Enemy_00->AI_AddCommand(Run, LOOKAT, "Player"); ::Mesh_02::Enemy_00->AI_AddCommand(DODGEFORWARD, LOOKAT, ""); ::Mesh_02::Enemy_00->AI_AddCommand(RUN, LOOKAT, "Player"); ::Mesh_02::Enemy_00->AI_AddCommand(DODGEFORWARD, LOOKAT, ""); ::Mesh_02::Enemy_00->AI_AddCommand(RUN, LOOKATPLAYER, "Player"); ::Mesh_02::Enemy_00->AI_AddCommand(DODGEFORWARD, LOOKAT, ""); ............... Which means enemy runs to you, than performing a DODGE which is a kick animation. By this way one issue appears that when you are standing and doing nothing - enemy never starts attacking you. You have to make a step or two to make enemy perform a hit - thats why this method sucks. Does anyone knows how to script AI melee combat like is StreetFighter mod for example? Thanks._ |
|
08-07-2009, 07:35 AM | #2 |
Re: [MP2] AI Melee Combat
I lost my level so I dont have the code I used which I gave to Aztec, you should pm him if he is still around.
I remember you should update your position, then he will know where you are but cant see you.
__________________
"Loose the gun. Take the canolli." |
|
08-07-2009, 09:16 AM | #3 |
Re: [MP2] AI Melee Combat
Thanks for feedback Kozak!
What do you mean by "you should update your position, then he will know where you are but cant see you"? Does it have something to do with AI_RevealTarget and turning AI_EnableSeing(false)? PS: Are you ukrainian or russian of having such a nickname? _ |
|
08-07-2009, 01:14 PM | #4 |
Re: [MP2] AI Melee Combat
Nah I from the netherlands.
Yes I think that's the right line, It's 5 years ago but I recall something of a timer that in the code of the enemy FSM which timed every few mili seconds to update the target. here is an old post: Re: melee ai? But's not how it was done in streetfighter, I will explain if recall it correctly beeeeen a very long time. I was trying to make lots of melee anims that the would do at random or even combos. I thought the only way it could be done in maxed, so what I did was made the enemy almost blind ( 1 m vision) but the player position would be updated every 0.1 seconds or so due to the fact that enemies can also hear. So he could walk to you but would not shoot you( because he didnt see you). If he came close he would see you, and then in maxed I made a script in the enemy fms that randomized all kinds of attacks (this is the beauty of the system, you can do loads of charanims not just shootdodges) in fm_shoot? You could also change fms_states so the enemy could do a combo's. The only problem I had that you needed to place lots of ai nodes so let them walk everywhere. __________________ Re: melee ai? DanTheMan004 asked me how I made the NPC blind, and I forgot. So I looked it up: In the skin text files of enemies these things are here: #include <..\ai_ranges.h> #include <..\targetid.h> #include <..\voiceevents_mobster.h> #include <Male_NPC.h> When you try to find Ai_ranges in the database but you can't find make sure you have Mp2_INIT unrassed. In the ai_ranges.h look for this: // meters - Shooting // NOTE: C00_HEARINGGROUPONERADIUS is used by projectiles\BulletGrenade_Player.txt for explosion #define C00_HEARINGGROUPONERADIUS 1000 #define C01_HEARINGGROUPONERADIUS 1000 #define C02_HEARINGGROUPONERADIUS 1000 #define C03_HEARINGGROUPONERADIUS 1000 #define C04_HEARINGGROUPONERADIUS 1000 #define C05_HEARINGGROUPONERADIUS 1000 // meters - Melee, throwing, jumping, dodging // NOTE: C00_HEARINGGROUPTWORADIUS is used by projectiles\BulletGrenade_Player.txt for ricochet #define C00_HEARINGGROUPTWORADIUS 5 #define C01_HEARINGGROUPTWORADIUS 5 #define C02_HEARINGGROUPTWORADIUS 5 #define C03_HEARINGGROUPTWORADIUS 5 #define C04_HEARINGGROUPTWORADIUS 5 #define C05_HEARINGGROUPTWORADIUS 5 // meters - Being #define C00_HEARINGGROUPTHREERADIUS 2 #define C01_HEARINGGROUPTHREERADIUS 2 #define C02_HEARINGGROUPTHREERADIUS 2 #define C03_HEARINGGROUPTHREERADIUS 2 #define C04_HEARINGGROUPTHREERADIUS 2 #define C05_HEARINGGROUPTHREERADIUS 2 Now you can change the shoot range to really close, and then make a npc in maxed with the randomization of fsm commands on shoot. Remember to set a trigger when you enter the room so that he targets you otherwise he will stand and do nothing untill walk closeby. On other funny thing: This is cool for a level boss and all kinds of stuff Look at the <..\voiceevents_mobster.h> [TARGETLOST] { [Alone] { [Message] String = "this->A_StopAll3DSounds( \"Bip01 Head\" );"; [Message] String = "this->A_Play3DSound( "AI", "Mobster_TargetLost", \"Bip01 Head\" );"; } [Group] { [Message] String = "this->A_StopAll3DSounds( \"Bip01 Head\" );"; [Message] String = "this->A_Play3DSound( "AI", "Mobster_TargetLost", \"Bip01 Head\" );"; } } You can do call stuff with this, like the level boss will powerup when he cant find you or something else. Hope you can work it out
__________________
"Loose the gun. Take the canolli."
Last edited by Kozak; 08-07-2009 at 01:26 PM.
|
|
08-08-2009, 01:52 AM | #5 |
Re: [MP2] AI Melee Combat
Oh, thanks. However calling AI_RevealTarget each 0.1 second in FSM timer, making enemy blind(AI_enableSeing(false)) makes enemy just following player and never shoot at all, besides enemy never stands just runing all the time, even if player is in idle state.
I changed all HEARINGGROUPONERADIUS variable values to low values such as 1/2/4 -doesnt metter, result is still the same. The "shoot range" has a lot to do with that variables, right? ..... As i understood, in all methods of doing this the main problem is to make enemy stop when it collides a player...... Anotheris question on "and then make a npc in maxed with the randomization of fsm commands on shoot" How can that be done? In MaxEd there is no such "ON_SHOOT" event or something like that in enemies entity so i am confused here. Thanks. |
|
08-08-2009, 03:56 AM | #6 | ||
Re: [MP2] AI Melee Combat
Quote:
Dont disable the seeing otherwise he wont see you , with blind I meant set the hearing group of seeing low. So that when he gets close the he starts firing, because he sees you when he is 2 feet infront of you. And have the timer update your position every 0.2 secs so he knows where you are even if he doesnt see you. Quote:
Maybe it on_activation? or on see player? I cant really recall. Can you list the commands in there maybe I will remember it then. And you can switch to different states which means different combo's etc. It's not that hard if you think logical you will work it out I think.
__________________
"Loose the gun. Take the canolli." |
|||
08-08-2009, 05:57 AM | #7 | ||
Re: [MP2] AI Melee Combat
Quote:
/ meters - Shooting // NOTE: C00_HEARINGGROUPONERADIUS is used by projectiles\BulletGrenade_Player.txt for explosion #define C00_HEARINGGROUPONERADIUS 2 #define C01_HEARINGGROUPONERADIUS 2 #define C02_HEARINGGROUPONERADIUS 2 #define C03_HEARINGGROUPONERADIUS 2 #define C04_HEARINGGROUPONERADIUS 2 #define C05_HEARINGGROUPONERADIUS 2 // meters - Melee, throwing, jumping, dodging // NOTE: C00_HEARINGGROUPTWORADIUS is used by projectiles\BulletGrenade_Player.txt for ricochet #define C00_HEARINGGROUPTWORADIUS 5 #define C01_HEARINGGROUPTWORADIUS 5 #define C02_HEARINGGROUPTWORADIUS 5 #define C03_HEARINGGROUPTWORADIUS 5 #define C04_HEARINGGROUPTWORADIUS 5 #define C05_HEARINGGROUPTWORADIUS 5 // meters - Being #define C00_HEARINGGROUPTHREERADIUS 2 #define C01_HEARINGGROUPTHREERADIUS 2 #define C02_HEARINGGROUPTHREERADIUS 2 #define C03_HEARINGGROUPTHREERADIUS 2 #define C04_HEARINGGROUPTHREERADIUS 2 #define C05_HEARINGGROUPTHREERADIUS 2 Interesting fact that StreetFighter does not overrwrite ai_ranges.h file at all. Quote:
OnActivate OnUse OnDeath OnPlayerAttack OnLowHealth Sure. That is clear as vodka. I know about that good. |
|||
08-08-2009, 07:58 AM | #8 |
Re: [MP2] AI Melee Combat
How can he shoot you when he cant see you? Are you sure that is correct?
Anyways, it should be done something like this, if I had a computer (mine is broke) I could figure it out, but since it's been 5 years obviously I cant recall it out of the top of my hat And since streetfighter created new characters maybe he put it in a different .txt file? Or maybe I'm just totally remembering a wrong path of what the code was. My best bet is try working with the On_activation and that it can only be triggered when the enemy is close to the player. And it can be done as you can see in SF Mod. I wish I could help you out more..
__________________
"Loose the gun. Take the canolli." |
|
08-08-2009, 08:47 AM | #9 |
Re: [MP2] AI Melee Combat
|
|
08-09-2009, 01:00 PM | #10 |
Re: [MP2] AI Melee Combat
-----
Last edited by NeoPain; 08-10-2009 at 10:34 AM.
|
|
08-10-2009, 09:30 AM | #11 |
Re: [MP2] AI Melee Combat
I finally did it. I can tell how if anybody is interested. (Но видимо всем похуй)
PS: not the streetfighter way_
Last edited by NeoPain; 08-12-2009 at 05:14 AM.
|
|
08-13-2009, 03:09 AM | #12 |
Re: [MP2] AI Melee Combat
Точно всем глубоко похуй)
|
|
08-13-2009, 12:45 PM | #13 |
Re: [MP2] AI Melee Combat
Do tell NeoPain.
Im looking for a system hopefully simpler than streetfighters |
|
Bookmarks |
|
|