Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   JKL's Scripting Questions (https://forums.graalonline.com/forums/showthread.php?t=134258195)

Deas_Voice 03-14-2010 09:41 PM

Quote:

Originally Posted by jkldogg (Post 1562542)
So if I take out the second function it will work?

i don't know? try! :asleep:
srsly man, rc should tell you errors like this!

jkldogg 03-14-2010 09:47 PM

Quote:

Originally Posted by Deas_Voice (Post 1562543)
i don't know? try! :asleep:
srsly man, rc should tell you errors like this!

It should, but doesn't.

xAndrewx 03-14-2010 09:48 PM

HTML Code:

function onActionGrab() {
  if (clientr.SquadName == "La Carmelas") {
    setlevel("vega_kody-house-inside.nw", 30, 30);
  } else {
    setlevel("vega_staff-meeting,nw", 20, 20);
  }
}

This uses the else feature, and you only need one function (onActionGrab)
:)

jkldogg 03-14-2010 09:59 PM

testing
 
1 Attachment(s)
Quote:

Originally Posted by xAndrewx (Post 1562549)
HTML Code:

function onActionGrab() {
  if (clientr.SquadName == "La Carmelas") {
    setlevel("vega_kody-house-inside.nw", 30, 30);
  } else {
    setlevel("vega_staff-meeting,nw", 20, 20);
  }
}

This uses the else feature, and you only need one function (onActionGrab)
:)

I'll try it with one function.

EDIT: I did this and it didn't work.

PHP Code:

function onActionGrab() {
      if (
clientr.SquadName == "Vega") {
        
setlevel("vega_hut.nw"3030);
      } else {
        
setlevel("vega_staff-meeting,nw"2020);
      }
    } 


salesman 03-14-2010 10:48 PM

Quote:

Originally Posted by jkldogg (Post 1562551)
I'll try it with one function.

EDIT: I did this and it didn't work.

PHP Code:

function onActionGrab() {
      if (
clientr.SquadName == "Vega") {
        
setlevel("vega_hut.nw"3030);
      } else {
        
setlevel("vega_staff-meeting,nw"2020);
      }
    } 


try setlevel2()

xAndrewx 03-14-2010 11:02 PM

Oh yeah- haha duh

Switch 03-14-2010 11:17 PM

Quote:

Originally Posted by jkldogg (Post 1562511)
PHP Code:

GraalControl.onKeyPressed(codekeyscan


Change this to GraalControl.onKeyDown(code, key, scan). Forgot to change it when I updated the script.

jkldogg 03-14-2010 11:51 PM

Quote:

Originally Posted by salesman (Post 1562564)
try setlevel2()

Works, thanks.

Quote:

Originally Posted by xAndrewx (Post 1562567)
Oh yeah- haha duh

lol, you had the just of it

Quote:

Originally Posted by Switch (Post 1562570)
Change this to GraalControl.onKeyDown(code, key, scan). Forgot to change it when I updated the script.

Thanks, already did.

DrakilorP2P 03-15-2010 12:03 AM

Quote:

Originally Posted by jkldogg (Post 1562551)
PHP Code:

function onActionGrab() {
      if (
clientr.SquadName == "Vega") {
        
setlevel("vega_hut.nw"3030);
      } else {
        
setlevel("vega_staff-meeting,nw"2020);
      }
    } 


You should probably remove the tabs that come when you copy paste.

jkldogg 03-15-2010 12:17 AM

Quote:

Originally Posted by DrakilorP2P (Post 1562588)
You should probably remove the tabs that come when you copy paste.

When I copy paste what?

Cubical 03-15-2010 12:22 AM

the script

jkldogg 03-15-2010 12:25 AM

Inventory()replace
 
Quote:

Originally Posted by Cubical (Post 1562590)
the script

Okay.

I want to replace the old classic inventory with my own one. I changed the key to "Q", but both inventories popped up..lol How can I easily disable the old classic one? Also, is there a way to drag out items and drop them on the ground?

I thought editing this would help..but I failed

PHP Code:

   player.chat "You can't drop this!";
    return;
  }
  
Inventory_Window.visible false;
  
this.dragging true;
  
this.dragWep = ( @ ct ).weapon;
  
Inventory_DragImg.image = ( @ ct ).weapon.image;
  
Inventory_DragQuantity.text 1;
  
refreshDrag();
  
Inventory_DragImg.visible true;
  
Inventory_DragQuantity.visible true;
  
this.startDrag timevar2;
  
client.frozen true;
}
function 
refreshDrag() 


Here's the code:

PHP Code:

function onActionServerSidecmdwepammimgacc )
{
  }
    
    
//echo(wep SPC clientr.item.( @ wep ) SPC player.account);
    
if ( clientr.item.( @ wep ) >= amm )
    {
      
clientr.item.( @ wep ) -= amm;
      if ( 
clientr.item.( @ wep ) == )
      {
        
removeweaponwep );
      }
      
temp.npc putnpc2dropPosition()[0], dropPosition()[1], "join(\"object_droppeditem\");" );
      
temp.npc.dropper acc;
      
temp.npc.realName wep;
      
temp.npc.itemQuantity amm;
      
temp.npc.itemImage img;
      
clientr.trueMoney base64encodeclientr.item.Money );
      
triggerclient"gui"name"reopenMenu" );
    }
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 onCreated()
{
  
setTimer0.05 );
}
function 
onActionClientSidecmd )
{
  if ( 
cmd == "reopenMenu" )
  {
    if ( 
this.menu == )
    {
      
destroyMenu();
      
showMenu();
    }
    else
    {
      
destroyMenu();
    }
  }
}
function 
onKeyPressedcodekey )
{
  if ( 
key == "w" )
  {
    
this.menu this.menu;
    if ( 
this.menu )
    {
      
showMenu();
      
setTimer0.05 );
    }
    else
    {
      
destroyMenu();
      
this.scroll 0;
    }
  }
}
function 
onTimeOut()
{
  if ( 
mousewheeldelta )
  {
    if ( 
this.scroll 35 this.iWeps.size() )
    {
      
this.scroll += 5;
      
destroyMenu();
      
showMenu();
    }
  }
  else if ( 
mousewheeldelta )
  {
    if ( 
this.scroll )
    {
      
this.scroll -= 5;
      
destroyMenu();
      
showMenu();
    }
  }
  if ( 
this.dragging )
  {
    
temp.Inventory_DragQuantity.text;
    if ( 
timevar2 this.lastTime >= .1 )
    {
      if ( 
keydown) )
      {
        if ( 
temp.!= clientr.item.( @ this.dragWep.name ) )
        {
          
Inventory_DragQuantity.text temp.1;
          
this.lastTime timevar2;
        }
      }
      if ( 
keydown) )
      {
        if ( 
temp.100 )
        {
          
Inventory_DragQuantity.text temp.100;
          
// this.lastTime = timevar2;
        
}
        else
        {
          
Inventory_DragQuantity.text 1;
          
//this.lastTime = timevar2;
        
}
      }
      if ( 
keydown) )
      {
        if ( 
temp.)
        {
          
Inventory_DragQuantity.text temp.1;
          
this.lastTime timevar2;
        }
      }
      if ( 
keydown) )
      {
        if ( 
temp.100 <= clientr.item.( @ this.dragWep.name ) )
        {
          
Inventory_DragQuantity.text temp.100;
          
//this.lastTime = timevar2;
        
}
        else
        {
          
Inventory_DragQuantity.text clientr.item.( @ this.dragWep.name );
          
//this.lastTime = timevar2;
        
}
      }
    }
    if ( ! 
leftmousebutton )
    {
      
endDragging();
    }
    else
    {
      
refreshDrag();
    }
  }
  if ( 
this.menu )
  {
    
setTimer0.05 );
  }
}
function 
destroyMenu()
{
  
Inventory_Window.destroy();
}
function 
showMenu()
{
  
iWeps.clear();
for ( 
temp.player.weapons )
  {
    
temp.temp.a.name;
    if ( ! 
temp.n.starts"-" ) )
    {
      
iWeps.addtemp.);
    }
  }
  
this.iWeps iWeps;
  
scroll this.scroll;
  new 
GuiShowImgCtrl"Inventory_DragImg" )
  {
    
image "";
    
0;
    
0;
    
visible false;
    
width 32;
    
height 32;
  }
  new 
GuiShowImgCtrl"Inventory_Window" )
  {
    
image "inventory1.png";
    
width 380;
    
height 380;
    
screenwidth - ( width 20 );
    
screenheight - ( height );
    
visible true;
    for ( 
temp.scrolltemp.35 scrolltemp.++ )
    {
      if ( 
temp.iWeps.size() )
      {
        
temp.iWeps[temp.i];
        if ( 
temp.cols == )
        {
          
temp.row ++;
          
temp.cols 0;
        }
        new 
GuiShowImgCtrl"Inventory_Item_" temp.a.name )
        {
          
image temp.a.image;
          
13 + ( 60.5 temp.cols );//108-x/original|35|
          
+ ( 43.5 temp.row );//9-y/original|35|
          //Newer Old-x=27.5
          //Newer Old-y=96
          
width 32;
          
height 32;
          
hint temp.a.name;
          
this.weapon temp.a;
          
thiso.catcheventname"onMouseDown""onItemClicked" );
          
thiso.catcheventname"onMouseDragged""onItemDragged" );
        }
        
temp.cols ++;
      }
    }
  }
  
onSelect( ( @ "Inventory_Item_" player.weapons[selectedweapon].name ) );
}
function 
onItemClickedctrnxycount )
{
  
temp.= ( @ ctr );
  
temp.temp.c.weapon;
  if ( 
count == )
  {
    
onEquipctr );
  }
  else
  {
    
onSelectctr );
  }
}
function 
onItemDraggedctrlnnx)
{
  if ( ! 
this.dragging )
  {
    
startDraggingctrln );
  }
}
function 
startDraggingct )
{
  if ( ( @ 
ct ).weapon.name == NULL )
  {
    
player.chat "You can't drop this!";
    return;
  }
  
Inventory_Window.visible false;
  
this.dragging true;
  
this.dragWep = ( @ ct ).weapon;
  
Inventory_DragImg.image = ( @ ct ).weapon.image;
  
Inventory_DragQuantity.text 1;
  
refreshDrag();
  
Inventory_DragImg.visible true;
  
Inventory_DragQuantity.visible true;
  
this.startDrag timevar2;
  
client.frozen true;
}
function 
refreshDrag()
{
  
player.dir getdirmousex player.xmousey player.);
  if ( 
mousex in player.10player.10 | && mousey in player.10player.10 |)// && ( timevar2 - this.startDrag > .5 ) )
  
{
    
setAni"grab"Inventory_DragImg.image );
  }
  else
  {
    
setAni"idle""" );
  }
  
Inventory_DragImg.mousescreenx 25;
  
Inventory_DragImg.mousescreeny 25;
  
Inventory_DragQuantity.mousescreenx 30;
  
Inventory_DragQuantity.mousescreeny 20;
  
Inventory_DragImg.showtop();
}
function 
endDragging()
{
  
Inventory_Window.visible true;
  if ( 
this.dragWep.name == "Medkit" )
  {
  for (
aallplayers)
    {
      if ( 
player.x in |a.2a.2| && player.y in |a.2a.2| )
      {
        if ( 
a.account != player.account )
        {
          
triggerserver"weapon"name"revive"a.account );
          
this.dragging false;
          
Inventory_DragImg.image "";
          
Inventory_DragImg.visible true;
          
Inventory_DragQuantity.text "";
          
Inventory_DragQuantity.visible false;
          
this.dragWep "";
          
client.frozen false;
        }
      }
    }
  }
  elseif ( 
mousex in player.10player.10 | && mousey in player.10player.10 | && ( timevar2 this.startDrag .5 ) )
  {
    
triggerserver"gui"name"dropItem"this.dragWep.nameInventory_DragQuantity.textthis.dragWep.imageplayer.account );
  }
  else
  {
    
setAni"idle""" );
  }
  
this.dragging false;
  
Inventory_DragImg.image "";
  
Inventory_DragImg.visible false;
  
Inventory_DragQuantity.text "";
  
Inventory_DragQuantity.visible false;
  
this.dragWep "";
  
client.frozen false;
}

function 
onSelectctrl )
{
  
temp.= ( @ ctrl ).weapon.name;
  
temp.temp.n.tokenize"/" );
  if ( 
temp.a.size() == )
  {
    
Inventory_ItemName.text "Item:" SPC temp.a[1];
  }
  else
  {
    
Inventory_ItemName.text "Item:" SPC temp.a[0];
  }

  
Inventory_ItemQuantity.text "Quantity:" SPC clientr.item.( @ temp.);
  
Inventory_Icon.image = ( @ ctrl ).weapon.image;
}
function 
onEquipctrl3 )
{
  
temp.= ( @ ctrl3 ).weapon.name;
  for ( 
temp.0temp.player.weapons.size(); temp.++ )
  {
    
temp.player.weapons[temp.i];
    if ( 
temp.a.name == temp.)
    {
      
selectedweapon temp.i;
    }
  }



Mark Sir Link 03-15-2010 01:50 AM

use enablefeatures() and the appropriate bitflags to enable what you want


Game features (for enablefeatures)

2 P key
4 Q key
8 R key
0x10 S+A combo
0x20 S+D combo
0x40 TAB key
0x80 chat text
0x100 hearts overhead
0x200 display of nicknames
0x400 toall/PM bubbles
0x800 right-click profiles
0x1000 emoticons
0x2000 Alt+5 snapshots
0x4000 Alt+8/9 zooming
0x8000 logframe
allfeatures all features

jkldogg 03-15-2010 02:34 AM

Quote:

Originally Posted by Mark Sir Link (Post 1562604)
use enablefeatures() and the appropriate bitflags to enable what you want


Game features (for enablefeatures)

2 P key
4 Q key
8 R key
0x10 S+A combo
0x20 S+D combo
0x40 TAB key
0x80 chat text
0x100 hearts overhead
0x200 display of nicknames
0x400 toall/PM bubbles
0x800 right-click profiles
0x1000 emoticons
0x2000 Alt+5 snapshots
0x4000 Alt+8/9 zooming
0x8000 logframe
allfeatures all features

I've seen this before, can't remember where it goes though. Any help?

Imperialistic 03-15-2010 02:58 AM

Maybe you should read and learn yourself instead of asking for scripts, it's okay to ask questions for help but people giving you scripts isn't helping. If you read through all of the wiki's you should be able to answer your own questions.

Maybe these links can help you:
www.wiki.graal.us
www.wiki.graal.net
www.gs2.graalstudios.com


All times are GMT +2. The time now is 09:36 AM.

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