Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Damage Blocks (https://forums.graalonline.com/forums/showthread.php?t=134268146)

brokk 04-29-2013 04:33 PM

Damage Blocks
 
Trigger functions from the player to the player directly to the NPC is easy.
So if the player "swings" it triggers damage on the baddie.

But damaging another player is a different story.

So why not knock out 2 birds with 1 stone?

I want to make "Damage Blocks"....
So when player swings it creates a temp npc and it triggers functions for both players and npcs.

For the players...I could simply do a onPlayerTouchsMe(), but how do I add collision between 2 NPCS?

xXziroXx 04-29-2013 04:50 PM

I am very confused about what you're trying to do.

devilsknite1 04-29-2013 07:42 PM

You can do it that way using a distance formula I guess, but that's probably a bit inefficient. Why not just trigger from a specific location?
PHP Code:

// in front of the player
temp.locations = { player.+ ( vecxplayer.dir ) * ) + 1.1player.+ ( vecyplayer.dir ) * ) + 1.1 };
// trigger in front of the player to an action in NPCs/players
triggerActiontemp.locations], temp.locations], "action to hit the player/npc"parameters ); 

Something similar could be done for NPC -> NPC interaction as well I suppose.

brokk 04-30-2013 02:43 PM

How do you make a player trigger a function in another player?

For example...

PHP Code:

//#CLIENTSIDE
function onKeyPressed(codekey)
{
 if (
key == "s")
 {
  
//Trigger function in this weapon/ in player in this y, and x range
  
}
 } 

I though about it and the "damage block" idea was more complex then I thought. So I'm sticking with triggering a function for both the NPC and player in seperate lines.

cbk1994 04-30-2013 09:18 PM

Generally I prefer to handle that stuff serverside because it's a lot more reliable (i.e. trigger serverside with the attack position, then find out what players have been hit and trigger clientside for them letting them know they've been hit).

Your other main option is to do a trigger like devilsknite1 showed above. It will call onActionWhatever (where "whatever" is the action type) in every clientside weapon that player has.

devilsknite1 05-02-2013 12:57 AM

Could players manipulate sent information to the server that way? And if many players were doing that at the same time, would that cause any lag? I mean it would be smaller edits so I wouldn't imagine, but if that was how larger servers like Era functioned, it might get pretty laggy.

cbk1994 05-02-2013 02:13 AM

Quote:

Originally Posted by devilsknite1 (Post 1717261)
Could players manipulate sent information to the server that way? And if many players were doing that at the same time, would that cause any lag? I mean it would be smaller edits so I wouldn't imagine, but if that was how larger servers like Era functioned, it might get pretty laggy.

That is how Era functions, and it works just fine.

devilsknite1 05-02-2013 04:12 PM

I suppose, but seems a little unreasonable when you can update all the information clientside, eliminating the need to do anything serverside. Would allow for a better projectile system too, unless the point is to run away from bullets :O


All times are GMT +2. The time now is 02:11 AM.

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