Jump to content

Help with OnHit script please.


Recommended Posts

Don't know what's wrong with this script. Could somebody shine some light on it?

 

 

Quest Property MyQuest Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked)

if (akAggressor == Game.GetPlayer())
MyQuest.Setstage(10)

endif
EndEvent

 

 

Even though it says 'Compile Succeeded' it gives this error and won't save...

 

(5,123): mismatched character 'b' expecting '\n'

 

 

Link to comment
Share on other sites

In the OnHit event line you have a slash "\" remove it or put the remainder on the next line.

 

The reason it is there is that you most likely copied the line from the CK wiki. The purpose of a slash by itself is to indicate that the current line of code continues on the next line. Someone probably included it in the example so that the code could be more easily read rather than requiring the reader to scroll horizontally.

 

It does have its uses. It is used heavily in the following function designed to allow a key press to process only when desired.

 

 

Bool Function SafeProcess()
	If (!Utility.IsInMenuMode()) \
	&& (!UI.IsMenuOpen("Dialogue Menu")) \
	&& (!UI.IsMenuOpen("Console")) \
	&& (!UI.IsMenuOpen("Crafting Menu")) \
	&& (!UI.IsMenuOpen("MessageBoxMenu")) \
	&& (!UI.IsMenuOpen("ContainerMenu"))
		;IsInMenuMode to block when game is paused with menus open
		;Dialogue Menu check to block when dialog is open
		;Console check to block when console is open - console does not trigger IsInMenuMode and thus needs its own check
		;Crafting Menu check to block when crafting menus are open - game is not paused so IsInMenuMode does not work
		;MessageBoxMenu check to block when message boxes are open - while they pause the game, they do not trigger IsInMenuMode
		;ContainerMenu check to block when containers are accessed - while they pause the game, they do not trigger IsInMenuMode
		Return True
	Else
		Return False
	EndIf
EndFunction

The above could have been done as one long line such as follows

Bool Function SafeProcess()
	If (!Utility.IsInMenuMode()) && (!UI.IsMenuOpen("Dialogue Menu")) && (!UI.IsMenuOpen("Console")) && (!UI.IsMenuOpen("Crafting Menu")) && (!UI.IsMenuOpen("MessageBoxMenu")) && (!UI.IsMenuOpen("ContainerMenu"))
		;IsInMenuMode to block when game is paused with menus open
		;Dialogue Menu check to block when dialog is open
		;Console check to block when console is open - console does not trigger IsInMenuMode and thus needs its own check
		;Crafting Menu check to block when crafting menus are open - game is not paused so IsInMenuMode does not work
		;MessageBoxMenu check to block when message boxes are open - while they pause the game, they do not trigger IsInMenuMode
		;ContainerMenu check to block when containers are accessed - while they pause the game, they do not trigger IsInMenuMode
		Return True
	Else
		Return False
	EndIf
EndFunction

 

 

Link to comment
Share on other sites

Make sure the property is properly assigned.

Make sure the quest in question is not already running when you start your testing.

Make sure the object that the script is attached to is not already existing in the game when you start your testing.

Make sure that you are not already on stage 10 when attempting to test the script.

 

Beyond that, no idea.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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