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 10-29-2012, 07:15 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Detecting if a player has been hit by another player?

Hey. Is there a function to check if a player has been hit by another player's sword? I can't seem to find one of the forums or on the wiki.
Reply With Quote
  #2  
Old 10-30-2012, 08:03 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
function onWasHit isn't it? I've not done classic systems for a while
__________________
Reply With Quote
  #3  
Old 10-30-2012, 08:14 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
Last time I tried, onWasHit() does not work on GMAPs.
__________________
Reply With Quote
  #4  
Old 10-30-2012, 08:50 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
onWasHit() doesn't do it
Reply With Quote
  #5  
Old 10-30-2012, 08:55 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
Pretty sure there is a serverside function like onplayerhurt() that now returns who/what hurt the player. I just don't know the exact name.
Reply With Quote
  #6  
Old 10-30-2012, 09:52 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
i think player.hurted returns a boolean if the player has been hurt or not
__________________
MEEP!
Reply With Quote
  #7  
Old 10-30-2012, 11:23 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
sounds pretty easy to do if it does't already exist! i also thought it was the "onwaShit" function.
__________________
Reply With Quote
  #8  
Old 11-01-2012, 07:39 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
If you didn't find a Clientside solution yet and onWasHit is being invoked by all forms of damage, you could try:

PHP Code:
function onWasHit(){
  
//receive original x and y from before first frame of recoil movement
  
temp.player.player.hurtdx;
  
temp.player.player.hurtdy;
  
temp.plist findnearestplayers(temp.xtemp.y);
  for(
temp.pl temp.plist){
    if(
temp.pl.ani.name == "sword"){
      
temp.bx temp.pl.0.5 + (vecx(temp.pl.dir) * 2);
      
temp.by temp.pl.+ (vecy(temp.pl.dir) * 2);
      if(
        
temp.0.5 <= temp.bx &&
        
temp.2.5 >= temp.bx &&
        
temp.<= temp.by &&
        
temp.>= temp.by
      
){
        
this.playerSlashed(temp.pl);
        return;
      }
    }
  }

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 10:10 AM.


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