![]() |
player.join and triggeraction?
I am curious as to how I would use a triggeraction to trigger an action in a joined class? Or is this not possible?
Class: PHP Code:
PHP Code:
|
Quote:
I'd suggest moving the "onActionHurt" into a weapon, but then simply calling a player.injured() or whatever in it's place within the class once recieved. |
It is usually best to do the entire thing serverside
PHP Code:
PHP Code:
However, if you choose to do it clientside, you will need a weapon to intercept the trigger. Once you intercept it clientside in a weapon, you will need to trigger serverside again in that weapon then call the player function as player.hearts can't be modified clientside. |
Quote:
I think the hearts variable can -falsely- be modified Clientside albeit for the illusion of no delay, which should be done along side the setting of the Gani, but yes hearts should definately be modified serverside either way. (Edit: having tested it seemed hearts had saved having set a new value Clientside and reconnected) |
I join a damage class script to the weapon (not the player), and just make sure both players have the weapon, then it works fine.
|
Revised. Still not working.
PHP Code:
|
Quote:
PHP Code:
Clientside is code that is ran directly on the players computer. This allows you to create effects, show images for only that player (including things like health interfaces), do things when the player presses a key, etc. The benefit to clientside code is that there is no delay between when the player tries to do something and when it happens. For example, if you had a clientside punching system, they would immediately see the punch. The disadvantage to clientside code is that it is run on the player's computer, and therefore it can be modified to some degree. It is very easy to disable onwall checks in a clientside movement system, for example. Because clientside code is local, it can't communicate with other players. Serverside is code that is ran on the NPC-server. This allows you to create solid systems that can interact with every player. An example of serverside code would be a "monster" like on GK which runs serverside and sends back the updates such as position, GANI, and so on, where it is displayed clientside. The advantage to serverside scripting is that it is secure and can't be tampered with by any player. You can also communicate with other players. The disadvantage is that there is a "lag" time between when the user does something and when it happens, depending on the player's internet connection. To communicate between the two you have to use things called triggers. There's a pretty good explanation of those in this thread. |
Thank you ckb. And the part you didnt understand was just some checks. Basically im using a system to check if a key is pressed or not. "this.keyb_" then the keychar. because tab+key seems to break alot of scripts under windows (not on linux from what i experienced).
Problem I am having now is you do not even have ot be remotly close to players to hit them.. and my sword seems to popoyt when i swing now. this did not happen before tho =/ Also, freezeplayer() no longer works. Possible because its being used serverside. Quote:
|
Little note about onCreated() on the server-side in weapon scripts, it is called when the server starts up too, not just when it's updated.
|
How inaccurate is it? Right not it's just using the player's x and y instead of the attack x/y, but if it's like a 10 tile difference, that's obviously not it.
|
i dont think its checking x/y at all. I mean were talking 64 tile difference in this level :o
No further need to reply.. i have fired myself from all development servers (except testbed) and devborn2kill.. didnt have rights to fully remove all my rights (ironic i know) |
Well, in case anybody was wondering, the problem was this line:
PHP Code:
PHP Code:
|
| All times are GMT +2. The time now is 05:02 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.