Jump to content

Why doesn't alt-fire in .npc files work?


Recommended Posts

Talking about JA mostly even though I wouldn't be surprised if this were the case in JK2 as well...

 

Why doesn't the alt-fire stat in .npc files work? All the proper code seems to be in place...

 

In JK2 there was a npc in cairn_bay i think, which uses alt-fire. Stcommander, two of them are place on the top of the elevators and using alt fire mode.

 

Dunno if they are scripted or using npc files.

Asgarath83 likes this

I am hosting Jedi Outcast and Jedi Academy servers for free up to 8 servers. Contact me if you are in need of a server for your community. 🙂

Link to comment

^In JA (and JK2 I bet) alt-fire can't be given to NPCs in their files but must be scripted to them through the map.

 

I don't understand why it doesn't work though. In NPC_stats.cpp the stat correctly refers back to a hardcoded define called SCF_ALT_FIRE or something.

Link to comment

So SET_ALT_FIRE, which comes from icarus scripts, activates the SCF_ALT_FIRE script flags, and so does altFire in an NPC file, or at least it's supposed to.

 

Perhaps therein lies the problem. My expertise ends right there though. I'm unskilled enough to analyze the code further.

Link to comment

Almost all of the NPCs are hardcoded to act a certain way with the weapons. CLASS_IMPERIAL with the right rank will always use alt fire, regardless of the altFire flag. Snipers always use alt fire except with the player being really really close (and even then, their firing routine is really broken).

 

Like I said, it's quite hardcoded and I'm pretty sure it doesn't work as intended.

Link to comment

^Icarus doesn't have any issues with hardcode conflicts though...

 

Reason I'm making this topic, is that for JA, I would like to have this feature work. Not a huge deal, but it would save me some ent-modding trouble ;)

without code hacking, you need just to add the spawnscript to the NPC and set in the spawnscript SET_ALT_FIRE, true.

also, you can check code part about the set_alt_fire of icarus for see how is working the declaration and the "altfire" parametrer of NPC files for see what's is of wrong.

altfire NPC however work well for saberist. if you use on saberist with saberthrow, they ever fight throwing the saber. if the saber is not throwable, they execute the Special kata and take kicks, if they rank is upper of lt.

but , yes, not work on shooters class, i not know why. :S

Link to comment
  • 2 weeks later...

In JK2 there was a npc in cairn_bay i think, which uses alt-fire. Stcommander, two of them are place on the top of the elevators and using alt fire mode.

 

Dunno if they are scripted or using npc files.

Yes, i remember the two foes. :D are scripted by icarus with set_altfire. in the mod escape from yavin 4 the lost map there is a level in a lava caves full of tusken raiders, velociraptors and imperials and reborn into a facility. the reborn soldier use every kind of altfire shoots. O.o

Link to comment
  • 2 months later...

Okay, sooo, I really want this to work, but I cannot for the life of me figure it out.

 

Yeah yeah the icarus system is great and all for specific npcs in maps, but if I want one kind of NPC to always use alt-fire then it would be nice to be able to just set it in one spot in their .npc file instead of ent-modding it into every map :/

Link to comment

^That's a good idea.

 

While I would like this sort of thing externalized outside the code, as a temporary (assuming one day this may be fixable) fix I could just use specific classes. Like the Rodian gunner for example, I want him to use alt-fire, so maybe NPCs with class_rodian and an E11 will be coded to use alt-fire.

 

EDIT:

Maybe what happens in the code is something overrides the alt-fire script flag canceling it out. Icarus scripting and the alt-fire npc field seem to work in the same way, so the only difference that I imagine could happen is the "when" of when the game applies each to an NPC. Maybe there is some AI code that says "if this, use primary fire", and that's why I can't find anything, because it's not alt-fire that's being applied incorrectly but rather primary fire, so I should really be looking for wherever "primary fire" is coded in. Just a theory.

Link to comment

mmmm, have you found in the code the code part of SET_ALT_FIRE boolean of Icarus functions? should exist. some time ago, Kenoi has fouind the line codes of the facial animation that interact with icarus. :) so should exist code line command of every icarus script function. incluse the set_alt_fire command. can you watch how that work, what the icarus "SET_ALT_FIRE, true"  activate into the code.

search in the entire solution SET_ALT_FIRE :)

Link to comment

in my modding work i noticed that the saberist with ltcomm , commander or captain rank using also the altfire attack: they make the kata atk many time twist and swing the saber with A1 \ A2 \ A3_SPECIAL attack.

also, if NPC have FP_SABERTHROW 1-2-3 level they throw the saber :)

For the shooting weapons, instead, that works only for CLASS_IMPERIAL, i think. you need to check the rank code, as told @@eezstreet, and maybe you can find some reference about the altfires.

Link to comment

It's crud like this that confuses me:

if ( ent->NPC->rank >= RANK_COMMANDER )
					{//commanders use alt-fire
						//ent->NPC->scriptFlags |= SCF_ALT_FIRE;
					}

That's in NPC_spawn.cpp, and the only reference I can find related to commander ranks using alt-fire, but it's commented out, so I'm kind of baffled as to what makes Class_imperial NPCs at commander rank use alt-fire at all...

Link to comment

Silly me. Never assume because it makes an *** out of you and me.

 

In JA imp commanders don't use alt-fire by default, precisely because that part of the code is commented out for JA. Still doesn't explain why alt-fire in .npc files doesn't work... but that's for another day.

Link to comment

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...