Thread: Player on Npc
View Single Post
  #7  
Old 03-05-2011, 03:44 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Try something like this:

- Check if the player touched the ladder
- If touched, "attach" the player to ladder
- Disable the player's normal movement
- While "attached" make sure the player is still on the ladder and check for keystrokes, move the player if necessary.

PHP Code:
//#CLIENTSIDE
function onPlayerTouchsMe() {
  if (!
this.ladder) {
    
this.ladder = true;
    
player.x = this.x;
    
setTimer(0.05);   
  } 
}

function 
onTimeout() {
  if (
player.y in |y-1.5, y+3|) {
    if (
keydown(0)) player.y -= 0.15;
    if (
keydown(2)) player.y += 0.3;
  } else {
    
this.ladder = false;
    
Movement.ReplaceAni("idle","climbidle"); 
    
Movement.ReplaceAni("walk","climb");      
  }
  if (
this.ladder) setTimer(0.05);
} 
__________________
Quote:
Reply With Quote