Game Development Community

Need help with Inventory GUI

by gamer · in Torque Game Engine · 03/27/2006 (5:52 pm) · 1 replies

I am using the script inventory gui (http://tork.beffy.de/tutorials/inventory/inventoryGui.php).
after I toggle the inventory up, no item is played.
in server/scripts/game.cs:

// Starting equipment
%player.setInventory(Crossbow,1);
%player.setInventory(CrossbowAmmo,10);
%player.mountImage(CrossbowImage,0);

shouldn't this add CrossBow to the inventory? what am I missing?

#1
03/28/2006 (11:03 am)
I tried invoking clientCmdPopInventory(DemoPlayer);
it invokes serverCmdListInventory(), player.totalInvNum turns out to be empty. it should be at a number greater than 0.
what am I missing? any idea?
thanks


function serverCmdListInventory(%client, %maxNum)
{

%player = %client.player;
%totalInvCount = %player.totalInvNum;
echo("ServerCmdListInventory ");
echo(%player.getName());
echo(%totalInvCount);

%directUseCounter = 0;
for(%i = 1; %i <= %totalInvCount; %i++)
{
if(%i > %maxNum)
return;
%usable = 0;
%invName = %player.totalInvName[%i];
%invDirectUse = %invName.directUse;
%invNumber = %player.getInventory(%invName);
%currSlot = "Slot" @ %i;
%currAmountSlot = "Amount" @ %i;

if(%invDirectUse)
{
%directUseCounter++;
%usable = 1;
}
commandToClient(%client,'UpdateInventoryGui',%currSlot,%currAmountSlot,
%i,%invName,%invNumber,%directUseCounter,%usable);
}
}