Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Triggeraction from serverside to clientside? (https://forums.graalonline.com/forums/showthread.php?t=49522)

Luigi1 12-07-2003 02:15 AM

Triggeraction from serverside to clientside?
 
Note: I mean in a local DB NPC, not a weapon.

I want to do something like this: (Well, what I need this for isn't for this script, but still... this is an example of the scenario)

NPC Code:
if (created || playerenters) {
setshape 1,32,32;
setstring this.test,hahaha.;
triggeraction x+.5,y+.5,test,#v(id),#s(this.test);
}

//#CLIENTSIDE
if (created) {
setshape2 2,2,{22,22,
22,22};
}

if (actiontest) {
if (strtofloat(#p(0)) == id) // So that it is received only by this NPC.
message received - #p(1);
}



... But that doesn't seem to work.

Is there a way to make this work? I can't use save[#0-299], because I believe you can only transfer variables with those, unless I'm mistaken.

Lance 12-07-2003 02:33 AM

Find out exactly what part doesn't work - eliminate all extraneous code.

xManiamaNx 12-07-2003 02:40 AM

Does triggeraction even work serverside? It never does for me.

Luigi1 12-07-2003 02:44 AM

Triggeraction does seem to work serverside, but it can't go to the clientside part of a script (unless you do it in a weapon with "triggeraction 0,0,clientside,weapon,params")

Loriel 12-07-2003 02:47 AM

Exactly.
I suggest you just set client. flags and strings which the client subsequently may unset.

KuJiGX 12-07-2003 05:32 AM

Re: Triggeraction from serverside to clientside?
 
Quote:

Originally posted by Luigi1
NPC Code:

triggeraction x+.5,y+.5,test,#v(id),#s(this.test);



Wouldn't you do triggeraction x,y,test,#v(id),#s(this.test);

xManiamaNx 12-07-2003 07:41 AM

perhaps the npc is x+.55 and y+.5 from the npc triggering the action.

KuJiGX 12-07-2003 07:45 AM

well if you trigger it on its x + y then its sending to its own NPC i believe. One of my scripts are like that.
Grab npc and it sends a script to the join npc.
if (created) join pwnt;
if (actiongrab) triggeraction x,y,test,pwnt;


then in join class:
if (actiontest) message #p(0); or something

Luigi1 12-07-2003 10:08 AM

No. (x,y) does not point inside of the NPC. (|x+.25,x+1.75|,|y+.25,y+1.75|) (probably a greater range than that, but not to ({x,x+2},{y,y+2})) does.

Also, I don't see why an if clause with the created event is needed when using the join command... join is like an include. (Or, "require" in PHP, which is an alias of include... although PHP does have the "include" command.)

KuJiGX 12-07-2003 04:06 PM

Quote:

Originally posted by Luigi1
No. (x,y) does not point inside of the NPC. (|x+.25,x+1.75|,|y+.25,y+1.75|) (probably a greater range than that, but not to ({x,x+2},{y,y+2})) does.

Also, I don't see why an if clause with the created event is needed when using the join command... join is like an include. (Or, "require" in PHP, which is an alias of include... although PHP does have the "include" command.)

So what do you do?
join pwnt;
if (actiongrab) triggeraction x,y,test,pwnt;


then in join class:
if (actiontest) message #p(0); or something

anyway u dont need it. And in PHP (I seen some php sources) your right. I think they do that in C++ also

KuJiGX 12-07-2003 04:14 PM

That script is fine for me... What isn't working?

NPC Code:

if (created || playerenters) {
setshape 1,32,32;
setstring this.test,hahaha.;
triggeraction x,y,test,#v(id),#s(this.test);
}
//#CLIENTSIDE
if (created) setshape 1,32,32;
if (actiontest) {
if (strtofloat(#p(0)) == id) // So that it is received only by this NPC.
message received - #p(1);
}


Luigi1 12-07-2003 08:06 PM

If you test it offline, it works, because in offline mode, it doesn't care at all about clientside and serverside. Basically, the entire thing is "clientside" (although I do believe with() works in offline mode, from what I've heard). However, if you test in online mode, it does not.

Anyway, I got it to work by setting client. strings to everyone on the server (and they get deleted by the NPC when it changes that to the this. string)


All times are GMT +2. The time now is 07:49 AM.

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