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-06-2012, 01:42 AM
greggiles greggiles is offline
Registered User
greggiles's Avatar
Join Date: Sep 2007
Posts: 149
greggiles has a spectacular aura about
Making a formula

I'm not sure how to write it out, but basically trying to make the 'zoom' value get higher as the player.y gets closer to the NPC's this.y

Here is what I got, and if I were to do full script with all values, it would be very very very very long. So looking for a more efficient way

PHP Code:
function onTimeOut() {
 
setTimer(0.05);

 if (
this.y in |player.y-5player.y|)
 { 
  
this.zoom 5;
  }
 if (
this.y in |player.y-8player.y-5|)
 { 
  
this.zoom 4.5;
  }  
 if (
this.y in |player.y-11player.y-8|)
 { 
  
this.zoom 4;
  }  
 if (
this.y in |player.y-14player.y-11|)
 { 
  
this.zoom 3.5;
  } 
 if (
this.y in |player.y-17player.y-14|)
 { 
  
this.zoom 1;
  }
 if (
this.y in |player.y-20player.y-100|)
 { 
  
this.zoom 0;
  }   
 } 
note: this is for the player being below the NPC
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 07:39 PM.


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