I've cobbled two scripts from abot's and qqqbbb's help. One moves my player to an NPC.
;script to move my character to where another NPC is
;adapted from working script by abot
;uses a unique NPC to identify spot where player goes to
;uses xMyCellID, xPositionCell, GetPos
;concept - get x,y,z, cellname coordinates of the other NPC
;GetPos does not return useable X, Y, Z coordinates until player is in its cell
;therefore movement to the NPC is a two step process
;first get the cell name where the NPC is now and move player to the cell
;once in NPC's cell, run GetPos to get actual X, Y, Z for use in xPositionCell
;plug the X, Y, Z values into xPositionCell parameters and run xPositionCell again for final move
;MWSE manual gave one suggestion - use xGetRef, getPos and xMyCellID
;Scripting for Dummies describes two functions GetPos and GetAngle
;for script testing, will choose the NPC Ajira
;later in testing replace Ajira with the custom NPC object ID name
Long NPCRef ;variable for pointer to NPC uses xGetRef
float NPCx ;x axis coordinate of the NPC (Ajira atm)
float NPCy ;y axis coordinate of the NPC (Ajira atm)
float NPCz ;z axis coordinate of the NPC (Ajira atm)
float NPCangle ;unclear to me how works, will set as 0
Long WhereNPC ;name of cell object is in - uses xMyCellID
Setx NPCRef to xGetRef "Ajira" ;no commas!, pointer to the NPC, in this case Ajira
setx WhereNPC to NPCRef->xMyCellID ;identifies the cell where the NPC is
player->xPositionCell 0 0 0 0 WhereNPC ;move player to NPC's cell
;step two of movement, get NPC coordinates using GetPos
XSetRef NPCRef ; the NPC is now the default implicit reference to be applied to next command
set NPCx to GetPos X ;stores value of X
XSetRef NPCRef
set NPCy to GetPos Y
XSetRef NPCRef
set NPCz to GetPos Z
;XSetRef NPCRef ;not used atm
;set NPCangle to GetAngle Z ;not used atm
player->xPositionCell NPCx NPCy NPCz 0 WhereNPC
stopscript JH_sendmethere ;seems needed to not bog down
End
;script to move an NPC marker to where I am
;uses xPositionCell, xPCCellID, GetPos
;concept - get x,y,z, cellname coordinates of my player
;use xPCCellID to identify cell where player is
;plug cellname into cellname parameter in xPositionCell
;run it to bring the NPC marker to cell where my char is
;for script testing, will choose the NPC Ajira
;test move Ajira to my position
Long NPCRef ;variable for pointer to NPC, necessary to load for use
float myx ;x axis coordinate of the player
float myy ;y axis coordinate of the player
float myz ;z axis coordinate of the player
;float myangle ;not sure if makes sense so will set as 0
Long IamHere ;name of cell player is in - uses xPCCellID
Long WhereNPC ;name of cell NPC is currently in (for testing)
setx Iamhere to xPCCellID Player ;stores name of cell where player is
;geographical position code
setx NPCRef to xGetRef Ajira ;get pointer to Ajira
setx WhereNPC to NPCRef->xMyCellID ;store name of cell where NPC is, used for testing
set myx to player->GetPos X ;variable for player's X coordinate
set myy to player->GetPos Y ;variable for player's Y coordinate
set myz to player->GetPos Z ;variable for player's Z coordinate
;set myangle to 0 ;chose to not declare
NPCRef->xPositionCell 0, 0, 0, 0, IamHere ;put NPC on top of me
stopscript JH_bringNPCHere
End
My testing has been restricted to running them from the console using startscript and stopscript choosing an arbitrary game NPC as a guinea pig The scripts use some MWSE functions and work, which is what counts although even I think they can use more tweaking (for one thing, the scripts drop the NPC on top of the player and vice versa which looks 'ugly' to me although because the NPC will be disabled, may not matter).
I'm now where I want to create two unique objects in the TESCS - a creature with a unique object ID and an amulet with a unique object ID. I'll use the code for the amulet, but I don't know how to proceed in the TESCS from here.
Because the code uses MWSE commands, it has to be compiled in MWEdit, which lets you make an esp. The objects that I'll tap for this are in the TESCS - I'm thinking a scrib and a common amulet for grins, which of course I'll make sure I give each one a unique Object ID and rename. But how do I get an MWSE script into the TESCS to use with an object and in order to continue testing on those objects?
Because MWSE scripts won't compile in TESCS, how do I recover if I accidentally hit the compile button in TESCS when I've also got MWSE scripts in the esp? For that matter, can one compile one script at a time in TESCS? It looks like its button is an all or nothing option.
Another question I have. Because it's for myself, my plan is just to place the NPC (scrib) somewhere on the ground outside the door where the player steps into Seyda Neen for the first time and to do the same for the amulet. How do I go about making sure that my mod puts them in the world but doesn't mess up the other mods that I load which affect Seyda Neen. I don't think my stuff would conflict after I get started, but I am concerned about the first time. I could add the amulet to my inventory using the console, which may still be the most practical for me, but that still leaves the NPC/creature. I'm sure I could always load it first so that it'd be obvious if there was a conflict, but I'd like the warm and fuzzy feeling that I was doing things right in the first case.
Thanks