Skip to content

Waypoint spawn

Is it possible to place one waypoint in an area in multiple places and get the same creature to spawn at each waypoint?

Comments

  • ProlericProleric Member Posts: 1,316
    edited January 2021
    Yes. Assuming every waypoint has the same tag, you can use the second parameter of GetObjectByTag to refer to each one uniquely.

    Notice that the first waypoint is number 0, not number 1!

    For example,
    int n = -1;
    object oWay = GetObjectByTag("my_waypoint", ++n);
    
    while (GetIsObjectValid(oWay)
      {
        CreateObject(OBJECT_TYPE_CREATURE, "my_creature_resref", GetLocation(oWay)):
        oWay = GetObjectByTag("my_waypoint", ++n);
      }
    
    Post edited by Proleric on
  • TheTinmanTheTinman Member Posts: 74
    Thank you. I couldn't get that figured out.
  • TheTinmanTheTinman Member Posts: 74
    Hit a snag.

    while (GetIsObjectValid(oWay) is causing an invalid declaration type error.
  • TheTinmanTheTinman Member Posts: 74
    void main()
    {
    int n = -1;
    object oWay = GetObjectByTag("my_waypoint", ++n);

    while (GetIsObjectValid(oWay))
    {
    CreateObject(OBJECT_TYPE_CREATURE, "my_creature_resref", GetLocation(oWay));
    oWay = GetObjectByTag("my_waypoint", ++n);
    }
    }

    This fixed it. Thanks alot. It works great.
  • GenisysGenisys Member Posts: 37
    Here you go mate, not a lot of great coders left around these days willing to do the real work...

    https://www.facebook.com/groups/nwncp/permalink/4123523214328520/
Sign In or Register to comment.