Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-29-2013, 04:33 PM
brokk brokk is offline
Registered User
Join Date: May 2012
Posts: 84
brokk is on a distinguished road
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?
__________________
No matter how much I hate graal, I'm always coming back.

smh
Reply With Quote
  #2  
Old 04-29-2013, 04:50 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
I am very confused about what you're trying to do.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #3  
Old 04-29-2013, 07:42 PM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
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.
Reply With Quote
  #4  
Old 04-30-2013, 02:43 PM
brokk brokk is offline
Registered User
Join Date: May 2012
Posts: 84
brokk is on a distinguished road
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.
__________________
No matter how much I hate graal, I'm always coming back.

smh
Reply With Quote
  #5  
Old 04-30-2013, 09:18 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #6  
Old 05-02-2013, 12:57 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
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.
Reply With Quote
  #7  
Old 05-02-2013, 02:13 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by devilsknite1 View Post
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.
__________________
Reply With Quote
  #8  
Old 05-02-2013, 04:12 PM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:27 PM.


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