Please **go vote on the new forums now**. Let's get this shipped.

Please **go vote on the new forums now**. Let's get this shipped.

0

No votes yet

Submitted by:

Submitted by Wyldhunt on 2017-09-20 21:26.

Last modified:

2017-09-20 21:39

This is two library scripts created by Genji and re-used in several mods.

I am uploading them as reference scripts since they seem to be used often.

All credit for them goes to their author, Genji.

All I did was rip them from one of Lord of Worms mods that used them, and upload them.

gen_inc2math appears to be an updated version of gen_inc_math

**Function Definitions:**

// real vector in two space. v = <i,j> were i = x axis and j = y axisstruct vectorR2{float i, j;};// This is less a math function then a f'ing bug fix for placeable objects.// Placeable objects return invalid facing's in the lower two quadrants// of the unit circle. Let alone the fact that the arrow points the opposite// direction. -------------------------------------- FIX ME ON TOOLSET PATCH// only use GetFacingFromLocation(o) for this one,// SUPPOSEDLY GetFacing(o) is fixed in 1.23, so i'm switching to it for objects.// however, facingFromLocation(o) is still broke dick. 8.26.02float FixFacing(float facing_in);// get the angle that would be required to face the target. Trig version// negative angle = turn clockwise.float GetAngleToFaceTargetTrig(object fTarget,object fLooking);// sub function to alloy inner call in GetAngleToFaceTargetTrigfloat FindAngleToFaceTargetTrig(vector apexPoint,vector targetPoint,float currentFacing,float leg);// get the angle that would be required to face the target. Vector version// negative angle = turn clockwise. always returns an angle <= 180.0 degrees with// the direction indiacted by the sign.float GetAngleToFaceTarget(object fTarget,object fLooking);// sub function to alloy inner call in GetAngleToFaceTargetfloat FindAngleToFaceTarget(vector apexPoint,vector targetPoint,float currentFacing,float leg);// get the third point that would form an Isosceles triangle given the length// and facing of the point apexPoint. Used in GetAngleToFaceTarget[Trig]vector GetIsoscelesPointThree(vector fApexPoint,float fCurrentFacing,float fLength);// use dot product and cos to figure out angle between vectorR2's passed in.float AngleBetweenVectors(struct vectorR2 first,struct vectorR2 second);// magnitude of the passed vectorfloat Magnitude(struct vectorR2 vect);// dot product of the passed in vectors.float DotProduct( struct vectorR2 first,struct vectorR2 second);// Figure out if the angle to return in GetAngleToFaceTarget = clockwise or ccw.int IsClockWise(vector apexPoint,vector targetPoint,float currentFacing, float angleToFace,float leg);// return the slope of the line between point1 and point2float GetSlope(vector fPoint1,vector fPoint2);// this function returns a location that is distance away in offFacing direction.// -90.0 is exactly on the creature's right, 90.0 is on the left, and 180.0 is behind them// facing can be set so the new location turns by offFacingOnArrival.location GetNearLocation(location loc,float offFacing, float distanceFrom, float offFacingOnArrival = 0.0);// return a location that is within 1 and distance from target loc, randomly// and heightZ meters off the ground so effects look centered on body if need be.location GetProximity(location loc,int distance, float heightZ = 0.0);// returns int is even or not.int IsEven(int number);// generic time output to stringstring PrintTime();// buffers natural numbers to hold zero's in places specified ( nat's and zero )string BufferNat(int int_in,int places);

Files:

Attachment | Size |
---|---|

gen_inc_math and gen_inc2math (26) | 5.74 KB |

Permissions & licensing:

Vordan's Hero Creator |
98.3% |

Nihil Trilogy: Awakening |
90% |

Ravenloft: Dreamscape |
74% |

Conan Chronicles 2 - The Zamorian Chronicles |
95% |

The Gathering Storm |
92.5% |

Lanterna |
76.7% |

A Hunt Through the Dark Remastered |
91.7% |

Path of Evil |
97.5% |

Serene |
90% |

SoZ Overland Map Demo and Documentation |
95% |