Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Do triggerserver() And onActionServerSide work in a class? (https://forums.graalonline.com/forums/showthread.php?t=134257661)

Liberated 01-14-2010 09:37 PM

Do triggerserver() And onActionServerSide work in a class?
 
I made a class, first time i used classes, and in the end it also appeared to be a totally out of the way of achieving what i wanted.
But the reason i gave up on my class, and used a weapon, was because i couldn't get my triggerserver to work in the class, and im 100% positive that it was the triggerserver, or onActionServerside that wasn't working, because in the function that i had the triggerserver, i made my player say something, and he said it, if i pasted it in any part of the onActionServerSide, he didn't say anything.

Crow 01-14-2010 09:44 PM

Yes and no, to answer the question in the thread title. Classes can also be joined to weapons, so theoretically, it works in classes. But it doesn't in level NPCs. You will have to do something along the lines of this:

PHP Code:

function onActionExample()
  echo(
"I was triggered on the serverside!");

function 
onCreated()
  
setShape(13232);

//#CLIENTSIDE
function onCreated() {
  
setShape(13232);
  
triggerAction(this.xthis.y"Example"nil);


There are important things to note though:
- you need a shape on the serverside (I usually add the same on the clientside too)
- the action may not be named "Serverside" or "Clientside", that won't work

DustyPorViva 01-14-2010 09:54 PM

^ Such a method is unreliable in certain circumstances, it should be noted. Triggeraction triggers the first NPC it 'finds', so if there is an NPC on top of the class it will capture the triggeraction, even if it doesn't do anything with it, and essentially break the NPC that was relying on it.

Admins 01-15-2010 02:23 AM

onActionServerSide should work fine in classes.

coreys 01-15-2010 08:55 AM

Quote:

Originally Posted by Stefan (Post 1550484)
onActionServerSide should work fine in classes.

Surely you've noticed that serverside/clientside triggers don't work most of the time in classes...?

Oddly enough, it seems to just get worse over the years, maybe with each release, I'm unsure. I remember it used to work just fine. Now it almost never does.

Liberated 01-15-2010 10:10 AM

I've made a NPC in a level, a sign in this case, and all it does is connect to the class, then in the class i have both the triggerserver, and the onactionserverside.
I wasn't even sure if i was making the right use of classes tho, never used them before.

cbk1994 01-15-2010 01:43 PM

Quote:

Originally Posted by coreys (Post 1550512)
Surely you've noticed that serverside/clientside triggers don't work most of the time in classes...?

Oddly enough, it seems to just get worse over the years, maybe with each release, I'm unsure. I remember it used to work just fine. Now it almost never does.

He's probably referring to weapon scripts, where classes will always work.

Admins 01-15-2010 04:07 PM

I've had problems with onActionClientSide in a class at some point but it was more a problem of the clientside part not loaded yet.

xXziroXx 01-15-2010 04:59 PM

Quote:

Originally Posted by Stefan (Post 1550534)
I've had problems with onActionClientSide in a class at some point but it was more a problem of the clientside part not loaded yet.

The clientside part stops loading script updates to classes after a certain amount of time/updates (cause unknown) and won't fetch the new updates until you relog, or in some cases, restart the client.

cbk1994 01-15-2010 11:02 PM

Quote:

Originally Posted by xXziroXx (Post 1550537)
The clientside part stops loading script updates to classes after a certain amount of time/updates (cause unknown) and won't fetch the new updates until you relog, or in some cases, restart the client.

I've only noticed this with classes joined to the player (where it always seems to happen). Does it happen with other classes :o?

xXziroXx 01-15-2010 11:18 PM

Quote:

Originally Posted by cbk1994 (Post 1550567)
I've only noticed this with classes joined to the player (where it always seems to happen). Does it happen with other classes :o?

To my knowledge, no. Only classes joined to the player. Sometimes you can update a script indefinite amount of times and the client will recognize so, but sometimes you can update it three, two or even one time and the client won't know you did a thing to the script. Seems completely random to me.

coreys 01-16-2010 11:45 PM

Well, all I know is that triggering between client/server in level npcs with classes almost never works anymore.

Jiroxys7 02-25-2011 02:31 AM

Quote:

Originally Posted by Stefan (Post 1550534)
I've had problems with onActionClientSide in a class at some point but it was more a problem of the clientside part not loaded yet.

sorry to bump such an old thread, but will this whole thing be fixed? I could really use a triggerclient on my class!

cbk1994 02-25-2011 02:37 AM

Quote:

Originally Posted by Jiroxys7 (Post 1633152)
sorry to bump such an old thread, but will this whole thing be fixed? I could really use a triggerclient on my class!

What exactly are you trying to do? You can use triggerClient to trigger a weapon and catch the onActionClientside event, you just need to understand that you can't trigger a class itself. You have to trigger the weapon which the class is joined to.

Jiroxys7 02-25-2011 03:34 PM

Quote:

Originally Posted by cbk1994 (Post 1633154)
What exactly are you trying to do? You can use triggerClient to trigger a weapon and catch the onActionClientside event, you just need to understand that you can't trigger a class itself. You have to trigger the weapon which the class is joined to.

I have a weapon that puts an npc (which uses the class as it's script) that emits particles that obscure vision. I want it so it can pass the this.dropper variable over to the clientside so I can make the alpha much lower for the person who dropped it. I have a feeling that something could bug out if I tried joining it to the weapon that holds the skill script.


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

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