Jump to content

enchantment script


DanielLeonHeart

Recommended Posts

I want to enchant a item to 25% of the time adsorb health life and mp

 

I got this script from ayleidweaponenchantment

 

I want to make the user of the sword adsorb the damage this thing dose I am guessing it would be some thing like

if ( Actor = player )

modAV Fatigue 25

modAV health 25

modAV magicka 25

 

scn eAFatigue1

 

short random

short randomAttack

ref Actor

 

begin ScriptEffectStart

 

set random to GetRandomPercent

 

if ( random <= 25 )

set Actor to getSelf

if ( Actor != player )

modAV Fatigue -25

modAV health -25

modAV magicka -25

pme DGFA 2

pms effectEnchantDestruction 2

endif

endif

 

end

Link to comment
Share on other sites

I want to enchant a item to 25% of the time adsorb health life and mp

 

I got this script from ayleidweaponenchantment

 

I want to make the user of the sword adsorb the damage this thing dose I am guessing it would be some thing like

if ( Actor = player )

 

That would be:

If ( Actor == Player )

 

You would also want to change the following magic effects to a restoration type, rather than destruction. I don't have the CS installed currently, so I can't help you there.

pme DGFA 2

pms effectEnchantDestruction 2

 

Link to comment
Share on other sites

So the script would be some thing like this?

 


scn 01f

     short random
         short randomAttack
               ref Actor

          begin ScriptEffectStart

                set random to GetRandomPercent

 if ( random <= 25 )
          set Actor to getSelf	
                   if ( Actor != player )
                        modAV Fatigue -25
                            modAV health -25
                               modAV magicka -25
                   pme DGFA 2
                     pms effectEnchantDestruction 2
                endif
               
                   If ( Actor == Player )
                         modAV Fatigue 25
                            modAV health 25
                               modAV magicka 25
                     pme RESP
                      pms effectEnchantRestoration
             endif
           endif

end 

 

I dont thnik thats right tho in fact I dont really think this is even going in the direction I want it to

 

I want who ever wilds the sword to have 25% changes on hit of stealing 25 hp fatigue and mp from target

 

and if it is possible to make the amount stolen from the target go any where from 1-150

 

or even better make the damage done by the sword 25% of the time hit all three bars and that damage dealt given to the swords wilder

Edited by DanielLeonHeart
Link to comment
Share on other sites

Just tidying up what you have first...

 

 

scn 01f

short random
ref Actor

begin ScriptEffectStart

    set random to GetRandomPercent

    if ( random <= 25 )

         set Actor to getSelf

         if ( Actor != player )

              modAV Fatigue -25
              modAV health -25
              modAV magicka -25
              pme DGFA 2
              pms effectEnchantDestruction 2

         endif
               
         If ( Actor == Player )

              modAV Fatigue 25
              modAV health 25
              modAV magicka 25
              pme RESP
              pms effectEnchantRestoration

         endif

    endif

end 

 

 

 

This script basically says "If the person hit with the sword IS NOT the player, remove 25 hp, mp and fp. If the Person hit with the sword IS the player, add 25 hp, mp and fp."

 

A quick fix for this would be to simply add the healing effect to the first IF statement...

 

 

 

scn 01f

short random
ref Actor

begin ScriptEffectStart

    set random to GetRandomPercent

    if ( random <= 25 )

         set Actor to getSelf

         modAV Fatigue -25
         modAV health -25
         modAV magicka -25
         pme DGFA 2
         pms effectEnchantDestruction 2

         if ( Actor != player )

              Player.modAV Fatigue 25
              Player.modAV health 25
              Player.modAV magicka 25
              Player.pme RESP
              Player.pms effectEnchantRestoration

         endif

    endif

end 

 

 

 

The script now says "Take 25 hp, mp and fp off the target. If the target IS NOT the player, then heal the player."

However, this can cause problems depending on the circumstances. If the player is not using the sword, then anyone who strikes the player will not be healed. If anyone else is hit with the sword, even if the player isn't holding the weapon at the time, the player will be healed. If the sword is unique and will only be used by the player, this is not a problem - otherwise some cross-scripting will be needed to discover the wielder.

 

Also, note that ModAV causes permanent changes when used in a script - this is because every actor value uses 3 factors: Calculated Base, Damage/Magic and Script. Long story short, Using ModAV changes the Script modifier which will not revert back to normal, meaning that every time this works, the player will permanently have 25 points of extra health, fatigue and magicka.

 

A safer thing to do would be to use an ability. Set up an ability with all three effects needed: restore health, restore fatigue and restore magicka, each magnitude 25 and duration 0. Then set up an ability with the same numbers, only use damage health, damage magicka and damage fatigue effects. Then make the script look like this:

 

 

 

scn 01f

short random
ref Actor

begin ScriptEffectStart

    set random to GetRandomPercent

    if ( random <= 25 )

         set Actor to getSelf

         AddSpell 01DamageEffect
         pme DGFA 2
         pms effectEnchantDestruction 2

         if ( Actor != player )

              Message " "
              Message " "                                             ;Empty messages to hide the "Spell Added" message
              Player.AddSpell 01HealingEffect                 ;Put spell with Healing effects here.
              Message " "
              Message " "
              Player.pme RESP
              Player.pms effectEnchantRestoration

         endif

    endif

end 

 

 

Link to comment
Share on other sites

WarRatsG's suggestion of using abilities is a good one, but has a catch: Ability spells are permanent unless removed. This means that the DamageEffectSpell will cause 25 damage per second to Health, Fatigue, and Magicka until the afflicted NPC is dead. Likewise, the Player will end up with an ability that permanently restores 25 Health, Fatigue, and Magicka per second. The fix for this is to attach a script to each ability that will remove the spell after one second. The script would look like this:

 

scn GenericSpellRemovalScript
float timer
ref me

begin GameMode
set me to GetSelf
set timer to timer + GetSecondsPassed
if timer >= 1
       me.removespell SpellEditorID
           sme SpellVisualID
           sms MagicShaderID
endif
end

 

Just replace SpellEditorID, SpellVisualID, & MagicShaderID with the appropriate editor IDs.

 

Edit: There's another catch to this setup as well; if the target has 25 health or less when the damage ability is added, the target will die but the Player will not get credit for the kill.

Edited by The_Vyper
Link to comment
Share on other sites

WarRatsG's suggestion of using abilities is a good one, but has a catch: Ability spells are permanent unless removed. This means that the DamageEffectSpell will cause 25 damage per second to Health, Fatigue, and Magicka until the afflicted NPC is dead. Likewise, the Player will end up with an ability that permanently restores 25 Health, Fatigue, and Magicka per second. The fix for this is to attach a script to each ability that will remove the spell after one second. The script would look like this:

 

scn GenericSpellRemovalScript
float timer
ref me

begin GameMode
set me to GetSelf
set timer to timer + GetSecondsPassed
if timer >= 1
       me.removespell SpellEditorID
           sme SpellVisualID
           sms MagicShaderID
endif
end

 

Just replace SpellEditorID, SpellVisualID, & MagicShaderID with the appropriate editor IDs.

 

Edit: There's another catch to this setup as well; if the target has 25 health or less when the damage ability is added, the target will die but the Player will not get credit for the kill.

 

 

would it not work better to make a script that has a 25% chance to cast a spell?

 

lets say I make a spell named 01adsorb

and this spell has 25 Health, Fatigue, and Magicka adsorb on it and I change the mp cost to 0

 

is there a way to script it so when the sword hits 25% of the time the sword will activate this spell?

Link to comment
Share on other sites

WarRatsG's suggestion of using abilities is a good one, but has a catch: Ability spells are permanent unless removed.

Hehe, forgot that part ;)

 

would it not work better to make a script that has a 25% chance to cast a spell?

 

lets say I make a spell named 01adsorb

and this spell has 25 Health, Fatigue, and Magicka adsorb on it and I change the mp cost to 0

 

is there a way to script it so when the sword hits 25% of the time the sword will activate this spell?

 

This is what we are telling you how to do.

 

Thing is, what you see in the game and the actual mechanics of how this happens are often completely different. An example of this is in several polymorph mods, where instead of making the player actually change form (which is impossible) they simply turn the player invisible and make them mount an animal. It looks like the player has transformed, but in reality they are just see-through.

In the same way, we cannot directly cause spell effects 25% of the time. So we work around it by adding a distinct ability to do the work.

 

If your question is about why you have to use an ability, it's because ModAV causes damage that cannot be fixed. So the player would permanently have 25 extra HP, while any damage caused to an enemy will be impossible to heal. By using a magic effect, we use the game's own mechanics to cause "natural" damage, as well as heal the player in a way that doesn't eventually become game breaking.

 

Incorporate the script that Vyper mentioned into both abilities (the healing and damage effects) and use the script I posted before (on the enchantment, not the weapon itself), and you will have your enchantment ;)

Edited by WarRatsG
Link to comment
Share on other sites

  • Recently Browsing   0 members

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