Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2008, 10:00 AM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
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.'

Last edited by The_Kez; 01-07-2008 at 10:04 AM.. Reason: Typo
Reply With Quote
  #2  
Old 01-07-2008, 11:13 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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.
__________________
Reply With Quote
  #3  
Old 01-07-2008, 06:28 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
Good deal, works now thanks a lot.
Reply With Quote
  #4  
Old 01-07-2008, 08:58 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
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.
__________________
Reply With Quote
  #5  
Old 01-07-2008, 10:13 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Dan View Post
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...
__________________
Reply With Quote
  #6  
Old 01-07-2008, 10:22 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Crow View Post
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).
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #7  
Old 01-08-2008, 03:42 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
The Clientside warp details were solely for the purpose of demonstrating how to use the parameters.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:42 PM.


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