Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] Need help with Mark & Recall Script


Nalfeyn
 Share

Recommended Posts

Hello hello ! 

 

At first I want to warn you, because I have never done a script before. I hope this wont change your mind in helping me. 

Second thing is, that I'm a german speaker and my last english lesson was 3 years ago. So I hope you will forgive me some missspelling or gramma mistakes. 

 

I took a look at the following mod : http://skyrim.nexusmods.com/mods/10955//?

and thought : Wow, beautiful animations, and the Idea of a portal, where you just have to go through without any buttons is quite brilliant !

So I wanted this in my mod, a bit modefied, but anyways ... 

I contacted the author, until I realized that he wasnt active since 03/2013 and might never come back.

So I took a look at his files, until I realized then, that there are no psc files, instead ... just pex files. 

 

I basically want to recreate this mod, modefied in the following way : 

 

Instead of a Mark spell, I want the portal to have a permanent location.

So the portal will appear since the beginning of a game in front of my player home. 

The Recall portal will appear on the players location. 

 

For the reason, that I have no experience in scripting, I decided to ask for help and tried to get an understanding of the mod, first. 

Here is what I got. 

 

It contains 3 scripts, which are important for the spell.

aaFXMarkandRecallPortalDoorScript

aaMarkandRecallMagicEffectScript

aaMarkandRecallPortalTriggerScript

 

He placed an interior area. "aaMarkandRecallDummyCell" which contains the objects :

FXMarkandRecallPortalDoor01 (MovableStatic)

FXMarkandRecallPortalDoor02  (MovableStatic)
MagConjurePortalLPMAR01 (Sound Marker)

MagConjurePortalLPMAR02 (Sound Marker)

MarkandRecallPortalLight01 (Light)

MarkandRecallPortalLight02 (Light)

MarkandRecallPortalTrigger01 (Activator)

MarkandRecallPortalTrigger02 (Activator)

XMarker (Static)

XMarker01 (Static)

XMarker02 (Static)

XMarker03 (Static)

 

Both FXMarkandRecallPortalDoor (MovableStatic) and MarkandRecallPortalTrigger (Activator) containing animation. Dont know why both of them ?

 

Dont know yet why he placed everything in this DummyCell ? Btw he set everthing one upon the other. Dont know why. 

 

I guess the script needs to contains the following : 

 

The aaFXMarkandRecallPortalDoorScript needs to contain information about the animation. 

When the animation is active, when its idle, when it starts and when its about to close. 

Animation Names are : animIdle01, animTrans01, animIdle02, animTrans02

So on event start the animTrans01 is playing, followed by the animIdle02 (which is a loop)

On event end the animTrans02 is playing, followed by animIdle01

 

The aaMarkandRecallMagicEffectScript needs to contain information about the MagicEffect. 

When the mark spell is cast, an Xmarker needs to be set up to the player's location. Also an Reference like "fast travel" needs to be linked to the following Xmarker of the recall spell, which is placed at the player's location, if casting the recall spell. 

When the recall spell is cast, an Xmarker needs to be set up to the player's location.

Maybe also the aaFXMarkandRecallPortalScript needs to be linked ? 

Or is the animation also linked with the spell ? 

 

The aaMarkandRecallPortalTriggerScript is also set up at the player's location. 

It needs to set the Trigger on the player's location. 

It's active on passing through - no need for a button to activate. 

 

I've really tried to understand the mod and how it works. 

I hope I didnt mess up that bad.

 

Hoping for your responses. 

 

-nalfeyn

 

'Edit : I've made a screenshot, what the "DummyCell" looks like in the CK. On the second and third one, you can see the ObjectsReferences (Hope that Helps)

 

 

16d038b115.png

 

 

f6b4564909.png

7daa74f0dd.png

Edited by Nalfeyn
Link to comment
Share on other sites

Just a couple of explanations on things that confused you:

 

Scripts can't create just anything they want out of thin air. Often they must work with pre-existing items placed in the Creation Kit. But these items are not meant to be seen by the player at all times or Skyrim would look like a junkyard. So, they are stored in places where the player can't see them, such as dummy cells, or a few thousand units underneath the world. As long as the scripts know the reference numbers of these items, it doesn't matter if they're all jumbled together or where they are.

 

There is a difference between a movable static, which is generally a physical item, and an activator trigger, which is often just an invisible box. The animation on the door is probably meant to play at all times to show that it is a magic door. The animation on the trigger is probably special spell effects that only play when the trigger is activated.

 

The animation names that you listed don't reveal anything useful, since hundreds of animated objects use the same names to identify different parts of their animation cycle. They are standard terms.

 

Have you taken a look at the script WillieSea suggested in his Leveler's Tower mod? If it does what you want, you're already set. If it does much of what you want, then you can decide whether that's good enough or whether it needs changes to be what you have to have.

Link to comment
Share on other sites

At first. Thank you very much for your response !

 

Yes, I took a look on WillieSea's script, but for the reason that I'm very new to scripting it confuses me. 

Is there an animation like in the other mod I mentioned ? 

Or does it teleport the caster directly after casting the mod ? 

 

I want a portal to appear on the place where I cast the spell.

Like in the "Mark and Recall" mod I've linked above.

Link to comment
Share on other sites

My script does not move a 'portal' to the location, but you could add that to the script. My script 'does' move a marker to the players location before teleport, so you can go back to where you were when you cast the spell.

 

Take a look at the basic scripting class here, so you understand how to get a script of your own to interact with objects in the game.

This is necessary since scripts are SEPERATE from the game environment, and must be linked via properties.

Link to comment
Share on other sites

It sounds like Willie's script is the right starting point, since it will do the basics for you and just needs the special effects added. If the author's permissions for the Mark & Recall script allow you to use the assets, then you could use the animated portal and trigger from that with a modified version of the Leveler's Tower script to get the result you want.

Link to comment
Share on other sites

I took a look at the basic scripting class. but where can I get a list with possible functions in the PSC ?

 

So I guess I'm gonna start then with the following ?
 
Scriptname LevelersSpellHomeScript extends activemagiceffect  
{Teleport Home Spell Script}
 
ObjectReference property HomeTarget auto - is this like the xmarker for themark spell (permanent location) ?
ObjectReference property TeleTarget auto - is this like the xmarker for the recall spell then ? 
 
Actor caster
ObjectReference casterRef
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
caster = akCaster
casterRef = (caster as ObjectReference)
 
 
 
 
 
 
 
Link to comment
Share on other sites

That was what I was looking for ! I have some good news though !

Today I was doing some research on the steam workshop and found a mod, which creates town portals with a similar animation. Only difference : they close themselves after the first use. I wrote to the author and he was very very friendly and offered me the script Psc's and his help. I looked through his script and I even understood nearly everything in there. So ... maybe I get it to work the next week. I'll keep this thread updated.

-Nalfeyn

Link to comment
Share on other sites

I just took a quick look at Willie's Leveler's Tower Magic Door setup. The permanent door in the Tower is just a copy of a Riften load door tied to the LevelersSpellMagicDoorActScript plus an XMarkerHeading used as the target destination. The vanilla barrier sitting over the door is just there to provide animation effects, which are already built into the portal you want. I would think all you would need to do is set the movable-static portal and the portal activator that goes with it, set up an XMarkerHeading at that location, attach Willie's script to the activator, set the parameters to your portal and marker references, and you would have your permanent portal. Make equivalent changes for the summoned door and you're done.

Edited by BrettM
Link to comment
Share on other sites

Okay, so I wrote the scripts, but I still get some errors. 

 

Scriptname ElinthrialMagicEffect extends activemagiceffect  

;FX
ObjectReference property ElinthrialFXPortalDoor01 auto
ObjectReference property ElinthrialFXPortalDoor02 auto

;Triggers
ObjectReference property ElinthrialPortalTrigger01 auto
ObjectReference property ElinthrialPortalTrigger02 auto

;Lights
ObjectReference property ElinthrialPortalLight01 auto
ObjectReference property ElinthrialPortalLight02 auto

;Markers
ObjectReference property ElinthrialPortalMarker auto
ObjectReference property ElinthrialxMarker auto
ObjectReference property ElinthrialxMarker01 auto
ObjectReference property ElinthrialxMarker02 auto
ObjectReference property ElinthrialxMarker03 auto

function CloseElinthrialFXPortalDoor01 ()
	ElinthrialFXPortalDoor01.moveto(ElinthrialxMarker01, 0.000000. 0.000000, 0.000000, true)
	ElinthrialFXPortalDoor01.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor01.enable(false)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle01", true, 0.000000)
	;utility.wait(0.0300000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animTrans01", true, 0.000000)
	;utility.wait(1.27000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight01.moveTo(ElinthrialxMarker01)
endFunction

function CloseElinthrialFXPortalDoor02 ()
	ElinthrialFXPortalDoor02.moveto(ElinthrialxMarker02, 0.000000. 0.000000, 0.000000, true)
	ElinthrialFXPortalDoor02.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor02.enable(false)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle01", true, 0.000000)
	;utility.wait(0.0300000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animTrans01", true, 0.000000)
	;utility.wait(1.27000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight02.moveTo(ElinthrialxMarker02)
endFunction

function SendElinthrialPortalTriggerstoCell ()
	ElinthrialPortalTrigger01.moveTo(ElinthrialxMarker01)
	ElinthrialPortalTrigger02.moveTo(ElinthrialxMarker02)
endFunction

function SummonElinthrialPortalDoor01 ()
	ElinthrialFXPortalDoor01.moveTo(ElinthrialPortalMarker)
	ElinthrialFXPortalDoor01.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor01.enable(false)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle01", true, 0.000000)
	utility.wait(0.0300000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animTrans01", true, 0.000000)
	utility.wait(1.27000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight01.moveTo(ElinthrialFXPortalDoor01)
	ElinthrialPortalTrigger01.moveTo(ElinthrialFXPortalDoor01)
endFunction

function SummonElinthrialPortalDoor02 ()
	ElinthrialFXPortalDoor02.moveTo(game.getPlayer() as objectreference, 0.000000, 0.000000, 0.000000, true)
	ElinthrialFXPortalDoor02.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor02.enable(false)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle01", true, 0.000000)
	utility.wait(0.0300000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation"(animTrans01", true, 0.000000)
	utility.wait(1.27000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation"(animIdle02", true, 0.000000)
	ElinthrialPortalLight02.moveTo(ElinthrialFXPortalDoor02)
	ElinthrialPortalTrigger02.moveTo(ElinthrialFXPortalDoor02)
endFunction

function OnEffectStart (actor akTarget, actor akCaster)
	SendElinthrialPortalTriggerstoCell ()
	CloseElinthrialFXPortalDoor01 ()
	CloseElinthrialFXPortalDoor02 ()
	SummonElinthrialPortalDoor01 ()
	SummonElinthrialPortalDoor02 ()
endFunction
 
Starting 1 compile threads for 1 files...
Compiling "ElinthrialMagicEffect"...
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(23,62): missing RPAREN at '.'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(23,64): no viable alternative at input '0.000000'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(23,82): required (...)+ loop did not match anything at input ','
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(23,88): required (...)+ loop did not match anything at input ')'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(35,62): missing RPAREN at '.'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(35,64): no viable alternative at input '0.000000'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(35,82): required (...)+ loop did not match anything at input ','
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(35,88): required (...)+ loop did not match anything at input ')'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(70,26): no viable alternative at input 'playGamebryoAnimation'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(70,61): required (...)+ loop did not match anything at input ','
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(70,67): required (...)+ loop did not match anything at input ','
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(70,77): required (...)+ loop did not match anything at input ')'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(72,26): no viable alternative at input 'playGamebryoAnimation'
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(72,60): required (...)+ loop did not match anything at input ','
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(72,66): required (...)+ loop did not match anything at input ','
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialMagicEffect.psc(72,76): required (...)+ loop did not match anything at input ')'
No output generated for ElinthrialMagicEffect, compilation failed.
 
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on ElinthrialMagicEffect
 
 
Scriptname ElinthrialPortalTrigger extends ObjectReference  

;FX
ObjectReference property ElinthrialFXPortalDoor01 auto
ObjectReference property ElinthrialFXPortalDoor02 auto

;Triggers
ObjectReference property ElinthrialPortalTrigger01 auto
ObjectReference property ElinthrialPortalTrigger02 auto

;Lights
ObjectReference property ElinthrialPortalLight01 auto
ObjectReference property ElinthrialPortalLight02 auto

;Markers
ObjectReference property ElinthrialPortelMarker auto
ObjectReference property ElinthrialxMarker auto
ObjectReference property ElinthrialxMarker02 auto
ObjectReference property ElinthrialxMarker03 auto
ObjectReference property ElinthrialxMarker04 auto

function SendElinthrialPortalTrigger01toCell ()
	ElinthrialPortalTrigger01.moveTo(ElinthrialxMarker02)
endFunction

function OnActivate(ObjectReference akActionRef)
	SendElinthrialPortalTrigger01toCell ()
	game.getPlayer().moveTo(ElinthrialFXPortalDoor02, 0.000000, 0.000000, 0.000000, true)
endFunction

ObjectReference property ElinthrialPortalTrigger01 auto

function OnActivate(ObjectReference akActionRef)
	game.getplayer().moveTo(ElinthrialPortalTrigger02, 0.000000, 0.000000, 0,000000, true)
endFunction
 
Starting 1 compile threads for 1 files...
Compiling "ElinthrialPortalTrigger"...
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialPortalTrigger.psc(31,25): script property ElinthrialPortalTrigger01 already defined
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialPortalTrigger.psc(31,25): script variable ::ElinthrialPortalTrigger01_var already defined
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialPortalTrigger.psc(31,25): script property ElinthrialPortalTrigger01 already has a get function defined
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialPortalTrigger.psc(31,25): script property ElinthrialPortalTrigger01 already has a set function defined
E:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\ElinthrialPortalTrigger.psc(33,0): script function onactivate already defined in the same state
No output generated for ElinthrialPortalTrigger, compilation failed.
 
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on ElinthrialPortalTrigger
 
Scriptname ElinthrialRefreshPortalAnimation extends ObjectReference  

;This script will reset the animation on the portal door, si it'll keep running
;even if the player shifts beyond cells.

function OnCellAttach()
	self.ResetElinthrialPortalAnimFunc()
endFunction

function OnCellLoad()
	; Empty Function
endFunction

function ResetElinthrialPortalAnimFunc()
	if self. is3DLoaded()
		if self.isDisabled()
			self.enable(false)
		endIf
		self.PlayGamebryoAnimation("animIdle02", true, 0.000000)
	endIf
endFunction
 
Hope you can help me. 
Edited by Nalfeyn
Link to comment
Share on other sites

First, it would really help readability if you would indent your code properly and use the "code" format button for posting it. (The button that looks like a blue "<>" in the editor toolbar.)

 

Second, punctuation errors, such as the missing right parentheses, can cascade throughout your code, causing a lot of errors that will just vanish if you get the punctuation fixed. Always fix your punctuation first, so you can see any real errors that remain.

 

Finally, there is a big difference between Functions and Events. None of your scripts have any Events that the system or other scripts can call to execute your code! Most of the routines that you have called Functions should actually be Events. For example,

function OnCellAttach()

    self.ResetElinthrialPortalAnimFunc()

endFunction
 
should actually be
 
Event OnCellAttach()

    self.ResetElinthrialPortalAnimFunc()

endEvent

Events are how the system notifies your script that something has happened that you may need to handle. So, when the system attaches a cell, it sends notifications of the event out to scripts. If the script has something that needs to be done when the cell is attached, then it intercepts that notification by having an "Event OnCellAttach."

 

You need to sort out which of your code blocks should be events and which should be functions for your script to work properly.

Link to comment
Share on other sites

In general, code blocks with names that begin with "On" should be events. Events defined by Papyrus are documented on the Creation Kit Wiki, which will tell you a number of important things about them and usually provides an example. For example, the OnCellAttach page.

 

In your first script, you can see that the OnEffectStart is really the beginning of the script. When the player casts the spell, the system signals this event, telling it who cast the spell (akCaster) and, if the spell is targeted at some actor, who that target is (akTarget). The event then calls the functions needed to produce the effect.

 

It is really important to have a basic understanding of concepts like Events, Functions, and Properties if you're going to script. I would recommend that you read the short Papyrus Primer at the CK site, at the very least. Reading some of the simple tutorials there, like "Hello World" and the introductory tutorials here would be very helpful as well. It's easier to get started by following a proper lesson that explains things in order than it is to get the basic information one question at a time when you don't really know what questions you need to ask.

Link to comment
Share on other sites

Also, realize that the teleport spell in Levelers Tower is a SPELL, so the script is setup as a spell script. (What it extends)

Scriptname ElinthrialMagicEffect extends activemagiceffect

 

ActiveMagicEffect will only work when attached to a spell.

 

So, you have to change that to what your attaching your script to if its not a spell.

Link to comment
Share on other sites

Okay. So I changed them : 

Scriptname ElinthrialMagicEffect extends activemagiceffect  

;FX
ObjectReference property ElinthrialFXPortalDoor01 auto
ObjectReference property ElinthrialFXPortalDoor02 auto

;Triggers
ObjectReference property ElinthrialPortalTrigger01 auto
ObjectReference property ElinthrialPortalTrigger02 auto

;Lights
ObjectReference property ElinthrialPortalLight01 auto
ObjectReference property ElinthrialPortalLight02 auto

;Markers
ObjectReference property ElinthrialPortalMarker auto
ObjectReference property ElinthrialxMarker auto
ObjectReference property ElinthrialxMarker01 auto
ObjectReference property ElinthrialxMarker02 auto
ObjectReference property ElinthrialxMarker03 auto

function CloseElinthrialFXPortalDoor01 ()
	ElinthrialFXPortalDoor01.moveto(ElinthrialxMarker01)
	ElinthrialFXPortalDoor01.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor01.enable(false)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle01", true, 0.000000)
	utility.wait(0.0300000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animTrans01", true, 0.000000)
	utility.wait(1.27000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight01.moveTo(ElinthrialxMarker01)
endFunction

function CloseElinthrialFXPortalDoor02 ()
	ElinthrialFXPortalDoor02.moveto(ElinthrialxMarker02)
	ElinthrialFXPortalDoor02.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor02.enable(false)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle01", true, 0.000000)
	utility.wait(0.0300000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animTrans01", true, 0.000000)
	utility.wait(1.27000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight02.moveTo(ElinthrialxMarker02)
endFunction

function SendElinthrialPortalTriggerstoCell ()
	ElinthrialPortalTrigger01.moveTo(ElinthrialxMarker01)
	ElinthrialPortalTrigger02.moveTo(ElinthrialxMarker02)
endFunction

function SummonElinthrialPortalDoor01 ()
	ElinthrialFXPortalDoor01.moveTo(ElinthrialPortalMarker)
	ElinthrialFXPortalDoor01.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor01.enable(false)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle01", true, 0.000000)
	utility.wait(0.0300000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animTrans01", true, 0.000000)
	utility.wait(1.27000)
	ElinthrialFXPortalDoor01.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight01.moveTo(ElinthrialFXPortalDoor01)
	ElinthrialPortalTrigger01.moveTo(ElinthrialFXPortalDoor01)
endFunction

function SummonElinthrialPortalDoor02 ()
	ElinthrialFXPortalDoor02.moveTo(game.getPlayer() as objectreference, 0.000000, 0.000000, 0.000000, true)
	ElinthrialFXPortalDoor02.setAngle(0.000000, 0.000000, 0.000000)
	ElinthrialFXPortalDoor02.enable(false)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle01", true, 0.000000)
	utility.wait(0.0300000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animTrans01", true, 0.000000)
	utility.wait(1.27000)
	ElinthrialFXPortalDoor02.playGamebryoAnimation("animIdle02", true, 0.000000)
	ElinthrialPortalLight02.moveTo(ElinthrialFXPortalDoor02)
	ElinthrialPortalTrigger02.moveTo(ElinthrialFXPortalDoor02)
endFunction

Event OnEffectStart (actor akTarget, actor akCaster)
	SendElinthrialPortalTriggerstoCell ()
	CloseElinthrialFXPortalDoor01 ()
	CloseElinthrialFXPortalDoor02 ()
	SummonElinthrialPortalDoor01 ()
	SummonElinthrialPortalDoor02 ()
endEvent
Scriptname ElinthrialPortal01 extends ObjectReference  

;FX
ObjectReference property ElinthrialFXPortalDoor01 auto
ObjectReference property ElinthrialFXPortalDoor02 auto

;Triggers
ObjectReference property ElinthrialPortalTrigger01 auto
ObjectReference property ElinthrialPortalTrigger02 auto

;Lights
ObjectReference property ElinthrialPortalLight01 auto
ObjectReference property ElinthrialPortalLight02 auto

;Markers
ObjectReference property ElinthrialPortelMarker auto
ObjectReference property ElinthrialxMarker auto
ObjectReference property ElinthrialxMarker01 auto
ObjectReference property ElinthrialxMarker02 auto
ObjectReference property ElinthrialxMarker03 auto

Event OnActivate(ObjectReference akActionRef)
	game.getPlayer().moveTo(ElinthrialFXPortalDoor02, 0.000000, 0.000000, 0.000000, true)
endEvent
Scriptname ElinthrialPortal02 extends ObjectReference  

;FX
ObjectReference property ElinthrialFXPortalDoor01 auto
ObjectReference property ElinthrialFXPortalDoor02 auto

;Triggers
ObjectReference property ElinthrialPortalTrigger01 auto
ObjectReference property ElinthrialPortalTrigger02 auto

;Lights
ObjectReference property ElinthrialPortalLight01 auto
ObjectReference property ElinthrialPortalLight02 auto

;Markers
ObjectReference property ElinthrialPortelMarker auto
ObjectReference property ElinthrialxMarker auto
ObjectReference property ElinthrialxMarker01 auto
ObjectReference property ElinthrialxMarker02 auto
ObjectReference property ElinthrialxMarker03 auto

Event OnActivate(ObjectReference akActionRef)
	game.getPlayer().moveTo(ElinthrialFXPortalDoor01, 0.000000, 0.000000, 0.000000, true)
endEvent
Scriptname ElinthrialRefreshPortalAnimation extends ObjectReference  

;This script will reset the animation on the portal door, si it'll keep running
;even if the player shifts beyond cells.

Event OnCellAttach()
	self.ResetElinthrialPortalAnimFunc()
endEvent

Event OnCellLoad()
	; Empty Function
endEvent

function ResetElinthrialPortalAnimFunc()
	if self. is3DLoaded()
		if self.isDisabled()
			self.enable(false)
		endIf
		self.PlayGamebryoAnimation("animIdle02", true, 0.000000)
	endIf
endFunction

No errors while compiling. 

 

But when I cast the spell, nothing happens ?!

Link to comment
Share on other sites

The only way to know if everything is done right is when the scripts pass the smoke test -- working as intended to work without crashing the game. :)

 

Getting scripts past the compiler is the first step, before even thinking about smoke testing. Once you're there, however, the best way to proceed is to plan your testing in advance. Think about each activity your script performs and under what circumstances that activity takes place. Then make a checklist of actions that a test character needs to take to be sure all of those script functions are carried out. Programmers often refer to this as "exercising" the code.

 

For example, if you have a script that behaves differently at night than in the day, you need to make sure that your character uses it both at night and in the day. If you just test it at night, then you don't really know if it will blow up when someone uses it during the day.

 

You also need to test situations where things are NOT supposed to happen, to be sure they don't happen. For example, if your spell is not supposed to work indoors, test it indoors to make sure it doesn't work.

Link to comment
Share on other sites

I've tested it. I set up the spell, attached the scripts to the objects ... 

then I cast the spell. Nothing happened. No game crash, no portal appeared. I've ran right through the place where the portal is supposed to be and nothing happened. 

Link to comment
Share on other sites

One thing that can help you find out where things are going wrong in a script is to insert Debug.Trace calls at certain key points in the code. Turn on Papyrus logging in your Skyrim.ini, run your test, then look for your traces in the log.

 

For example, in your OnEffectStart event, you could put a statement at the top that reads something like

Debug.Trace(Self + " is being cast by " + akCaster)

If that statement shows up in the Papyrus log, then you know that the script at least recognized that you were casting the spell. If the statement does not show up, then you know that your spell is not being activated for some reason. Either way, you have a better idea of where to begin looking for a solution. In your functions you can put statements such as:

Debug.Trace (Self + " is summoning Portal Door 1")

So you know that the function that was supposed to be called was actually called.

 

Even without the Debug statements, you should check the log to see if any mention of your script is there. If your script is doing something that the system doesn't like, such as trying to call a function on an object that does not exist, then there will be an error message there.

 

Once you've solved your problems, you can then comment out the Debug statements by putting a ";" in front of them and recompile before release. The reason to leave them in as comments is that you might want to add or change something for the next version, so the debug statements are already there when you want to test that version and you don't have to rewrite them from scratch. Just change them from comments back into statements.

 

By the way, it is very, very good practice to comment your code well and put tooltip comments on your parameters, or at least the most important ones.

 

Edit: I would also recommend taking a look at FAQ: My Script Doesn't Work.

Edited by BrettM
Link to comment
Share on other sites

What did you do? Add debug statements? If you didn't get any messages in the log, then your script isn't being called for some reason, so worrying about what kind of references you need internally won't help.

 

However, the BaseID is used when you need to create a new copy of an object. It's like dragging something from the Object Window (where the base objects live) over to the Render Window (where reference objects live): a copy is created and given its own FormID in the cell. The BaseID is also used to refer to things such as FormLists, which don't have any physical existence. So, normally you will be referring to objects by reference ID.

Link to comment
Share on other sites

What did you do? Add debug statements? If you didn't get any messages in the log, then your script isn't being called for some reason, so worrying about what kind of references you need internally won't help.

 

However, the BaseID is used when you need to create a new copy of an object. It's like dragging something from the Object Window (where the base objects live) over to the Render Window (where reference objects live): a copy is created and given its own FormID in the cell. The BaseID is also used to refer to things such as FormLists, which don't have any physical existence. So, normally you will be referring to objects by reference ID.

I think this was/is the main mistake in my scripts. I wrote down the objectID in the scripts, not the reference ID. 

 

And yes, I added 2 debug statements in my magiceffect script and none of it was called. 

Link to comment
Share on other sites

Okay !!! Yeah ! 

It worked. 

I replaced all the ObjectID's in the scripts with the referenceID's ... and the portals do appear !

Still one thing is left. 

If I go right through the portal, the trigger is not activated. 

Scriptname ElinthrialPortalTrigger01 extends ObjectReference  

;FX
ObjectReference property FXPortalDoor01 auto
ObjectReference property FXPortalDoor02 auto

;Triggers
ObjectReference property PortalTrigger01 auto
ObjectReference property PortalTrigger02 auto

;Markers
ObjectReference property ElinthrialPortalMarker auto
ObjectReference property xMarker01 auto
ObjectReference property xMarker02 auto

Event OnActivate(ObjectReference akActionRef)
	game.getPlayer().moveTo(FXPortalDoor02, 0.000000, 0.000000, 0.000000, true)
endEvent

There must be something wrong with the Event, or maybe the trigger itself ?

How can I tell the script, that the trigger should be activated, right after passing the triggerbox ? 

Or do I have to make a change on the trigger itself ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...