Jump to content

Recommended Posts

Posted

I'm working on a mod that scans the cells around a player and identifies certain major objects like oblivion gates, doors, and other things. I've been unable to get the GetfirstRef or Getnextref to identify map markers. Am I missing something? Map markers are very useful to my mod as they cleanly identify the proximity of a dungeon (using getmapmarkertype).

 

t

Posted
Map markers are statics (28), but have persistent reference names (49). You could try using those.
Posted (edited)

Thanks for responding Hickory,

 

I tested your suggestion and still came up with nothing.

 

Here is my script:

 

 

scriptname nateMapMarkerScript

 

short doonce

float fQuestDelayTime

 

float mode

 

 

begin GameMode

 

if ( doonce != 4 )

set doonce to 4

set mode to 1.0

set fQuestDelayTime to 5

 

endif

 

 

ref pMapMarker

ref BaseMapMarker

float Mapmarkerfound

 

 

 

set BaseMapMarker to "10"

...

set pMapMarker to GetFirstRef 49 1 1 (49 as suggested. Tried 28)

while (pMapMarker)

 

if pMapMarker.getbaseobject == BaseMapMarker

 

message "Map Marker found"

set Mapmarkerfound to 1

 

endif

 

set pMapMarker to GetNextRef

loop

 

end

Edited by nate_12357
Posted
Yes, what QQuix said. You are scanning for BaseObjects of type MapMarker. Your script is querying if the ref equals "10".
Posted (edited)

You must look for type 28, not 49. I know, because I have a working scan for Map Markers in my Map Marker Overhaul mod.

 

Here is a shortened version of the script I use:

	let rMarker := GetFirstRef 28 2

While rMarker
	let oMarker := rMarker.GetBaseObject
	if oMarker == MapMarker
		if rMarker.GetDisabled == 0
			let s1 := rMarker.GetName
			let i := rMarker.GetMapMarkerType
			if eval (sv_Length s1) <= 0 || i == 0
				DebugPrint "MMO:Ignore non-valid marker %i, type: %.0f", rMarker, i
			else
				DebugPrint "MMO:found valid map marker %z", s1
			endif
		endif
	endif
	let rMarker := GetNextRef
Loop

Edited by theNiceOne
Posted
That code worked perfectly. I think my issue involved improper use of variable types. I had never really used string_var type variables and mostly used float to store values. Strange that my code worked for doors/rocks and not map markers. Thanks to all those that helped me solve my issue!
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...