Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

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 by IsharaMeradin
Link to comment
Share on other sites

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

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

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

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 by Kerberus14
Link to comment
Share on other sites

 

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...