OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bedges on 03 Sep 2005, 11:27:56
-
m'kay, i have used this tutorial here (http://www.ofpec.com/editors/resource_view.php?id=162) which explains how to use user-defined markers, and i have implemented these ideas into a satellite script. what happens is the player goes to the map, double clicks to create a marker, and then on opening the satellite viewing device, the marker is there to be selected.
there is (of course) a problem. it works each and every time in my own missions. however, i have incorporated this script into the 1985 campaign, and sometimes it works, sometimes it doesn't. the satellite works a charm, but there are sometimes no extra markers available, even if i put ten of the buggers on the map. so far, having looked at the offending missions in the editor i can't find a reason for the temperamental nature of this bug.
anyone out there have experience with user-defined markers?
-
but there are sometimes no extra markers available
as far as I am aware it doesnt matter what markers are already there, it simply depends on which number user defined marker you have placed. if the satellite is called from user defined marker 0 then the first marker you put down will work but no others. so maybe if you have put down one already and not deleted it before you placed another one (i.e. user defined marker 1) it has gotten itself all out of order. that could be the problem, maybe?
anyone out there have experience with user-defined markers?
i used it in Shadows of the Motherland :)
-
hmmm... well here's the script excerpt that i use to collate the user defined markers -
_markernum = 0
#seek_marker
_mpos = getMarkerPos format["_USER_DEFINED #0/%1",_markernum]
? ((_markernum >= 13) and (not _found)) : goto "begin_satcomm"
? (_mpos select 0) == 0 and (_mpos select 1) == 0 and _found : goto "begin_satcomm"
? ((_mpos select 0) == 0) and ((_mpos select 1) == 0) and (not _found) : _markernum = _markernum + 1 ; goto "seek_marker"
satcomm_targ = satcomm_targ + [_mpos]
_found = true
_markernum = _markernum + 1
goto "seek_marker"
on the assumption that the player will not place markers at 0/0, i give the loop 13 chances to find a marker that is elsewhere. if one is found, it's added to the marker array satcomm_targ. then, if markers have been found and the next is at 0/0, it breaks out of the loop.
like i say, some missions it works just fine, finding all user-defined markers. then other missions it won't even see one. :-\
-
i give the loop 13 chances
i found your problem - you chose an unlucky number of loops ;D
-
of course... now why didn't i think of that... ::)
-
discovered what the problem was - it lies here, in the tutorial on user defined markers...
Note that all markers in the mission (including those inserted by mission designer) are counted to this number - so if you have three markers in the mission, the first user defined marker (during the mission) is automaticaly named "_USER_DEFINED #0/3"...
so if there are more than, say, 13 markers already on the map (which in many missions, especially those with dots marking a path, is the case) then my script won't work. i've increased the marker count to 200, and suddenly it works.
let this be a lesson - always read the tutorials properly, kids ;)