Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Request: onPlayerHurt() (https://forums.graalonline.com/forums/showthread.php?t=73750)

Chandler 04-29-2007 08:43 PM

Request: onPlayerHurt()
 
Since all the default damage is done by this one thing, would it be possible to detect what called it?

HTML Code:

function onPlayerHurt(damageType)
{
  player.chat = temp.damageType;
}

Currently returns "0", however, wouldn't it be great if you could find out what called it?
Such as an explosion, the player being hit by a default projectile [arrow, bush, fireball etc].

Wouldn't it be cool, thanks!!

Chompy 04-29-2007 10:13 PM

Sounds interesting, could be nice for some classic servers :o

Tyhm 04-29-2007 10:29 PM

Agreed.

Maybe even like the Java Main function, where there is an array of arguments which you may or may not use...like, hurt 0,32,32,0.314,Tyhm; for "By a bush, impact at 32,32, direction of travel was 0.314 radians, owned by #a=Tyhm". So your script ignores all the arguments you do not (for some reason I lost my apostrophe) need...

(Totally wants to play jump&run now)

Chandler 05-03-2007 06:24 PM

Totally. :D

Gambet 05-03-2007 09:03 PM

You could script a custom like this, though it would be much easier to just have Stefan do all the work :rolleyes:

Tyhm 05-03-2007 09:14 PM

It's ALWAYS easier to have Stefan do all the work. It's the only way anyone can be sure the fixes will be compatible two versions down the road, and as efficient as they can be; if we script something clever where the shrubbery last thrown set a local level-wide variable, and whoever or whatever got hit checks the local level-wide variable, what happens if somebody else throws a vase and hits someone else before the first one drops? What happens if vase2 lands after bush1? Do we set up an array of level-side strings? Do we then have to check each one to match up "Okay, the vase wouldn't have hit him all the way down there, so it must have been the shrubbery"?

Much more efficient if it's just In The Default.

DustyPorViva 05-03-2007 10:16 PM

I think the problem is having to redo the whole hit system just to pass a few parameters.
... and I could of sworn I posted in here before... where did my post go.

Gambet 05-03-2007 10:42 PM

Quote:

Originally Posted by Tyhm (Post 1305292)
It's ALWAYS easier to have Stefan do all the work. It's the only way anyone can be sure the fixes will be compatible two versions down the road, and as efficient as they can be; if we script something clever where the shrubbery last thrown set a local level-wide variable, and whoever or whatever got hit checks the local level-wide variable, what happens if somebody else throws a vase and hits someone else before the first one drops? What happens if vase2 lands after bush1? Do we set up an array of level-side strings? Do we then have to check each one to match up "Okay, the vase wouldn't have hit him all the way down there, so it must have been the shrubbery"?

Much more efficient if it's just In The Default.



Do you think Stefan just presses a button and the command magically appears? He has to script it ya know x-x

cbk1994 05-04-2007 03:30 AM

Quote:

Originally Posted by Gambet (Post 1305288)
Stefan (...) work

Best not to say those two words in the same sentance.

Tyhm 05-04-2007 07:48 PM

Quote:

Originally Posted by Gambet (Post 1305311)
Do you think Stefan just presses a button and the command magically appears? He has to script it ya know x-x

I know, and he's overtaxed, he's working on too many projects at once and so we in the Red-Headed Stepchild department get significantly less Stefan's-Brain Time than, say, Graal3D.

But I stand by it. If he were to script the defaults in GScript, distribute them to every PW, and remove them from the EXE, we could handle these things on our own. "Playerhurt needs to pass more parameters? Okay, hm, let's open Stefan_DefaultDmg and search for triggeraction playerhurt..."
"The Playerlist needs to stop showing people who've cast NinjaVanish to anyone but staff? Okay, hm, let's open Stefan_DefaultPL..."
"Someone's using a movement trainer? Okay, let's open up Stefan_DefaultMovement..."

Deadly_Killer 05-04-2007 10:26 PM

Quote:

Originally Posted by cbkbud (Post 1305366)
Best not to say those two words in the same sentance.

Yeah, as if Graal wasn't more then 1000 lines.

Graal client + server is at least 10-20 megabytes of files if not more.

killerogue 05-04-2007 11:31 PM

Quote:

Originally Posted by Chandler (Post 1304300)
Since all the default damage is done by this one thing, would it be possible to detect what called it?

HTML Code:

function onPlayerHurt(damageType)
{
  player.chat = temp.damageType;
}

Currently returns "0", however, wouldn't it be great if you could find out what called it?
Such as an explosion, the player being hit by a default projectile [arrow, bush, fireball etc].

Wouldn't it be cool, thanks!!


I see how this could be useful! But you're the king of pfs ;).

Chandler 05-05-2007 08:48 AM

I'm wondering what a PF is now :(

Inverness 05-05-2007 09:15 AM

I'd really like access to Object Types and to be able to make my own :(

xAndrewx 04-17-2010 04:47 PM

bump!!

DustyPorViva 04-17-2010 08:06 PM

function onPlayerhurt(attacker,damageamount) {

}

xAndrewx 04-18-2010 09:42 AM

ois ty
no way to check explosion or thrown object :S

DustyPorViva 04-18-2010 09:53 AM

Quote:

Originally Posted by xAndrewx (Post 1570158)
ois ty
no way to check explosion or thrown object :S

Oh... err my post was a suggestion, heh. It would probably be more useful if it returned the person who damaged them, rather than the object(in the case of bombs and such). At least, that's how onPlayerKilled() works.

Admins 04-19-2010 01:22 PM

Ok added power, hittype [, player] as parameters, it's on clientside though so you will need to wait for v6 being released.

cbk1994 04-19-2010 11:49 PM

Quote:

Originally Posted by Stefan (Post 1570463)
Ok added power, hittype [, player] as parameters, it's on clientside though so you will need to wait for v6 being released.

Just as clarification, is the player parameter the TServerPlayer object or the account name?

xAndrewx 04-19-2010 11:53 PM

yay you rock!! :)


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

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