Grabstein Posted February 21, 2012 Share Posted February 21, 2012 Hey, all. Again. Sorry for being such a pain. I'm at a bit of a loss, again, though. I'm not quite sure what I've done wrong. I have a script for summoning a leveled weapon. Here's the spell.ScN gDepthsEdgeSummoningSpellScript Ref Self Begin ScriptEffectStart Set Self to GetSelf Self.RemoveItem gDepthsEdgeWeapon05 1 Self.RemoveItem gDepthsEdgeWeapon04 1 Self.RemoveItem gDepthsEdgeWeapon03 1 Self.RemoveItem gDepthsEdgeWeapon02 1 Self.RemoveItem gDepthsEdgeWeapon01 1 If (Self.GetBaseAV Conjuration == 100) Self.AddItem gDepthsEdgeWeapon05 1 Self.EquipItem gDepthsEdgeWeapon05 ElseIf (Self.GetBaseAV Conjuration >= 100) Self.AddItem gDepthsEdgeWeapon04 1 Self.EquipItem gDepthsEdgeWeapon04 ElseIf (Self.GetBaseAV Conjuration >= 75) Self.AddItem gDepthsEdgeWeapon03 1 Self.EquipItem gDepthsEdgeWeapon03 ElseIf (Self.GetBaseAV Conjuration >= 50) Self.AddItem gDepthsEdgeWeapon02 1 Self.EquipItem gDepthsEdgeWeapon02 ElseIf (Self.GetBaseAV Conjuration >= 25) Self.AddItem gDepthsEdgeWeapon01 1 Self.EquipItem gDepthsEdgeWeapon01 EndIfEnd Begin ScriptEffectFinish Set Self to GetSelf Self.RemoveItem gDepthsEdgeWeapon01 1 Self.RemoveItem gDepthsEdgeWeapon02 1 Self.RemoveItem gDepthsEdgeWeapon03 1 Self.RemoveItem gDepthsEdgeWeapon04 1 Self.RemoveItem gDepthsEdgeWeapon05 1EndThe script on the item is ScN gDepthsEdgeSummoningScript Ref Self Begin OnAdd If (Self.GetItemCount gDepthsEdgeWeapon05 == 0) Self.AddItem gDepthsEdgeWeapon05 1 Self.EquipItem gDepthsEdgeWeapon05 ElseIf (Self.GetItemCount gDepthsEdgeWeapon04 == 0) Self.AddItem gDepthsEdgeWeapon04 1 Self.EquipItem gDepthsEdgeWeapon04 ElseIf (Self.GetItemCount gDepthsEdgeWeapon03 == 0) Self.AddItem gDepthsEdgeWeapon03 1 Self.EquipItem gDepthsEdgeWeapon03 ElseIf (Self.GetItemCount gDepthsEdgeWeapon02 == 0) Self.AddItem gDepthsEdgeWeapon02 1 Self.EquipItem gDepthsEdgeWeapon02 ElseIf (Self.GetItemCount gDepthsEdgeWeapon01 == 0) Self.AddItem gDepthsEdgeWeapon01 1 Self.EquipItem gDepthsEdgeWeapon01 EndIfEnd Begin OnUnequip Set Self to GetSelf Disable RemoveMeEnd My issue is that in game the summons will go off, effects and all, yet no weapon will appear. I cannot tell if I've simply misscripted or if I'm missing something. Thanks, in advance. Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted February 21, 2012 Share Posted February 21, 2012 (edited) Hmm, that looks interesting. I can't see anything wrong in the first script, so I'm clueless why it doesn't add any weapon to your inventory.Perhaps that's the function GetBaseAV to blame for though, so it could help trying to figure out what your base Conjuration value actually is.Try outputting it via Message or MessageBox for example and see if it is above 25 already or not. If it's below, nothing will happen according to your script. And if GetBaseAV doesn't return the calculated value and only the calculated includes skill level increases, that could be an issue. This is just guessing though, so it'd really be a good idea checking the actual value this function returns first now. In your object script though there's some oddities I can't make sense of, I'm afraid. First off, there's no initialization of "Self" anywhere in the OnAdd block, which being the first to be called will just stall once "Self.GetItemCount" comes up.Then, what's the OnAdd block intended to do anyways? I mean, after you added the weapon "gDepthsEdgeWeapon05" to the inventory via the spell script, this script runs and checks if there is such a weapon, which is not the case for this one but for the next, and thus it adds and equips the next, which will trigger the same check from the next weapon's script again, this time the first check will fail and add and equip the first weapon accordingly and so on and so on.If "Self" would be set to the wearer previously, via "set Self to GetContainer", then this would be an infinite loop, just causing your game to crash after seconds. And in the OnUnequip block Self is set to GetSelf without any use, which is neglectable, but then there's "disable" called on an "inventory" object, which as far as I know only works on "world" objects, whereas even if it would work, "RemoveMe" (doing that thing for inventory objects) would never get executed afterwards, as the script terminated at the point the item vanished. Oh and from a performance point of view you can simply call this "GetBaseAV" once and store the result in a variable you then use on the checks afterwards. For one you can then easier output its result, and for two you won't have successive resource-intensive function calls for each check in the if block following. I hope this helps, and am curious now what the debug output of the value returned by "GetBaseAV Conjuration" actually will be now. edit: Just realized, there's the case when you drop such a sword, which will call OnUnequip but can't do inventory-related actions on it anymore. In this case OnDrop could help, but I think making these swords quest items will prevent them being dropped in the first place and they can only be cleanly disposed of via the OnUnequip block's function calls. After all, "disable" (only turning off rendering and "some" script processing of world objects) isn't half as clean and permanent as "RemoveMe" is anyways. Edited February 21, 2012 by DrakeTheDragon Link to comment Share on other sites More sharing options...
Grabstein Posted February 22, 2012 Author Share Posted February 22, 2012 (edited) Actually, everything was running fine, until I made the weapon "leveled". So, I'm not quite sure what I've done wrong. The whole point, though, of the "disable""removeme" is so the weapon is removed from game upon either a simple unequipping or from a dropping. It was not working correctly with just "disable" or "removeme". EDIT: Also, the whole idea is for this summoned weapon to level with the caster's Conjuration. The summons is not supposed to be permanent, but a "normal bound item". Thus, the removing, completely, and the attempting to make the weapon "unglitchable". I don't fully understand how the scripting works and there's no *real* basis for me to start from. Everything I've found, or been helped with, has been *either* for summoning *or* for leveling. I'm just tryin' to do this, piecemeal, and gettin' quite a few headaches. I *have* looked on various mods and at what Bethesda has already put forth, however, *most* of what could truly be helpful is far too in depth for my fragile, little mind to handle. I shall try to "cull" some of the excess "fat" from what I have on the weapon. That *may* do it. It just seemed to me, though, that things aren't, quite, adding up, for the game. Like it's looking for something that it can't find. I'm not sure if I've just given it so much information that it kinda gives up. EDIT: EDIT: DOH! *Just* realized that it's =100, >100, >75, >50 and >25. *sigh* Edited February 22, 2012 by Grabstein Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted February 23, 2012 Share Posted February 23, 2012 Hmm, if the skill doesn't get above 100, then "== 100" and ">= 100" check for exactly the same thing, and "> 100" is impossible.Is this meant to give weapon 5 at skill 100, weapon 4 at skill > (or >=) 75, weapon 3 at skill > 50, weapon 2 at skill > 25 and weapon 1 for below ("else")?In this case, once you rewrote the "if" block, there will be a weapon provided every time, no matter what value GetBaseAV actually returns.But did you already do as I suggested and check what value exactly GetBaseAV returns? I'm not sure which one it is, but if it's the wrong one (something below 25), which is very well possible, your current script will not react to it and that's why there is no weapon added. As I said, the spell script should be working, unless GetBaseAV returns not what it's supposed to return and the value returned is < 25. In this case nothing will happen, as the "if" block doesn't cover this range, yet.The object script on the actual weapons though will be causing trouble with the OnAdd blocks. "Self" is used "uninitialized" in there and any call to GetItemCount or AddItem or EquipItem will crash the script.Even if "Self" was set to GetSelf, it still won't work, as it'd be "the weapon itself", which of course doesn't have an "inventory" of its own.And if "Self" was properly set to "the one carrying the weapon", via GetContainer, this would be causing an "infinite loop" crashing the game, as each weapon added to the inventory would have another weapon from the "if" checks which is missing and will be added and equipped accordingly, which again will trigger the OnAdd block of the next weapon and another weapon will be found missing, added and equipped, then this weapon's OnAdd block triggers, adds and equips another weapon and so on and so on, until the game crashes. From what you told me those weapons are meant to do there is no need for the OnAdd block at all. Nothing has to be done once such a weapon gets added to the inventory, only once it's unequipped or dropped.But let's first try to figure out why it isn't even "added" to begin with. Link to comment Share on other sites More sharing options...
Grabstein Posted February 23, 2012 Author Share Posted February 23, 2012 Yeah, the numbers were the issue. Thanks for pointing me in that direction. :) Link to comment Share on other sites More sharing options...
Recommended Posts