Author Topic: Mounting a weapon on spawn  (Read 1155 times)

Is there anyway to mount a certain weapon to a certain inventory slot when you spawn? Kind of like how you normally spawn with a hammer, wrench, and printer? Please respond. Thanks in advance.

The multitool does this, but doesn't work 98% of the time.

Code: [Select]
function InventonSpawn(%this, %obj, %player)
{
%player.tool[0] = yourweaponImage;
messageClient(%player.client,'MsgItemPickup','',0,yourweaponImage);
}
package Spawn
{
   function GameConnection::spawnPlayer(%this)
   {
      Parent::spawnPlayer(%this);
      InventorySpawn();
   }
};
activatePackage(Spawn);

Well, Thank you Jervan :D

One Question, If Im using 7 inventory slots and I want to mount the weapon to the last one, would I do...

Code: [Select]
function InventonSpawn(%this, %obj, %player)
{
%player.tool[6] = yourweaponImage;
messageClient(%player.client,'MsgItemPickup','',6,yourweaponImage);
}
package Spawn
{
   function GameConnection::spawnPlayer(%this)
   {
      Parent::spawnPlayer(%this);
      InventorySpawn();
   }
};
activatePackage(Spawn);

6 instead of 0.

I fixed the typo, but it still doesn't mount the image...

Current Code:

Code: [Select]
function InventorySpawn(%this, %obj, %player, %client)
{
%player.tool[0] = IceFreezeImage;
messageClient(%player.client,'MsgItemPickup','',0,IceFreezeImage);
}

package Spawn
{
    function GameConnection::spawnPlayer(%this)
  {
      Parent::spawnPlayer(%this);
      InventorySpawn();
    }
};
activatePackage(Spawn);
« Last Edit: May 09, 2008, 05:25:12 PM by Dr Bling »

Code: [Select]
package WepOnSpawn
{
    function GameConnection::spawnPlayer(%this)
  {
      Parent::spawnPlayer(%this);
                %this.player.tool3 = IceFreezeImage.getID();
                messageClient(%this,'MsgItemPickup','',3,IceFreezeImage.getID());
    }
};
activatePackage(WepOnSpawn);

@Jervan: You have no idea how obvious it is that you just cut and pasted that code.

That just makes the ui icon go there, but it still doesn't mount the weapon when I go to that slot...

use %this.mountimage(%this.player.tool[0]); or %this.mountimage(IceFreezeImage); if that doesn't work. Theres probably a variable that needs to be modified for which slot is selected as well but I don't know that one.

Code: [Select]
package WepOnSpawn
{
    function GameConnection::spawnPlayer(%this)
  {
      Parent::spawnPlayer(%this);
                %this.player.tool3 = IceFreezeItem.getID();
                messageClient(%this,'MsgItemPickup','',3,IceFreezeItem.getID());
    }
};
activatePackage(WepOnSpawn);

Silly me, I made the mistake of assuming Jervan got at least a bit of his code right. :cookieMonster:

Try now.

Sorry, I wont try from now on. And no, I can actually write code without syntaxs now. I only got it wrong because I don't know everything about everything, and was in a rush to get out, so I couldn't test. Oh well.