![]() |
player to player interaction
How would I make it so the actions of one player trigger someone elses? For example if a player fires a weapon all players within a 8x4 area of the players direction are effected.(like being hit by a sword).
Another example would be a slap item that causes the player next to the player that uses the weapon to say "owww, that hurt!" I understand there are projectile functions, but I want to know the best way to immediatly effect the players within a certain area. |
I am not sure if there is an equivalent of getareanpcs( x,y,width,height ) to get players. One way to accomplish what you want is to loop through the players object. Test each player's coordinates to determine whether they are inside your rectangle.
|
PHP Code:
|
I imagine you ask for the slap example because of UN's, the way UN's works is by using a triggeraction. The other player then receives the triggeraction and handles it to change ani
|
Quote:
You should also use allplayers.size() rather than allplayerscount as it makes no sense to use the latter. I would recommend using a foreach loop. PHP Code:
|
tirggeraction sounds about right
|
Quote:
Best plan of action would be to... 1. Loop through the players on clientside and check if they're in the '8x4' section 2. Send the list of players in the section to the server-side 3. Double-check that they're in the square (perhaps with some leniency) 4. Triggerclient each person in the square, or even just change their animation and chat if that's all that's necessary. It looks like this: PHP Code:
|
Quote:
your right, i'm sorry. :) |
| All times are GMT +2. The time now is 02:39 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.