Jump to content

Home

Scripting a Waypoint


Darkkender

Recommended Posts

Okay guys I got a scripting Q here.

 

How do you define a waypoint within a script without actually writing a waypoint gff file. What I'm trying to do is establish a Load module script but I want it to start at a script defined X, Y, Z coordinate without defining a seperate waypoint file.

 

I know the StartNewModule script typically uses the following syntax;

 

StartNewModule("ModuleName", "startpoint");

 

so could I define "startpoint" or a different string as a set location?

Link to comment
Share on other sites

A waypoint must exist in order to be used in the StartNewModule function. Now, the CreateObject function supports the creation of waypoints, but you must be in the module in order to spawn the waypoint. Later, you could then use the waypoint to return to the module.

 

You could try this:

// create the waypoint
void main() {
float x=0.0; //whereami
float y=0.0; //whereami
float z=0.0; //whereami
vector v=Vector(x,y,z);
location l=Location(v,0.0);
CreateObject(OBJECT_TYPE_WAYPOINT, "mywaypoint", l);
}

Then later when you want to reload that module:

 StartNewModule("module_name","mywaypoint");

 

I think that's the best you can hope for script-wise.

Link to comment
Share on other sites

so if I typed the script as such then it should work right?

 

// create the waypoint
void main()
{
float x=0.0; //whereami
float y=0.0; //whereami
float z=0.0; //whereami
vector v=Vector(x,y,z);
location l=Location(v,0.0);
CreateObject(OBJECT_TYPE_WAYPOINT, "mywaypoint", l);
StartNewModule("module_name","mywaypoint");
}

 

Or would I need to write 2 seperate scripts for this?

Link to comment
Share on other sites

No you'll need two scripts.

 

Here's the problem: the CreateObject can only create and Waypoint in the current module. So you'll have to travel to that module normally first. Then fire the script that creates the waypoint.

 

After that you should be able to call the StartNewModule from anywhere in the game and go back to that Waypoint you created.

 

(Hey I like the way this functionality is shaping up into a warpband or something.)

Link to comment
Share on other sites

darn I was hoping.

 

I'm actually trying to have the player returned to set coordinates within a new module(existing module) after leaving from a certain point. I guess I should get over my fear of waypoints and write one then. I'm hoping to have a new area module mod completed by this weekend.

 

Edit:

NeverMind

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...