1) I'd really like to have some functions that I can just call on an actor, from any script, as if they were in Actor.psc. I do not want to edit actor.psc for obvious reasons, though. As an example, I have these functions in an activemagiceffect script right now:
Spoiler
float Function getAttribute(string attribute) if ( attribute = "Strength" ) return thisActor.getAV("FavorActive") elseif ( attribute = "Endurance" ) return thisActor.getAV("FavorPointsBonus") elseif ( attribute = "Speed" ) return thisActor.getAV("FavorsPerDay") elseif ( attribute = "Agility" ) return thisActor.getAV("FavorsPerDayTimer") elseif ( attribute = "Intelligence" ) return thisActor.getAV("BypassVendorStolenCheck") elseif ( attribute = "Willpower" ) return thisActor.getAV("BypassVendorKeywordCheck") elseif ( attribute = "Personality" ) return thisActor.getAV("Infamy") else return none endifEndfunctionFunction setAttribute(string attribute, float value) if ( attribute == "Strength" ) thisActor.setAV("FavorActive", value) elseif ( attribute == "Endurance" ) thisActor.setAV("FavorPointsBonus", value) elseif ( attribute == "Speed" ) thisActor.setAV("FavorsPerDay", value) elseif ( attribute == "Agility" ) thisActor.setAV("FavorsPerDayTimer", value) elseif ( attribute == "Intelligence" ) thisActor.setAV("BypassVendorStolenCheck", value) elseif ( attribute == "Willpower" ) thisActor.setAV("BypassVendorKeywordCheck", value) elseif ( attribute == "Personality" ) thisActor.setAV("Infamy", value) endifEndfunction
Instead of copying this to every script and setting "thisActor" to the actor, I'd rather have it accessible from any script without pasting it in. So my question is: if I add these functions to a script that extends actor (deleting "thisActor" of course), and attach it to every actor in my mod, will I be able to just do something like:
someActor.getAttribute("Strength")Without importing or pasting the functions in every activemagiceffect or other script?
I'd like to just move all of my actor-related functions from my other scripts into a single one, and call them like this, but before I make that change I want to know if it would work or not, and if I would need to write it any differently.
Lastly, my mod is basically a total conversion, so I'm not worried about compatiblity, but I also want to know if, in this case, there are problems with attaching a script directly to an actor? I mean, I could imagine this working if I attach the script directly to the actor, but so far I've been attaching scripts to actors with magic effects because I've read that it's bad to attach them directly, and have experienced some issues myself like that if I save a game, change the script, and open it again for example. But I'm just wondering if there are problems with attaching a script directly for a total conversion mod, with finalized scripts?
(P.S. if you have some optimization suggestion for those attribute functions, go ahead.)