Jump to content

Script help for new mod I am working on


figor888

Recommended Posts

this mod involves player entering trigger box along the bridge to college of Winterhold.

The trigger should initiate a courier quest to deliver a note by Farengar where the player is to investigate necromancers at a Point of Interest location. Loot involves a Mass Reanimation Spell that I created.

 

I have followed along DF127 and Doug Hamil's courier quest tutorials,

Issues I am having, no properties are generated from the auto declaration lines and error is generated when I try to compile that says the following:

 

Starting 1 compile threads for 1 files...
Compiling "SM_MassReanimateTriggerScript"...
E:\SteamLibrary E\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\SM_MassReanimateTriggerScript.psc(5,0): missing EOF at 'Scriptname'
No output generated for SM_MassReanimateTriggerScript, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on SM_MassReanimateTriggerScript

 

here is the script:

 

;Mass Reanimate trigger script
Scriptname MassReanimate extends ObjectReference
Book Property Note Auto
Quest Property WICourier Auto
ReferenceAlias Property NoteAliasRef Auto
Actor Property PlayerRef Auto
ActorBase property TriggerActor auto
{actor that trigger is looking for - all non-empty trigger actors need to be in trigger in order for IsTriggerReady to be true
Update OnInit when adding new trigger properties!}
Int InTrigger = 0
Event OnTriggerEnter(ObjectReference akTriggerRef)
if (InTrigger == 0) && akTriggerRef == PlayerRef()
InTrigger += 1
NoteAliasRef.ForceRefTo(PlayerRef().PlaceAtMe(Note))
(WICourier as WICourierScript).AddAliasToContainer(NoteAliasRef)
endif
endif
EndEvent
Event OnTriggerLeave(ObjectReference akTriggerRef)
if (InTrigger > 0)
if akTriggerRef == Game.GetPlayer()
InTrigger -= 1
debug.notification("You thought you saw the courier heading your way")
endif
endif
EndEvent
Thank you!
Any help is much appreciated!
Link to comment
Share on other sites

Don't start the script with a comment. You can add a documentation string underneath the header like you did with the ActorBase property.

Scriptname MassReanimate extends ObjectReference
{Mass Reanimate trigger script}
Also remove the brackets behind PlayerRef, and there's a doubled up endif in the OnTriggerEnter block. Edited by Ghaunadaur
Link to comment
Share on other sites

And if you are going to have a property for the player reference, be sure to utilize it instead of Game.GetPlayer(). But in this particular case I actually find it preferable to compare the akTriggerRef to Game.GetPlayer() and then use akTriggerRef once you are certain that it is the player.

Link to comment
Share on other sites

E:\SteamLibrary E\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\SM_MassReanimateTriggerScript.psc(5,0): missing EOF at 'Scriptname'

 

BUT the name inside the script is "MassReanimate", which does not match with filename above.

 

SM_MassReanimateTriggerScript

 

Scriptname SM_MassReanimateTriggerScript extends ObjectReference
{Mass Reanimate trigger script}
; https://forums.nexusmods.com/index.php?/topic/10400493-script-help-for-new-mod-i-am-working-on/

; figor888 wrote: "trigger should initiate a courier quest to deliver a note by Farengar,
;                  where the player is to investigate necromancers at a POI location"

  Quest PROPERTY WICourier auto        ; vanilla Skyrim quest
  Book  PROPERTY Note      auto        ; Farengars note

  Bool bNoteGiven    ; [default=False]


; -- EVENTs --

EVENT OnReset()
    bNoteGiven = False
ENDEVENT


EVENT OnCellAttach()
IF ( bNoteGiven )
ELSE
    gotoState("Waiting")            ; ### STATE ###
    IF self.IsDisabled()
        self.Enable()
    ENDIF
ENDIF
ENDEVENT


;===================================
auto state Waiting
;=================
    EVENT OnTriggerEnter(ObjectReference triggerRef)
    IF (triggerRef as Actor)
        IF (triggerRef == Game.GetPlayer() as ObjectReference)
            myF_Action(triggerRef)
        ENDIF
    ENDIF
    ENDEVENT
;=======
endState

;===================================
state Done
;=========
    EVENT OnTriggerLeave(ObjectReference triggerRef)
        IF (triggerRef == Game.GetPlayer() as ObjectReference)
            self.Disable()
            Debug.Notification("You thought, you saw the courier heading your way.")
        ENDIF
    ENDEVENT
;=========
endState


; -- FUNCTION --

;----------------------------------------------
FUNCTION myF_Action(ObjectReference triggerRef)
;----------------------------------------------
IF WiCourier.IsRunning()
    RETURN    ; - STOP -    do not clash with others
ENDIF
;---------------------
    WICourierScript ps = WICourier as WICourierScript

IF ( ps )
    IF ( Note )
        gotoState("Done")            ; ### STATE ###
        bNoteGiven = TRUE
        ps.ItemToContainer(Note as Form, 1)
        WiCourier.setStage(0)                    ; start the quest now
    ENDIF
ENDIF
ENDFUNCTION


; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Scriptname QF_WICourier_00039F82 Extends Quest Hidden
;
;;BEGIN FRAGMENT Fragment_1
;Function Fragment_1()
;;BEGIN CODE
;; debug.trace("WICourier: stage 0, start up")
;;move to location center marker and enable
;    Alias_Courier.TryToMoveTo(Alias_LocationCenterMarker.GetReference())
;    Alias_Courier.TryToEnable()
;    RegisterForUpdate(10.0)                        ; REGISTER
;;END CODE
;EndFunction
;;END FRAGMENT
;
;;BEGIN FRAGMENT Fragment_3
;Function Fragment_3()
;;BEGIN CODE
;; debug.trace("WICourier: stage 200, shut down")
;;move to holding cell and disable
;    Alias_Courier.TryToMoveTo(Alias_CourierMarker.GetReference())
;    Alias_Courier.TryToDisable()
;    UnRegisterForUpdate()                        ; UNREGISTER
;;END CODE
;EndFunction
;;END FRAGMENT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


; ++++++++++++++++++++++++++
; see "WICourierScript.psc"
; ++++++++++++++++++++++++++

;FUNCTION addItemToContainer(Form FormToAdd, Int countToAdd = 1)    ; * FORM *
;;--------------------------------------------------------------
;;;    Debug.Trace(self+" addItemToContainer()")
;
;    pCourierContainer.AddItem(FormToAdd, countToAdd)
;    incrementItemCount()
;ENDFUNCTION

;FUNCTION addRefToContainer(ObjectReference objectRefToAdd)            ; * ObjectReference *
;;---------------------------------------------------------
;;;    Debug.Trace(self+" addRefToContainer()")
;
;    pCourierContainer.AddItem( objectRefToAdd )
;    incrementItemCount()
;ENDFUNCTION

;FUNCTION addAliasToContainer(ReferenceAlias refAliasToAdd)            ; * ReferenceAlias *
;;---------------------------------------------------------
;;;    Debug.Trace(self+" addAliasToContainer()")
;
;    pCourierContainer.AddItem( refAliasToAdd.GetReference() )
;    incrementItemCount()
;ENDFUNCTION


;FUNCTION incrementItemCount()
;;----------------------------
;    ;pWICourierItemCount.value += 1            ; ERROR by Default
;    pWICourierItemCount.Mod(1)
;ENDFUNCTION

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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