Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

Is there a simple way to force the inventory to close when you activate an item in the inventory? (i.e. in a script attached to the item?)

Using SKSE? Yes.

Event OnEquipped(Actor akActor)

     Input.TapKey(Input.GetMappedKey("Tween Menu")

EndEvent

Add that snippet to your item's script.

Link to comment
Share on other sites

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

 

Quick question!

I'm pretty new to mod creating in Skyrim (I did a little in Oblivion though)

I'm having trouble finding how to make spells work based on percentages.

For example, what I am trying to do here is have health damaged by 10% per second while restoring magicka and stamina in percentages

-I think I could figure out how to put the spell together just fine, I just can't seem to figure out how to do percentages, which seems like it is easier said than done, or atleast it should be easier done....

 

In addition, basically on the same line of things here, I was also trying to get some sort of life-steal going, this I don't know how to do. But I would like to put in %percentage% of life steal per hit.

(Like...in the old days of Oblivion that should just be "Absorb Health on contact" but, I can't seem to figure that one out here in Skyrim. ALSO, I suppose I should mention the life steal thing I kind of want it to globally effect the player, so all weapons and spells are now fortified with life steal, which I would assume would be an "ability" spell, but again, this comes down to: how?

 

Your help is appreciated!

You could quite easily do this by script. So you have a script effect, which, once activated, has a script like so:

Scriptname LifeStealMGEFScript Extends ActiveMagicEffect

Event OnEffectStart(Actor akTarget, Actor akCaster)

	akTarget.DamageAV("Health", ActorValuePercent(akTarget, "Health", 0.1)); in this scenario, damage the actors health by 20 percent
	akTarget.RestoreAV("Stamina", ActorValuePercent(akTarget, "Stamina", 0.1)); restore stamina by 10 percent
	akTarget.RestoreAV("Magicka", ActorValuePercent(akTarget, "Magicka", 0.1)); restore magicka by 10 percent

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

EndEvent

Float Function ActorValuePercent(Actor akTarget, String AV, Float Percent)

	If AV == "Health"

		Return ((akTarget.GetAV("Health") / akTarget.GetAVPercentage("Health")) * Percent)

	ElseIf AV == "Stamina"

		Return ((akTarget.GetAV("Stamina") / akTarget.GetAVPercentage("Stamina")) * Percent)

	ElseIf AV == "Magicka"

		Return ((akTarget.GetAV("Magicka") / akTarget.GetAVPercentage("Magicka")) * Percent)

	EndIf

EndFunction

Then attach the magic effect to your spell/ability/perk.

 

There might just be a way to do this through the Absorb archetype though, haven't played around with it much.

 

 

Heads up: GetActorValuePercentage() doesn't work as intended with buffed HP/magicka. The code snippet on the wiki page is wrong.

Edited by Terra Nova
Link to comment
Share on other sites

 

Is there a simple way to force the inventory to close when you activate an item in the inventory? (i.e. in a script attached to the item?)

Using SKSE? Yes.

Event OnEquipped(Actor akActor)

     Input.TapKey(Input.GetMappedKey("Tween Menu")

EndEvent

Add that snippet to your item's script.

 

So if I add that to the item's script, it would require SKSE for the mod to work properly, but would compile without issues?

 

Another question - Is there anyway to make a MiscObject item favoritable in-game? I tried to favorite the Converter Skull from my mod and it gave me a message saying that the item isn't important enough.

Link to comment
Share on other sites

 

 

 

 

Is there a simple way to force the inventory to close when you activate an item in the inventory? (i.e. in a script attached to the item?)

Using SKSE? Yes.
Event OnEquipped(Actor akActor)

     Input.TapKey(Input.GetMappedKey("Tween Menu")

EndEvent
Add that snippet to your item's script.

So if I add that to the item's script, it would require SKSE for the mod to work properly, but would compile without issues?

 

Another question - Is there anyway to make a MiscObject item favoritable in-game? I tried to favorite the Converter Skull from my mod and it gave me a message saying that the item isn't important enough.

If you have SKSE installed properly (7z archive way) then yes, it will compile.

 

And iColor, guess I'm not sure how that would work then.

Link to comment
Share on other sites

Is there a simple way to force the inventory to close when you activate an item in the inventory? (i.e. in a script attached to the item?)

non-SKSE method....

 

I use this to open a container's inventory when activating/equipping an item in the player's inventory.

Game.DisablePlayerControls(False, False, False, False, False, True)	; Exit menu
Utility.Wait(0.01)
;perform an action if necessary such as activating a container to simulate accessing a bag of holding or other player carried container
Utility.Wait(0.01) 
Game.EnablePlayerControls(False, False, False, False, False, True)	; Reenable menu		

I have also seen it done as follows...

Game.DisablePlayerControls(False, False, False, False, False, True)	; Exit menu
Utility.Wait(0.01)
Game.EnablePlayerControls(False, False, False, False, False, True)	; Reenable menu
;perform some other actions as desired
Link to comment
Share on other sites

 

Is there a simple way to force the inventory to close when you activate an item in the inventory? (i.e. in a script attached to the item?)

 

non-SKSE method....

 

I use this to open a container's inventory when activating/equipping an item in the player's inventory.

Game.DisablePlayerControls(False, False, False, False, False, True)	; Exit menu
Utility.Wait(0.01)
;perform an action if necessary such as activating a container to simulate accessing a bag of holding or other player carried container
Utility.Wait(0.01) 
Game.EnablePlayerControls(False, False, False, False, False, True)	; Reenable menu		

I have also seen it done as follows...

Game.DisablePlayerControls(False, False, False, False, False, True)	; Exit menu
Utility.Wait(0.01)
Game.EnablePlayerControls(False, False, False, False, False, True)	; Reenable menu
;perform some other actions as desired

This would be better. By a lot.

Link to comment
Share on other sites

 

Quick question!

I'm pretty new to mod creating in Skyrim (I did a little in Oblivion though)

I'm having trouble finding how to make spells work based on percentages.

For example, what I am trying to do here is have health damaged by 10% per second while restoring magicka and stamina in percentages

-I think I could figure out how to put the spell together just fine, I just can't seem to figure out how to do percentages, which seems like it is easier said than done, or atleast it should be easier done....

 

In addition, basically on the same line of things here, I was also trying to get some sort of life-steal going, this I don't know how to do. But I would like to put in %percentage% of life steal per hit.

(Like...in the old days of Oblivion that should just be "Absorb Health on contact" but, I can't seem to figure that one out here in Skyrim. ALSO, I suppose I should mention the life steal thing I kind of want it to globally effect the player, so all weapons and spells are now fortified with life steal, which I would assume would be an "ability" spell, but again, this comes down to: how?

 

Your help is appreciated!

You could quite easily do this by script. So you have a script effect, which, once activated, has a script like so:

Scriptname LifeStealMGEFScript Extends ActiveMagicEffect

Event OnEffectStart(Actor akTarget, Actor akCaster)

	akTarget.DamageAV("Health", ActorValuePercent(akTarget, "Health", 0.1)); in this scenario, damage the actors health by 20 percent
	akTarget.RestoreAV("Stamina", ActorValuePercent(akTarget, "Stamina", 0.1)); restore stamina by 10 percent
	akTarget.RestoreAV("Magicka", ActorValuePercent(akTarget, "Magicka", 0.1)); restore magicka by 10 percent

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

EndEvent

Float Function ActorValuePercent(Actor akTarget, String AV, Float Percent)

	If AV == "Health"

		Return ((akTarget.GetAV("Health") / akTarget.GetAVPercentage("Health")) * Percent)

	ElseIf AV == "Stamina"

		Return ((akTarget.GetAV("Stamina") / akTarget.GetAVPercentage("Stamina")) * Percent)

	ElseIf AV == "Magicka"

		Return ((akTarget.GetAV("Magicka") / akTarget.GetAVPercentage("Magicka")) * Percent)

	EndIf

EndFunction

Then attach the magic effect to your spell/ability/perk.

 

There might just be a way to do this through the Absorb archetype though, haven't played around with it much.

 

 

Blegh...well I tried. I played around with these scripts a lot but for some reason I couldn't even get my player to add the ability. I double checked the spell and what I named it. It had the proper effect attached to the spell and the script to handle adding the spell to the player had the right ID for the spell, but, it wouldn't add it, and I can't for the life of me figure it out.

 

I guess I'll just live with the mod as is, I don't think I know enough about modding to make my own personal adjustments to this mod :/

Link to comment
Share on other sites

 

 

Blegh...well I tried. I played around with these scripts a lot but for some reason I couldn't even get my player to add the ability. I double checked the spell and what I named it. It had the proper effect attached to the spell and the script to handle adding the spell to the player had the right ID for the spell, but, it wouldn't add it, and I can't for the life of me figure it out.

 

I guess I'll just live with the mod as is, I don't think I know enough about modding to make my own personal adjustments to this mod :/

 

 

I think perhaps Matthiaswagg misunderstood what you are trying to do. The provided script would work on a targeted spell or a weapon enchantment, not on an ability added to the player. Can you describe the effect you are trying to achieve in-game?

Link to comment
Share on other sites

 

 

 

Blegh...well I tried. I played around with these scripts a lot but for some reason I couldn't even get my player to add the ability. I double checked the spell and what I named it. It had the proper effect attached to the spell and the script to handle adding the spell to the player had the right ID for the spell, but, it wouldn't add it, and I can't for the life of me figure it out.

 

I guess I'll just live with the mod as is, I don't think I know enough about modding to make my own personal adjustments to this mod :/

 

 

I think perhaps Matthiaswagg misunderstood what you are trying to do. The provided script would work on a targeted spell or a weapon enchantment, not on an ability added to the player. Can you describe the effect you are trying to achieve in-game?

 

Oh. Indeed, I thought it was about the former two.

Link to comment
Share on other sites

 

 

 

Blegh...well I tried. I played around with these scripts a lot but for some reason I couldn't even get my player to add the ability. I double checked the spell and what I named it. It had the proper effect attached to the spell and the script to handle adding the spell to the player had the right ID for the spell, but, it wouldn't add it, and I can't for the life of me figure it out.

 

I guess I'll just live with the mod as is, I don't think I know enough about modding to make my own personal adjustments to this mod :/

 

 

I think perhaps Matthiaswagg misunderstood what you are trying to do. The provided script would work on a targeted spell or a weapon enchantment, not on an ability added to the player. Can you describe the effect you are trying to achieve in-game?

 

 

Yes, sorry I'm not the best at explaining so tell me if you have any uncertainty about what I am trying to explain.

 

basically I'm trying to add an ability to my character that will increase stamina and magic regen (by percent of total Stamina/Magicka) while the player gets their health damaged by percentage of total health, WHILE ALSO adding a buff to all my attacks (from magic, bows, swords, whatever. All of it) that drain health.

-The modification I am making to the mod already has a method to add and remove this spell I get that, I just need to make the ability itself.

 

So...yeah...just to keep it short:

Ability (on self) that regenerates magic and stamina by percent, damages health by percent, and has life-steal.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...