Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-22-2010, 11:36 PM
xMane xMane is offline
NPC-Server (Server)
xMane's Avatar
Join Date: May 2010
Posts: 59
xMane is on a distinguished road
Shovel

http://forums.graalonline.com/forums...ad.php?t=73836
/\
PHP Code:
function onActionServerside(serverOption)
{
  if (
temp.serverOption != "dig")
  {
    return 
false;
  }
  
temp.digPosition player.dropPosition();
  if (
clientr.lastDig[0] == temp.digPosition[0] && clientr.lastDig[1] == clientr.lastDig[1])
  {
    return 
false;
  }
  
  
temp.digCheck this.checkTiles(temp.digPosition);
  
  
clientr.lastDig temp.digPosition;
  
setani("v_shovel""v_shovel-"temp.digCheck @".png");
  
  switch (
temp.digCheck)
  { 
    case 
"grass":
      
this.doDrops(temp.digPosition, {{"object_hole"0}, {"object_artifact"290}});
    break;
    
    case 
"sand":
      
this.doDrops(temp.digPosition, {{"object_sandhole"280}, {"generator_dungeon"0}});
    break; 
  }
}
function 
checkTiles(position)
{
  
temp.tilePosition tiles[temp.position[0], temp.position[1]];
  
temp.allTiles = {
    {
"grass", {102329910100816130197131147114}},
    {
"sand", {301171170299329923010297715,  83813822881812976}},
    {
"darksand", {170947949895847904339905}}
  };
  for (
temp.currentTilestemp.allTiles)
  {
    if (
temp.tilePosition in temp.currentTiles[1])
    {
      
temp.foundTile temp.currentTiles[0];
      break;
    }
  }
  return 
temp.foundTile;
}
function 
doDrops(dropPositiondropMode)
{
  for (
temp.currentDroptemp.dropMode)
  {
    if (
temp.currentDrop[1] != 0)
    {
      
temp.doDrop = (random(0300) < temp.currentDrop[1]? truefalse);
    }
     else
    {
      
temp.doDrop true;
    }
    if (
temp.doDrop)
    {
      
putnpc2(temp.dropPosition[0], temp.dropPosition[1], ("join" SPC temp.currentDrop[0] @";"));
    }
  }
}
public function 
dropPosition()
{
  
temp.playerPos = {{0.751}, {0.61.5}};
  
temp.dropPos = {
    
player.+ (player.dir in {02}? temp.playerPos[0][0] : temp.playerPos[1][0]) + vecx(player.dir) * 2,
    
player.+ (player.dir in {02}? temp.playerPos[0][1] : temp.playerPos[1][1]) + vecy(player.dir) * 2
  
};
  return 
temp.dropPos;
}
//#CLIENTSIDE
function onWeaponFired()
{
  
triggerserver("weapon"this.name"dig");
  
setani("grab",NULL);

how would i make that drop sumthing? also only dig in sand and leave a rock lifted hole?
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.