Getting Player World Region?

Post » Sat Nov 17, 2012 3:58 am

I'm attempting to find the general world region the player is in, eg if they are in the wilderness plateau near Riften, or are hanging out in the Reach, or skulking about the hotsprings... and I have no clue whats the best way to approach this, or if a method already exists. I do NOT want to modify any cells, for fear of causing CTDs, so I'm wondering if there is a "best practices" way to do this via code? I have several approaches in mind and wanted feedback, or suggestions for better methods I'm not aware of:

1) Make a formlist of landmarks and see which is closest to the player. This is the easiest but least accurate.... I'm 10000 yards from Riften Main gate and 230,000 from Solitude's.... kinda vague.

2) Find the Current worldspace and then the Cell XY. It's accurate enough, However , it's really kind of tedious since i'd have to plot out all the cell ranges I'm interested in. (I could use player XY as a fallback - IS there a cell XY?)


Maybe there's a better way I'm unaware of?
User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Fri Nov 16, 2012 8:17 pm

Have you read up on LOCATIONS?

http://www.creationkit.com/Location_Script

(It's not foolproof ... but it might reduce your workload? The Child/Parent functions may help you too)



As far as I know, there is no foolproof, "easy" way to do what you want
User avatar
Alex Blacke
 
Posts: 3460
Joined: Sun Feb 18, 2007 10:46 pm

Post » Fri Nov 16, 2012 11:50 pm

Actually, that was perfect. There's a method on ObjectRef that gets location recursively, thus:

if (Self.IsInLocation(DawnstarLocation))elseif (Self.IsInLocation(BlackreachLocation))elseif (Self.IsInLocation(EastmarchHoldLocation))elseif (Self.IsInLocation(FalkreathHoldLocation))elseif (Self.IsInLocation(HaafingarHoldLocation))elseif (Self.IsInLocation(MarkarthLocation))elseif (Self.IsInLocation(HjaalmarchHoldLocation))elseif (Self.IsInLocation(MorthalLocation))elseif (Self.IsInLocation(PaleHoldLocation))elseif (Self.IsInLocation(ReachHoldLocation))elseif (Self.IsInLocation(RiftenLocation))elseif (Self.IsInLocation(RiftHoldLocation))elseif (Self.IsInLocation(IronbindBarrowLocation))elseif (Self.IsInLocation(SolitudeLocation))elseif (Self.IsInLocation(WhiterunHoldLocation))elseif (Self.IsInLocation(WinterholdHoldLocation))elseif (Self.IsInLocation(WindhelmLocation))endif
User avatar
Emmi Coolahan
 
Posts: 3335
Joined: Wed Jan 24, 2007 9:14 pm


Return to V - Skyrim