PDA

View Full Version : onActionGrab


pig132
08-24-2006, 09:30 PM
I dont see why this doesnt work..

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


I also tried:
//#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, 09:52 PM
I'm gonna have to say it's not working because it doesn't exist. :)

KuJi
08-24-2006, 10: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.


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

Admins
08-24-2006, 10: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, 10:43 PM
Also why didn't he just do join("door");

Skyld
08-24-2006, 10:45 PM
Also why didn't he just do join("door");
Because this.join("door"); is nice and implies scope.

KuJi
08-24-2006, 11:13 PM
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, 11:34 AM
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:

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

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

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

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

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

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

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

function onPlayerChats() {
if(player.chat.starts("/changestate")) {
temp.state = (temp.state == 1 ? 2 : 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, 01: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, 03:30 PM
why don't do something like:


//#CLIENTSIDE
function onKeyPressed(code, key)
{
switch(key)
{
case "a":
temp.gx = player.x + 1.5 + vecx(player.dir) * 2;
temp.gy = player.y + 2 + vecy(player.dir )* 2;
triggeraction(temp.gx, temp.gy, "Grab", player.account, player.guild);
break;
}
}

//#CLIENTSIDE
function onActionGrab(acct, guild)
{
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, 07:38 PM
You don't need to add the player's details into a triggeraction... :) (player.account, player.guild etc)

xXziroXx
10-06-2006, 07:50 PM
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, 08:22 PM
//#CLIETNSIDE


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