IsharaMeradin Posted November 12, 2014 Share Posted November 12, 2014 (edited) Is there such a thing as global variables in papyrus like in c++? in this case a variable that I can declare outside of an event. a global variable that takes the value of an ActorValue?Yes, you can use global variables. You can set the value within the CK or within any script event. You can get the value within any script event or condition (effects, dialog, etc). See GlobalVariable Script for available functions. Edited November 12, 2014 by IsharaMeradin Link to comment Share on other sites More sharing options...
Kerberus14 Posted November 13, 2014 Share Posted November 13, 2014 I can't seem to figure this out, I've tried most things but to no avail. I'm trying to make the player's magicka bar drain by a certain percentage 0.0023% of his maximum magicka, I've tried doing it, waiting for 12 hours expecting for my magicka to deplete almost completely but it doesn't, nothing happens. Link to comment Share on other sites More sharing options...
lofgren Posted November 13, 2014 Share Posted November 13, 2014 I can't seem to figure this out, I've tried most things but to no avail. I'm trying to make the player's magicka bar drain by a certain percentage 0.0023% of his maximum magicka, I've tried doing it, waiting for 12 hours expecting for my magicka to deplete almost completely but it doesn't, nothing happens. Post your script. Here would be my attempt: float MagickaDamage Actor Me Event OnEffectStart(Actor akTarget, Actor akCaster) Me = AkTarget MagickaDamage = Me.GetBaseActorValue("Magicka") * 0.000023 Me.DamageActorValue("Magicka", MagickaDamage) RegisterForSingleUpdate(1.0) endEvent Event OnUpdate() Me.DamageActorValue("Magicka", MagickaDamage) RegisterForSingleUpdate(1.0) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) UnregisterForUpdate() endEvent Totally untested, of course. Link to comment Share on other sites More sharing options...
Kerberus14 Posted November 13, 2014 Share Posted November 13, 2014 (edited) Function RegisterForUpdateGameTime(float afInterval) native Event OnPlayerLoadGame() RegisterForUpdateGameTime(0.1) ; endevent Event OnUpdateGameTime() messagebox to check if event is triggered Added a spell that deals damage to magicka and changed magnitude using a formula. endevent this was just a test to see if it works, the script won't even trigger. Edited November 13, 2014 by Kerberus14 Link to comment Share on other sites More sharing options...
marieruth Posted November 13, 2014 Share Posted November 13, 2014 Is there a papyrus script function that involves altering recovery times through a script? Link to comment Share on other sites More sharing options...
lofgren Posted November 13, 2014 Share Posted November 13, 2014 Function RegisterForUpdateGameTime(float afInterval) native Event OnPlayerLoadGame() RegisterForUpdateGameTime(0.1) ; endevent Event OnUpdateGameTime() messagebox to check if event is triggered Added a spell that deals damage to magicka and changed magnitude using a formula. endevent this was just a test to see if it works, the script won't even trigger.Well what is it attached to? Link to comment Share on other sites More sharing options...
Kerberus14 Posted November 13, 2014 Share Posted November 13, 2014 To a MagicEffect. Link to comment Share on other sites More sharing options...
lofgren Posted November 13, 2014 Share Posted November 13, 2014 OK, so you add the ability or cast the spell on the player, then you save the game, then you exit the game, then you load the game, and through all of that you get no feedback from your script whatsoever? Also I am curious, why do you need an OnPlayerLoadGame() event? Why don't you just register for the update using OnEffectStart() like I did above? Link to comment Share on other sites More sharing options...
Kerberus14 Posted November 13, 2014 Share Posted November 13, 2014 I will now, and yes, no feedback, nothing. Link to comment Share on other sites More sharing options...
Kerberus14 Posted November 13, 2014 Share Posted November 13, 2014 If PlayerRef.HasPerk(PerkRef)==1Magicka Drained by 0.0023% of total magicka. I want just this line to run every second in the game.I'll even attach it to the player to make sure. Link to comment Share on other sites More sharing options...
Recommended Posts