Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

Ok, guess I'll ask my question in another way (and maybe get an answer?): does anyone know of a way to dynamically (and temporarily) change the texture set of NPCs? Basically, I want a certain texture to be applied to NPCs when they are hit with a certain effect. I was thinking the way to do this would be via an Effect Shader, but I'm having a very difficult time finding information about this (even the CK wiki is pretty sparse). Any help would be appreciated. Thanks!

Link to comment
Share on other sites

@Elia555 : You could do it so that when you are not supposed to be able to cast it the cost is practically infinite which can be acomplished by a perk entry of type "Mod spell cost" that you'd add your conditions on. You could get your perk on the player by linking it in a magic effect of an ability and then this ability being the equip ability of your spell to keep it scriptless or just add the perk via OnEquip, either way it should work I think. I believe I did something similar in my paladin mod for a cooldown.

Another thing is what powerofthree did for Silenced Prisoners, it's a pretty clever method for blocking casting, you'd of course need to add your conditions so it only blocks that particular spell and only if you don't have the keywords of the blessing.

Edited by FrankFamily
Link to comment
Share on other sites

Hi everyone!



What I want to do is spawn a boss enemy after dealing with several mobs. Essentially I need to advance the quest by a set amount on each subsequent kill, however I haven't been able to figure it out. The script I used earlier went as follows:



Event OnDeath(Actor killer)

Advquestondeath.SetStage(20)

EndEvent


For obvious reasons, this can cause sequencing errors if the player kills mobs out of one specific sequence

What I need is for this "Advquestondeath.SetStage(20)" to become "Advquestondeath.SetStage(current quest stage+10)".


Any and all help will be greatly appreciated!

Link to comment
Share on other sites

You can literally do what you wrote you wanted it to become, use: https://www.creationkit.com/index.php?title=GetStage_-_Quest

Advquestondeath.SetStage(Advquestondeath.GetStage() + 10)

Not sure if it's the best method though, a counter seems safer. Check the example here:

https://www.creationkit.com/index.php?title=Safely_increment_variable_from_multiple_scripts

Edited by FrankFamily
Link to comment
Share on other sites

Hey everyone, another quicky:

How do I multiply an attribute value by a set amount?

Let's say I want to increase total Magicka (not just base - including enchantments and whatever) by 30%, how do I do it?

The magic effect to modify Actor Value increase it by a set sum only (as far as I know).

I thought about entry point, but none of the options there allow to modify actor values...

Any ideas? :D

 

P.S: I thought about scripting the effect, but I want to leave that as a last resort cuz it'll require event handling which I really don't want to get into...

Link to comment
Share on other sites

I don't think that can be done without scripting, it wouldn't be that complex though. I asume this is some enchantment or ability and you want it to buff magicka by a percent instead of a fixed value, correct? Just calculate how much is 30% of your actor value after buffs and add that. Something like this:

Scriptname BuffPercent extends Activemagiceffect
{Buffs an actor value by a %, calculated after all other buffs}

String Property ActorValue = "Magicka" Auto
{Typically Health, Magicka or Stamina}
Float Property Percent = 0.3 Auto
{In decimal form, i.e. 0.3 for 30%}
FLoat Buff

Event OnEffectStart(Actor akTarget, Actor akCaster)
  Buff = (akTarget.GetActorValue(ActorValue) / akTarget.GetActorValuePercentage(ActorValue)) * Percent ;Getav/GetPercent should give the maximum and the multiplied by what you want but Im not completely certain on this math. 
;In the wiki someone mentions that the percent doesnt actually give a value between 0 and 1 but goes beyond for buffs, in which case this calculation would be off
  akTarget.ModActorValue(ActorValue, Buff)
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
  akTarget.ModActorValue(ActorValue, - Buff)
endEvent
Edited by FrankFamily
Link to comment
Share on other sites

 

I don't think that can be done without scripting, it wouldn't be that complex though. I asume this is some enchantment or ability and you want it to buff magicka by a percent instead of a fixed value, correct? Just calculate how much is 30% of your actor value after buffs and add that. Something like this:

Scriptname BuffPercent extends Activemagiceffect
{Buffs an actor value by a %, calculated after all other buffs}

String Property ActorValue = "Magicka" Auto
{Typically Health, Magicka or Stamina}
Float Property Percent = 0.3 Auto
{In decimal form, i.e. 0.3 for 30%}
FLoat Buff

Event OnEffectStart(Actor akTarget, Actor akCaster)
  Buff = (akTarget.GetActorValue(ActorValue) / akActor.GetActorValuePercentage(ActorValue)) * Percent ;Not completely certain on this math though. Getav/GetPercent should give the maximum and the * what you want
  akTarget.ModActorValue(ActorValue, Buff)
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
  akTarget.ModActorValue(ActorValue, - Buff)
endEvent

 

The math you did is correct and everything - I used the same math in another script and worked out great.

One problem though: It only modifies the value on the effect's start - i.e if you gain a level and increases that attribute, this perk won't affect that change.

I already did this script before you posted it (sorry, forgot to mention that :sweat: ) and worked around that by doing that buff element in an OnUpdate event and registering for a single update every 0.1.

I was hoping for a non-scripting solution, but we don't always get what we want ha?...

Thanks though!

Link to comment
Share on other sites

No problem, on I related matter, I was saving the above script in case I find it some use in the future and stumbled upon this:

 


> Parts of an Actor value:

---------------------------

The Base Actor Value (1) => Base value of the actor

The Permanent Modifier (2) => Fortifications by enchantments and abilities

The Temporary Modifier (3) => Buffs or drains for example from fortify potions

The Damage Modifier (4) => Damage/Healing, magicka spent casting etc

Current value (5): (1 + 2 + 3 + 4)

Current max value (6): (1 + 2 + 3)

Displayed atribute bar percent (7): (5 / 6) * 100

 

> Get:

GetBaseActorValue => Returns 1

GetActorValue => Returns 5

GetActorValuePercentage => Returns 5 / 1

> Set:

SetActorValue => Sets 1

ModActorValue => Adds/Subtracts to 2

ForceActorValue => Forces 5 (By changing what?)

DamageActorValue/RestoreActorValue => Adds/Subtracts to 4

 

I don't know the source of this or the truth in it, could be something someone told me, something I wrote down, can't remember. It does seem to go along the notes on the wiki though, that GetActorValuePercentage doesn't actually match the percent displayed by the UI as one would expect.

Edited by FrankFamily
Link to comment
Share on other sites

No problem, on I related matter, I was saving the above script in case I find it some use in the future and stumbled upon this:

 

> Parts of an Actor value:

---------------------------

The Base Actor Value (1) => Base value of the actor

The Permanent Modifier (2) => Fortifications by enchantments and abilities

The Temporary Modifier (3) => Buffs or drains for example from fortify potions

The Damage Modifier (4) => Damage/Healing, magicka spent casting etc

Current value (5): (1 + 2 + 3 + 4)

Current max value (6): (1 + 2 + 3)

Displayed atribute bar percent (7): (5 / 6) * 100

 

> Get:

GetBaseActorValue => Returns 1

GetActorValue => Returns 5

GetActorValuePercentage => Returns 5 / 1

> Set:

SetActorValue => Sets 1

ModActorValue => Adds/Subtracts to 2

ForceActorValue => Forces 5 (By changing what?)

DamageActorValue/RestoreActorValue => Adds/Subtracts to 4

 

I don't know the source of this or the truth in it, could be something someone told me, something I wrote down, can't remember. It does seem to go along the notes on the wiki though, that GetActorValuePercentage doesn't actually match the percent displayed by the UI as one would expect.

 

It's working out fine for me!

This is what I do to get the max HP (Target is whoever you want, can be the player - change it however you want):

Float totalHP = IntIt(1.0 * (Target.GetActorValue("Health") / Target.GetActorValuePercentage("Health")))
Where "IntIt" is just a function that I wrote that imitates Math.Int() (which for some reason doesn't work when compiling in Papyrus...):
Float Function IntIt(Float number)
	return -Math.Ceiling(-number - 0.5)
EndFunction

Thanks for the discussion, really helped me figure these stuff out! :thumbsup:

 

Edit: IntIt wasn't working for 0.5, fixed!

Edited by DMan1629
Link to comment
Share on other sites

  • Recently Browsing   0 members

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