Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.