Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Mount (https://forums.graalonline.com/forums/showthread.php?t=134270144)

Kirko 12-23-2015 01:33 PM

Mount
 
So I've been working on a 2 person mount script but having trouble with the passenger sticking to the driver. When the driver is inbetween two levels on a gmap the passenger will begin warping all over the place and when I enter a new level, the passenger will stay in previous level. I was lucky to get some help by a few individuals and fix some of my crappy scripting but I still can't seem to fix these problems.

Here is the portion that involves the passenger.
PHP Code:

function onActionServerSide(cmd){
  switch(
cmd){   
    case 
"unFollow":
      
temp.pl findplayer(params[1]);
      
temp.pl.clientr.passenger_driver null;
      
temp.pl.clientr.driver null;
            
      
clientr.passenger_driver null;
      
clientr.driver null;
      break;

    case 
"warpPlayer":
      
temp.pl findplayer(player.clientr.driver);
      
player.setlevel2(temp.pl.level.nameplayer.xplayer.x);
      break;
  }
}


//#CLIENTSIDE
function onCreated(){
  
hideInviteIcon();
  if(
clientr.passenger_driver != null || clientr.driver != null)
    
onLeave();
}

function 
onActionClientSide(temp.cmd){
  switch(
cmd){
    case 
"follow":
      
this.following findplayer(clientr.driver);
      
onTimeOut();
      break;

    case 
"unFollow":
      
onLeave();
      break;
      
    default:
      break;
  }
}

function 
onTimeOut(){
  
temp.pl findplayer(clientr.driver);
  if(
temp.pl == null) return onLeave();
  if(
clientr.driver != null){
    
moveToDriver();
    
setTimer(0.05);
  }else{
    
onLeave();
  }
}

function 
moveToDriver(){
  
temp.driverAccount findPlayer(clientr.driver);
  
player.dir temp.driverAccount.dir;
  if(
player.level.name != temp.driverAccount.level.name){
    if(!(
this.lastUsed timevar2 )) {
      
triggerserver("weapon"this.name"warpPlayer");
      
player.chat "forcewarp";
      
this.lastUsedtimevar2 5;
    }
  }
  
player.temp.driverAccount.vecx(temp.driverAccount.dir) * 2;
  
player.temp.driverAccount.vecy(temp.driverAccount.dir) * 2;
}

function 
onLeave(){
  
temp.driverAccount findPlayer(clientr.driver);
  
player.temp.driverAccount.x;
  
player.temp.driverAccount.y;

  
this.timeout 0;
  if(
clientr.driver != null)
    
triggerserver("gui"this.name"unFollow"this.following);
  else
    
triggerserver("gui"this.name"unFollow"passenger_driver);
  
this.following null;
}

function 
GraalControl.onKeyDown(temp.keycodetemp.keystringtemp.scancode) {
  switch (
temp.keycode) {
    case 
VK_A:
      if(
clientr.driver != null)
        
onLeave();
      break;
  }



Distorted 12-23-2015 04:51 PM

There's already a script for that, if I find it I'll post it here for referencing.


All times are GMT +2. The time now is 09:49 PM.

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