Hello, I'm trying to script the limit of chem use depending on player's Endurance, but I've never touched Timer before.
I wanted to set the global variable to +1 each time the chem is used, but I wanted it to get back after 10 secs.
According to my understanding of ScriptEffectElapsedSeconds, that part should work.
This script adds perk if global variable is higher than 2 and removes it if it's lower than 3.
This is the same as saying the player must have the perk if the global >= 3, right?
The script is missing an endif, but I would also guard the addperk/removeperk functions so it is not continually adding/removing the perk
Scn ChemsAll1Script Begin GameMode if ChemLimit >= 3 if player.HasPerk PerkChemOverdose1 == 0 player.AddPerk PerkChemOverdose1 endifelse if player.HasPerk PerkChemOverdose1 == 1 player.RemovePerk PerkChemOverdose1 endifendifEnd
Edit - You need a way to stop the timer part and remove the spell:
scn ChemOverdoseJetScript float Timer short iDone Begin ScriptEffectStart Set ChemLimit to ChemLimit + 1 End Begin ScriptEffectUpdate if iDone == 0 Set Timer to ScriptEffectElapsedSeconds if Timer >= 10 Set ChemLimit to ChemLimit - 1 Set iDone to 1 RemoveSpell ChemOverdoseJetSpell ;whatever your spell name is endif endif End