Jump to content

Change Ammo Amount for NPC Dropped Weapons (SP)


Go to solution Solved by Asgarath83,

Recommended Posts

Posted

I was wondering how to change the amount of ammo a weapon dropped from a defeated NPC (in single player) has when you pick it up? I've been looking through the source code but haven't found anything relating to that. I've also looked at the items.dat file but the count variable there does not seem to apply to weapons dropped from NPC's. Does anyone have any idea about where this is specified in the source code or how it works? Many thanks for your help.

Posted

I was wondering how to change the amount of ammo a weapon dropped from a defeated NPC (in single player) has when you pick it up? I've been looking through the source code but haven't found anything relating to that. I've also looked at the items.dat file but the count variable there does not seem to apply to weapons dropped from NPC's. Does anyone have any idea about where this is specified in the source code or how it works? Many thanks for your help.

mmm or is into weapons.dat or items.dat (now i not remember but i guess is there) or is inside the code. i hope for you is not into the code itself... @.@

Posted

@@Asgarath83 - Thanks for the response! I checked the count variable in the items.dat file again, but it does not change the amount of ammo the weapon has when dropped by an NPC, only the amount it has when it is spawned directly. The weapons.dat file doesn't seem to have any variables relating to the amount of ammo each weapon gives you when you pick it up. So, yes. I do believe this setting is in the source code. I was endeavoring to discover where this is happening.

Asgarath83 likes this
Posted

@@Asgarath83 - Thanks for the response! I checked the count variable in the items.dat file again, but it does not change the amount of ammo the weapon has when dropped by an NPC, only the amount it has when it is spawned directly. The weapons.dat file doesn't seem to have any variables relating to the amount of ammo each weapon gives you when you pick it up. So, yes. I do believe this setting is in the source code. I was endeavoring to discover where this is happening.

 

Found it. is in items.dat

when an NPC is killed he drops the weapon he own as an ITEM. if you get the weapon, you get also a lot of ammo.

 

 

CHECK THIS PARTE OF THE FILE:

{

itemname    ITM_BLASTER_PISTOL_PICKUP

 

classname    weapon_blaster_pistol

worldmodel    models/weapons2/blaster_pistol/blaster_pistol_w.glm

icon        gfx/hud/w_icon_blaster_pistol

// Amount of ammo given with weapon

count        50

type        IT_WEAPON

tag        WP_BLASTER_PISTOL

min        -10 -10 -2

max         10  10 12

}

[/code ]

Edit the COUNT field changing the number on the value you want.

in that way, you should change the dropped ammo amounts.

Posted

I checked this again but the count in the items.dat does not seem to control how much ammo a weapon dropped from an NPC provides, just the amount it provides if you pick up one that is spawned directly. For example, if you use the console to spawn a WP_BOWCASTER and pick it up, it gives you 50 ammo, which is indeed the count value. However, if you spawn a Weequay NPC, kill him and pick up the bowcaster he drops, it gives only 5 ammo. It does not matter how many shots he fires before he's killed either, the amount is always 5. Again, I'm trying to figure out how to change the amount of ammo given by a dropped weapon, not one already in a map or spawned via the console. Apparently, there is a difference.

Posted

I checked this again but the count in the items.dat does not seem to control how much ammo a weapon dropped from an NPC provides, just the amount it provides if you pick up one that is spawned directly. For example, if you use the console to spawn a WP_BOWCASTER and pick it up, it gives you 50 ammo, which is indeed the count value. However, if you spawn a Weequay NPC, kill him and pick up the bowcaster he drops, it gives only 5 ammo. It does not matter how many shots he fires before he's killed either, the amount is always 5. Again, I'm trying to figure out how to change the amount of ammo given by a dropped weapon, not one already in a map or spawned via the console. Apparently, there is a difference.

mmm the dropped... understood. oh no no, that is hardcoded sorry. if you wanna make a game when every weapon can store as max value only how many ammo how are the total ammo that can carry on the full weapon, and that npc have not infinite ammo shoots, and that npc dropped weapons give you an ammo recharge amount that is like the amout of residuaol ammo not again shooted by a killing npc... nope. you can do that realistic combat only with a deep code hacking. and is a lot complicated as stuff to code.

: \

i fear i cannont help you for that.

  • Solution
Posted

I checked this again but the count in the items.dat does not seem to control how much ammo a weapon dropped from an NPC provides, just the amount it provides if you pick up one that is spawned directly. For example, if you use the console to spawn a WP_BOWCASTER and pick it up, it gives you 50 ammo, which is indeed the count value. However, if you spawn a Weequay NPC, kill him and pick up the bowcaster he drops, it gives only 5 ammo. It does not matter how many shots he fires before he's killed either, the amount is always 5. Again, I'm trying to figure out how to change the amount of ammo given by a dropped weapon, not one already in a map or spawned via the console. Apparently, there is a difference.

I found what you're looking for.

search on openjk code.

/*

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

TossClientItems

 

Toss the weapon and powerups for the killed player

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

*/ on code/g_combat.cpp

THEN...Go down until you find that:

 
else
            {//FIXME: base this on the NPC's actual amount of ammo he's used up...
                switch ( weapon )
                {
                case WP_BRYAR_PISTOL:
                case WP_BLASTER_PISTOL:
                    dropped->count = 20;
                    break;
                case WP_BLASTER:
                    dropped->count = 20;
                    break;
                case WP_DISRUPTOR:
                    dropped->count = 20;
                    break;
                case WP_BOWCASTER:
                    dropped->count = 20;
                    break;
                case WP_REPEATER:
                    dropped->count = 20;
                    break;
                case WP_DEMP2:
                    dropped->count = 20;
                    break;
                case WP_FLECHETTE:
                    dropped->count = 20;
                    break;
                case WP_ROCKET_LAUNCHER:
                    dropped->count = 3;
                    break;
                case WP_CONCUSSION:
                    dropped->count = 100;//12;
                    break;
                case WP_THERMAL:
                    dropped->count = 5;
                    break;
                case WP_TRIP_MINE:
                    dropped->count = 3;
                    break;
                case WP_DET_PACK:
                    dropped->count = 1;
                    break;
                case WP_STUN_BATON:
                    dropped->count = 20;
                    break;
                case WP_ATST_MAIN:
                    dropped->count = 10;
                    break;
                case WP_ATST_SIDE:
                    dropped->count = 15;
                    break;
                case WP_EMPLACED_GUN:
                    dropped->count = 20;
                    break;
                case WP_TUSKEN_RIFLE:
                    dropped->count = 10;
                    break;
 

now change the count value as your will.

You need however:

-Openjk

-Visualstudio

-Basic C++ knowledge

-Basic Knowledge for build a edited dll and exe files for override the game executable with the change

NOTE: IMPORTANT: back up your default dll and exe of JKA before do that.

Special thanks to @@eezstreet for pointed me into the right way.

  • 4 weeks later...

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