Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   onActionGrab (https://forums.graalonline.com/forums/showthread.php?t=68333)

pig132 08-24-2006 08:30 PM

onActionGrab
 
I dont see why this doesnt work..

NPC Code:
function onActionserverside() {
this.join("door");
}
//#CLIETNSIDE
function onActionGrab() {
triggeraction 0,0,serverside,test;
}



I also tried:
NPC Code:
//#CLIETNSIDE
function onActionGrab() {
this.join("door");
}


Could someone help me? I'm not sure what it is, but i think actiongrab is messed up, if (actiongrab) also doesnt work

Tolnaftate2004 08-24-2006 08:52 PM

I'm gonna have to say it's not working because it doesn't exist. :)

KuJi 08-24-2006 09:09 PM

The action of Grab is usually made custom. You can try something like this - it doesnt allow you to hold down A and must/should be in a timeout.

PHP Code:

  if (keydown(6))
  {
    if (
this.grab == false && player.ani == "grab")
    {
      
triggeraction(player.1.5 vecx(player.dir)*2player.1.5 vecy(player.dir)*2"grab"player.accountplayer.guild);
      
this.grab true;
    }
  }
  else 
this.grab false


Admins 08-24-2006 09:26 PM

The "grab" event is not built-in, the script wouldn't work anyway though since a triggeraction with "serverside" is for sending a trigger to a serverside weapon script.

KuJi 08-24-2006 09:43 PM

Also why didn't he just do join("door");

Skyld 08-24-2006 09:45 PM

Quote:

Originally Posted by KuJi
Also why didn't he just do join("door");

Because this.join("door"); is nice and implies scope.

KuJi 08-24-2006 10:13 PM

Quote:

Originally Posted by Skyld
Because this.join("door"); is nice and implies scope.

I mean over the ENTIRE script he didnt need to trigger the server to join it x.x

ApothiX 08-25-2006 10:34 AM

Quote:

Originally Posted by KuJi
I mean over the ENTIRE script he didnt need to trigger the server to join it x.x

Perhaps he is using a state-approach, where he joins a class in one state, and another class in another.

Example:

PHP Code:

// CLASSES/State1
function DoSomething() {
  echo(
"Currently in State 1.");
}

function 
LeavingState() {
  echo(
"Leaving State 1");
}

function 
JoiningState() {
  echo(
"Joining State 1");


PHP Code:

// CLASSES/State2
function DoSomething() {
  echo(
"Currently in State 2.");
}

function 
LeavingState() {
  echo(
"Leaving State 2");
}

function 
JoiningState() {
  echo(
"Joining State 2");


PHP Code:

// Some Object
function onCreated() {
  
SetState(1);
}

function 
onPlayerChats() {
  if(
player.chat.starts("/changestate")) {
    
temp.state = (temp.state == 1);
    
SetState(temp.state);
  } else if(
player.chat.starts("/dosomething")) {
    
this.DoSomething();
  }
}

function 
SetState(stateNum) {
  if(
this.state in |1,2|) {
    
temp.oldstate this.state;
    
this.LeavingState();
    
this.leave("State" temp.oldstate);
  }

  
this.state stateNum;
  
this.join("State" this.state);
  
this.JoiningState();



The Evil Within 10-04-2006 12:59 PM

Being that ActionGrab doesn't exist try just using the keydown command along with playertouchsme.

i.e.

function onPlayerTouchsMe() {
if (keydown(4)) {
stuff
}
}

(I'm relatively sure the #4 = D I dunno what A is, but once you find that out it should work no problem).

Chompy 10-06-2006 02:30 PM

why don't do something like:

PHP Code:

//#CLIENTSIDE
function onKeyPressed(codekey
{
  switch(
key)
  {
    case 
"a":
      
temp.gx player.1.5 vecx(player.dir) * 2;
      
temp.gy player.vecy(player.dir )* 2;
      
triggeraction(temp.gxtemp.gy"Grab"player.accountplayer.guild);
    break;
  }


PHP Code:

//#CLIENTSIDE
function onActionGrab(acctguild)
{
  
hide();
  
sleep(3);
  
show();


and with the parametres in ActionGrab(acct, guild) you can make a protection system for example ^^
(the function "onActionGrab" can go in a class or an level npc too,
and the onKeyPressed could be added like an system, like -Grab?)

xAndrewx 10-06-2006 06:38 PM

You don't need to add the player's details into a triggeraction... :) (player.account, player.guild etc)

xXziroXx 10-06-2006 06:50 PM

Quote:

Originally Posted by xAndrewx (Post 1226693)
You don't need to add the player's details into a triggeraction... :) (player.account, player.guild etc)

Correct, just use actionplayer to find it out.

Twinny 10-06-2006 07:22 PM

Quote:

Originally Posted by pig132 (Post 1213100)
//#CLIETNSIDE

No-one seemed to notice but i'm sure spelling clientside wrong doesn't help.


All times are GMT +2. The time now is 05:39 AM.

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