Forum Archive

Go Back   3D Realms Forums > 3D Realms Topics > Other Apogee/3D Realms Games > Max Payne > Max Payne Modifications
Blogs FAQ Members List Social Groups Calendar Mark Forums Read

Notices

 
 
Thread Tools
Old 08-07-2009, 06:22 AM   #1
NeoPain

NeoPain's Avatar
[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._
NeoPain is offline  
Old 08-07-2009, 07:35 AM   #2
Kozak
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."
Kozak is offline  
Old 08-07-2009, 09:16 AM   #3
NeoPain

NeoPain's Avatar
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? _
NeoPain is offline  
Old 08-07-2009, 01:14 PM   #4
Kozak
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.
Kozak is offline  
Old 08-08-2009, 01:52 AM   #5
NeoPain

NeoPain's Avatar
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.
NeoPain is offline  
Old 08-08-2009, 03:56 AM   #6
Kozak
Re: [MP2] AI Melee Combat
Quote:
Originally Posted by NeoPain View Post
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......
Just theorizing now since I cant remember it, and I dont have Maxed anymore.

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:
Originally Posted by NeoPain View Post
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.

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."
Kozak is offline  
Old 08-08-2009, 05:57 AM   #7
NeoPain

NeoPain's Avatar
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.
Even at minimal hearing radius, when AI_EnableSeing is set to true, enemy immediately starts shooting me from far distance. Yes, that it is.

/ 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:
Originally Posted by Kozak View Post
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
OnActivate raises when AI_SetTactic is called and enemy starts moving, not when shooting. Events list is:

OnActivate
OnUse
OnDeath
OnPlayerAttack
OnLowHealth

Quote:
Originally Posted by Kozak View Post
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.
Sure. That is clear as vodka. I know about that good.
NeoPain is offline  
Old 08-08-2009, 07:58 AM   #8
Kozak
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."
Kozak is offline  
Old 08-08-2009, 08:47 AM   #9
NeoPain

NeoPain's Avatar
Re: [MP2] AI Melee Combat
Quote:
Originally Posted by Kozak View Post
How can he shoot you when he cant see you? Are you sure that is correct?
Yes. With those low values in ai_ranges.h enemy can still se the player.
NeoPain is offline  
Old 08-09-2009, 01:00 PM   #10
NeoPain

NeoPain's Avatar
Re: [MP2] AI Melee Combat
-----
Last edited by NeoPain; 08-10-2009 at 10:34 AM.
NeoPain is offline  
Old 08-10-2009, 09:30 AM   #11
NeoPain

NeoPain's Avatar
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.
NeoPain is offline  
Old 08-13-2009, 03:09 AM   #12
D_Slayer
Re: [MP2] AI Melee Combat
Точно всем глубоко похуй)
D_Slayer is offline  
Old 08-13-2009, 12:45 PM   #13
andersenthemuss
Re: [MP2] AI Melee Combat
Do tell NeoPain.

Im looking for a system hopefully simpler than streetfighters
andersenthemuss is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 10:39 PM.

Page generated in 0.19434190 seconds (100.00% PHP - 0% MySQL) with 16 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.

Website is 1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.