Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-23-2015, 01:33 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
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;
  }

Reply With Quote
  #2  
Old 12-23-2015, 04:51 PM
Distorted Distorted is offline
Registered User
Distorted's Avatar
Join Date: Aug 2015
Posts: 48
Distorted has a spectacular aura aboutDistorted has a spectacular aura about
Send a message via ICQ to Distorted Send a message via AIM to Distorted
There's already a script for that, if I find it I'll post it here for referencing.
Reply With Quote
Reply


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 09:23 PM.


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