Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Retrieving another player's variables within a clientside loop.. (https://forums.graalonline.com/forums/showthread.php?t=134267837)

Jiroxys7 02-03-2013 03:49 AM

Retrieving another player's variables within a clientside loop..
 
So I'm working on a script where I need to get an attacking player's stats. The problem is, it doesn't seem like I have a choice but to figure out some way to get this information from within a clientside for loop. Is there any way to get this information? doing a triggerserver() with a return <data>; on the other end doesn't seem to be possible. And while findplayer(acct) works, only player.vars are accessible.

Are there any workarounds? or is this some kind of hopeless endeavor?

cbk1994 02-03-2013 04:00 AM

You can't access arbitrary variables (e.g. clientr) of another player on clientside. That would require an enormous amount of data to be constantly synced to every player on the server (or at least in the same level).

Without knowing what your end goal is (would it make sense to do this stuff serverside?), you can always store the data you need in players' "attr" arrays. Those are accessible by other players in the same level (globally if you configure it in server options), although there are restrictions on the amount and format of data you can store.

If you want to ask the server explicitly for the data, you can use triggerServer, but instead of using "return" to send back data, you use triggerClient. There are some examples [here](http://forums.graalonline.com/forums...17&postcount=4).

Jiroxys7 02-03-2013 04:15 AM

Quote:

Originally Posted by cbk1994 (Post 1713111)
You can't access arbitrary variables (e.g. clientr) of another player on clientside. That would require an enormous amount of data to be constantly synced to every player on the server (or at least in the same level).

Without knowing what your end goal is (would it make sense to do this stuff serverside?), you can always store the data you need in players' "attr" arrays. Those are accessible by other players in the same level (globally if you configure it in server options), although there are restrictions on the amount and format of data you can store.

If you want to ask the server explicitly for the data, you can use triggerServer, but instead of using "return" to send back data, you use triggerClient. There are some examples [here](http://forums.graalonline.com/forums...17&postcount=4).

Well I'm working on Zodiac's server, and this particular script plays a pretty major role. I can't exactly go changing everything up without everything breaking. I usually do the triggerserver -> triggerclient thing for stuff like this, but considering this is in a loop, which is triggered by another player's attack, means that I need to have some way to get this variable without leaving the loop. Unless there's a way to stop the loop where it is, access that information, and then resume the loop, the effect would only kick in after the next player attacks. >_<

Quote:

Originally Posted by cbk1994 (Post 1713111)
That would require an enormous amount of data to be constantly synced to every player on the server (or at least in the same level).

I mean like something that's accessed only when it's called for. e.g. temp.thing = findplayer("Dude").client.stuff; would basically do it's own triggerserver to determine the variable, then go back to the client again to set temp.thing. wouldn't that be feasible? I recall something like that being possible in one of the C languages.

cbk1994 02-03-2013 05:41 AM

Sounds like the attr solution would work fine for you.

Quote:

Originally Posted by Jiroxys7 (Post 1713114)
but considering this is in a loop, which is triggered by another player's attack

Why not just send the data whenever you're letting the player know they've been attacked?

Quote:

I mean like something that's accessed only when it's called for. e.g. temp.thing = findplayer("Dude").client.stuff; would basically do it's own triggerserver to determine the variable, then go back to the client again to set temp.thing. wouldn't that be feasible? I recall something like that being possible in one of the C languages.
You could rig something up but it would probably be impractical due to high latency.


All times are GMT +2. The time now is 01:20 AM.

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