View Single Post
  #1  
Old 06-23-2012, 02:40 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Warped NPC will not show after being hidden

I'm working on warping a car from one point to another after they leave the car, but for some reason, the NPC will successfully warp to the point I'd like it to warp to, but because the NPC is hidden after the player gets in the car, using show() to make it visible again will not work, and the NPC remains invisible.

Here's a condensed version of what I'm doing.

Class Script - Joined to the car

PHP Code:
function onCreated() {
  
this.setshape(11616);
}

function 
onActionGrab() {
  if (
player.client.incar != true && player.account == this.owner) {
    
player.client.incar true;
    
player.client.carlevel this.level.name;
    
player.client.carid this.id;
    
    
//Hide the car
    
this.hide();
  }
}

/*Called when the player leaves the car, and is triggered from a
control weapon. The car is warped to the correct position, but
the car still remains hidden, and using show() will not show it*/

public function outOfCar() {
  
//Attempt to show the car
  
this.show();

Weapon Script - Warping process

PHP Code:
function onActionServerside() {
  switch(
params[0]) {
    case 
"getoutofcar": {
      
temp.car_level findlevel(client.carlevel);
      
      for (
ln temp.car_level.npcs) {
        if (
ln.id == player.client.carid) {
          
ln.warpto(player.level.nameplayer.yplayer.y);
          
//Trigger the attempt to show the car
          
ln.outOfCar();
        }
      }
      break;
    }
  }
}

//#CLIENTSIDE

function leaveCar() {
  
triggerserver("gui"name"getoutofcar");

Does anybody have any ideas?
Reply With Quote