motarx Posted August 3, 2016 Share Posted August 3, 2016 So I have a puff of smoke aggro-drop spell and I want to make it use charcoal as a component, if the PC doesn't have charcoal in inventory they can't cast it, if they do a charcoal gets eaten and the spell casts. Would throwing a if player.getitemcount charcoal == 0 in the begin part of spelleffect script be enough to stop the whole thing or will I need a more complex solution like checking if the PC is casting that spell? Link to comment Share on other sites More sharing options...
Surilindur Posted August 3, 2016 Share Posted August 3, 2016 If the spell is cast on the caster itself, then yes, you could limit it somehow in the spell effect script - and also on others, not just player (although NPCs might not use the spell, I think). I do not have access to the CS(E) at the moment (no access to my gaming PC), but maybe something like this could be a simple and fast way to do it - but it might not be the best one. You could find better tools to achieve that effect somewhere in the documentations, I need to check for them myself too, but I have not had the time to do it yet: short bAllow Begin ScriptEffectStart If ( GetItemCount Charcoal < 1 ) set bAllow to 0 Return EndIf RemoveItem Charcoal 1 set bAllow to 1 ... other stuff ... End ; if you need to run something in the finish block, you could ; block it if the spell was not allowed to run Begin ScriptEffectFinish If ( bAllow == 0 ) Return EndIf ... other stuff ... End ; and the update one comes last, as the return statement can ; cause issues with other sript blocks if you place this above the others Begin ScriptEffectUpdate If ( bAllow == 0 ) Return EndIf ... other stuff ... EndOf course there can be solutions that are more simple, and better from a technical point of view, as well. That one is just a quick way to do it without thinking too much. Assuming it is possible to remove individual magic effects, that would be the best solution. Skyrim has conditions available for magic effects (in the fashion of dialogue conditions), but I do not remember seeing anything like that in Oblivion. Hopefully that helps, and hopefully someone else can give you (and me) a better solution. :) Link to comment Share on other sites More sharing options...
lubronbrons Posted August 4, 2016 Share Posted August 4, 2016 (edited) make sure your spell is like this.http://i.imgur.com/Jr5Lz4Q.jpg.and here's the script for your ninja charcoal bomb. scn castCarchoal Begin ScriptEffectStart if Player.GetItemCount Charcoal == 0 || GetDead || GetKnockedState || GetUnconscious || GetSleeping Dispel spellCharcoal ;cancel the order because pc insufficient charcoal or the npc is down return ;stop this script from running further endif ;pay 1 charcoal in pc inventory Player.RemoveItem Charcoal 1 ;this is something like ninja cloud bomb to escape right ? ;dramatic effect some gray cloud maybe, you should create by yourself this gray cloud bomb effect Player.PlayMagicShaderVisuals cloudCharcoalEffect 7 ;---> change this seconds to match your preferred cloud effect duration End Begin ScriptEffectUpdate ;enemies affected by charcoal is blind temporary and make pc always undetected because foe eyes covered with charcoal if GetDetectionLevel PlayerRef SetDetectionState PlayerRef 0 endif End Edited August 4, 2016 by lubronbrons Link to comment Share on other sites More sharing options...
motarx Posted August 4, 2016 Author Share Posted August 4, 2016 Thanks for inputs, have a smoke effect nif that I'll be using. Link to comment Share on other sites More sharing options...
Recommended Posts