Grabstein Posted February 3, 2012 Share Posted February 3, 2012 (edited) Greetings all, I have been working on a mod to do some summoning. It will be a summoned bow that summons its own arrows. However, the trick is that it levels with you. All of it. Not too much of a problem, so far. The issues start arising, though, while attempting to script the leveling of the four enchantments on the arrows. Is it possible to script leveling enchants? I've been searching for days, to no avail. I am, also, what one might call a "novice", to scripting. Any help would be most...helpful. Thanks, in advance. Grabstein Lord of All Master of None EDIT: That's a leveling script *for* enchants, *not* an enchant script for leveling. Edited February 3, 2012 by Grabstein Link to comment Share on other sites More sharing options...
David Brasher Posted February 4, 2012 Share Posted February 4, 2012 (edited) Knights of the Nine does this kind of thing. It gives you different gear depending on what level you happen to be at the time. So if you play Knight of the Nine early, the gear you get will start seeming pathetic and weak and you won't want to use it after awhile. The method that is used, and which is used in Shivering Isles with the Amber and Madness gear, is to have a whole series of weapons or armor. Like eight different levels. They all have different stats and different enchantments. If there were eight shields, then there would be eight enchantments corresponding to the eight shields. Some are weaker and some are stronger. So what you would do is build all the enchantments and all the gear, and attach the enchantments to the gear. So if you are working with arrows, then you would have multiple copies of the arrows, with different strengths of enchantments. You would summon the proper one for your level. Edited February 4, 2012 by David Brasher Link to comment Share on other sites More sharing options...
Grabstein Posted February 4, 2012 Author Share Posted February 4, 2012 Hmm. Thanks. I figured that there was a way to script, like a formula, for the enchants to "level", as opposed to a replacing script. I'm trying to avoid a replacer script, due to the intensive, and repetitive, time spent. A cut corner, if you will. I know that there's a way to have damage, for example, actually level with you, instead of having numerous copies of a weapon. Just not as script savvy as I'd like to be... Link to comment Share on other sites More sharing options...
Lanceor Posted February 4, 2012 Share Posted February 4, 2012 You can set a weapon's damage via script.. though it's not saved with the savegame, so you'll need to have a quest script running to update the damage at regular intervals. Don't forget that you'll also need to update the weapon's health and weight (and speed and reach). For the enchantment, you can use SetEnchantment to change the enchantment via script, but like above, it's not saved with the Savegame so your quest script has to check and update it. You'll also need to have created a different enchantment for each tier and update the number of charges available. At the end of the day, it's easier to just create all the different versions of the weapon and swap them out as needed. :) Link to comment Share on other sites More sharing options...
Grabstein Posted February 4, 2012 Author Share Posted February 4, 2012 You can set a weapon's damage via script.. though it's not saved with the savegame, so you'll need to have a quest script running to update the damage at regular intervals. Don't forget that you'll also need to update the weapon's health and weight (and speed and reach). For the enchantment, you can use SetEnchantment to change the enchantment via script, but like above, it's not saved with the Savegame so your quest script has to check and update it. You'll also need to have created a different enchantment for each tier and update the number of charges available. At the end of the day, it's easier to just create all the different versions of the weapon and swap them out as needed. :)Awesome! Thanks! I *knew* there was a way. The issue is that I'm planning on having the bow and arrows level, *every* level. That's almost 100 times that I'd have to dupe and *still* have to script. Just scripting seems easier, I think. I'll still need to create separate enchants, though, for every level, huh? Well, I suppose that's do-able. Again, thanks. ;) Link to comment Share on other sites More sharing options...
Lanceor Posted February 7, 2012 Share Posted February 7, 2012 I recently had to create 800+ different items for various upgraded Crusader Relics so I know your pain. :D There IS a shortcut for the enchantment... but it does have limitations. Instead of using a spell effect to cause damage, you can use a scripted effect instead. The scripted effect simply modifies the target's health downwards using whatever mathematical formula you want to calculate the damage. One problem with this is that resistances, armour, blocking and even the difficulty slider have no effect on the amount of damage caused... except that targets with 100% magic resistance will take NO scripted damage at all. The second problem is that the player can't mouse over the item in their inventory to see exactly how much damage the effect does. Still, clever coders will find creative ways around the game's limitations. ;) Link to comment Share on other sites More sharing options...
Grabstein Posted February 9, 2012 Author Share Posted February 9, 2012 Thanks. :)I *do* have another question, though, now. Would it be better, or easier, to have the game check "on equip" or "on cast" since the items will be non-permanent summons, rather than a quest script? Link to comment Share on other sites More sharing options...
jaime74 Posted February 9, 2012 Share Posted February 9, 2012 I've had to struggle a lot with quite similar problems in my mod (Blade of the Haunted).Here's what I did to solve it (I think that this solution matches roughly what has already been stated in several posts above, so it might serve as a code example): create separate leveled versions of the enchantmentdetect the player level, then define the required enchantment plus base weapon attributesassign the enchantment plus base weapon attributes to the weapon's base form (not the reference!)move the code for all of this into a custom script functionensure that the function is always invoked upon game restart/reload, so that customizations don't get lost between game sessions Some code details (just quickly copied & pasted from my mod... might look quite fragmented and weird in this quick&dirty form, but maybe it gives some inspiration anyway):... for 2.: if playerLevel < 5 set updateLevel to 1 set enchRef to BoTEnchBladeOfTheHaunted01 set damageNewValue to 9 set healthNewValue to damageNewValue * 15 set reachNewValue to 0.8 set speedNewValue to 1.2 set rechargeFactorNewValue to 2 set usesNewValue to 9 set chargePerUse to 21 elseif playerLevel < 10 set updateLevel to 5 set enchRef to BoTEnchBladeOfTheHaunted05 set damageNewValue to 11 set healthNewValue to damageNewValue * 20 set reachNewValue to 0.8 set speedNewValue to 1.2 set rechargeFactorNewValue to 2.1 set usesNewValue to 11 set chargePerUse to 25 elseif playerLevel < 15 set updateLevel to 10 set enchRef to BoTEnchBladeOfTheHaunted10 set damageNewValue to 13 set healthNewValue to damageNewValue * 25 set reachNewValue to 0.8 set speedNewValue to 1.2 set rechargeFactorNewValue to 2.2 set usesNewValue to 13 set chargePerUse to 39 [...] ... for 3. and 4.: ScriptName MyWeaponUpdateFunction ref playerRef ref bladeRef begin function {playerRef} [...] set bladeRef to BoTBladeOfTheHauntedx1H ; this is the base object, not a reference (the variable name "bladeRef" is a bit misleading in that point) [...] playerRef.setAttackDamage damageNewValue bladeRef playerRef.setObjectHealth healthNewValue bladeRef playerRef.setWeaponReach reachNewValue bladeRef playerRef.setWeaponSpeed speedNewValue bladeRef playerRef.setEnchantment enchRef bladeRef let BoT.bladeMaxCharge := chargePerUse * usesNewValue playerRef.setObjectCharge BoT.bladeMaxCharge bladeRef [...] end ... for 5.: (inside the main quest script) begin gameMode [...] if getGameLoaded == 1 || getGameRestarted == 1 call MyWeaponUpdateFunction player endif [...] end Link to comment Share on other sites More sharing options...
Grabstein Posted February 9, 2012 Author Share Posted February 9, 2012 Hmm. Thanks. I was *hoping* that there was a less time intensive way of scripting it. Meh. Better get started... :) Link to comment Share on other sites More sharing options...
Grabstein Posted February 15, 2012 Author Share Posted February 15, 2012 (edited) Alright. I've figured out the summoning issue. The script for the spell is ScN VariousItemSummoningScript Ref Self Begin ScriptEffectStart Set Self to GetSelf If(Self.GetItemCount VariousItem == 1) Self.RemoveItem VariousItem 1 EndIf If(Self.GetItemCount VariousItem <= 0) Self.AddItem VariousItem 1 Self.EquipItem VariousItem EndIfEnd Begin ScriptEffectFinish Set Self to GetSelf If(Self.GetItemCount VariousItem == 1) Self.RemoveItem VariousItem 1 EndIfEnd And the script for the item is ScN VariousSummonedItemScript Ref Self Begin OnAdd Self.AddItem VariousSummonedItem 1 Self.EquipItem VariousSummonedItemEnd Begin OnUnequip Set Self to GetSelf Disable RemoveMeEnd However, *now* my issue is, can I just mash the summoning with the enchant leveling? Is there a certain order that things need to go in? Thanks. EDIT: I *think* that I've figured out how to make a Quest Script. I'm using that, now, to add the summoning spell. Is there a particular order, in the script, that I need to have the summoning and enchant leveling? Edited February 15, 2012 by Grabstein Link to comment Share on other sites More sharing options...
Recommended Posts