View Single Post
  #8  
Old 03-15-2006, 09:01 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
Okay, I have an expansion of this idea now that my mind's eye wandered across when in another thread.

new event handlers:
onPlayerEntersMyShape
onPlayerLeavesMyShape

These would offer extraordinary functionality.
First things first. It would solve the hit detection problem on Classic simply with onPlayerEntersMyShape().

However, that is not where it ends.
Say you have a sparring arena inside of a level. You want weapons to be disabled outside of the sparring area but not inside of the sparring area.

So... You could place an NPC over the entire sparring area and define it as such:
PHP Code:
onPlayerEntersMyShape() {
  
this.myPlayers.add(player.account);
  
enableweapons();
  
focusArena();
  if (
myPlayers.size() == 2) {
    
closedoors();
    
matchHPperSword();
  } else if (
myPlayers.size() > 2) {
    
kickoutofarena(player);
  }
}

onPlayerLeavesMyShape() {
  
this.myPlayers.remove(player.account);
  
disableweapons();
  
//anything else taken away

In essence it would be like having onPlayerEnters and onPlayerLeaves but on a scale that isn't the level (would be simply awesome for dealing with a GMAP). Treating it like such, it would make sense that if the player were on the NPC's shape and left the level, that onPlayerLeavesMyShape be called on that NPC, and then on the level's level onPlayerLeaves would be called.

Last edited by jake13jake; 03-15-2006 at 09:14 PM..
Reply With Quote