Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   function onActionGrab (https://forums.graalonline.com/forums/showthread.php?t=134262290)

MattKan 03-03-2011 02:14 AM

function onActionGrab
 
I've seen it referenced in a lot of places... how do I set it up?

cyan3 03-03-2011 02:18 AM

Quote:

Originally Posted by MattKan (Post 1634185)
I've seen it referenced in a lot of places... how do I set it up?

PHP Code:

//#CLIENTSIDE
function onCreated() {

 
// creates a block image
 
setimg("block.png");

}

function 
onActionGrab() {

  
// sends message "Grab" if the block is grabbed
  
sendrpgmessage("Grab");




MattKan 03-03-2011 02:24 AM

Quote:

Originally Posted by cyan3 (Post 1634186)
PHP Code:

//#CLIENTSIDE
function onCreated() {

 
// creates a block image
 
setimg("block.png");

}

function 
onActionGrab() {

  
// sends message "Grab" if the block is grabbed
  
sendrpgmessage("Grab");




It's not a built in function, you have to set it up with a script

cyan3 03-03-2011 02:25 AM

Quote:

Originally Posted by MattKan (Post 1634187)
It's not a built in function, you have to set it up with a script

Has always worked for me without setting anything up.

MattKan 03-03-2011 02:30 AM

Not for me...

fowlplay4 03-03-2011 03:03 AM

It's usually something like this:

PHP Code:

//#CLIENTSIDE
function onKeyPressed() {
  if (
keydown(6) && player.ani == "grab") {
    
triggeraction(player.x+vecx(player.dir)*2player.y+vecy(player.dir)*2"Grab"player.account);
  }



cbk1994 03-03-2011 03:50 AM

Quote:

Originally Posted by cyan3 (Post 1634188)
Has always worked for me without setting anything up.

That's because Kingdoms has the trigger script already in the movement system.

MattKan 03-03-2011 04:49 AM

Quote:

Originally Posted by fowlplay4 (Post 1634194)
It's usually something like this:

PHP Code:

//#CLIENTSIDE
function onKeyPressed() {
  if (
keydown(6) && player.ani == "grab") {
    
triggeraction(player.x+vecx(player.dir)*2player.y+vecy(player.dir)*2"Grab"player.account);
  }



There was a script I saw somewhere that allowed you to use just function onActionGrab as if if you were using function onPlayerTouchsMe or function onCreated anywhere on the server.

cbk1994 03-03-2011 04:56 AM

Quote:

Originally Posted by MattKan (Post 1634220)
There was a script I saw somewhere that allowed you to use just function onActionGrab as if if you were using function onPlayerTouchsMe or function onCreated anywhere on the server.

That's it. You have to put Jer's script into a system (generally the movement system, if you're not using the default; otherwise, any system weapon), and then you can use onActionGrab just like onPlayerTouchsMe.


All times are GMT +2. The time now is 08:43 PM.

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