Jump to content

NPCs not using Alt-Fire


Recommended Posts

Posted

The AI in Outcast were way smarter and a lot tougher than the JA AI, that said, I believe the AI on JA scale in toughness depending on the difficulty.

In JA, i think that AI remains the same no matter the difficulty setting. The only thing that changes is that the base damage of ranged weapons is increased for npcs and that the player's health is reduced. 

 

 

Close to end of MD3 works. >.< i think friday maybe can i got a better look to altfire code. this issue of NPC file is little annoying.

Nice, it's a little nuisance that's been bugging me for a lot of time  :mellow:

Posted

I found the incriminating code part, but i haven't much good luck.

 

i found that above on line 3600 of code/NPC_stats.cpp (Jedi Academy client)

 

 

 
if ( !parsingPlayer )
            {
                //altFire
                if ( !Q_stricmp( token, "altFire" ) )
                {
                    if ( COM_ParseInt( &p, &n ) )
                    {
                        SkipRestOfLine( &p );
                        continue;
                    }
                    if ( NPC->NPC )
                    {
                        if ( n != 0 )
                        {
                            NPC->NPC->scriptFlags |= SCF_ALT_FIRE;
                        }
                    }
                    continue;
                }
                //Other unique behaviors/numbers that are currently hardcoded?
            }
 

 

this is the code part that NOT work.  it's really strange because as you can see, this call the same flags of icarus scripting.

so at moment i have not much idea how to fix it.

maybe with a boolean?

i am not much sure.

Posted

nope, not work. :(

 

            if ( !parsingPlayer )
            {
                extern void Q3_SetAltFire( int entID, qboolean add);
                extern void ChangeWeapon( gentity_t *ent, int newWeapon );
                //altFire
                if ( !Q_stricmp( token, "altFire" ) )
                {
                    if ( COM_ParseInt( &p, &n ) )
                    {
                        SkipRestOfLine( &p );
                        continue;
                    }
                                    
                    if ( NPC->NPC )
                    {
                        if ( n != 0 )
                        {
                            NPC->NPC->scriptFlags |= SCF_ALT_FIRE;
                        }
                        else
                        {
                            NPC->NPC->scriptFlags &= ~SCF_ALT_FIRE;
                        }
                        ChangeWeapon( NPC,   NPC->client->ps.weapon );
                    }
                    continue;
                }
                //Other unique behaviors/numbers that are currently hardcoded?
            }
Posted

Really, i not understand why not works. i tryed with a custom NPC equiped with blaster pistol and "altfire 1"

on NPC file.

but the command into the code is present... why not work on Npc_stats.cpp and works on q3_interface.cpp? o_o

on q3_interface.cpp is a qboolean. on NPC stats is simple a setting.

i tryied to reply the code structure of q3_interface.cpp of SET_ALTFIRE, but it not work also as a boolean.

sure i miss something...

 

No other idea for the moment. sorry for my failure.

:(

Posted

Point of situation:

 

Script working code on q3_interface.cpp

/*

============

Q3_SetAltFire

 

?

============

*/

static void Q3_SetAltFire( int entID, qboolean add)

{

gentity_t *ent = &g_entities[entID];

 

if ( !ent )

{

Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_SetAltFire: invalid entID %d\n", entID);

return;

}

 

if ( !ent->NPC )

{

Quake3Game()->DebugPrint( IGameInterface::WL_ERROR, "Q3_SetAltFire: '%s' is not an NPC!\n", ent->targetname );

return;

}

 

if(add)

{

ent->NPC->scriptFlags |= SCF_ALT_FIRE;

}

else

{

ent->NPC->scriptFlags &= ~SCF_ALT_FIRE;

}

 

ChangeWeapon( ent, ent->client->ps.weapon );

 

}

///////////////////////////

case SET_ALT_FIRE:

if(!Q_stricmp("true", ((char *)data)))

Q3_SetAltFire( entID, qtrue);

else

Q3_SetAltFire( entID, qfalse);

break;

 

///////////////////////////////////

 

case SET_ALT_FIRE://## %t="BOOL_TYPES" # Force NPC to use altfire when shooting

if ( ent->NPC == NULL )

{

DebugPrint( WL_WARNING, "GetFloat: SET_ALT_FIRE, %s not an NPC\n", ent->targetname );

return false;

}

*value = (ent->NPC->scriptFlags&SCF_ALT_FIRE);

break;

 

 

NOT working code of npc stats:

if ( !parsingPlayer )
{
//altFire
if ( !Q_stricmp( token, "altFire" ) ) 
{
if ( COM_ParseInt( &p, &n ) ) 
{
SkipRestOfLine( &p );
continue;
}
 
if ( NPC->NPC )
{
if ( n != 0 )
{
NPC->NPC->scriptFlags |= SCF_ALT_FIRE;
 
}
}
continue;
}
//Other unique behaviors/numbers that are currently hardcoded?
}
Posted

Hey, thanks for getting into it. Sorry if I don't understand most of  the coding commands that are there, but you said that you're trying it on a npc with a blaster pistol? altfire doesn't work on npcs with the blaster pistol, the bowcaster and (i think) the disruptor rifle. 

Posted

Hey, thanks for getting into it. Sorry if I don't understand most of  the coding commands that are there, but you said that you're trying it on a npc with a blaster pistol? altfire doesn't work on npcs with the blaster pistol, the bowcaster and (i think) the disruptor rifle. 

 

Disruptor work by default on Altfire because set the NPC into sniper modality. they use primary fire only when player is closest to NPC.

however... tryed with repeater. not work, ever primary file. ever. how's boring. T_T

but into the code ... well.. into the code the altfire for NPC is coded. i was wrong about that. simply, not works. for reason that i not fully understand.

>.<

but it should be work. i suppose that ravens team never care too much of this detail.

Posted

The alt fire code is identical in JK2 and JKA however JKA adds the altfire parser option to enforce it if it exists which shouldn't be affecting anything since it doesn't remove the flag if it doesn't.

 

JK2 hardcodes certain enemies based on rank to use altfire, where as JKA adds the flag to certain ones in the npc file.

Posted

So you're saying that the JKA alt fire code is the JO one plus an unecessary batch of code? If that was just it, we would just need to remove the useless part and leave the rest in, then we could determine which enemies used altfire based on their rank. But I figure it's not that simple.

Posted

It's not unnecessary.  Most of the ones you would think do, don't actually meet the rank check anyway.  Considering stcommander and stofficer is actually listed as ensign and not commander.

Posted

So is there any chance to get this working? I didn't think that a small npc behavior modification would be this troublesome...

Posted

Because you see, both games use a script flag (bitmask) to tell it you want the NPC to fire with alt fire. It's not very intuitive. If you use a script to enable the specific NPC to alt fire does it work? Which NPC's use it in jk2 using the NPC spawn command?

Posted

Well with a boolean icarus script I can make a specific entity enter alt-fire mode but that would only work for that specific npc only and in that map, not whenever I npc spawned it. If I wanted to make a battalion i would have to script each one of the npcs.

 

In jk2 the ones I can remember are: rodian2, impcommander, stofficeralt, and jan.  Oh, and in JO you could create more alt-firing npcs by mixing it with the name of an already alt-firing npc (ie. rodian2_custom, or janstormtrooper...); but in jka it doesn't work. Even the stofficeralt doesn't alt-fire and that was the only thing that distinguished him from the  normal stofficer.

Asgarath83 likes this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...