PDA

View Full Version : Is it possible tp spawn a npc at a waypoint?


Seamhainn
01-18-2008, 12:59 PM
Hello!

The topic says it all. Is it possible and how would the script look like?

Thanks and take care

Marius Fett
01-18-2008, 01:02 PM
void main()
{

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("waypoint_tag_here");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "creature_resref_here", lTarget);

}

I think that's how you do it anyway...

Seamhainn
01-18-2008, 01:14 PM
void main()
{

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("waypoint_tag_here");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "creature_resref_here", lTarget);

}

I think that's how you do it anyway...

Thanks, I'll try it out!

stoffe
01-18-2008, 04:21 PM
I think that's how you do it anyway...

Pretty much. Waypoints are normal objects and you can get an object reference for them, and from that their location, like most other world objects.

(You can write the same thing with a bit less variable bloat though, even though either way should work. :)
void main() {
location lTarget = GetLocation(GetObjectByTag("waypoint_tag_here"));
CreateObject(OBJECT_TYPE_CREATURE, "creature_resref_here", lTarget);
}
)

tk102
01-18-2008, 04:46 PM
You can write the same thing with a bit less variable bloat thoughGot to go all the way.
void main() {
CreateObject(OBJECT_TYPE_CREATURE, "creature_resref_here", GetLocation(GetObjectByTag("waypoint_tag_here")));
}