![]() |
Triggering Functions on other Players
I'm looking to trigger an action on another player for the combat system I am making.
How do I trigger the hurt function in the other player. (Need help where the // is) -system/hurt PHP Code:
PHP Code:
Is triggering a serverside function in an NPC similar to triggering another player? I need to trigger the onHurt() with the baddies too. |
To trigger back the clientside, you can do
player.triggerClient("gui", weaponNameHere, "parameter", "parameter", ...) then on the clientside part you can have something like PHP Code:
PHP Code:
|
Quote:
So essentially, I don't even need to trigger serverside to trigger a clientside function in another player? |
Quote:
(I think I recall Stefan adding a better way to find players in a certain radius/area? The forums search isn't working as usual so not sure) Quote:
The approach you were using before avoids all of those and gives you much more flexibility (for example, instead of point attacks which are very limited you are free to use your own attack radii, or even special attack patterns for different weapons). You also get the benefit of handling things serverside which is inherently more reliable. edit: I read callimuc's post wrong, he was only talking about for NPCs. You can use point triggers for that but they are still very unreliable. A preferred solution would be to handle NPCs the same way as players (loop through them and use the same attack/hitbox logic; use something like npc.trigger("hurt", player, damage); to call onHurt in an NPC). |
Quote:
Scripthelp: TServerLevel.findareaplayers(float, float, float, float) - returns object - returns an array of all players in the specified rectangle (x,y,width,height), uses the blocking rectangle of players (0.5,1,2,2) instead of (0,0) Quote:
|
| All times are GMT +2. The time now is 05:24 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.