Random Location Spawner. Needs Critique and Help

  • void main()
    int iFetch_zmax = GetLocalInt(OBJECT_SELF, "zmax");
    int iFetch_zcounter = GetLocalInt(OBJECT_SELF, "zcounter");
    int iFetch_ztimer = GetLocalInt(OBJECT_SELF, "ztimer");

    int iRandomX = Random(100);
    int iRandomY = Random(100);
    int iRandomZ = Random(100);

    float fRandomXConvert = IntToFloat(iRandomX);
    float fRandomYConvert = IntToFloat(iRandomY);
    float fRandomZConvert = IntToFloat(iRandomZ);

    int iRandomO = Random(100);
    float fRandomOConvert = IntToFloat(iRandomO);

    vector vRandomVector = Vector(fRandomXConvert, fRandomYConvert, fRandomZConvert);

    object oFetchedArea = GetArea(OBJECT_SELF);

    location lRandomLocation = Location(oFetchedArea, vRandomVector, fRandomOConvert);

    if (iFetch_zcounter

  • What is this even trying to do?

  • I'm making a zombie survival rp server, and this script spawns zombies at random locations in an area. What I need help with is how the vectors work in relation to placement on the map. I basically made the random generation for the vectors for the random location 100 in hopes it would work, not knowing exactly how they interact with the grid and terrain. The script seems to work, but I was hoping on advice for how vectors and such work in the toolset. Also orientation in a location.

  • Nwn lexicon is your friend

    http://www.nwnlexicon.com/index.php?tit ... 0_position

    Search for random on that page and you will find GetRandomLocation ();

    You can use that to plug in your locations without needing to get into the vector stuff.

  • If you really really need to then fiddle by hand with the orientation, you can use SetFacing ();

Log in to reply