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 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
  #16  
Old 09-16-2009, 07:27 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
How do you check to see if the players kills increased? That would be sufficient for what Im doing possibly.

Also, stefan, adding an even for that would probably be very very helpful to the entire graal community.
__________________
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
  #17  
Old 09-16-2009, 07:38 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
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.
It'd be better to pass who has last hit the player(though I'm not objecting to passing also who last killed the player).
Reply With Quote
  #18  
Old 09-16-2009, 07:42 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
I would personally think if you were looking for who killed a player, better to pass through who killed it, rather than checking the hit each time to see if the player died.
__________________
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
  #19  
Old 09-16-2009, 07:48 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
Quote:
Originally Posted by sssssssssss View Post
I would personally think if you were looking for who killed a player, better to pass through who killed it, rather than checking the hit each time to see if the player died.
But sometimes it'd be nice to check who hit a player. Therefor, you can kill two birds with one stone by checking when the player dies who last killed them(which undoubtfully would be the last player who hit them). Like I said though, I wouldn't be against both. Default needs more support like this.
Reply With Quote
  #20  
Old 09-16-2009, 09:13 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 sssssssssss View Post
How do you check to see if the players kills increased? That would be sufficient for what Im doing possibly.

anyone?
__________________
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
  #21  
Old 09-16-2009, 09:26 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 sssssssssss View Post
anyone?
Loop?
Reply With Quote
  #22  
Old 09-16-2009, 11:19 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
It's not hard to detect who you were killed by if your bow and bomb (unless you use putbomb) have custom scripts for compatibility with gmaps.

I'd imagine if you had a function to find the closest player with the sword animation within range when you the player dies, that would pretty much pinpoint the killer, but it's not a perfect detection method and could produce false positives.

I.e:

PHP Code:
//#CLIENTSIDE
function onPlayerDies() {
  
// Find closest player with sword animation
  // Other Script..

__________________
Quote:
Reply With Quote
  #23  
Old 09-17-2009, 01:45 AM
Deeek Deeek is offline
o_O
Deeek's Avatar
Join Date: Jul 2008
Location: Freeburg, Missouri
Posts: 167
Deeek will become famous soon enough
Does onWasH!t() return any useful parameters?
Edit: WOW, censorship FTL
__________________
God grant me the serenity to accept the things I cannot change, the courage to change the things I can... and the wisdom to know the difference.

Last edited by Deeek; 09-17-2009 at 01:46 AM.. Reason: WOW, censorship FTL
Reply With Quote
  #24  
Old 09-17-2009, 09:45 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
For playerhurt, does this still apply in gs2?

Quote:
when the player is hurt then you can detect that in
scripts by doing if (playerhurt) ...
you can read the variable playerhurtpower to get
the amount of power that the player lost


new npc script variables playerhurtdx and playerhurtdy when the
player is hurt (otherwise they are 0)
Because if so, you could use a simple code in the weapon every single player has that reads if the player gets hurt and player.hearts==0, or use onPlayerDies(), then go to a
Quote:
findnearestplayer(float1, float2)
since the person who hurt the player SHOULD be closest.

Would that work? Am I correct? Or is my logic wrong?
__________________
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
  #25  
Old 09-17-2009, 02:31 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by sssssssssss View Post
since the person who hurt the player SHOULD be closest.

Would that work? Am I correct? Or is my logic wrong?
What if you get killed over range or if you are grouped by several players? (:
__________________
Reply With Quote
  #26  
Old 09-17-2009, 04:14 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
Ok, well again I ask if anyone knows how to see if the players kils increase? Wouldn't even know what variable to use for that.
__________________
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
  #27  
Old 09-17-2009, 06:02 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by sssssssssss View Post
Ok, well again I ask if anyone knows how to see if the players kils increase? Wouldn't even know what variable to use for that.
player.kills

you could shove it in a timeout in the clientside and send a triggeraction to the server whenever it increases, but it seems messy and likely to fail to me.
Reply With Quote
  #28  
Old 09-19-2009, 02:46 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
onPlayerDies() is only clientside correct? or can it be serverside?
__________________
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
  #29  
Old 09-19-2009, 03:05 AM
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
Quote:
Originally Posted by sssssssssss View Post
onPlayerDies() is only clientside correct? or can it be serverside?
Try it and find out :P
__________________
Quote:
Reply With Quote
  #30  
Old 09-19-2009, 05: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
detects clientside
__________________
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
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 01:48 PM.


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