View Single Post
  #14  
Old 12-29-2007, 10:25 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
well thats part of a system weapon. For Instance you add this to a weapon.

PHP Code:
//#CLIENTSIDE
function onKeyPressed( code, key)
{

  switch ( 
temp.code)
  {
  
    case 
"65": //a
      
Grab();
    break;
    
  }
}

function 
Grab()
{

  
frontPosition = { player.x + 1.5 + vecx(player.dir) * 2, player.y + 1.5 + vecy(player.dir) * 2};
  
  
canGrab = ( testplayer(frontPosition[0], frontPosition[1]) || testnpc(frontPosition[0], frontPosition[1]));

  if ( 
canGrab)
    
triggerAction(frontPosition[0], frontPosition[1], "Grabbed", player.account, player.guild);

} 
then in a level NPC on the ground you would add this.

PHP Code:

function onCreated()
{

  
setImg( image);
  
setShape( 1, 16*2, 16*2);

}

function 
onActionGrabbed()
{

  
findPlayer( params[ 0]).addWeapon( weapon);

  
destroy();

} 
__________________
Deep into the Darkness peering...
Reply With Quote