Jump to content

Papyrus Scripting


Recommended Posts

Ive been learning for about 3 years now and even so i still have alot of trouble with scripting i can usally make my way through but right now i am working on some stuff for fallout london some personal things and a few things im going to publish one of which being a mod that slows time when the favorites menu is open and dispels afterwards i have a couple scripts that have been unsuccessful. specifically ive tried from scratch and used the jettimeslowscript and the nerdragescript to try and put together mine but  here it is 

 

Scriptname TimeScaleManager extends Quest

; Define properties for spells and image space modifiers
SPELL Property SlowTimeSpell Auto
SPELL Property SlowTimeSpellMedium Auto
SPELL Property SlowTimeSpellLight Auto

ImageSpaceModifier Property FadeInImod Auto
ImageSpaceModifier Property FadeOutImod Auto

; Function to apply slow time effects based on magnitude
Function ApplySlowTimeMode(int magn, Actor player)
    if magn == 0
        player.DoCombatSpellApply(SlowTimeSpell, player)
    elseif magn == 1
        player.DoCombatSpellApply(SlowTimeSpellMedium, player)
    elseif magn == 2
        player.DoCombatSpellApply(SlowTimeSpellLight, player)
    endif
    FadeInImod.ApplyCrossFade(1.0)
EndFunction

; Function to dispel slow time effects
Function DispelSlowTime(Actor player)
    player.DispelSpell(SlowTimeSpell)
    player.DispelSpell(SlowTimeSpellMedium)
    player.DispelSpell(SlowTimeSpellLight)
    FadeOutImod.Remove()
EndFunction

; Function to handle the favorites menu opening
Function OnFavoritesMenuOpen()
    ApplySlowTimeMode(0, Game.GetPlayer()) ; Change the magnitude as needed
EndFunction

; Function to handle the favorites menu closing
Function OnFavoritesMenuClose()
    DispelSlowTime(Game.GetPlayer())
EndFunction

; Event: OnInit
Event OnInit()
    ; Register for favorites menu events (this requires custom implementation to detect menu changes)
    ; This part is pseudo-code and will need to be replaced with actual registration logic
    RegisterForFavoritesMenuOpen()
    RegisterForFavoritesMenuClose()
EndEvent
 and i attach to a quest and use another script to 

Scriptname MyModInitScript extends Quest

; Define a property for the TimeScaleManager script
TimeManager Property myTimeManager Auto

; Event: OnInit
; Purpose: Initializes the TimeScaleManager by starting its periodic checks
Event OnInit()
    myTimeManager.get()
EndEvent
 i know there may be some inconsistencys these may not reflect my most recent but should give an idea of what and how im trying to do this any input would be greatly appreciated. 

Link to comment
Share on other sites

  • 3 weeks later...

Maybe Not the right place to ask this but I am out of ideas.

I finally got the Creation Kit fully working???? and am getting scripts to compile, HOWEVER.

I have created a quest whch runs on startup. I have called Start() in the script intended to be the main script, I have filled all properties (whatever that does), but SetStage(index 0) is not starting the quest and my Player inventary related commands are not working either. I other words the quest is not running, or not connecting with the game. In Skyrin there was a RegisterForUpdate(...,...) command, I know why that was needed for a quest to function, but now, I.m out of ideas.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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