Jump to content
Sign in to follow this  
Matthijs

Issue with user defined markers

Recommended Posts

I wrote a script that keeps track of the user defined markers. My brother found out that placing markers in the editor caused my script to fail.

Here is what happens

In OFP, the code for reading a user defined marker, the code looks like this:

getmarkerpos "_USER_DEFINED #0/0"     (for 1st marker)

getmarkerpos "_USER_DEFINED #0/1"     (for 2nd marker)

getmarkerpos "_USER_DEFINED #0/2"     (for 3rd marker)

(etc. etc.)

The problem is that OFP increases this count, for every marker placed in the mission using the mission editor. So, if you place 2 markers in the editor for example, the code changes to:

getmarkerpos "_USER_DEFINED #0/0"     (empty)

getmarkerpos "_USER_DEFINED #0/1"     (empty)

getmarkerpos "_USER_DEFINED #0/2"     (for 1st marker)

(etc. etc.)

The workaround is simple but not very elegant:

Let the mission creator place the number of markers in a value in the init.sqs, so your scripts can access this variable and take it into account.

I thought this could be usefull to my fellow mission-makers.

marnsmile.gif

Share this post


Link to post
Share on other sites

Another workaround would be at mission start to constantly (in a loop) check the position of say the first 50 markers;

As soon as one of these is nonzero, you know the player has placed a marker and you have its index.

Now you can normally track the placement of usermarkers.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×