Jump to content

Seeking help tweaking a script


Recommended Posts

Posted
I'm trying to do something that sounds simple but it's apparently not because I can't get it to work :(
I have a script from a mod that teleports the player to a cell when an item is equipped and returns them to their original location when it is unequipped. Haven Bag Campsite
 
Scriptname HavenBagTeleport extends activemagiceffect

ObjectReference Property Marking Auto
ObjectReference Property HavenBagMarker Auto
Cell Property HavenBag Auto
objectReference property BagItem auto
{Point explicity to the unique, placed reference of the bag in the world}

EVENT OnEffectStart ( Actor Target, Actor Caster )
if (Caster.GetParentCell() != HavenBag)
Marking.MoveTo (Caster)
Caster.MoveTo (HavenBagMarker)
Endif
EndEvent

EVENT onEffectFinish ( Actor Target, Actor Caster )
if (Caster.GetParentCell() == HavenBag)
Caster.Moveto (Marking)
if caster.getItemCount(BagItem) < 1
; safety catch - if the player dropped the bag in the sanctuary, add it to inventory so it doesn't get lost.
caster.addItem(BagItem)
endif
endif
EndEvent
 
I'm trying to simply change the cell this teleports to to be the Magical Dollhouse from this mod, https://www.nexusmods.com/skyrimspecialedition/mods/54109
This is the 'teleport' script from the dollhouse mod. I thought it would be relatively simple to find where this mod was teleporting to and paste that into the bag script but it doesn't appear to work.
 
scriptName JLTeleportPlayer extends ActiveMagicEffect

objectreference property DollhouseActiRef auto

Bool Ready = true

function OnEffectStart(Actor akTarget, Actor akCaster)

if Ready
Ready = false
game.GetPlayer().MoveTo(DollhouseActiRef, 100 as Float, 100 as Float, 10 as Float, true)
utility.Wait(1.00000)
Ready = true
endIf
endFunction
 
If anyone could help me with what I'm doing wrong it would be appreciated.
Thank you.
Posted (edited)
2 hours ago, Angahran said:

can't get it to work

 

Have you tried turning it off, and back on again?

 

Edit: What do you mean doesn't work? Does it teleport you somewhere, but not where you expected? Did your character turn purple and grow bunny ears and fluffy tail? Nothing happened?

 

When in doubt, add more debug notifications:

Scriptname HavenBagTeleport extends activemagiceffect

ObjectReference Property Marking Auto
ObjectReference Property HavenBagMarker Auto
Cell Property HavenBag Auto
objectReference property BagItem auto
{Point explicity to the unique, placed reference of the bag in the world}

EVENT OnEffectStart ( Actor Target, Actor Caster )
    Debug.Notification("OnEffectStart")
EndEvent

EVENT onEffectFinish ( Actor Target, Actor Caster )
    Debug.Notification("onEffectFinish")
EndEvent

 

Edited by traison
  • 2 weeks later...
Posted

1. Yes I tried turning it off and on again :P

2. When I tried equipping/unequipping the item the script was attached to nothing happened.

 

I did finally figure it out.

The fact that 'properties' for the script are not actually stored in the script is what threw me :P

 

Once I dug into creation kit to look at how the existing script was working I found the properties and that gave me enough of a hint to figure out how to get mine working.

 

So, now I have a handy dandy 'Dollhouse Doll' that teleports me to the dollhouse when I equip it and returns me to where I came from when I unequip it.

 

Scriptname JLDollHouseTeleport extends activemagiceffect  

ObjectReference Property Marking  Auto  
ObjectReference Property DollHouseMarker  Auto  
Cell Property DollHouse  Auto  
objectReference property DollHouseItem auto

EVENT OnEffectStart ( Actor Target, Actor Caster )
	if (Caster.GetParentCell() != DollHouse)
		Marking.MoveTo (Caster)
		Caster.MoveTo (DollHouseMarker)
	Endif
EndEvent

EVENT onEffectFinish ( Actor Target, Actor Caster )
	if (Caster.GetParentCell() == DollHouse)
		Caster.Moveto (Marking)
		if caster.getItemCount(DollHouseItem) < 1
			caster.addItem(DollHouseItem)
		endif
	endif
EndEvent

 

MGKDH.esp jldollhouseteleport.pex

Posted

To get properties to refresh on scripts, one bruteforce way is to delete the script instance from the save file using something like ReSaver. I've recently used that to "reset" properties on trigger boxes in a cell I've created. Good idea? dunno, works well during development though.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...