Jump to content

[LE] Papyrus script help


Evyen

Recommended Posts

Hi all,

 

I am currently struggling with a modification to a script of an existing mod. I am not a modder nor do I have any experience whatsoever, but with the help of some tutorials and a lot of trial and error I managed to edit a lot of the mod to suit my liking except for this last part.

This mod I am modifying for my playthrough has an ability which damage is tied to the enchanting skill. I managed to tie it to a some other data except to equiped weapon damage / melee damage. I would like the damage to be tied to my current melee damage/weapon damage.

 

 

Event OnEffectStart(Actor Target, Actor Caster)

Actor PlayerActor = Game.GetPlayer()
if target != none && !Target.IsInFaction(faction01) && !Target.IsDead()
if !Target.IsHostileToActor(PlayerActor)
return
endif
Damage = Caster.getav("enchanting") as float
Damage *= 0.6
Damage *= EldritchDamageRate.getValue()
Target.DamageAv("Health", Damage)

 

This is the part where I am struggling with. I tried different options. Some do not compile because of errors, fair enough. Some compile succesfully but do not work ingame.

Damage = Caster.getav("attackdamage") as float for example compiles just fine, but the ability does no damage at all. Same when I change it to meleedamage .

 

Even Damage = PlayerActor.Getgoldamount() as float works so there is no way something as simple as tying the damage to sheet dps isn't possible.

 

Just to be clear, that's the stat I'd like to link to the damage of the ability.

Any help would be appreciated!

Link to comment
Share on other sites

The reason it is not working is because you are guessing what these functions do. If you look up "getav" on the creation kit wiki it will tell you what it does.

 

You have to use Actor Values for that, which are very specific. MeleeDamage might be what you are looking for, but there are others you can try.

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

 

The script compiler isn't gonna check to see if an AV is real, it just looks for syntax problems. It will run in game and come up with 0 if it can't find the AV.

 

Use this wiki! Its a god send!

Link to comment
Share on other sites

The recommended wiki page is a source I have poured over multiple times.

Â

Caster.getav("meleedamage") as float was one of the first things I have tried and it compiles just fine. Sadly the ability triggers no problem, but does no damage. Player.getav does not compile even though that is how I used to get some things done in the console ie player.modav xxxxxxxx.

Â

At first I thought caster.getav is the solution and the ability doing no damage was caused by something else, but Damage = PlayerActor.Getgoldamount() works just fine, which made me think I used the syntax wrong and thus Damage = playeractor.getmeleedamage() was born, which obviously doesn't compile.

 

I wonder if meleedamage is correct but the caster has no meleedamage unlike unarmeddamage. It is the weapon that has melee damage?

 

Damage = Game.GetPlayer().GetEquippedWeapon()

PlayerWeapon.getBaseDamage()

 

Would this be the way to go instead? Will try later when I am sitting behind my computer.

Edited by Evyen
Link to comment
Share on other sites

I don't think you want to use an Actor Value, but instead to get the damage of the weapon(s) that are equipped. Damage output is based on the damage of the weapon and the actor's stats. There is a function for weapons GetBaseDamage, but it does require SKSE, and because it's base damage I don't think it accounts for improvements made from tempering.

 

It would look something like this:

 

        Weapon RightWeapon = Caster.GetEquippedWeapon()
        Weapon LeftWeapon = Caster.GetEquippedWeapon(true)
        
        Int RightDamage = 1
        Int LeftDamage = 1
        
        If RightWeapon != None 
            RightDamage = RightWeapon.GetBaseDamage()
        Endif 
        
        If LeftWeapon != None 
            LeftDamage = LeftWeapon.GetBaseDamage()
        Endif 
         
        Float Damage =  RightDamage + LeftDamage
        Damage *= 0.6
        Damage *= EldritchDamageRate.getValue()
         
        Target.DamageAv("Health", Damage)
Edited by dylbill
Link to comment
Share on other sites

Thanks Smashballs and Dylbill,

 

I'm not there yet but with your pointers I feel like I am getting on the right track. Through weapon damage I can get there, but that would mean that during a playthrough tempering (smithing) would get ignored for progression which is not something I want to give up on right away.

 

Game.GetPlayer().GetEquippedWeapon().GetMaxRange() perhaps through a nifty formula I can get the current damage of said weapon. Range should be damage range through tempering seeing how Reach is also a "form" (?)

I tried caster.getav("meleedamage") again and no damage until I player.setav meleedamage 12 through console..... lo and behold, I do damage. Going to see if I cannot get

Link to comment
Share on other sites

"Player.getav" isn't just gonna work in a script, its nothing like the command console, so separate them in your mind. You need to define who the player is as done already "Actor PlayerActor = Game.GetPlayer()"

 

".getmeleedamage()" sadly you can't just use a function if it doesn't exist or you didn't make it.

 

"Caster.getav("meleedamage")" should work fine, you don't need to cast it as a float, its already that by default. Also ".GetActorValue()" is supposedly quicker for the script engine.

 

 

"Caster.GetActorValue("MeleeDamage")"

 

On to a solution! Actor Values are weird, they don't always do what they are supposed to do. So let's back this up and start by seeing if you are even getting a value. Plant this right under the above function, and see if it even returns a value, that way we know FOR SURE that this is the issue.

 

"Debug.Notification("AV = " + Damage)"

 

(Sorry I am not on my computer, so bare with me!)

Link to comment
Share on other sites

".GetEquippedWeapon()" is a wierd one, it only checks the right hand I believe. The guy who edited the script for you was gonna be my solution as well because I had a very similar problem&solution in the past. Best of luck with you.
Link to comment
Share on other sites

Cheers Smashballs.

AV=0.00000 so I have verified meleedamage is 0.

I am going to go through the wiki and find how the game gets the Damage stat under in the inventory UI. That should be the way to a solution. If I can get the gold value or carry weight as a value for damage, then the actual sheet damage should be possible too. Just need to find the formula or command.

Link to comment
Share on other sites

I am still not on my computer, so my help is limited, but I have an idea for you.

 

If you can't find out where that damage variable comes from, you can make your own.

 

So make a formula in the script that calculates damage in much the same way Skyrim does.

https://en.m.uesp.net/wiki/Skyrim:Damage

 

So find ways to gather up other verifiables, and combine them like the game does. I have had to do this before, it works wonders!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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