Jump to content

Would like some help with a quest script.


marieruth

Recommended Posts

That's because you aren't supposed to change that line. That line MUST remain as:

Event OnEffectStart(Actor akTarget, Actor akCaster)

The reason it is this way is so that you can script things to happen either to the target or to the one that cast the spell.

 

Alright thanks, I'm not really sure why I originally set the parameters to the magic effect ID, but it just appeared in the Wiki to me as a sort of "placeholder" example. :)

Link to comment
Share on other sites

It is a sort of placeholder. You can use a different variable name if you wish. But you still have to define the type of variable. The event as coded in the engine has two actors associated with it: the target and the caster.

 

If you really wanted, you could write it as

Event OnEffectStart(Actor Bob, Actor Fred)

However, as you can quickly tell it would be very easy to forget who is doing what. Sticking with Bethesda's variable makes an easier time of telling which actor is in which role.

Link to comment
Share on other sites

 

 

It is a sort of placeholder. You can use a different variable name if you wish. But you still have to define the type of variable. The event as coded in the engine has two actors associated with it: the target and the caster.

 

If you really wanted, you could write it as

Event OnEffectStart(Actor Bob, Actor Fred)

However, as you can quickly tell it would be very easy to forget who is doing what. Sticking with Bethesda's variable makes an easier time of telling which actor is in which role.

 

 

 

It would probably be best for my sanity if I stuck with Bethesda's way, anyhow. :smile:

 

I made a small script that I would attach to the quest that checks to see if a recovery spell is active, I'm getting a compiling error and I am not sure what it means.

Scriptname aaa_ShoutRecovery_SpellCheck_Script extends Quest  
{This script checks to see if player has the restoration spell that removes the timing alterations.}

Actor Property PlayerRef  Auto  
{Player Reference}

bool SpellActive = false

Event OnInit()
	If PlayerRef.HasSpell("aaa_ResetRecoveryTimeSpell")
		SpellActive = true
	Else	
		PlayerRef.AddSpell("aaa_ResetRecoveryTimeSpell")
		SpellActive = true
	EndIf
endEvent

The error I'm getting is:

 

Starting 1 compile threads for 1 files...
Compiling "aaa_ShoutRecovery_SpellCheck_Script"...
C:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaa_ShoutRecovery_SpellCheck_Script.psc(10,14): type mismatch on parameter 1 (did you forget a cast?)
C:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaa_ShoutRecovery_SpellCheck_Script.psc(13,12): type mismatch on parameter 1 (did you forget a cast?)
No output generated for aaa_ShoutRecovery_SpellCheck_Script, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on aaa_ShoutRecovery_SpellCheck_Script
I originally didn't have the quotation marks added around the Spell ID, and I had errors telling me that my Spell ID was undefined, and after I added the quotation marks I got the error message above.
Link to comment
Share on other sites

You need to make a spell property and fill that then use that spell property inside that function. If you make the property variable the same name as the corresponding record then it will auto-fill.

 

Example

 

 

Scriptname aaa_ShoutRecovery_SpellCheck_Script extends Quest  
{This script checks to see if player has the restoration spell that removes the timing alterations.}
 
Actor Property PlayerRef  Auto  
{Player Reference}
Spell Property aaa_ResetRecoveryTimeSpell Auto
{spell to use}
 
bool SpellActive = false
 
Event OnInit()
	If PlayerRef.HasSpell(aaa_ResetRecoveryTimeSpell)
		SpellActive = true
	Else	
		PlayerRef.AddSpell(aaa_ResetRecoveryTimeSpell)
		SpellActive = true
	EndIf
endEvent 

Link to comment
Share on other sites

 

 

You need to make a spell property and fill that then use that spell property inside that function. If you make the property variable the same name as the corresponding record then it will auto-fill.

 

Example

 

 

Scriptname aaa_ShoutRecovery_SpellCheck_Script extends Quest  
{This script checks to see if player has the restoration spell that removes the timing alterations.}
 
Actor Property PlayerRef  Auto  
{Player Reference}
Spell Property aaa_ResetRecoveryTimeSpell Auto
{spell to use}
 
bool SpellActive = false
 
Event OnInit()
	If PlayerRef.HasSpell(aaa_ResetRecoveryTimeSpell)
		SpellActive = true
	Else	
		PlayerRef.AddSpell(aaa_ResetRecoveryTimeSpell)
		SpellActive = true
	EndIf
endEvent 

 

 

 

So is it generally a rule of thumb that if you involve an object that is created by the user within a script to give it its own property when using it in the script?

Link to comment
Share on other sites

If you are wanting to reference something that the player created in game and it does not have a base form that you can link, you cannot make a property and link to it in the CK. You'll have to obtain the reference in another manner. So no, it is not a general rule of thumb. It is what is typically done with known objects in the CK. Unknown objects tend to require a variety of workaround solutions. Not all of which are 100% reliable.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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