Game Development Community

Trying to get TAIK Weapons Pack Installed

by Jason Campbell · in Torque 3D Beginner · 02/02/2015 (9:51 pm) · 4 replies

I could use some help with this, perhaps Bryce will pop in?

I really believe that I've got everything merged correctly all the included files are in the right place.

Everyone can use weapons(AI and Player) but the weapons are invisible even when I just drop one into the scene with the editor.

Additionally there are some more errors. Actually there are a ton of errors but some of them are normal I think.

Here is the console.log, if anyone cares to look at it.
www.mediafire.com/?i9ldtv7ae8v93h2

The sound errors are because the script references .wav files but all included sound files are .ogg. The sounds work anyway.

Could these errors cause the invisibility? Those textures are there and there is a material.cs file with each weapon.
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/TAIK/PDW/PDW
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/TAIK/G18/arcGlock
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/TAIK/FiveSeveN/fiveseven
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/TAIK/RPG/RPG7
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/TAIK/AUG/surface
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/TAIK/attachments/eotech


I get this error also:
scripts/server/inventory.cs (210): Unable to find object: '' attempting to call function 'getName'

from the getInventory function

function ShapeBase::getInventory(%this, %data)
{
   echo(%this.inv[%data.getName()]);
   echo(%data.getName());
   // Return the current inventory amount
   return %this.inv[%data.getName()];
}


Yet another error:

art/datablocks/weapons/TAIK/attachments.cs (421): Unknown command mountimageimage.

I double checked the shapeBase.cpp to make sure that mountImageImage function was there and it is.

Finally I get this one:
scripts/server/player.cs (616): Unknown command getSemiAuto.

which stems from this TAIK Weapons script:

function Player::constantHudUpdate(%this)
{
  %this.updateHud();
  if (%this.getState() !$= "Dead")
    %this.schedule(50,constantHudUpdate);
}

function Player::updateHud(%this)
{
  // Don't update if we're using a special weapon, such as a grenade or knife
  if (!%this.getMountedImage(0))
    return;
  %cur = %this.getMountedImage(0).getName();
  if (%cur $= "GrenadeImage" || %cur $= "TAIKKnifeImage" || %cur $= "")
    return;

   // Update the weapon hud
   if (%this.client && %this.getState() !$= "Dead")
   {
     %wpn = %this.getMountedImage(0).getName();
     if (%wpn.itemName !$= "")
       %wpnN = %wpn.itemName;
     else
       %wpnN = %wpn.item.getName();
     %curAmmo = %this.getInventory(%wpn.ammo);
     %curBPammo = %this.getInventory(%wpn.bpAmmo);
     %clipSize = %wpn.clipSize;
     %nadeCount = %this.getInventory(grenade);
     %dataName = %this.getMountedImage(0).Item.getName();
     %sd = %this.getMountedIMage(1) != 0;
     %dot = %this.getMountedImage(2).aType == 2;
     %scope = %this.getMountedImage(2) && strStr(%this.getMountedImage(2).getName(),"ACOG") != -1;
     %launcher = %this.getMountedImage(3) != 0;
     %launcherCount = %this.getInventory(M203Ammo);
     if (!doesWeaponHaveSemi(%cur))
       %rof = 0;
     else {
       if (%this.getSemiAuto())
         %rof = 1;
       else
         %rof = 2;
     }
     commandToClient(%this.client,'UpdateWeaponHud',%wpnN,%curAmmo,%curBPAmmo,%clipSize,%nadeCount,%mineCount,%dataName,%sd,%dot,%scope,%launcher,%launcherCount,%rof);
   }
}


Perhaps I should have made more then one thread for this...

#1
02/05/2015 (9:03 pm)
Ok, I cleaned the solution and compiled it again and it seems to be working!!

I still get one error

scripts/server/inventory.cs (210): Unable to find object: '' attempting to call function 'getName'

from inventory.cs

function ShapeBase::getInventory(%this, %data)  
{  
    
   // Return the current inventory amount  
   return %this.inv[%data.getName()];  
}

When I echo(%this); it appears to give me a valid four digit id.
When I echo(%data); it prints the amount of ammo.
When I echo(%this.inv[%data.getName()]); it prints a string of the type of ammo.

It seems to be working because I can reload and it keeps track of my ammo but would just like to understand where the error is coming from.

Any ideas so I can stop obsessing?
#2
02/06/2015 (8:15 am)
Well, you could check for the method on the object before calling it:
function ShapeBase::getInventory(%this, %data)    
{
   if(%data.isMethod("getName"))
      %objName = %data.getName();

   // Return the current inventory amount
   if(%objName !$= "")
      return %this.inv[%objName];

   return %this.inv[%data];
}
Maybe. That might be
if(isMethod(%data, "getName"))
I can't remember.
Or say screw it and use
return %this.inv[%data];
That should work, as long as %data is a valid object and ShapeBase::inv() likes it.
#3
02/06/2015 (10:09 pm)
Thank you Richard, that cleared it up.
#4
02/06/2015 (10:35 pm)
No prob - I use that all the time.