Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-05-2010, 03:37 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Serverside/Clientside problems

Okay, i have two scripts that this has affected so far. One is a damage text script that creates particles. i have it in a gani yet the text will only show if you are the one who get's damaged. but only for the person who was damaged.
example: person A hits person B. person B sees damage text. person A does not.

Secondly I have a weapon that spawns daggers to move around you. problem is, it suffers a similar problem.
player A uses the item. the daggers are rotating around player A. (correct)
to player B, the daggers are rotating around player B, and not player A. (incorrect)

I'm trying to combat this by replacing the player.x and player.y's with variables taken from the npcdropper.

Problem is, the stupid class can only read this.dropper from the serverside. and i cant seem to send that data over to the clientside with triggeraction nor triggerclient. (wtf? )

So any tips on the gani? and what command should i be using for the class to send the data over from server to client?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 08-16-2010, 01:26 AM
dereklarue dereklarue is offline
PurplePeopleEater
Join Date: Aug 2007
Location: Mi
Posts: 32
dereklarue is on a distinguished road
Send a message via AIM to dereklarue Send a message via Yahoo to dereklarue
Quote:
Originally Posted by Jiroxys7 View Post
So any tips on the gani? and what command should i be using for the class to send the data over from server to client?
I don't think you can send data to client side in a class, at least for all i know.
The join function only goes one way, from A to B, not B to A. 'A' being a player weapon and 'B' being a class. When sending data over to a class, be sure to send everything needed. You could add a Clientside part to the class and use a trigger.
Reply With Quote
  #3  
Old 08-16-2010, 02:46 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
in a class the only way I really know of sending data across the client-server barrier is setting vars to attr[ #] and checking on the other side for that attr

EDIT: I also remember Invern making a pretty good function pack for communicating across the barrier.
Here's the link Client <-> Serverside Function Caller
Maybe this can help you a bit, it's helped me before.
Reply With Quote
  #4  
Old 08-16-2010, 04:49 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Your problem is that the particles/images are on the client side, not the server side. To make everyone able to see them you need to make a Gani script.
Ex:
PHP Code:
GANI0001

LOOP
CONTINUOUS
DEFAULTATTR1 hat0
.png
DEFAULTHEAD head19
.png
DEFAULTBODY body
.png

SCRIPT
function onPlayerEnters() {
  
drawImages();
}
function 
drawImages() {
  
// yada yada
}
SCRIPTEND

ANI
ANIEND 
Also, classes themselves can't trigger the client from the server if not joined by a weapon.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #5  
Old 09-15-2010, 11:44 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by MrOmega View Post
in a class the only way I really know of sending data across the client-server barrier is setting vars to attr[ #] and checking on the other side for that attr

EDIT: I also remember Invern making a pretty good function pack for communicating across the barrier.
Here's the link Client <-> Serverside Function Caller
Maybe this can help you a bit, it's helped me before.
Been trying to get the thing working for an hour. I've tried it before with no luck. And this time around it still won't work for me. even following Chompy's 'guide' didnt work (unless I need the class triggercontrol, which, if this is the case, i dont have because it isnt posted on there anyway)

Why can't Stefan allow triggerclient and triggerserver in classes anyway?
This is giving me a headache..
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #6  
Old 09-15-2010, 11:49 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Jiroxys7 View Post
Why can't Stefan allow triggerclient and triggerserver in classes anyway?
This is giving me a headache..
You are talking about classes like they are something that they aren't. A class in GScript is essentially an include; you can join a class to a weapon, in which case the class code will work like it's in a weapon, or you can join a class to an NPC, in which case the class code will work like it's in an NPC.

When joining to a weapon you can triggerclient and triggerserver normally, even from inside the class (like triggerserver("gui", this.name, …)). When joining to an NPC of some kind you probably want more to send triggeractions onto the NPC's coordinates.
__________________
Skyld
Reply With Quote
  #7  
Old 09-16-2010, 12:14 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Anywho, I'm now trying to work on a simplified version of inverness' workaround in which you can join the class to a weapon (that every player will have), then trigger a public function in the weapon while sending over some params, use triggerclient/server on itself, sending over the params, then triggering a public function in the class, sending over the params.

but when the weapon hits the triggerclient part, i immediately get a callstack overrun error. I have no clue what that is supposed to mean. any tips on what causes this?

Also @ Skyld, It really doesn't seem like it would be too hard to achieve. Especially knowing that it's possible to do a hackaround, a similar effect should be able to be hardcoded into graal.

edit: and triggeraction doesnt seem to work like this (i must be doing something wrong. what it is, i have no clue) and I'm really just trying to get the name of the account that put the npc. I dont get why that needs to be sent through a bajillion different scripts to get
__________________
MY POSTS ARE PRONE TO EDITS!

Last edited by Jiroxys7; 09-16-2010 at 12:30 AM..
Reply With Quote
  #8  
Old 09-16-2010, 12:47 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Basic client -> server interaction for a level NPC.

PHP Code:
function onCreated() {
  
// Gives the triggeraction something to hit on the server-side
  
this.setshape(13232);
}

function 
onActionExample(npcid) {
  if (
params[0] == npcid) {
    
this.chat "Trigger received from" SPC player.account "!";
  }
}

//#CLIENTSIDE

function onPlayerChats() {
  if (
player.chat == "example"triggerExample();
}

function 
triggerExample() {
  
triggeraction(this.1this.1"Example"this.id);

I've never had a reason to send a message back to the level NPC specifically though, your code can probably re-factored or sent directly to the Weapon NPC via triggerclient that needs the information from the server.
__________________
Quote:
Reply With Quote
  #9  
Old 09-16-2010, 01:04 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
I'm actually trying to send a param server -> client. I think it was cbk that got me into the habit of putting npc.dropper = player.account; after my putnpc2's. The problem is, this.dropper can only be read from the clientside. and since I have my damage system and stat system on the clientside (so i can loop them faster without bogging down the npcserver and whatnot), when the damage near the npc is dealt, since it has to read from the npc dropper's stats, i need to send that player's account name though the clientside portion of the script. (in fact, when i first tried this, i was reading client.vars when it dealt damage, just to find out that it was reading off of each individual player's stats. causing players to receive a very wide variety of damage)

I really dont see why the npcdropper can't be automatically placed in the npc's variables when it's created on both the client and on the serverside portion of it.


but I digress.. I tried to invert that script so it goes server -> client but it didnt seem to work. I'm going to keep trying though. but just to make sure, triggeraction can trigger clientside functions too right? (Hoping the answer is yes because if not...)

edit: if not, maybe i could just move the damage triggers in the npc over to the serverside, then copy part of the damage portion of my weapon script onto the serverside. and then send over the data to the client from there.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #10  
Old 09-16-2010, 01:56 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
The additional trigger required to make your system run properly pretty much nullifies the efficiency bonus (if there actually is one) of having it processed on the client. So yes you should have the onActionDamage in the server-side portion.
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:26 PM.


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