Script templates

2 posts / 0 new
Last post
Rot's picture
Rot
Lead DeveloperDeveloperQuest Developer
Joined:
2014-03-16 17:45
Last seen:
4 days 4 hours ago

Scripts library WIP

 Journal updates
 
when a NPC dies

Trigger journal when a NPC dies
 

 
 
once several NPCs are dead

Trigger journal once several NPCs are dead
 

 
 
once several creatures are dead

Trigger journal once several creatures are dead
 

 
 
after 24 hours

Wait 24 hours before triggering something
 

 
 
after a week

Wait a week before triggering something
 

 
 
Disable Enable

Disable a NPC or object until a quest starts

Disable a NPC or object until a quest starts
 

 
 
Disable a NPC after a quest is finished

Make a NPC in exteriors leave after a quest is finished
 
Slepana's picture
Slepana
Senior DeveloperDeveloperQuest DeveloperReviewer
Joined:
2019-02-02 18:33
Last seen:
1 week 4 days ago

Book script currently used in TR:

Perform an action when the player opens a book or a scroll

 

begin your_script_name

short OnPCEquip
short PCSkipEquip

set PCSkipEquip to 0
; any actions that might end the script must be placed lower than this line

; Activating from the inventory
if ( MenuMode )
    set PCSkipEquip to 1

    if ( OnPCEquip )

        ; place actions for when the player opened the book from the inventory here

        set OnPCEquip to 0
        set PCSkipEquip to 0
        Activate
    endif

    return
endif

; Activating in the world
if ( OnActivate )

    ; place actions for when the player opened the book from the world here

    Activate
endif

end

A version with more comments explaining what the script does can be found here, but watch out for the missing line in the beginning (see arvisrend's comment). Also it was written with an older version of OpenMW in mind, so it sadly doesn't work with nightly builds at the time of writing (May 2020)

Your flesh is an insult to the perfection of the digital.