gstark1 Posted January 28, 2013 Share Posted January 28, 2013 I'm wanting to create three new spells, based on the Turn Undead spells. (effects, etc...look and feel like turn undead but not turn undead). These spells will only work on undead. Lesser Harm Undead - Fire and Forget spell that does damage based on player restoration skill / 2. Should be a max of 50 damage before perks.Harm Undead - Fire and Forget spell that does damage based on player restoration skill / .75 plus half of destruction. Max of 125 before perks.Greater Harm Undead - Fire and Forget spell that does damage based on player restoration skill plus destruction. Max of 200 before perks. I know how to make new spells, add them to the game via tomes, etc. I can make the three, and set the magnitude static, but I want it to be a variable. I'm guessing I'll need a script, but I'm not exactly the best scripter out there...any pointers? Link to comment Share on other sites More sharing options...
kromey Posted January 28, 2013 Share Posted January 28, 2013 (edited) I see two ways to accomplish this: 1) Make a series of perks that scale your effects; since making 100 perks for each skill (and then assigning them all to the player) is not only tedious but ridiculously excessive, you'd probably want to make tiers, e.g. every 10 to 20 skill levels your damage goes up. Not ideal, but straightforward. Edit: Never mind, this was a stupid suggestion. I blame it on being up for 30 hours straight and counting.... 2) Make all of your spells' Magic Effects use the Script archetype, and then write your script to apply damage based on skill. For example, the Magic Effect script for your Lesser Harm Undead would look something like this: Event OnEffectStart(Actor akTarget, Actor akCaster) Float damage = akCaster.GetAV("Restoration") / 2 ;Calculate the damage as Restoration/2 If damage > 50 damage = 50 ;Cap it at 50 (of course, skills are capped at 100, so this is probably unnecessary...) EndIf ; You will have to manually apply perk effects you want here akTarget.modAV("Health", damage) ;Apply the damage to the target EndEvent (Note: Untested code, I don't even know if it will compile -- best to treat this as pseudo-code showing you the idea, rather than an actual script giving you the answer. (Also, I wish the Nexus' code highlighting would recognize Papyrus comments...)) This is probably the route you'll want to go, as it gives you exactly what you're asking for. (NB: I don't think the equation for your second effect is what you mean it to be -- if I have 50 Restoration and 0 Destruction, I'd be doing 66.7 damage with that spell, whereas I think you probably mean it to be doing 37.5 damage, which is Restoration times .75.) Hope this helps. Good luck -- I love the concept you're going for here! P.S. You can apply the condition that the target be undead as either a conditional function on the Magic Effect in the Spell itself, or by adding a check to the script. Or, heck, for the fun of it -- both! :thumbsup: Edited January 28, 2013 by kromey Link to comment Share on other sites More sharing options...
gstark1 Posted January 28, 2013 Author Share Posted January 28, 2013 Thanks Kromey! That is a huge help. You are correct on the numbers you crunched for damage. I'll be working on a bit more solid math this evening. Link to comment Share on other sites More sharing options...
gstark1 Posted January 29, 2013 Author Share Posted January 29, 2013 Alright, an update and another script question... I've changed the plan for the spell...instead of three spells, it is now one spell that improves as the player's destruction and Restoration improve. The formula is Restoration * ((Destruction / 100) +1). So, at minimum with 15 in each skill the spell power is 17.25. At max 100/100, you get a 200 power spell. If you have 100 Dest and 15 Resto, you get 30 power, and with 100 Resto and 15 Dest you get 115. In order to benefit the most, the player must gain skill in both trees but the spell power is very dependent on Resto skill, which I think makes sense being it's a Harm Undead spell. Of course, this is all before perks. Also, I've added a crit chance component based off of the Perks in the Resto tree...Novice - Master each grant an aditional % chance of doing double damage, up to 5% right now (might change that, not sure) Here's the question: I want the mana cost associated with the spell to be variable based off the base damage of the spell. I've found that using akCaster.modAV("Magicka", manacost) will decrease the caster's mana, but only when the spell hits and does damage. Not exactly what I was looking for. Do I need to write an entirely different script for say...OnSpellCast and if so, do I just tack that onto the Magic Effect as well? Link to comment Share on other sites More sharing options...
cscottydont Posted January 29, 2013 Share Posted January 29, 2013 (edited) If you're watching for spell casts you won't be able to do it from the script of the spell being cast. As you've noticed, that script doesn't run until it hits an actor (a limitation of the spell system). You'll need to monitor for casting with OnSpellCast in a script on the player. You can give a script to the player through a scripted ability or by sticking the player into an alias that has a script. EDIT: Note that this method will allow the player to cast even if they don't have the magicka required (their magicka is only affected after the cast).I've never used this script function, but you may be able to set something up with InteruptCast to check if magicka requirements are met and stop casting if not. Edited January 29, 2013 by cscottydont Link to comment Share on other sites More sharing options...
gstark1 Posted January 30, 2013 Author Share Posted January 30, 2013 Ok I've been beating my head against this all evening. I cannot figure out how to assign a script to the player. I've made a blank quest, references the player, assigned the script in the reference and/or to the quest...nothing. I'm officially stumped Link to comment Share on other sites More sharing options...
kromey Posted January 30, 2013 Share Posted January 30, 2013 I'm assuming you did all of the following:1. Create quest2. Create Reference Alias in said quest, pointing to the player3. Assigned the script (which extends AliasReference) to said alias4. Made said quest "Start game enabled" I suspect your issue is either extending the wrong form in your script (don't worry, your events will still function because reference aliases receive all the same events as their object references), or forgetting your quest has to "start game enabled". Link to comment Share on other sites More sharing options...
Sjogga Posted January 30, 2013 Share Posted January 30, 2013 I think you can accomplish everything with perks and keywords alone (with the exception of a script that adds these perks to the player). Perks can modify both spell cost and spell magnitude which can be based on the level of a specific actor value, in this case restoration and destruction. Adding a keyword to your magic effect and as a perk entry condition causes this specific perk to only affect your specific spell. My question to you is what determines the magicka cost; what is the equation do you use? Link to comment Share on other sites More sharing options...
Avastgard Posted February 18, 2015 Share Posted February 18, 2015 Is there an easy way (i.e., without the need for scripts) to make Magic Effects give percentual bonuses, instead of static bonuses? Link to comment Share on other sites More sharing options...
Recommended Posts