Jump to content

Getting Magic User's Stats on Magic Effect Script


MichikoUnknownFox

Recommended Posts

Hello again TES Nexus. Yeah just like the title says, I'm trying to find a way to get the magic effect script to read Actor Values from the caster of spells.

 

Actually, to be more specific, let's say I'm trying to create a "lucky sword" or something like that. I want the lucky sword to do additional damage based on the luck of the one using the sword. I understand that using player.luck works, but only if I'm the one using it. How can I make it so that even if other actors use the sword, their stat is also read and added to the script?

Link to comment
Share on other sites

Hello again TES Nexus. Yeah just like the title says, I'm trying to find a way to get the magic effect script to read Actor Values from the caster of spells.

 

Actually, to be more specific, let's say I'm trying to create a "lucky sword" or something like that. I want the lucky sword to do additional damage based on the luck of the one using the sword. I understand that using player.luck works, but only if I'm the one using it. How can I make it so that even if other actors use the sword, their stat is also read and added to the script?

You can't really. The spell would need a reference to check. Unless you have a specific reference, or a way for a script on that reference to record a variable for later use, it cannot be done. The problem with recording an exterior variable is that if you have more than one instance of the weapon, they will changing the same variables. What you might want to do is use something like

set self to getself
set target to self.getcombattarget
if target.combattarget == self
set luck to target.getav luck
else
set luck to getrandompercent
endif
end

this would make it so that if an NPC is using the weapon against another NPC, luck would be set to the luck of the person using the weapon. However this only works if both combatants are attacking eachother. To find out who is using the weapon, they have to be the target. Since the player will never return a combat target, the luck of the person using the weapon can never be found (simulating it with random percent). Also, this will return a random number if the user of the weapon isn't targeted by the person they're hitting. Unless you only have one instance of this weapon, and can use a global or something to record the luck of the user (set on equip) this is pretty much the only way to make anything like this work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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