How to access propterties of an effect in that effect's scri

Post » Mon Jun 18, 2012 2:40 pm

OK, I'm toying with adding a script to a magical effect (in this case FireDamageConcAimed, since that's the most basic fire spell, and I want to learn how to script for effects...how do I access the base damage value for the effect in the script? In the description, it does so with "A gout of fire that does points per second. Targets on fire take extra damage."

I want that number () in my script, but I don't see anything in the Papyrus documentation on how these are referenced.
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm

Post » Mon Jun 18, 2012 2:40 am

(Listens to the chirping crickets)

So...IS there any way for a called script to access properties of the item or obect that called them in the script? This script could be called by dozens of different spells with dozens of different magnitudes, and there doesn't appear to be a way to add a script directly to a spell, only on the Magic Effects, and I don't want to have to write the script dozens of times with different constant values.

I tried just using "magnitude", "Parent.magnitude", "this.magnitude" and so on, but so far I have not found a way to access this variable in the script. It's being called, and passing values is very basic programming.
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm

Post » Mon Jun 18, 2012 7:09 am

I don't think its possible, but it would be incredibly useful if it were. This might be something the SKSE team could add though.
User avatar
Amanda Leis
 
Posts: 3518
Joined: Sun Dec 24, 2006 1:57 am

Post » Mon Jun 18, 2012 2:16 pm

That's ridiculous...how could they NOT have a way for the object/effect/whatever running the script to be accessed in the script?

Here's what I have so far...I used the examples in the wiki, but it still doesn't work.
Scriptname PlayerDestructionScalingEffect extends ActiveMagicEffect  {Deals extra damage based on players' Destruction skill and spell magnitude.}MagicEffect CallingSpellEffect = ActiveMagicEffect.GetBaseObject()float SpellIntensity = CallingSpellEffect.magnitude / 2.0Event OnEffectStart(Actor Target, Actor Caster)	if Caster.Faction == "PlayerFaction" ; If the caster is the player		float PDestructionLevel = Caster.GetActorValue("Destruction") as float		int DestructionPowerLevel = (PDestructionLevel/10) - 1.5		int Damage = DestructionPowerLevel * SpellIntensity		if DestructionPowerLevel >= 1 ; If destruction is high enough for a bonus,			Target.DamageAV("Health",Damage) ; Deals damge equal to half the base value for each 10 levels in destruction above 15		endif	endifEndEvent
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am

Post » Mon Jun 18, 2012 11:00 am

It may be because magnitudes are stored as part of the spell or potion that contains the effect, rather than with the effect itself. But I don't know. Generally in the past you wouldn't use a magnitude or area for a script effect, only duration.

One thing that you can do is have 'magnitude' be a property of your effect script. That at least lets you reuse the script for different effects of varying magnitudes.

Add the line:

float Property magnitude auto

And it'll show up in the effect script's properties window. If you need to make another spell with the same effect but a different magnitude, duplicate the effect, and change the magnitude property.
User avatar
Jynx Anthropic
 
Posts: 3352
Joined: Fri Sep 08, 2006 9:36 pm

Post » Mon Jun 18, 2012 10:41 am

unfortunately spell script objects don't have any properties or functions to get any information about their effects :(
User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am

Post » Mon Jun 18, 2012 4:46 pm

So then how is the description getting the value for the tag to display in the description? it has to be accessable somehow!

The problem is, you can't put the script in the spell, only in the spell effect (in this case, FireDamageConcAimed) - there's no way to know ahead of time which spell is using it to set the value...
User avatar
butterfly
 
Posts: 3467
Joined: Wed Aug 16, 2006 8:20 pm

Post » Mon Jun 18, 2012 9:59 am

So then how is the description getting the value for the tag to display in the description? it has to be accessable somehow!

The problem is, you can't put the script in the spell, only in the spell effect (in this case, FireDamageConcAimed) - there's no way to know ahead of time which spell is using it to set the value...
unfortunately it seems to be a hardcoded string concatenation. I'd definitely look to the SKSE team on this one.
User avatar
Kathryn Medows
 
Posts: 3547
Joined: Sun Nov 19, 2006 12:10 pm

Post » Mon Jun 18, 2012 2:12 pm

O well, looks like I'll have to guess....this compiles at least:

Scriptname PlayerDestructionScalingEffect extends ActiveMagicEffect  {Deals extra damage based on players' Destruction skill and spell magnitude.}int HalfSpellIntensity = 4 ;Have to guess, since there is no way to pass the spell intensity, which is stupid.Event OnEffectStart(Actor Target, Actor Caster)    Actor ThePlayer = Game.GetPlayer()    if Caster == ThePlayer ; If the caster is the player        float PDestructionLevel = Caster.GetActorValue("Destruction") as float        int DestructionPowerLevel = ((PDestructionLevel/10.0) - 1.5) as int        int Damage = DestructionPowerLevel * HalfSpellIntensity as int        if DestructionPowerLevel >= 1 ; If destruction is high enough for a bonus,            Target.DamageAV("Health",Damage) ; Deals damge equal to half the base value for each 10 levels in destruction above 15        endif    endifEndEvent
User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm

Post » Mon Jun 18, 2012 1:47 pm

changes with difficulty setting as well
User avatar
Josh Sabatini
 
Posts: 3445
Joined: Wed Nov 14, 2007 9:47 pm

Post » Mon Jun 18, 2012 5:01 am

changes with difficulty setting as well

Which is precisely why I want to be able to get the value at run-time instead of making guesses.
User avatar
Sudah mati ini Keparat
 
Posts: 3605
Joined: Mon Jul 23, 2007 6:14 pm


Return to V - Skyrim