Jump to content

Recommended Posts

Posted

I have a spell doing 1 rad damage, and I apply it every second, but despite being applied multiple times, nothing changes. Can I just increase the magnitude and apply it all at once?
The controls for it are in a quest
 

Scriptname permRadiationFunctionScript extends Quest

int Property radiationAmount = 1 Auto
SPELL Property radiationSpell Auto Const

Function StartRadiationEffect()
    Debug.Notification("Starting radiation effect with amount: " + radiationAmount)
    if (radiationAmount <= 0)
        Debug.Notification("Invalid radiation amount. Must be greater than 0.")
        return
    endif
    
    ; Set up a timer to apply radiation effect every second
    if ((Self as Quest).GetStage() == 20) ; Assuming stage 20 is the initial state
        StartTimer(1, 0) ; Start the timer to apply radiation effect every second
        StartTimerGameTime(24, 0) ; Start a game time timer to double radiation amount every 24 hours
        Debug.Notification("Radiation effect started.")
        (Self as Quest).SetStage(10)
    endif
EndFunction

Function WentToStage()
	Debug.Notification("Went To Stage 10")
EndFunction

Function ApplyRadiationEffect()
    Actor player = Game.GetPlayer()
    Debug.Notification("applying a radiation effect")
    if (radiationSpell && player)
        int i = 0
        While(i < radiationAmount)
            player.AddSpell(radiationSpell, false) ; Apply the radiation spell to the player
            Debug.Notification("Applying radiation spell: " + radiationSpell + " i = " + i + " radiationAmount = " + radiationAmount)
            i = i + 1
        EndWhile
        Debug.Notification("Radiation effect applied. Current radiation amount: " + radiationAmount)
    ElseIf (player == None)
        Debug.Notification("Player not found.")
    ElseIf (radiationSpell == None)
        Debug.Notification("Radiation spell not set.")
    endif
EndFunction

Function doubleradiationamount()
    if (radiationAmount >= 10000)
        Debug.Notification("Radiation amount cannot be doubled further.")
        return
    endif
    radiationAmount *= 2
    Debug.Notification("Radiation amount doubled. New amount: " + radiationAmount)
    (Self as Quest).SetStage(10)
EndFunction

Function halveradiationamount()
    if (radiationAmount <= 1)
        Debug.Notification("Radiation amount cannot be halved further.")
        return
    endif
    radiationAmount /= 2
    Debug.Notification("Radiation amount halved. New amount: " + radiationAmount)
   (Self as Quest).SetStage(10)
EndFunction

Event OnTimer(int timerID)
    if (timerID == 0) ; Assuming 0 is the ID for the radiation effect timer
        ApplyRadiationEffect()
        StartTimer(1, 0) ; Restart the timer for continuous effect
    endif
EndEvent

Event OnTimerGameTime(int timerID)
    if (timerID == 0) ; Assuming 0 is the ID for the radiation effect timer
        doubleradiationamount()
        Debug.Notification("YOUR RADIATION LEVEL HAS DOUBLED")
        StartTimerGameTime(24, 0) ; Restart the timer for continuous effect
    endif
EndEvent

 

Posted (edited)

I'd try with a perk. I didn't tried this myself, so take it as an experiment.

In a perk entry you can use the option "Entry Point", there's one named "Mod Spell Magnitude", from this option you can use the function "Multiply Actor Value Mult", the argument for this function can be any actor value, so that you can use the actor value later to modify the magnitud multiplier through your script.

Note that, when you selected "Mod Spell Magnitude", a "Spell" tab has appeared in the Conditions area, there you can set a condition to make your spell be the one affected by this magnitude modifier.

Edited by DieFeM
  • Recently Browsing   0 members

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