Jump to content

self use in script


Recommended Posts

I want to have one script that will be attached to two magic effects, in that script is a function that I want to know which effect is the one the script is attached to - so that the function can do one of two things.

my_function(Bool choice)

where choice = True or False depending on which magic effect has the script running.

I think that using 'self' might be the answer to determine the boolean value to pass to the function but just by itself just gives me the name of the script.

Is this a doable thing?

I could just make two scripts very similar to each other, but I wish to avoid having to maintain two scripts and keep them in sync if I can just have the one.

 

diziet

 

Link to comment
Share on other sites

 

As an aside, would it be possible to somehow pass a value/parameter etc. to a magiceffect when the spell is cast without using a global variable or script property? I ask out of pure academic interest since your answer satisfies my needs completely!

 

GetFormFromFile might work in this scenario.

 

If the magic effect needs to get a variable value from another script (say a quest script):

 

 

;inside a function or event
NameOfQuestScript myQuestScript = (Game.GetFormFromFile(0x12345678,"WhateverPlugin.esp") as Quest) as NameOfQuestScript
If myQuestScript.myVar = XYZ
  ; change XYZ depending up whatever type of variable
  ; do stuff if matches
Else
  ; do stuff if does not match
EndIf

 

 

Edited by IsharaMeradin
Link to comment
Share on other sites

  • Recently Browsing   0 members

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