Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-15-2009, 08:22 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Finding Killer

Is there a way to find, if a player dies, who killed the player?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 09-15-2009, 02:42 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
No. You will have to code something yourself.
Reply With Quote
  #3  
Old 09-15-2009, 03:50 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Would be helpful if there was a reference to the object of the PKer passed or something D:
Reply With Quote
  #4  
Old 09-15-2009, 08:13 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Use triggerAction() to send the account information of the player hurting another player to the player getting hurt then whenever that player dies, simply read the account sent for the person that last hit him to read who he was killed by.
Reply With Quote
  #5  
Old 09-15-2009, 08:19 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
If you're using default? Not really. If you're persistent, you can add a weapon that duplicates default HD without the actual HD, and simply use it to detect who is hitting you.
Reply With Quote
  #6  
Old 09-15-2009, 09:20 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I was wondering this myself when I was making a Classic-Mode for Zodiac CTF.

Stefan should/could add an event on the serverside, I'd imagine this wouldn't be that hard because the server already handles the adding of player.kills + player.deaths.

function onPlayerKilled(killer_obj) { }
__________________
Quote:
Reply With Quote
  #7  
Old 09-16-2009, 10:59 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
I found this, and figured I could use this idea except instead of using onweaponfired, use onkeydown, keypress = "s". Although, if someone wouldnt mind helping sort through this to get to just the part that has to deal with the radius of the player, and marking who the player killed... xD

http://forums.graalonline.com/forums...ad.php?t=68271
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #8  
Old 09-16-2009, 04:12 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by sssssssssss View Post
I found this, and figured I could use this idea except instead of using onweaponfired, use onkeydown, keypress = "s". Although, if someone wouldnt mind helping sort through this to get to just the part that has to deal with the radius of the player, and marking who the player killed... xD

http://forums.graalonline.com/forums...ad.php?t=68271

Don't check if the player presses the 's' key, use the keydown() value just in case the player alters their default control configuration (via the F3 menu).


Also, what I said a few posts above still holds merit. Send a triggerAction() when the player swings their sword and have whoever they hit catch the action and work from there.
Reply With Quote
  #9  
Old 09-16-2009, 05:16 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by Gambet View Post
Don't check if the player presses the 's' key, use the keydown() value just in case the player alters their default control configuration (via the F3 menu).


Also, what I said a few posts above still holds merit. Send a triggerAction() when the player swings their sword and have whoever they hit catch the action and work from there.
I would rather use onKeyPressed and compare the keyname with the keyname(#) function, then running a constant timeout checking for keydown(#).

Good:
PHP Code:
function onKeyPressed(keynamekeycode)
{
  
// keyname(6) checks if the Grab button is pressed, default A on Qwerty.
  
if (keyname == keyname(6).lower()) {
    
// stuff
  
}


Bad:
PHP Code:
function onCreated()
  
setTimer(.05);

function 
onTimeOut()
{
  
// keydown(6) checks if the Grab button is pressed, default A on Qwerty.
  
if (keydown(6)) {
    
// stuff
  
}
  
setTimer(.05);

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #10  
Old 09-16-2009, 05:38 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I figure that:

PHP Code:
function onKeyPressed() {
  if (
keydown(6)) {

  }

Would suffice as well.
__________________
Quote:
Reply With Quote
  #11  
Old 09-16-2009, 05:53 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by fowlplay4 View Post
I figure that:

PHP Code:
function onKeyPressed() {
  if (
keydown(6)) {

  }

Would suffice as well.
I don't know why, but I prefer:

PHP Code:
function GraalControl.onKeyDown() {
  if (
keydown(6)) {
    ...
  }

Reply With Quote
  #12  
Old 09-16-2009, 07:00 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Quote:
Originally Posted by Gambet View Post
Also, what I said a few posts above still holds merit. Send a triggerAction() when the player swings their sword and have whoever they hit catch the action and work from there.
Thats the problem im having, dont know how to find who hit/killed the player. Have no idea where to even start.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #13  
Old 09-16-2009, 07:02 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Theoretically we could add an event for it, something like onPlayerKilled or so. Right now the only way to detect would be to check if the kills increased, although that doesn't tell you who killed who.
Reply With Quote
  #14  
Old 09-16-2009, 07:03 PM
Liberated Liberated is offline
not doing alot
Liberated's Avatar
Join Date: Feb 2008
Posts: 1,366
Liberated has a spectacular aura about
Quote:
Originally Posted by Stefan View Post
Theoretically we could add an event for it, something like onPlayerKilled or so. Right now the only way to detect would be to check if the kills increased, although that doesn't tell you who killed who.
how does era do it then?

edit, nvm i understand thats the only way to do it inside an event.
__________________
Quote:
Originally Posted by Tigairius View Post
I promise when I get rich I'll send you an iPhone. I'll send everyone an iPhone.
Reply With Quote
  #15  
Old 09-16-2009, 07:16 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
Theoretically we could add an event for it, something like onPlayerKilled or so. Right now the only way to detect would be to check if the kills increased, although that doesn't tell you who killed who.
Actually, emulating the default hit detection works as well. It won't replace the default systems though, it'll be there just to check if you hit a player, and if so, set some kind of last attacker flag on him.


Quote:
Originally Posted by Liberated View Post
how does era do it then?
Custom system
Reply With Quote
Reply


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 06:31 PM.


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