Game Development Community

Ammo pickup on tge

by Mark Junior · in Torque Game Engine · 10/27/2006 (1:18 am) · 2 replies

Hi, im using tge 1.4/1.5 and im wondering, what file do i edit to change the thing that when i pickup an ammo patch i will pickup m16 ammo instead of ol' crossbow ammo. i tried searching through item.cs but all i can find is stuff related to this:

function ItemData::onPickup(%this,%obj,%user,%amount)
{
// Add it to the inventory, this currently ignores the request
// amount, you get what you get. If the object doesn't have
// a count or the datablock doesn't have maxIventory set, the
// object cannot be picked up.
%count = %obj.count;
if (%count $= "")
if (%this.maxInventory !$= "") {
if (!(%count = %this.maxInventory))
return;
}
else
%count = 1;
%user.incInventory(%this,%count);

// Inform the client what they got.
if (%user.client)
messageClient(%user.client, 'MsgItemPickup', '\c0You picked up %1', %this.pickupName);

// If the item is a static respawn item, then go ahead and
// respawn it, otherwise remove it from the world.
// Anything not taken up by inventory is lost.
if (%obj.isStatic())
%obj.respawn();
else
%obj.delete();
return true;
}

it doesnt seem to specify the crossbow ammo.

#1
10/27/2006 (1:52 am)
The crossbow datablocks that include the amo and weapon info are in a file called crossbow.cs located in starter,fps/server/scripts dir, best tip I can give is to copy that file and then name the new one to the new weapon so you keep at least 1 file original
also you would need to add the new file into the game.cs file located in the same dir look for this
exec("./crossbow.cs");
and place the new file name in a similer line, this will load up when the game starts
and then you would need to edit the mission file to add some ammo packs with the new datablock, and the new weapoon
then you would need to alter the players inventory in player.cs, look for the datablock starting with "datablock PlayerData(PlayerBody)" near the bootom of that you will find // Allowable Inventory Items, and add the new weapon to there, this is so you can
1, be able to hold some ammo for the new weapon.
2, be able to piclup and carry the new weapon
a shotgun.cs script is avalible from http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6237[/url
]
this would help with getting started, you would also need a shotgun model and an ammo model but you can use the crossbow models for now
also
[url=http://www.garagegames.com/products/93]Modern Weapons Pack
comes with the models and cs scripts to start you off
Hope this helps
#2
10/27/2006 (2:19 am)
Actaully im already using tridanauts soldier pack so i have my weapons .cs file

thanks for the info.

and it comes with an m16.


EDIT: ive found out that m16.cs is a copied file from crossbow.cs but edited . it uses the same ammo pickup dts shape as the crossbow, to make this work instead of adding whole new ammo dts to my game i could just delete the crossbow.cs? cause i dont really need it.

EDIT: OK thanks it works now!