Game Development Community

Tribes Mod

by Michael Cozzolino · in Technical Issues · 02/16/2001 (1:05 pm) · 6 replies

I am working on a Tribes Modification. Not a total conversion or anything, just playing around. Who better to ask? Right? Ok I made a gun for Tribes. I didn't use a backpack with it. My question is how do I get it so when I cycle through my guns that I can get to the one I made. The only way I can use it is by pressing (I) and selecting the weapon then selecting use. I think it has something to do with the next weapon and previos weapon in the item.cs . I played around with it but I couldn't figure it out. I was getting confused to how I had to arrange it. I would really appreciate your help.

Thanks

About the author

Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489


#1
02/16/2001 (1:49 pm)
That was code that I wrote... a long, long time ago :) In the item.cs file, the $NextWeapon array is an associative array which is indexed by the current weapon and who's value is the weapon to switch to. $PrevWeapon works the same way. If you want to stick a new weapon at the end, try:

$NextWeapon[LaserRifle] = NewWeapon;
$NextWeapon[NewWeapon] = EnergyRifle;

$PrevWeapon[EnergyRifle] = NewWeapon;
$PrevWeapon[NewWeapon] = LaserRifle;

Change the existing LaserRifle entries and add the NewWeapon lines.
#2
02/17/2001 (7:17 pm)
Thanks alot. The site is really coming together too. I hopefully will be able to add some resources soon. Although it will probably be geared towards rookies like me. :)
#3
02/19/2001 (11:18 am)
Ok I think I must be misunderstanding your instructions. Here is what I have. The SniperRifle is the new weapon.

$NextWeapon[EnergyRifle] = Blaster;
$NextWeapon[Blaster] = PlasmaGun;
$NextWeapon[PlasmaGun] = Chaingun;
$NextWeapon[Chaingun] = DiscLauncher;
$NextWeapon[DiscLauncher] = GrenadeLauncher;
$NextWeapon[GrenadeLauncher] = Mortar;
$NextWeapon[Mortar] = LaserRifle;
$NextWeapon[LaserRifle] =SniperRifle;
$NextWeapon[SniperRifle] =EnergyRifle;



$PrevWeapon[Blaster] = EnergyRifle;
$PrevWeapon[PlasmaGun] = Blaster;
$PrevWeapon[Chaingun] = PlasmaGun;
$PrevWeapon[DiscLauncher] = Chaingun;
$PrevWeapon[GrenadeLauncher] = DiscLauncher;
$PrevWeapon[Mortar] = GrenadeLauncher;
$PrevWeapon[LaserRifle] = Mortar;
$PrevWeapon[EnergyRifle] = SniperRifle;
$PrevWeapon[SniperRifle] = LaserRifle;
#4
02/19/2001 (6:26 pm)
Think of it as a circular link list. Hmmm... actually, what you have looks correct. I take it it's not working though :) Maybe we should continue this discussion through email, it might go a little faster. Can you email me any more details? Does it still cycle the original weapons, or not at all?
#5
03/22/2001 (8:45 am)
Try a function like this, and run it once at server start-up somewhere:

function CreateWeaponCyclingTables()
{
	%counter = 0;
	for(%i = 0; %i < getNumItems(); %i++)
	{
		%item = getItemData(%i);
		if(%item.className == Weapon)
		{
			if(%counter > 0)
				$NextWeapon[%lastitem] = %item;
			else
				%firstitem = %item;

			%lastitem = %item;
			%counter++;
		}
	}
	$NextWeapon[%lastitem] = %firstitem;

	for(%i = Dagger; $NextWeapon[%i] != Blaster; %i = $NextWeapon[%i])
	      $PrevWeapon[$NextWeapon[%i]] = %i;
	$PrevWeapon[$NextWeapon[%i]] = %i;
}
#6
03/26/2001 (4:18 pm)
Michael got his weapon working (a small typo somewhere). A function to build the list is a good idea though :)