View Single Post
  #7  
Old 03-13-2006, 09:17 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Stefan
Ok I have checked how the playertouchsme event is working:
- on serverside it is basicly doing a findareanpcs(player.x+0.5+vecx(player.dir), player.y+1+vecy(player.dir),2,2) each time a player is moving, and is invoking a playertouchsme event on those npcs; it is also verifying that abs(npc.z-player.z)<=3

- on clientside it is checking two points in front of the player, and is invoking the playertouchsme event on npcs that are on those points; it is marking the npc as touched so that it doesn't happen again until the player moves away again.

Although these checks are not very accurate the question is if it's really a problem, I think it's more important that the event is actually happening and not that the player is touching it pixel-wise; by getting the playertouchsme event before the player is actually touching it fully you can avoid some lag
Well Stefan, what's bothering me the most is that direction is even a factor. The player can be moving sideways or backwards and there would still be cases where you would want playertouchsme to be called. It is apparent that the purpose of playertouchsme is for simple scripts such as opening doors, reading signs, or anything that would require you to use your hands (which would explain why you would want the event to occur early).

abs(npc.z-player.z)<=3: which I just happened to know from trying to learn how projectiles work (I wish it were relevant)

If there would be a playertouchsme event for this only purpose, then I would suggest for an alternate but similar event to occur onto the area:
findareanpcs(player.x+0.5-1/16, player.y+1-1/16, 2+1/8, 2+1/8);

The problem is that the functionality that I'm looking for to build a lot of systems is close to playertouchsme, but playertouchsme isn't defined correctly for me to use it in the way that I would want to use it.

Such an alternate event would probably be the same definition you might want to use for level links, while viewing signs/entering doors would probably require a player to be facing forward. It would be most useful for detecting if the player is entering an area of x,y,w,h that is defined by an npc's x,y,w,h.

Or another idea would be to somehow allow redefinition of playertouchsme for servers (however, don't know how you'd go around implementing that)

Or another idea would be to take the direction change from the last set of coords and use that, but that would probably lead to a few problems.

Last edited by jake13jake; 03-13-2006 at 11:05 PM..
Reply With Quote