View Single Post
  #16  
Old 03-15-2006, 08:50 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
playertouchsme is the strangest event handler in the sense that you can't modify it. There are several instances in which you might want to, but you just can't.

You can most easily control certain clientside events if you can disable them (consider disableweapons). However, you can't control all serverside events quite as efficiently. I'm pretty sure you could tell an NPC not to recognize an event and use the trigger function to call it whenever you needed it, but it would be hard to mimick serverside with the lack of a timeout (especially for playertouchsme).

I'm hoping Stefan will release at least one more event handler, being similar to playertouchsme, for the player overlapping or bordering the NPC. Playertouchsme doesn't do that specifically, but there are a lot of places it could be used if you simply wanted a script to be based on a field and use the npc's x,y,width,height to define that field. Perhaps damage fields, or even any coordinate dependent zones that activate some other script functionality. Damage fields would be what I would immediately use this for, but the concept can certainly cover other aspects of things as well. I would probably think the best implementation would be something like:
onPlayerEntersMyShape() and onPlayerLeavesMyShape(). It would be comparable to having onPlayerEnters() and onPlayerLeaves(), but the player only enters a part of the level that's defined by an NPC's x,y,w,h... or leaves a part of the level that's defined by an NPC's x,y,w,h. It would make sense to call the onPlayerLeavesMyShape() for the NPC the player has not left the shape of before the player leaves the level. I ought to post this in my other thread about playertouchsme.

It would certainly help a bit to have such functionality.
Reply With Quote