IPB

Welcome Guest ( Log In | Register )

> m_iAmmoIndex in TF2WeaponsData_t
J@nek
post Jun 22 2009, 03:43 PM
Post #1


Member
**

Group: Members
Posts: 19
Joined: 18-May 09
Member No.: 1,541



Hi,

I'm trying to understand to what m_iAmmoIndex is refering to in the weapons data structure. Here is the structure:
typedef struct
{
int iSlot;
int iId;
const char *szWeaponName;
int m_iFlags;
float minPrimDist;
float maxPrimDist;
int m_iAmmoIndex;
int m_iPreference;
}TF2WeaponsData_t;

Of course, my first thought was that it was corresponding to AmmoIndex that we have in our mod meaning that if I have a specific ammo for each weapons, I should have a different index and normally 0 is not used.

What I don't understand is that for TF2 you did this table of indexes for weapons :
int m_TF2AmmoIndices[] =
{
0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,2,2,2,2,1,1,2,1,2,2,0,2,1,1,3
};

where we can see very often the same values and very often 0. Does it mean that all weapons referencing a value > 0 are referencing the same type of ammo and that for all weapons with 0 it is automatic ?

I'm interested by all explainations about that.

Thank you in advance.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
Cheeseh
post Jun 22 2009, 08:16 PM
Post #2


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



Every bot has an ammo array of the ammo it has. The array has about 3-4 elements, each of these elements relate to a weapon, the ammo for that weapon is stored in that array,
The ammo index is the array index where the Ammo for the particular weapon's ammo is stored

all this e.g.

CODE

index
0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3
0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1
----------------------------------------------------------------------
ammo index
0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,2,2,2,2,1,1,2,1,2,2,0,2,1,1,3


weapon 0 is TF2_WEAPON_BAT and the ammo index for that is 0, because it is melee there is no ammo, it is the same for all melee weapons that need no ammo

The minigun is 12 which has weapon index 1, so this contains a different position in the bots ammo array

don't know how to explain well.. but this stufff is better untouched for now anyway
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th June 2025 - 10:18 PM