Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   event metouchsplayer (backwards playertouchsme) (https://forums.graalonline.com/forums/showthread.php?t=63395)

jake13jake 01-13-2006 07:36 AM

event metouchsplayer (backwards playertouchsme)
 
Having an event handler for objects touching players would make serverside damage handling infinitely better (esp. for baddies).

Ajira 01-13-2006 09:12 AM

Or Stefan enabling the onCollision() function on 2D playerworlds would be great. =D

jake13jake 01-13-2006 09:18 AM

Quote:

Originally Posted by Ajira
Or Stefan enabling the onCollision() function on 2D playerworlds would be great. =D

yea

jake13jake 02-19-2006 08:00 AM

okay, I SERIOUSLY SERIOUSLY want an event for when the NPC comes into contact on the sole behalf of it's own movement after instantiation. I want this VERY VERY much.

ApothiX 02-20-2006 05:34 AM

Quote:

Originally Posted by jake13jake
okay, I SERIOUSLY SERIOUSLY want an event for when the NPC comes into contact on the sole behalf of it's own movement after instantiation. I want this VERY VERY much.

Then script it.

jake13jake 02-20-2006 06:33 AM

Quote:

Originally Posted by ApothiX
Then script it.

....
Okay, don't be an idiot, PLEASE.
So, given: an NPC joined to a baddy class, and serverside HD.
In order to do anything with as little lag as possible, you'd want to test for NPCs clientside on a 1/20 timeout, trigger the server in a weapon, which in turn triggers the event in the NPC. This would probably cause a substantial amount of lag (not to mention I'd get yelled at for it being insecure). If there were a direct method built into gscript, it would be much more efficient (hardcoding, easier access to classes).

Gambet 02-20-2006 06:17 PM

Um, I'm not sure I understand exactly where you're getting at, but NPC's do act upon collision with the player with an if (playertouchsme) {}. I've noticed that if you create an NPC and set it to move from point A to point B, and the player is standing somewhere inbetween the path, idle, then when the NPC goes through the player, the system reads it as if the player is touching the NPC, even though the player did not move at all.

Loriel 02-20-2006 06:28 PM

Yeah. On the serverside, playertouchsme is triggered when the NPC moves to the player. And on the clientside, there is not that much of a problem with a 0.05 timeout loop with collision checking

Ajira 02-20-2006 07:26 PM

But onCollision() would be awesome for both clientside and serverside. :D

ApothiX 02-20-2006 07:57 PM

Quote:

Originally Posted by jake13jake
....
Okay, don't be an idiot, PLEASE.

So making countless useless suggestions that are easy enough to script isn't being an idiot?

Quote:

Originally Posted by jake13jake
So, given: an NPC joined to a baddy class, and serverside HD.
In order to do anything with as little lag as possible, you'd want to test for NPCs clientside on a 1/20 timeout, trigger the server in a weapon, which in turn triggers the event in the NPC. This would probably cause a substantial amount of lag (not to mention I'd get yelled at for it being insecure). If there were a direct method built into gscript, it would be much more efficient (hardcoding, easier access to classes).

If you're scriptin the movement for the NPC, it would not be hard at all to detect if it hit a player during it's movement.

jake13jake 02-20-2006 08:05 PM

Quote:

Originally Posted by ApothiX
If you're scriptin the movement for the NPC, it would not be hard at all to detect if it hit a player during it's movement.

...using the move function?
Really, the only way to do it would be with a timeout. ie. go to Kingdoms and tell me if the bomies there can attack you just as efficiently as the baddies in offline mode.

Might add, I try not to suggest useless things. I try to suggest things that would either make sense to have built in. I generally don't have a problem creating complex things as long as I have all the tools to do it. The read-only var for npcs blocking is an example of that, and now my movement is done, and all of Classic's systems are ready for v2 disabling except for AP, Ratings, and a new rank system

Quote:

Originally Posted by Loriel
Yeah. On the serverside, playertouchsme is triggered when the NPC moves to the player. And on the clientside, there is not that much of a problem with a 0.05 timeout loop with collision checking

Thanks. It didn't before, but maybe I should test to see if it does now.

jake13jake 02-23-2006 01:19 AM

Quote:

Originally Posted by jake13jake
Thanks. It didn't before, but maybe I should test to see if it does now.

PHP Code:

NPC *****.png 21 38
function onCreated() {
  
setshape(1,64,64);
  while(
true) {
    
move(20,0,10,0);
    
sleep 10;
    
move(-20,0,10,0);
    
sleep 10;
  }
}
function 
onPlayerTouchsMe() {
  
player.chat "giggle";
}
NPCEND 

Uhm, Loriel... I didn't move, and playertouchsme wasn't called. But what you said is exactly what I would want... an abstraction of the problem of creating a more aesthetic damage system.

Loriel 02-23-2006 01:25 AM

Quote:

Originally Posted by jake13jake
Uhm, Loriel... I didn't move, and playertouchsme wasn't called.

I guess someone broke it :mad:
Sorry about that; but I distinctly remember playertouchsme on serverside acting different than on clientside. Good thing this thread is not in the scripting forum so I get away with bad advice :D

jake13jake 02-23-2006 01:28 AM

Quote:

Originally Posted by Loriel
I guess someone broke it :mad:
Sorry about that; but I distinctly remember playertouchsme on serverside acting different than on clientside.

I remember about it only getting called on initial contact on serverside, and it getting called (but not anymore) when every .05 seconds movement is true on clientside. I could be wrong, that would be my guess though.


All times are GMT +2. The time now is 04:06 AM.

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