Jump to content

Script won't compile


Xerperious

Recommended Posts

Hey can someone tell me why my script isn't compiling?

Scriptname TwinAxesScript extends ObjectReference  
{Summons left Twinaxe}
Actor property PlayerRef auto
Spell Property SpellToCast auto

Event OnInit()
    RegisterForActorAction(0)
EndEvent

Event OnActorAction(int actionType, Actor akActor, Form source, int slot)
	If akActor == PlayerRef
		If !source
			If ActionType == 6
				If !slot
					SpellToCast.Cast(Self, Self)
				Endif
			Endif
		Endif
	Endif
EndEvent

This is the error it keeps giving

"Starting 1 compile threads for 1 files...
Compiling "TwinAxesScript"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\Scripts\Source\temp\TwinAxesScript.psc(7,4): RegisterForActorAction is not a function or does not exist
No output generated for TwinAxesScript, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on TwinAxesScript"

Not sure what I am doing wrong if someone could help that would be good.

It is supposed to be a script attached to a weapon, and once that weapon is drawn it should cast a summon weapon spell and summon into the left hand. As in a "paired weapons" script.

Link to comment
Share on other sites

You need the SKSE source scripts (PSC files) installed to the folder where you have the game's source scripts located. If they are not present, then the compiler will not find any SKSE functions/events.

Thank you, now it compiles. I thought I had them in there.

Edited by Xerperious
Link to comment
Share on other sites

The ActionType that you check against in the OnActorAction event needs to be the ActionType registered with RegisterForActorAction.

 

Currently, you register for 0 and check for 6. With that setup, it will fail.

Still doesn't work with 6 7 or 8.

Scriptname TwinAxesScript extends ObjectReference  
{Summons left Twinaxe}
Actor property PlayerRef auto
Spell Property SpellToCast auto

Event OnInit()
    RegisterForActorAction(7)
EndEvent

Event OnActorAction(int actionType, Actor akActor, Form source, int slot)
	If akActor == PlayerRef
		If !source
			If ActionType == 7
				If !slot
					SpellToCast.Cast(Self, Self)
				Endif
			Endif
		Endif
	Endif
EndEvent
Link to comment
Share on other sites

Why do you have the If !source and If !slot lines?

 

I don't understand your purpose with them. It could be that those lines are blocking the rest of your script. Could also be that you have it attached to a weapon. The weapon is most likely within the player's inventory. There are some things which will not run on objects while they are in a container (actor inventory is considered a container by the game). You might want to consider moving this from the weapon to a script on a player alias on a quest that runs for the duration that you want the player to have this ability. You could then compare the 'source' variable in OnActorAction against the desired weapon. That would allow it to process when only the correct weapon is used rather than any weapon.

 

I know for a fact that it works as I used OnActorAction with ActionType 7 & 9 in my Followers as Companions mod.

Link to comment
Share on other sites

Why do you have the If !source and If !slot lines?

 

I don't understand your purpose with them. It could be that those lines are blocking the rest of your script. Could also be that you have it attached to a weapon. The weapon is most likely within the player's inventory. There are some things which will not run on objects while they are in a container (actor inventory is considered a container by the game). You might want to consider moving this from the weapon to a script on a player alias on a quest that runs for the duration that you want the player to have this ability. You could then compare the 'source' variable in OnActorAction against the desired weapon. That would allow it to process when only the correct weapon is used rather than any weapon.

 

I know for a fact that it works as I used OnActorAction with ActionType 7 & 9 in my Followers as Companions mod.

Nothing has worked yet, I tried doing a quest and that didn't work either.

Link to comment
Share on other sites

Are you testing on a new game or a save that has not seen your mod at all? Sometimes script changes won't be recognized mid-game.

It is on a save that hasn't had the mod played on it yet. I have to spawn in the items each time and equip it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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