Alternative to Positioncell

Post » Sun May 29, 2011 12:32 am

I would like to position an NPC in an unnamed cell - however PositionCell does not seem to work - the NPC won't show up and I get an FPS hit - I've read that using position is less than friendly as well and NPC's can end up either MIA or inside out

Is there some way around this apart from using clones?
User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm

Post » Sat May 28, 2011 8:50 pm

By unnamed cell I assume you mean an exterior cell?

If the player is already in an exterior cell using Position to move to another exterior cell has always been safe for me.

Alternatively, you could try using PositionCell, but for the cell name just use any exterior cell name.

I believe using Position in an interior cell only moves you within that interior cell.

But I could be wrong, I'm already getting rusty at this stuff.
User avatar
Emmi Coolahan
 
Posts: 3335
Joined: Wed Jan 24, 2007 9:14 pm

Post » Sat May 28, 2011 10:57 pm

I'm getting a little rusty on this myself, got too used to using xPositionCell now. Let's see... For moving an NPC to an exterior:

If the cell is active (ie the player is there), and the NPC is NOT already in the cell, PositionCell should work but you need to do visibility and AI fixes to make sure it's all fixed. The usual version (from CDCooley's Companion Teleporting) goes something like this IIRC:
PositionCell
wait 1 second
disable
enable
wait 0.7 sec (or so...)
disable
enable
AI command (AIFollow, AIWander, etc)
check NPC is in correct cell, if not then go back to the PositionCell and start over
check AI package, if it's OK then stop, if it's not what it should be then go on to:
startcombat player
wait 0.3 sec or until weapon drawn or spell readied
stopcombat
go back to the AI command (and also force-equip and remove a weapon or force-cast a spell in case they get stuck in weapon drawn/spellreadied)

The disable/enable parts are to make them properly visible, the combat is to fix AI glitches.

If the cell you're teleporting them to isn't active, you shouldn't need any of that.

BUT... If the NPC is already in an active cell, and you're moving them within the active cells, do NOT use PositionCell - instead use SetPos. Otherwise you get weird shadow-people that can't be activated, and that's not easy to fix.

I can probably write up a script for you if you want, just let me know what's supposed to happen specifically (AI, position coords, is the player there, etc).
User avatar
Solène We
 
Posts: 3470
Joined: Tue Mar 27, 2007 7:04 am

Post » Sat May 28, 2011 3:48 pm

I'm getting a little rusty on this myself, got too used to using xPositionCell now. Let's see... For moving an NPC to an exterior:

If the cell is active (ie the player is there), and the NPC is NOT already in the cell, PositionCell should work but you need to do visibility and AI fixes to make sure it's all fixed. The usual version (from CDCooley's Companion Teleporting) goes something like this IIRC:
PositionCell
wait 1 second
disable
enable
wait 0.7 sec (or so...)
disable
enable
AI command (AIFollow, AIWander, etc)
check NPC is in correct cell, if not then go back to the PositionCell and start over
check AI package, if it's OK then stop, if it's not what it should be then go on to:
startcombat player
wait 0.3 sec or until weapon drawn or spell readied
stopcombat
go back to the AI command (and also force-equip and remove a weapon or force-cast a spell in case they get stuck in weapon drawn/spellreadied)

The disable/enable parts are to make them properly visible, the combat is to fix AI glitches.

If the cell you're teleporting them to isn't active, you shouldn't need any of that.

BUT... If the NPC is already in an active cell, and you're moving them within the active cells, do NOT use PositionCell - instead use SetPos. Otherwise you get weird shadow-people that can't be activated, and that's not easy to fix.

I can probably write up a script for you if you want, just let me know what's supposed to happen specifically (AI, position coords, is the player there, etc).


Thanks Melian - there seems to be a lot of failsafe's built into that code

What I'm trying to do is create an NPC schedule for an exterior cell that is Ascadian Isles Region 2, -12 - I have 5 NPC's in the cell - 2 are guards though unique ones not clones

I was using max aka nobody's scheduler and found I could move one of the guards using PositionCell to an interior cell, set her to AIWander 0 and change out of her uniform, then I could send her to another interior - unfortunately the clothes change did not work a second time however at least she was int he right position

However when i tried to send her back to her original position in the exterior cell she would not show - I looked through the scripts of LCOV - which I can understand some of but they are really too advanced for me - however in the read me Wrye mentions he had trouble with unnamed exterior cells and positioncell would not work and position was problematic

I've settled for using clones a healthcheck on clone and original and lineofsight - it's still a bit clunky at the moment but at least the originals are appearing at the right times. I wonder if Bethesda had similar problems for the statue at Khartag Point and whay they used clones there?

Thanks for the info on using setpos when within a cell - I will try out AITravel for some of my NPC's and see if I can replicate Galbedir's walking script where she checks to see whether she is near hidden rings before she goes into AIwander mode.
User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Sun May 29, 2011 1:55 am

Hmm... Not sure if this is what Wrye's talking about or not, but I've found that PositionCell in exteriors can be a little weird about the cell ID - sometimes you need to say "Ascadian Isles Region 2 -12" but sometimes that just fails and the NPC doesn't turn up, but "Ascadian Isles Region" works - but sometimes it's the other way round and you need the grid numbers. Very annoying!

You can also try using "Wilderness" for the cell ID instead - sometimes that works better (if it works they'll still end up in the correct cell).

I've also had trouble with Position, but haven't got round to testing it yet to find out why... Prime suspect atm is whether it works at all if the NPC hasn't been encountered yet, or if the NPC's current cell isn't loaded (for me it was failing when I used it for NPCs from a storage cell, but working for a companion being moved along with the player - I haven't really used it much with NPCs so that's all I've got to go on atm). Position does normally work for the player though.
User avatar
Strawberry
 
Posts: 3446
Joined: Thu Jul 05, 2007 11:08 am


Return to III - Morrowind