darkness947 Posted December 7, 2016 Share Posted December 7, 2016 Hi all! I've been working on a script for the past 10 hours over the last day or so, and I've run into a wall. The goal of this simple mod is to create a two-way portal (like this mod http://www.nexusmods.com/skyrim/mods/29447/?). The difference between the two and the reason I wasn't simply content in using that one during my playthough is I wanted to have an object that was activated and would look like a giant mirror (an eluvian from Dragon Age actually) :smile: . I've been able to create a test spell for the first portal, and it works really well in that it summons the object I want it to. The object I'm using is one of the portal doors in the wayshrines from Dawnguard, recolored to have a solid background. I even have a script attached to the door that gives a textbox if the portal is activated but both portals haven't been placed. I've dabbled in scripting before (I did some simple stuff in high school and started to learn my way around Neverwinter Nights' scripting engine), but I think I'm out of my depth here.What I want is for each portal to be unique so the scripts won't get confused during teleportation. This means the previous door has to either be destroyed and a new one created or the door has to be moved to the player when the spell is cast. I can get the spell to summon the "first door" by creating it in front of the player, but I can't figure out how to get the spell script to either destroy or move the previous door when the spell is cast again; this leads to unique doors being created every time. I think It might be the fact that I've duplicated an actual door, which won't allow me to do what I want, but I'm not sure. I also haven't attached any waypoints or teleport objects to the door's spawning yet, but I wanted to take the problem one step at a time.I basically cannibalized the script from this mod (http://www.nexusmods.com/skyrim/mods/19303/?), which lets one summon a chest in front of them. The other problem I was having is I wanted to make SURE that these portals (and whatever I eventually attach to them that allows the teleportation) were unique, but I couldn't find anything other than the findclosestreferenceoftypefromref function that would allow me to check, and I'm not sure about ranges and the like that would interfere with the results of that returning as it should. I thought about setting a variable (and when I put my scripts up you'll be able to see I played around with variables a little bit) but I couldn't understand how I would destroy the old reference when the time came if it couldn't find it during a check. So to summarize I'm asking for help with two things:1) destroying the portal/moving the portal in the first place when the spell is cast and the portal already exists(to make sure only one instance of the portal is active at once)2) making sure that the portals are unique (so that there are no problems when it comes to pairing). I'm going to attach all the scripts I've developed thus far (which is two): Scriptname _EluvianPortal01 extends activemagiceffect {What this will do is create portal 1 and set a var.} Door Property Eluvian01 auto Activator Property SummonFX auto Activator Property BanishFX auto Float Property AngleOffset auto Float Property FrontDistance auto GlobalVariable Property Portal01Up auto GlobalVariable Property SearchDistance Auto Event onEffectStart (actor akcaster, actor aktarget) ObjectReference Portal01 = (game.findclosestreferenceoftypefromref(Eluvian01, game.getplayer(), (SearchDistance.GetValue() as int)))int Portal01Check = (Portal01Up.GetValue() as int)if Portal01Check != 0;the idea here is to move the portal if it's already presentPortal01.placeatme(BanishFX) utility.wait(0.5) Portal01.disable()Portal01.delete()endif ObjectReference PortalGenerate = Game.GetPlayer().placeatme(Eluvian01, 1) PortalGenerate.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))PortalGenerate.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))PortalGenerate.placeatme(SummonFX)Portal01Up.SetValue(1) EndEvent Like I said, I think I'm close but I'm also out of my depth. Any help would be appreciated. Scriptname EluvianPortal01REF extends ObjectReference {this lives on the first Eluvian portal, and willgive the portal its activation and so on.} import debugimport utility GlobalVariable Property Portal01Up autoGlobalVariable Property Portal02Up autoObjectReference Property Portal1Destination auto Event OnLoad(){The first part of this will simply play the portal animation on the item}If Portal01Up != NONEPlayAnimation("playAnim02")EndIfEndEvent Event OnActivate(ObjectReference akactionref){This will spit out a text box if the second Eluvian is not up; otherwise it will activate the first Eluvian and teleport the player to the second one}If Portal02Up != NONEGame.GetPlayer().moveto(Portal1Destination)EndIf Debug.MessageBox("Please place the second portal.")EndEvent Link to comment Share on other sites More sharing options...
darkness947 Posted December 9, 2016 Author Share Posted December 9, 2016 Update: it wasn't the door itself. It was the searchdistance property which wasn't working for some reason. I replaced it initially with a really large integer. Now on to problem 2! Someone please please help with this because I'm stuck. I can get the portal to move now if I recast relatively close to the previous portal, but it doesn't work If I put it down in say Riverwood and then go to the Radiant Raiment (in Solitude) to replace it. I thought I could do it by making each of the two portals persistent, but I can't figure out how to move them via formID. Any help would be appreciated. Link to comment Share on other sites More sharing options...
darkness947 Posted December 10, 2016 Author Share Posted December 10, 2016 I fixed my problem! I placed the doors in a new interior cell which allowed me to set them as properties in the script (making them unique). This has been solved. Link to comment Share on other sites More sharing options...
Recommended Posts