Syfor Posted July 22, 2012 Share Posted July 22, 2012 I need help with this script, it should increase the charge of the weapon in the left hand with 50 per second. Scriptname ChargeLH extends ActiveMagicEffect {Charge the weapon equiped in Left Hand of caster} MagicEffect Property ChargeLHWeapon Auto Event OnEffectStart(Actor Target, Actor Caster) While ( Target.HasMagicEffect( ChargeLHWeapon ) ) float ChargeWeapon = Target.GetAV("LeftItemCharge") ChargeWeapon = ChargeWeapon +50 Target.SetAV("LeftItemCharge", ChargeWeapon) Utility.Wait(1.0) EndWhileEndEvent This script is attached to a concentration magic effect called ChargeLHWeapon. When I use this in a spell in-game, nothing hapens. Can anybody tell me what's wrong? Link to comment Share on other sites More sharing options...
Leeira Posted July 22, 2012 Share Posted July 22, 2012 Try to replace "ChargeWeapon = ChargeWeapon +50" with "ChargeWeapon += 50" Link to comment Share on other sites More sharing options...
Syfor Posted July 22, 2012 Author Share Posted July 22, 2012 Thanks for your reply Leeira. Unfortunately it still doesn't work.I think that something goes wrong in this line: While ( Target.HasMagicEffect( ChargeLHWeapon ) I think the scripts doesn't recognize ChargeLHWeapon as the proper magic effect. This the magic effect I defined as ChargeLHWeapon:ID: ChargeLHWeaponName: Charge LH WeaponEffect Archetype: ScriptCasting Type: ConcentrationDelivery: SelfMagic Skill: Conjuration Assoc. Item1: NONE Papyrus Scripts:ChargeLH This is the script now:Scriptname ChargeLH extends ActiveMagicEffect {Charge the weapon equiped in Left Hand of caster} MagicEffect Property ChargeLHWeapon Auto Event OnEffectStart(Actor Target, Actor Caster) While ( Target.HasMagicEffect( ChargeLHWeapon ) ) float ChargeWeapon = Target.GetAV("LeftItemCharge") ChargeWeapon += 50 Target.SetAV("LeftItemCharge", ChargeWeapon) Utility.Wait(1.0) EndWhileEndEvent Link to comment Share on other sites More sharing options...
Syfor Posted July 28, 2012 Author Share Posted July 28, 2012 Still no reply? I seriously cannot believe no one on Nexus knows how to script with Papyrus. Link to comment Share on other sites More sharing options...
Spinner385 Posted July 28, 2012 Share Posted July 28, 2012 (edited) Give me more info. When you say:it should increase the charge of the weapon in the left hand with 50 per second.Are you saying add 50 charges to the weapon every second or add 50 damage per second to the effect of the weapon? So a weapon with 10 fire damage per second should now be 60 fire damage per second.When do you want this additional charge/effect applied? Is this applying to an effect already on the weapon or are you creating a new effect? Edited July 29, 2012 by Spinner385 Link to comment Share on other sites More sharing options...
Syfor Posted July 29, 2012 Author Share Posted July 29, 2012 It should add 50 charges to the weapon per second. So if the weapon you have equiped in your left hand has no charge, you should be able to recharge it using this spell. Link to comment Share on other sites More sharing options...
Spinner385 Posted July 29, 2012 Share Posted July 29, 2012 (edited) Edit: just found an easier way again I'll work on it when I get back from work tonight. I have some experience with spells so shouldn't be a problem. Just need to make sure papyrus agrees with it. If it works do you want the mod or directions to do it yourself? Edited July 29, 2012 by Spinner385 Link to comment Share on other sites More sharing options...
Syfor Posted July 29, 2012 Author Share Posted July 29, 2012 (edited) Thank you for your time Spinner385, I really appreciate this. I would like to see the script with some explanation, so I can understand Papyrus myself. This was my first attempt of a script but I just couldn't figure out how to make a concentration version of this spell. I had to change it into a fire and forget version for my mod "Lost Magic" you can check it out here: http://steamcommunity.com/sharedfiles/filedetails/?id=82398601&searchtext=. In the meanwhile I discovered that I could replace these lines: float ChargeWeapon = Target.GetAV("LeftItemCharge") ChargeWeapon += 50 Target.SetAV("LeftItemCharge", ChargeWeapon) by only this Target.ModAV("LeftItemCharge", 50) My aim was a concentration spell, so I will make a new version of the Soulcharge spell and give you credit for the script. Thanks again for trying to help me out. Edited July 29, 2012 by Syfor Link to comment Share on other sites More sharing options...
steve40 Posted July 30, 2012 Share Posted July 30, 2012 (edited) Having a script test for the MagicEffect that it is attached to is a weird thing to do. The script will be killed as soon as the MagicEffect stops, so the test is meaningless. I put in a little test to only charge the weapon if it's charge is less that 10%. Scriptname ChargeLH extends ActiveMagicEffect {Charge the weapon equiped in Left Hand of caster} bool loop = True Event OnEffectStart(Actor Target, Actor Caster) Debug.Notification("[ChargeLH] The MagicEffect is active") float ChargeWeapon While loop == True ChargeWeapon = Target.GetAVPercentage("LeftItemCharge") If ChargeWeapon <= 0.1 Target.ModAV("LeftItemCharge", 50.0) EndIF Utility.Wait(1.0) EndWhile EndEvent Event OnEffectFinish(Actor Target, Actor Caster) {this safeguard is redundant as the script will end when the spell ends} loop = False Debug.Notification("[ChargeLH] The MagicEffect just finished") EndEvent This version doesn't check how much charge the weapon has: Scriptname ChargeLH extends ActiveMagicEffect {Charge the weapon equiped in Left Hand of caster} bool loop = True Event OnEffectStart(Actor Target, Actor Caster) Debug.Notification("[ChargeLH] The MagicEffect is active") While loop == True Target.ModAV("LeftItemCharge", 50.0) Utility.Wait(1.0) EndWhile EndEvent Event OnEffectFinish(Actor Target, Actor Caster) {this safeguard is redundant as the script will end when the spell ends} loop = False Debug.Notification("[ChargeLH] The MagicEffect just finished") EndEvent I haven't tested this yet, btw.Edit: oops, I forgot to pass parameters into OnEffectFinish :facepalm: . Edited July 31, 2012 by steve40 Link to comment Share on other sites More sharing options...
steve40 Posted July 30, 2012 Share Posted July 30, 2012 Try to replace "ChargeWeapon = ChargeWeapon +50" with "ChargeWeapon += 50" Same difference. Both are correct. Link to comment Share on other sites More sharing options...
Recommended Posts