I am trying to wrap my head around this new papyrus system as I used to work with the old construction kit a lot.
My problem is I am trying to find a way to have a statement return true if the player is near a certain a cell but the IsLoaded thingy is not working for me. The name of the cell I want to check for is SCHLocation. Maybe I am not referencing the cell correctly or maybe the Isloaded thing is not working correctly in special edition.
The main idea behind this script is to have one spell that will teleport the player to my house location and place a marker and their departure point, assuming they are out of combat and not in an interior space. Then when they want to return they can use the same spell to teleport back to where they first cast the spell if the spell is used near the house location.
Here is my current code:
Scriptname SCHteleport extends activemagiceffect
{SCHTeleport script}
ObjectReference Property SCHRecallMarker Auto
ObjectReference Property SCHHomeMarker Auto
Cell Property SCHLocation Auto
Event OnEffectStart(Actor target, Actor caster)
Cell CurCell = caster.GetParentCell()
bool CasterCom = caster.IsInCombat()
if (SCHLocation.IsLoaded())
caster.MoveTo(SCHRecallMarker)
else
if (CurCell.IsInterior())
Debug.Notification("This spell does not work indoors.")
elseif (CasterCom == 1)
Debug.Notification("This spell does not work while in combat.")
else
SCHRecallMarker.MoveTo(caster)
caster.MoveTo(SCHHomeMarker)
endif
endif
EndEvent