Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   hurt() (https://forums.graalonline.com/forums/showthread.php?t=82607)

DustyPorViva 11-01-2008 08:34 PM

hurt()
 
Is there any way, while using this function, I can make the player recoil in the direction I want?

I've tried changing player.hurtdx/dy but apparently they're read only.

Soala 11-01-2008 08:51 PM

maybe have a complete movement system ? so it would be easier.

or maybe something like

function onCreated() {
this.newdir=player.dir
}

then hurt()
this.newdir = (number);

idk xD

DustyPorViva 11-01-2008 08:53 PM

Nah, I don't want to do a complete movement system for a simple project. And it isn't effected by direction, but by delta.

LoneAngelIbesu 11-01-2008 08:59 PM

Which way do you want to recoil? Unless I've never paid attention to it, the sprites recoil in the opposite direction they're facing. The "physics" seem right to me.

DustyPorViva 11-01-2008 09:00 PM

No, the recoil away from the direction they were hit... in the case of hurt(), since they weren't hit by someone else, there is no default recoil direction... which is what I want to define.

LoneAngelIbesu 11-01-2008 09:13 PM

Quote:

Originally Posted by DustyPorViva (Post 1438236)
No, the recoil away from the direction they were hit... in the case of hurt(), since they weren't hit by someone else, there is no default recoil direction... which is what I want to define.

Oh, yeah. That would make sense.

Have you tried hitplayer(index, halfhearts, fromx, fromy)?
hitplayer(0, 1, 45, 50); seems to recoil the player down to the left, diagonally.

DustyPorViva 11-01-2008 09:15 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1438239)
Oh, yeah. That would make sense.

Have you tried hitplayer(index, halfhearts, fromx, fromy)? hitplayer(0, 1, 45, 50); seems to recoil the player down to the left, diagonally.

That's for hitting other players. I just want to hit the player themselves, after a hit from a projectile... I could probably rig it, but I don't want to run an extra loop if I don't have to.

LoneAngelIbesu 11-01-2008 09:15 PM

Quote:

Originally Posted by DustyPorViva (Post 1438240)
That's for hitting other players. I just want to hit the player themselves, after a hit from a projectile... I could probably rig it, but I don't want to run an extra loop if I don't have to.

Using an index of 0, I was able to hit myself.

EDIT: Actually, using an index other than 0 produces as access violation (Vista). Bug, perhaps?

Crow 11-01-2008 09:24 PM

Use hitplayer() with player.index. Worked for me last time I had the exact same problem as yours.

Edit: Now that I think about it, I looked for that in a pretty old piece of code, and somehow player.index doesn't make sense to me. Might just be 0...

DustyPorViva 11-01-2008 09:29 PM

Ya, hitplayer with 0 did work, thanks for the help :)


All times are GMT +2. The time now is 03:09 AM.

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