Game Development Community

How to change the default starting ammo

by Tom Ward · in Torque Game Engine · 05/31/2004 (6:06 am) · 5 replies

I am wanting to change the deafault starting ammo in the fps - I tried changing this in game.cs ...

%player.setInventory(CrossbowAmmo,10);


This works fine after dying and coming back in to the game, but the first time into the game, I get the full maxinventory count (50). I can easily change this count, but I don't want to - I simply want a different initial count.

Any ideas?

About the author

Recent Threads


#1
05/31/2004 (11:17 pm)
Strange you doing the right thing.
Where do you set all inventory in what files ?
#2
05/31/2004 (11:35 pm)
What about

%obj.setImageAmmo(0,10);

in the players onAdd function.
#3
06/01/2004 (1:45 am)
If you are using head version then you might want to search for "setMaxInv" and see what that comes up with. What I'm guessing is happening is that your initial entry into the game is using the Armor datablock which appears to be 50 max, and then when you respawn, it's being set to 10.

If you go into the armor datablock (player.cs) then you can change Max crossbow ammo to 10 and you'll never get more than 10. The inventory system can be a little confusing at first. Don't change things to fast. It just takes a little tweaking most times to get it set right.
#4
06/02/2004 (11:11 am)
Thanks for responses so far
Billy - I changed the setInventory command in game.cs - it was already there, I just changed the number
Mark - had a search for onAdd, but couldn't find an onAdd for the player - only one for the Armor/Camera/LoadingGUI/Editor
Gonzo - already searched for setMaxInv and couldn't find anything much else that I hadn't already changed - as I mentioned, I don't want to change the max bullets - only the initial count

Another interesting thing I noticed today, is that all other players who connect in start with the correct ammo count (10), it's just the person who starts as the server who gets the full maxInventory number (currently 50), and then only the first time they come into the game.
#5
06/02/2004 (4:27 pm)
Tom try this

In game.cs there you have the start ammo when a playerspawns
gameconnection::createPlayer
{  
   ..
   %player.setInventory(Ammo,amount);
   ..
}

In the player.cs
This is the max inventory a player could have of this ammo
PlayerData(Player)
{
 ..
 MaxInv[Ammo] = amount;
 ..
}

On the weapon you have the max ammo in a clip
ItemData(Ammo)
{
  ..
  maxInventory = amount;
  ..
}

Do you have this ?