View Single Post
  #1  
Old 02-12-2012, 07:41 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Skyld's Magic Ship

I've decided to post this because quite a few people seem to have fun playing with it and have expressed interest in the code. Plenty of Era players will be familiar with this!

The script demonstrates how an NPC can move smoothly to a given target location at a set speed, and how it can adjust speed in order to try and land as close to the target coordinates as possible. The landing position is not completely exact, but it should be close enough for most purposes. So far I haven't seen the CPU usage of the script go above 0.06% even mid-movement, so I think it should be fairly safe.

Hopefully this will help someone to create some interesting moving ships or planes or similar.

The onPlayerChats function gives some examples of how you can issue instructions to the script, but you'll probably want to remove that and replace it with your own logic. The onCreated function contains a couple of configuration parameters, and you can adjust the animations at the top of the timeout.

Enjoy!

Attached Images
  
Attached Files
File Type: txt ship.txt (5.5 KB, 416 views)
File Type: gani skyld-flyer_nowarp.gani (1.1 KB, 244 views)
__________________
Skyld

Last edited by Skyld; 02-12-2012 at 08:19 PM..
Reply With Quote