Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Level-Style Triggeractions (https://forums.graalonline.com/forums/showthread.php?t=78270)

The_Kez 01-07-2008 10:00 AM

Level-Style Triggeractions
 
This is for a mining system. I have a trigger going from the pickaxe weapon to the clientside portion of the rock called 'MineHit'. That trigger is received perfectly fine. The problem is that I obviously need to access the Serverside portion of the rock NPC.
I triggered onActionServerside, but for some reason it's finding it on the Clientside instead of on the Serverside. None of the triggers I send are being found anywhere but the Clientside, no matter how I tweak them.

NPC Code:
function onActionServerside() {
switch ( params[0] ) {

case "Damage Rock":
this.chat = "Hit by.."@ params[1];
break;

}
}
//#CLIENTSIDE
function onCreated() {
setShape(1,32,32);
setImg("np_miningrocks_2.png");
DrawUnderPlayer();
}
function onActionMineHit() {
temp.owner = params[0];
temp.pwr = params[1];
triggeraction(x+1.5,y+1.5,"Serverside","Damage Rock",temp.owner); // Triggers the clientside -.-
if ( temp.pwr > 0 ) ShowDamage( temp.pwr );
}
function onActionServerside() {
this.chat = "Called on the Clientside.";
}
function ShowDamage( damage ) {
this.newx = this.x + random(.4,1.1);
this.newy = this.y - .5;
this.newalpha = .99;
temp.subx = random(.05,.135);
temp.suby = random(.12,.22);
for ( i=0;i<25;i++ ) {
this.newx += temp.subx;
this.newy -= temp.suby;
this.newalpha -= .05;
showText(350,this.newx,this.newy,"Arial Narrow","bold",damage);
changeImgColors(350,.8,0,0,this.newalpha);
changeImgVis(350,1);
sleep(.05);
if ( this.newy < this.y - 3 ) {
hideImg(350);
break;
}
}
}



When the rock is hit with the pickaxe, everything works, but instead of getting the intended return 'Hit by..The_Kez' it returns 'Called on the Clientside.'

Inverness 01-07-2008 11:13 AM

Don't use the action name "serverside" or "clientside" for normal triggers. Those two action names are for special functionality having to do with weapons.

For normal action behavior just use an action name that isn't "serverside" or "clientside" or starts with "server" as those go to the Control-NPC.
PHP Code:

function onCreated() {
  
setshape(13232);
}
function 
onActionWarp(newlevelnewxnewy) {
  
setlevel2(newlevelnewxnewy);
}
//#CLIENTSIDE
function onCreated() {
  
setshape(13232);
}
function 
onPlayerTouchsMe() {
  
triggeraction(this.xthis.y"Warp""lol.nw"3030);


The shape needs to be set on serverside for the NPC to acknowledge the action.

The_Kez 01-07-2008 06:28 PM

Good deal, works now thanks a lot.

Dan 01-07-2008 08:58 PM

Best would be to define the warp details serverside, like a set function already instead of anything to fill in. This way other staff members cannot abuse this to warp anywhere with some 'level script' that triggers the NPC.

Crow 01-07-2008 10:13 PM

Quote:

Originally Posted by Dan (Post 1368687)
Best would be to define the warp details serverside, like a set function already instead of anything to fill in. This way other staff members cannot abuse this to warp anywhere with some 'level script' that triggers the NPC.

Staff members who have rights to any scripts or levels to do that normally also have warping rights anyways...

napo_p2p 01-07-2008 10:22 PM

Quote:

Originally Posted by Crow (Post 1368689)
Staff members who have rights to any scripts or levels to do that normally also have warping rights anyways...

To add to that... If a staff member can edit the level, then they can just make a setlevel2 script themselves to "abuse" warping.

However, I do agree with Dan that the warp details should be set serverside, as anything clientside is potentially unsecure (i.e. Someone could use a memory editor to change the clientside details and warp anywhere they want to).

Inverness 01-08-2008 03:42 AM

The Clientside warp details were solely for the purpose of demonstrating how to use the parameters.


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

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