Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Feel free to post in this thread. Just label the category of function it is, and explain what it is.

For starters, I just incorporated the proximity resource by Orion Elenzil.

AI Behavior Scripting

Code:

// Basically these allow you to get a value between two players
// which is based on the distance between the players and how much each one is facing the other.
// the value is the same from each player's point of view.
//
// this is really just two workhorse functions and a bunch of conveniences on top.
// the two workhorses are:
//
// rangeRadial  : distance = 0     yields: 1.
//              : distance = range yields: 0.
//              : distance > range yields: negative values.
//
// rangeAngular : angle    = 0     yields: 1.
//              : angle    = range yields: 0.
//              : angle    > range yields: negative values.
//
// the rest of the functions are just combinations of these.
//
// "directed" is just rangeRadial * rangeAngular, with negative values pre-clamped to zero.
// "mutual"   is just the average of the given range function for each point of view.
//
// So for example the mutual directed range of two players is highest when they're near and facing each other,
// and gets smaller as either one turns or moves away.
//
// The functions behave well in degenerate situations. (ie, they don't divide by zero)
proxRangeRadial(%posA, %posB, %rangeA);

proxRangeDirected(%transformA, %posB, %rangeAngA);
proxRangeDirected(%transformA, %posB, %rangeA, %rangeAngA);

proxRangeMutualRadial(%posA, %posB, %rangeA, %rangeB);
proxRangeMutualDirected(%transformA, %transformB, %rangeA, %rangeB, %rangeAngA, %rangeAngB);

Code:
>: echo(getMaterialNames("core/data/shapes/player/left/shield.dts"));
shield
>: echo(getMaterialNames("core/data/shapes/bricks/baseplate32.dts"));
2x2Top
bottomLoop
brickSide
bottomEdge

This is useful for dynamically changing the pallet in the colors dialog.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement