Jump to content

Need some scripting help :3


nurmi

Recommended Posts

So i'm trying to make a chance on hit effect for a weapon using a script from this mod: Ayleid Weapon Enchantments except, i want to absorb health.

 

Heres the code he/she used:

scn eDFrost3

 

short random

short randomAttack

ref Actor

 

begin ScriptEffectStart

 

set random to GetRandomPercent

 

if ( random <= 20 )

set Actor to getSelf ;try to be effecient with computing power

if ( Actor != player )

modAV health -30

pme FRDG 2

pms effectFrostDamage 2

endif

endif

 

end

 

I get most of it expect how to do absorb health rather than fire/frost damage D:

 

If anyone could lend some help you would be mucho awesomesauce.

Link to comment
Share on other sites

  • 3 weeks later...

Mucho Awesomesauce? Really? I'm in lol. Usually I work for peanuts or kudos, but that somehow sounds more fun.

 

scn (yourIDhere)Absorb30script

short random
short randomAttack
ref Actor

begin ScriptEffectStart

set random to GetRandomPercent

if ( random <= 20 )
set Actor to getSelf ;try to be effecient with computing power
if ( Actor != player )
modAV health -30
player.modAV health 30
pme ABHE 2
pms effectAbsorb 2
endif
endif

end

 

This should work. If you want the player to have magic shaders too, I can set that up. It really is a simple bit of code.

 

-edit-

 

I am going to use something like this on a sword. What a nice piece of code. I think I will make mine leveled and damage both parties, victim and predator.

Edited by theuseless
Link to comment
Share on other sites

You will want to watch out if you are using ModAV. It does not actually change your health directly, but changes the script modifier for your health. This can mean that you may end up with higher than maximum health, or that your enemy will be unable to heal themselves fully. This is not a problem on enemies, because they will probably die regardless of whether they can heal themselves or not. It's a problem for the player though.

 

From the CS wiki about ModActorValue:

 

If you use ModActorValue in a script, the Script Modifier is adjusted, and ONLY a script can adjust it back. In other words, if you have a script do "player.modav health 100" you are also responsible for doing "player.modav health -100" or that 100 points will *always* be in the script modifier.

 

This is because the function was designed to cause temporary changes to stats that couldn't be reversed with a spell.

 

If you are not using OBSE, What you could do instead is manually add a spell to the player through script that heals them, and also add a spell to the enemy that hurts them. Would that be an option?

If you are using OBSE then you just have to use the command ModAV2, which was designed to work just like a Damage Attribute spell.

 

 

Test it out first, just in case I'm wrong. ;)

Edited by WarRatsG
Link to comment
Share on other sites

  • Recently Browsing   0 members

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