Talk:GetParentCell

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

This isn't really an alternative for Cellchanged

Most cases where you can use GetParentCell, you could also use GetInCell, while a real cellchanged wouldn't require any global scripts or scripts on the entrance door.

The only thing you can't do without using OBSE is a script that fires whenever you enter a new exterior cell. But usually you use Cellchanged to trigger stuff (music for example) when you enter a certain cell.--JOG 09:51, 14 August 2006 (EDT)

Dragoon Wraith TALK 11:35, 14 August 2006 (EDT): The need of a short global script hardly makes this less useful than CellChanged. Your point is taken, however, and your request accepted.
I don't see how GetInCell can possibly achieve the functionality that GetParentCell can. If you have a global variable CellChanged and this global script, you have the CellChanged function:
scn CellChangedScript

float fQuestDelayTime

ref CellLastFrame

Begin GameMode

  set fQuestDelayTime to 0.0001
  if ( CellLastFrame != player.GetParentCell )
    set CellChanged to 1
    set CellLastFrame to player.GetParentCell
  else
    set CellChanged to 0
  endif

End


JOG 05:05, 18 August 2006 (EDT):As I wrote above, usually you want to know when the player enters a specific cell. This can be accomplished with a global script and getincell just the same

scn GetinMycell 

short within 

begin Gamemode
 if Getincell Mycell != within
    set within to getincell mycell
    if within
       message "Another Visitor, stay a while, stay forever..."
    endif
  endif
end

Same for leaving, and entering any Interior-Cell can be recognized the same way, using IsInInterior

The only Advantage of GetParentCell for CellChange purposes is that it works when you enter another exterior cell, but you rarely have to test for this, when we did in Morrowind, only to avoid a FPS-lag due to constantly calling getdistance, you can now avoid this lag by testing on getdistance in the global script.


With cellchanged you would require just a local script on an object in the cell:

scn GetinMycell

begin gamemode
  if cellchanged
     message "Another Visitor, stay a while, stay forever..."
  endif  
end

Or even better:

scn GetinMycell

Beging OnCellChange
  message "Another Visitor, stay a while, stay forever..."
end
Dragoon Wraith TALK 09:50, 18 August 2006 (EDT): Not what I had been looking to use CellChanged for, but using the script I posted above, you could do that exactly how you have written it (the first one), anywhere in the game. Yes, it means there needs to be a (miniscule) global script in addition to it, but it is a replacement for CellChanged. Might not be as good, but it's close. The important thing is that the functionality is there.


JOG 19:13, 18 August 2006 (EDT): But as I wrote already twice: in 95% of the applications you don't need OBSE for realizing this functionality with a global script.
Dragoon Wraith TALK 19:23, 18 August 2006 (EDT): Oh, I'm sorry, I didn't realize that's what you were saying. I thought you were claiming that GetParentCell wasn't a replacement for CellChanged.