Jump to content

Getting a reference for quest targets?


geoffrax

Recommended Posts

Hey Modders

 

I'm in the process of making a mod where I'm recording a whole lot of data to develop some comprehensive stats about the player. It's a pretty intensive project and I've already got a lot of scripts capturing combat data.

 

I'm sort of stuck on a particular issue with gathering quest data. I'd like to find out: A) the distance to the nearest Quest Target of the active quest (if one is available) and B) if the player is facing in the direction of the reference.

 

I can calculate distance, and I can calculate the angle (GetDistance and GetHeadingAngle) but to actually get the coordinates of the current quest target is quite infuriating, I can't seem to find a function that allows me to get it.

 

I know of the console command, GetQuestTargets, returns the active quest targets, but it doesn't seem work in a script.

I could print to the console, but I can't read the results from the console.

 

I can get the Active Quest by GetActiveQuest, and I can read the current quest variables if they exist, but the quest target data is stored separately. I can read what stage they are up to but not the target :(

 

I guess what I'm looking for is:

A way to get the current TargetRef of the active quest;

Alternatively:

Is there a way to get x,y data about the green/red quest marker/s on the map/compass?

 

 

This is what I'd like to be able to do (but obviously doesn't work)

 

ref currentquest

ref currentquesttarget

 

set currentquest to GetActiveQuest

set currentquesttarget to currentquest.getquestvars target_ref

 

Any clue how to go about doing this? I'd prefer not to have to modify every other quest script to accommodate :( I'm using OBSE if that helps any.

Edited by geoffrax
Link to comment
Share on other sites

  • 3 weeks later...

Are you trying to use this script to run only on your quest data or on all quest data for all quests? If it is a universal code, it could be quite difficult without obse. I don't know much obse but i would bet there is something in there for you. If not, you could request it and it just might get made. It seems like a common enough code to warrant new scripting functions. I am frustrated that some code works in the cs and not console, and vice versa.

 

If you are trying to get the position of a specific xmarker in x,y,z co-ordinates, that is simple. You just name the xmarker (or better yet place your own on top of it, as not to make a conflict). Then you can do all sorts of fun stuff such as movetomarker, getdistance, etc. If anybody else (like mr DavidBrasher) who has more experience modding than me reads this, it would be cool to see some other work arounds.

 

short MyPosX
short MyPosY
short MyPosZ

short QuestPosX
short QuestPosY
short QuestPosZ

begin gameMode
set MyPosX to player.getpos x
set MyPosY to player.getpos y
set MyPosZ to player.getpos z

set QuestPosX to (markerID).getpos x
set QuestPosY to (markerID).getpos y
set QuestPosZ to (markerID).getpos z

;put math here

end

 

You would have to either define the markerID as a ref (which you could set dynamically) or you could call it by name directly. Again, this isn't a global script. You would have to define the markerID ref manually or set it with other code. Please give a small example of what you are trying to accomplish. It would help for people willing to lend a hand.

 

theuseless

 

 

-edit-

 

If you could make one static marker and move that to the quest target, that would be ideal. I'm not sure if you can do this with vanilla however.

Edited by theuseless
Link to comment
Share on other sites

I think you are mixing up GetQuestTargets with ShowQuestTargets. GetQuestTargets has no mention on either the CS wiki or the OBSE command Documentation, but ShowQuestTargets is a console command that toggles the green and red arrows on or off. It does not return any references to the targets themselves.

 

In fact, quest targets themselves are mostly arbitrary, and I can't think of any way to gain a reference to them dynamically. You would have to just know what the quest target is attached to and call it by name. Not exactly pretty or efficient. Not only that, but the x,y,z positions of something in a different interior cell are 65535 I think (don't know about exterior cells though). In that case, the red arrow will be over a door, but there is definitely no way of retrieving the reference of that door.

 

theuseless had the right idea about using a marker though. I would suggest Marker Rats, which are just rats that are disabled. Because they are actors, they are not subject to certain glitches that occur when objects are moved around between worldspaces.

 

Whatever you do though, I highly recommend that you do not modify every quest script. There probably would not actually be that many incompatibilities with other mods, but it's just etiquette.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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